-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjest.config.mjs
26 lines (26 loc) · 1.01 KB
/
jest.config.mjs
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
// Changed from module.export to export default to support ES vs CommonJS
// Also renamed file from .js to .mjs
// export default {
export default {
preset: 'ts-jest/presets/default-esm',
testEnvironment: 'node',
transform: {
'^.+\\.ts?$': ['ts-jest', { isolatedModules: true }], // changed to work for ts files
},
moduleFileExtensions: ['ts', 'js', 'json', 'node'],
collectCoverage: true,
collectCoverageFrom: ['src/**/*.{ts,js}', '!src/**/*.d.ts'],
coverageDirectory: 'coverage',
testMatch: [
'**/__tests__/**/*.[jt]s?(x)', // Matches .js, .jsx, .ts, and .tsx files in __tests__
'**/?(*.)+(spec|test).[tj]s?(x)', // Matches .spec or .test in .js, .jsx, .ts, and .tsx files
],
// Following required for compatibility with ES vs CommonJS
extensionsToTreatAsEsm: ['.ts'],
// below is commented out to get rid of deprecated waring of jest
// globals: {
// 'ts-jest': {
// useESM: true,
// },
// },
};