Skip to content

Commit 6de4cbb

Browse files
committed
fix(jest-config): Fix ts-jest deprecation warning
1 parent f6dd8ad commit 6de4cbb

File tree

1 file changed

+18
-19
lines changed

1 file changed

+18
-19
lines changed

packages/jest-config/src/jest.config.js

+18-19
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,24 @@ module.exports = {
9393
transform: {
9494
// Using this directly as opposed to the preset because of
9595
// to be able to manually specify the ts-jest dependency.
96-
'^.+\\.tsx?$': require.resolve('ts-jest'),
96+
'^.+\\.tsx?$': [
97+
require.resolve('ts-jest'),
98+
{
99+
tsconfig: {
100+
// Minimise transpilation since tests run in modern Node.
101+
// https://github.com/microsoft/TypeScript/wiki/Node-Target-Mapping#node-12
102+
target: 'es2019',
103+
104+
// Some tsconfigs e.g. the ones owned by create-react-app turn this on
105+
// which causes some type errors across file boundaries to be silenced.
106+
isolatedModules: false,
107+
108+
// next.js forces `jsx: 'preserve'` for their toolchain, but Jest wants
109+
// the transformer to transpile the syntax.
110+
...(compilerOptions.jsx === ts.JsxEmit.Preserve && { jsx: 'react' }),
111+
},
112+
},
113+
],
97114

98115
// Ignore static assets such as images and stylesheets.
99116
'\\.(css|less)$': require.resolve('./style-mock.js'),
@@ -127,22 +144,4 @@ module.exports = {
127144
branches: 100,
128145
},
129146
},
130-
131-
globals: {
132-
'ts-jest': {
133-
tsconfig: {
134-
// Minimise transpilation since tests run in modern Node.
135-
// https://github.com/microsoft/TypeScript/wiki/Node-Target-Mapping#node-12
136-
target: 'es2019',
137-
138-
// Some tsconfigs e.g. the ones owned by create-react-app turn this on
139-
// which causes some type errors across file boundaries to be silenced.
140-
isolatedModules: false,
141-
142-
// next.js forces `jsx: 'preserve'` for their toolchain, but Jest wants
143-
// the transformer to transpile the syntax.
144-
...(compilerOptions.jsx === ts.JsxEmit.Preserve && { jsx: 'react' }),
145-
},
146-
},
147-
},
148147
};

0 commit comments

Comments
 (0)