1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
import path from 'node:path';
import fileUrlToDirname from './fileUrlToDirname.js';
const thisDir = fileUrlToDirname(import.meta.url);
/** @type {import('@jest/types').Config.InitialOptions} */
export default {
transform: {
'\\.tsx?$': path.join(thisDir, 'jestEsbuildTransformer.js'),
},
extensionsToTreatAsEsm: ['.ts', '.tsx'],
moduleNameMapper: {
'^@sophie/(.+)$': path.join(thisDir, '../packages/$1/src/index.ts'),
'^(\\.{1,2}/.*)\\.jsx?$': '$1',
// Workaround for jest to recognize the vendored dependencies of chalk.
'^#ansi-styles$': path.join(
thisDir,
'../node_modules/chalk/source/vendor/ansi-styles/index.js',
),
'^#supports-color$': path.join(
thisDir,
'../node_modules/chalk/source/vendor/supports-color/index.js',
),
},
resetMocks: true,
restoreMocks: true,
testEnvironment: 'node',
testPathIgnorePatterns: ['/dist/', '/node_modules/'],
};
|