test(plugin-cloud): update jest config for esm
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/swcrc",
|
||||
"sourceMaps": true,
|
||||
"exclude": ["/**/*.spec.ts", "/**/mocks"],
|
||||
"exclude": ["/**/mocks"],
|
||||
"jsc": {
|
||||
"target": "esnext",
|
||||
"parser": {
|
||||
|
||||
@@ -1,15 +1,11 @@
|
||||
module.exports = {
|
||||
testEnvironment: 'node',
|
||||
testMatch: ['**/src/**/*.spec.ts'],
|
||||
transform: {
|
||||
'^.+\\.(ts|tsx)?$': 'ts-jest',
|
||||
},
|
||||
verbose: true,
|
||||
// globalSetup: './test/jest.setup.ts',
|
||||
moduleNameMapper: {
|
||||
'\\.(css|scss)$': '<rootDir>/src/webpack/mocks/emptyModule.js',
|
||||
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
|
||||
'<rootDir>/src/webpack/mocks/fileMock.js',
|
||||
},
|
||||
testTimeout: 60000,
|
||||
import baseConfig from '../../jest.config.js'
|
||||
|
||||
/** @type {import('@jest/types').Config} */
|
||||
const customJestConfig = {
|
||||
...baseConfig,
|
||||
globalSetup: null,
|
||||
testMatch: ['**/src/**/?(*.)+(spec|test|it-test).[tj]s?(x)'],
|
||||
testTimeout: 20000,
|
||||
}
|
||||
|
||||
export default customJestConfig
|
||||
|
||||
@@ -8,7 +8,7 @@ import { payloadCloud } from './plugin.js'
|
||||
describe('plugin', () => {
|
||||
describe('not in Payload Cloud', () => {
|
||||
// eslint-disable-next-line jest/expect-expect
|
||||
it('should return unmodified config, with webpack aliases', () => {
|
||||
it('should return unmodified config', () => {
|
||||
const plugin = payloadCloud()
|
||||
const config = plugin(createConfig())
|
||||
|
||||
@@ -119,26 +119,21 @@ describe('plugin', () => {
|
||||
})
|
||||
|
||||
function assertCloudStorage(config: Config) {
|
||||
expect(config.admin).toHaveProperty('webpack')
|
||||
expect(config.upload?.useTempFiles).toEqual(true)
|
||||
}
|
||||
|
||||
function assertNoCloudStorage(config: Config) {
|
||||
expect(config.admin).toHaveProperty('webpack')
|
||||
expect(config.upload?.useTempFiles).toBeFalsy()
|
||||
}
|
||||
|
||||
function assertCloudEmail(config: Config) {
|
||||
expect(config.admin).toHaveProperty('webpack')
|
||||
if (config.email && 'transport' in config.email) {
|
||||
expect(config.email?.transport?.transporter.name).toEqual('SMTP')
|
||||
}
|
||||
}
|
||||
|
||||
/** Asserts that plugin did not run (other than webpack aliases) */
|
||||
/** Asserts that plugin did not run */
|
||||
function assertNoCloudEmail(config: Config) {
|
||||
expect(config.admin).toHaveProperty('webpack')
|
||||
|
||||
// No transport set
|
||||
if (!config.email) return
|
||||
|
||||
|
||||
Reference in New Issue
Block a user