2022-07-25 10:37:34 +02:00
|
|
|
/** @type {import('jest').Config} */
|
2021-06-18 13:05:06 +02:00
|
|
|
module.exports = {
|
|
|
|
testMatch: [
|
|
|
|
'<rootDir>/packages/*/src/**/*.test.ts',
|
|
|
|
'<rootDir>/theatre/*/src/**/*.test.ts',
|
|
|
|
],
|
|
|
|
moduleNameMapper: {
|
2021-06-18 14:32:01 +02:00
|
|
|
...require('./devEnv/getAliasesFromTsConfig').getAliasesFromTsConfigForJest(),
|
2021-08-08 10:16:33 +02:00
|
|
|
'\\.(css|svg|png)$': 'identity-obj-proxy',
|
2021-06-18 13:05:06 +02:00
|
|
|
'lodash-es/(.*)': 'lodash/$1',
|
|
|
|
'react-use/esm/(.*)': 'react-use/lib/$1',
|
|
|
|
'lodash-es': 'lodash',
|
2023-01-04 20:03:47 +01:00
|
|
|
// ES modules that jest can't handle at the moment.
|
|
|
|
uuid: '<rootDir>/node_modules/uuid/dist/index.js',
|
|
|
|
nanoid: '<rootDir>/node_modules/nanoid/index.cjs',
|
|
|
|
'nanoid/non-secure': '<rootDir>/node_modules/nanoid/non-secure/index.cjs',
|
2021-07-14 19:08:25 +02:00
|
|
|
'react-icons/(.*)': 'identity-obj-proxy',
|
2021-06-18 13:05:06 +02:00
|
|
|
},
|
|
|
|
setupFiles: ['./theatre/shared/src/setupTestEnv.ts'],
|
|
|
|
automock: false,
|
|
|
|
transform: {
|
2022-02-21 13:33:08 +01:00
|
|
|
'^.+\\.tsx?$': [
|
2023-07-16 22:19:21 +02:00
|
|
|
'jest-esbuild',
|
2022-02-21 13:33:08 +01:00
|
|
|
{
|
|
|
|
sourcemap: true,
|
2023-07-16 22:19:21 +02:00
|
|
|
supported: {
|
|
|
|
'dynamic-import': false,
|
|
|
|
},
|
2022-02-21 13:33:08 +01:00
|
|
|
},
|
|
|
|
],
|
|
|
|
'^.+\\.js$': [
|
2023-07-16 22:19:21 +02:00
|
|
|
'jest-esbuild',
|
2022-02-21 13:33:08 +01:00
|
|
|
{
|
|
|
|
sourcemap: true,
|
2023-07-16 22:19:21 +02:00
|
|
|
supported: {
|
|
|
|
'dynamic-import': false,
|
|
|
|
},
|
2022-02-21 13:33:08 +01:00
|
|
|
},
|
|
|
|
],
|
2021-06-18 13:05:06 +02:00
|
|
|
},
|
|
|
|
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
|
|
|
|
}
|