mirror of
https://github.com/zhigang1992/create-react-app.git
synced 2026-04-24 05:05:53 +08:00
@@ -12,7 +12,7 @@
|
||||
const pathExists = require('path-exists');
|
||||
const paths = require('../../config/paths');
|
||||
|
||||
module.exports = (resolve, rootDir) => {
|
||||
module.exports = (resolve, rootDir, isEjecting) => {
|
||||
const setupFiles = [resolve('config/polyfills.js')];
|
||||
if (pathExists.sync(paths.testsSetup)) {
|
||||
// Use this instead of `paths.testsSetup` to avoid putting
|
||||
@@ -26,7 +26,6 @@ module.exports = (resolve, rootDir) => {
|
||||
'^.+\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': resolve('config/jest/FileStub.js'),
|
||||
'^.+\\.css$': resolve('config/jest/CSSStub.js')
|
||||
},
|
||||
scriptPreprocessor: resolve('config/jest/transform.js'),
|
||||
setupFiles: setupFiles,
|
||||
testPathIgnorePatterns: ['<rootDir>/(build|docs|node_modules)/'],
|
||||
testEnvironment: 'node',
|
||||
@@ -35,5 +34,10 @@ module.exports = (resolve, rootDir) => {
|
||||
if (rootDir) {
|
||||
config.rootDir = rootDir;
|
||||
}
|
||||
if (!isEjecting) {
|
||||
// This is unnecessary after ejecting because Jest
|
||||
// will just use .babelrc in the project folder.
|
||||
config.scriptPreprocessor = resolve('config/jest/transform.js');
|
||||
}
|
||||
return config;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user