Skip to content

Commit af339ec

Browse files
ricokahlermrmckeb
authored andcommitted
Add '--no-watch' flag for tests (#6285)
1 parent 714599d commit af339ec

File tree

1 file changed

+8
-1
lines changed
  • packages/react-scripts/scripts

1 file changed

+8
-1
lines changed

Diff for: packages/react-scripts/scripts/test.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,24 @@ function isInMercurialRepository() {
5454
}
5555
}
5656

57-
// Watch unless on CI, in coverage mode, or explicitly running all tests
57+
// Watch unless on CI, in coverage mode, explicitly adding `--no-watch`,
58+
// or explicitly running all tests
5859
if (
5960
!process.env.CI &&
6061
argv.indexOf('--coverage') === -1 &&
62+
argv.indexOf('--no-watch') === -1 &&
6163
argv.indexOf('--watchAll') === -1
6264
) {
6365
// https://github.com/facebook/create-react-app/issues/5210
6466
const hasSourceControl = isInGitRepository() || isInMercurialRepository();
6567
argv.push(hasSourceControl ? '--watch' : '--watchAll');
6668
}
6769

70+
// Jest doesn't have this option so we'll remove it
71+
if (argv.indexOf('--no-watch') !== -1) {
72+
argv = argv.filter(arg => arg !== '--no-watch');
73+
}
74+
6875
// @remove-on-eject-begin
6976
// This is not necessary after eject because we embed config into package.json.
7077
const createJestConfig = require('./utils/createJestConfig');

0 commit comments

Comments
 (0)