Skip to content

Commit 200b98b

Browse files
Jack Zhaomrmckeb
Jack Zhao
authored andcommitted
Remove no-watch flag in favor of watchAll=false (#6848)
1 parent 022b984 commit 200b98b

File tree

3 files changed

+4
-11
lines changed

3 files changed

+4
-11
lines changed

docusaurus/docs/debugging-tests.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ Use the following [`launch.json`](https://code.visualstudio.com/docs/editor/debu
5555
"test",
5656
"--runInBand",
5757
"--no-cache",
58-
"--no-watch"
58+
"--watchAll=false"
5959
],
6060
"cwd": "${workspaceRoot}",
6161
"protocol": "inspector",

docusaurus/docs/running-tests.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ The watcher includes an interactive command-line interface with the ability to r
3535

3636
![Jest watch mode](https://jestjs.io/img/blog/15-watch.gif)
3737

38-
> \*Although we recommend running your tests in watch mode during development, you can disable this behavior by passing in the `--no-watch` flag. In most CI environments, this is handled for you (see [On CI servers](#on-ci-servers)).
38+
> \*Although we recommend running your tests in watch mode during development, you can disable this behavior by passing in the `--watchAll=false` flag. In most CI environments, this is handled for you (see [On CI servers](#on-ci-servers)).
3939
4040
## Version Control Integration
4141

@@ -376,7 +376,7 @@ CI=true npm run build
376376

377377
The test command will force Jest to run in CI-mode, and tests will only run once instead of launching the watcher.
378378

379-
For non-CI environments, you can simply pass the `--no-watch` flag to disable test-watching.
379+
For non-CI environments, you can simply pass the `--watchAll=false` flag to disable test-watching.
380380

381381
The build command will check for linter warnings and fail if any are found.
382382

packages/react-scripts/scripts/test.js

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

57-
// Watch unless on CI, explicitly adding `--no-watch`,
58-
// or explicitly running all tests
57+
// Watch unless on CI or explicitly running all tests
5958
if (
6059
!process.env.CI &&
61-
argv.indexOf('--no-watch') === -1 &&
6260
argv.indexOf('--watchAll') === -1
6361
) {
6462
// https://github.com/facebook/create-react-app/issues/5210
6563
const hasSourceControl = isInGitRepository() || isInMercurialRepository();
6664
argv.push(hasSourceControl ? '--watch' : '--watchAll');
6765
}
6866

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

0 commit comments

Comments
 (0)