Skip to content

Commit 09f7baf

Browse files
committed
Update Jest config for ts-jest v29
- Moved `ts-jest` config to `transform` as config under `globals` is now deprecated. - Added type def for Jest config object. - Simplified regex for Jest `testMatch` value.
1 parent 48781b0 commit 09f7baf

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

jest.config.mjs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,9 @@ function pathsToESModuleNameMapper() {
3434
return esmMap;
3535
}
3636

37+
/** @type {import('ts-jest').JestConfigWithTsJest} */
3738
export default {
3839
testEnvironment: 'node',
39-
globals: {
40-
'ts-jest': {
41-
tsconfig: 'tsconfig.json',
42-
},
43-
},
4440
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json'],
4541
moduleNameMapper: pathsToESModuleNameMapper(),
4642
modulePathIgnorePatterns: [
@@ -49,10 +45,15 @@ export default {
4945
'<rootDir>/out',
5046
],
5147
transform: {
52-
'^.+\\.(ts|tsx)$': 'ts-jest',
48+
'^.+\\.(ts|tsx)$': [
49+
'ts-jest',
50+
{
51+
tsconfig: 'tsconfig.json',
52+
},
53+
],
5354
},
5455
testMatch: [
55-
'**/tests/**/*.(spec|test).(ts?(x)|js?(x))',
56+
'**/tests/**/*.(spec|test).([jt]s?(x))',
5657
],
5758
collectCoverage: true,
5859
verbose: true,

0 commit comments

Comments
 (0)