Skip to content

Commit 32fa420

Browse files
committed
Downgrade Jest version so it works with V3
Adjust a few bits so that Jest works properly with V3 Add property to jest config for matching jest files in this lower version of jest
1 parent 69663c4 commit 32fa420

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

packages/react-scripts/config/jest/babelTransform.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ const babelJest = require('babel-jest');
1212

1313
module.exports = babelJest.createTransformer({
1414
presets: [require.resolve('babel-preset-react-app')],
15-
babelrc: false,
15+
babelrc: true,
1616
});

packages/react-scripts/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"autoprefixer": "7.1.2",
2626
"babel-core": "6.25.0",
2727
"babel-eslint": "7.2.3",
28-
"babel-jest": "20.0.3",
28+
"babel-jest": "^16.0.0",
2929
"babel-loader": "7.1.1",
3030
"babel-preset-react-app": "^3.0.2",
3131
"babel-runtime": "6.23.0",
@@ -44,7 +44,7 @@
4444
"file-loader": "0.11.2",
4545
"fs-extra": "3.0.1",
4646
"html-webpack-plugin": "2.29.0",
47-
"jest": "20.0.4",
47+
"jest": "^16.0.1",
4848
"object-assign": "4.1.1",
4949
"postcss-cssnext": "^3.0.2",
5050
"postcss-flexbugs-fixes": "3.2.0",

packages/react-scripts/scripts/utils/createJestConfig.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ module.exports = (resolve, rootDir, isEjecting) => {
2626
collectCoverageFrom: ['src/**/*.{js,jsx}'],
2727
setupFiles: [resolve('config/polyfills.js')],
2828
setupTestFrameworkScriptFile: setupTestsFile,
29+
testRegex: 'jest\\.js$',
2930
testMatch: [
3031
'<rootDir>/src/**/__tests__/**/*.js?(x)',
3132
'<rootDir>/src/**/?(*.)(spec|test).js?(x)',
@@ -42,6 +43,9 @@ module.exports = (resolve, rootDir, isEjecting) => {
4243
transformIgnorePatterns: ['[/\\\\]node_modules[/\\\\].+\\.(js|jsx)$'],
4344
moduleNameMapper: {
4445
'^react-native$': 'react-native-web',
46+
'^.+\\.css$': '<rootDir>/scripts/utils/css-stub.js',
47+
'^.+\\.(jpg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm)$':
48+
'<rootDir>/scripts/utils/file-stub.js',
4549
},
4650
moduleFileExtensions: ['web.js', 'js', 'json', 'web.jsx', 'jsx', 'node'],
4751
};

0 commit comments

Comments
 (0)