Skip to content

Commit 31e5843

Browse files
authoredAug 28, 2022
feat: migrate globals config to transformer config (#3780)
DEPRECATION Define `ts-jest` config under `globals` is now deprecated. Please define the config via transformer config instead.
1 parent c8be99d commit 31e5843

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+405
-328
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,7 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

33
exports[`partial successfully runs the tests inside const-enum with 'isolatedModules: true' 1`] = `
4-
"FAIL __tests__/import-from-d-ts-no-js.spec.ts
5-
● Test suite failed to run
6-
7-
Cannot find module '../hoo-constant' from '__tests__/import-from-d-ts-no-js.spec.ts'
8-
9-
However, Jest was able to find:
10-
'../hoo-constant.d.ts'
11-
12-
You might want to include a file extension in your import, or update your 'moduleFileExtensions', which is currently ['js', 'mjs', 'cjs', 'jsx', 'ts', 'tsx', 'json', 'node'].
13-
14-
See https://jestjs.io/docs/configuration#modulefileextensions-arraystring
15-
16-
> 1 | import { HooConstEnum } from '../hoo-constant'
17-
| ^
18-
2 |
19-
3 | const getTwo = (): string => HooConstEnum.two
20-
4 |
21-
22-
at Resolver._throwModNotFoundError (../../node_modules/jest-resolve/build/resolver.js:487:11)
23-
at Object.<anonymous> (__tests__/import-from-d-ts-no-js.spec.ts:1:1)
24-
25-
PASS __tests__/import-from-d-ts-has-js.spec.ts
4+
"PASS __tests__/import-from-d-ts-has-js.spec.ts
5+
PASS __tests__/import-from-d-ts-no-js.spec.ts
266
PASS __tests__/import-from-ts.spec.ts"
277
`;
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
/** @type {import('../../../dist').InitialOptionsTsJest} */
22
module.exports = {
33
automock: true,
4-
globals: {
5-
'ts-jest': {
6-
isolatedModules: true,
7-
tsconfig: {
8-
allowJs: true,
9-
},
10-
},
11-
},
124
moduleNameMapper: {
135
react$: '<rootDir>/node_modules/react',
146
},
157
transform: {
16-
'^.+.[tj]sx?$': '<rootDir>/../../../legacy.js',
8+
'^.+.[tj]sx?$': [
9+
'<rootDir>/../../../legacy.js',
10+
{
11+
isolatedModules: true,
12+
tsconfig: {
13+
allowJs: true,
14+
},
15+
},
16+
],
1717
},
1818
}

0 commit comments

Comments
 (0)
Please sign in to comment.