mirror of
https://github.com/zhigang1992/create-react-app.git
synced 2026-04-23 20:51:12 +08:00
Add '--no-watch' flag for tests (#6285)
This commit is contained in:
9
packages/react-scripts/scripts/test.js
vendored
9
packages/react-scripts/scripts/test.js
vendored
@@ -54,10 +54,12 @@ function isInMercurialRepository() {
|
||||
}
|
||||
}
|
||||
|
||||
// Watch unless on CI, in coverage mode, or explicitly running all tests
|
||||
// Watch unless on CI, in coverage mode, explicitly adding `--no-watch`,
|
||||
// or explicitly running all tests
|
||||
if (
|
||||
!process.env.CI &&
|
||||
argv.indexOf('--coverage') === -1 &&
|
||||
argv.indexOf('--no-watch') === -1 &&
|
||||
argv.indexOf('--watchAll') === -1
|
||||
) {
|
||||
// https://github.com/facebook/create-react-app/issues/5210
|
||||
@@ -65,6 +67,11 @@ if (
|
||||
argv.push(hasSourceControl ? '--watch' : '--watchAll');
|
||||
}
|
||||
|
||||
// Jest doesn't have this option so we'll remove it
|
||||
if (argv.indexOf('--no-watch') !== -1) {
|
||||
argv = argv.filter(arg => arg !== '--no-watch');
|
||||
}
|
||||
|
||||
// @remove-on-eject-begin
|
||||
// This is not necessary after eject because we embed config into package.json.
|
||||
const createJestConfig = require('./utils/createJestConfig');
|
||||
|
||||
Reference in New Issue
Block a user