Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove no-watch flag in favor of watchAll=false #6848

Merged
merged 1 commit into from
Apr 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docusaurus/docs/debugging-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Use the following [`launch.json`](https://code.visualstudio.com/docs/editor/debu
"test",
"--runInBand",
"--no-cache",
"--no-watch"
"--watchAll=false"
],
"cwd": "${workspaceRoot}",
"protocol": "inspector",
Expand Down
4 changes: 2 additions & 2 deletions docusaurus/docs/running-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ The watcher includes an interactive command-line interface with the ability to r

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

> \*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)).
> \*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)).

## Version Control Integration

Expand Down Expand Up @@ -376,7 +376,7 @@ CI=true npm run build

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

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

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

Expand Down
9 changes: 1 addition & 8 deletions packages/react-scripts/scripts/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,23 +54,16 @@ function isInMercurialRepository() {
}
}

// Watch unless on CI, explicitly adding `--no-watch`,
// or explicitly running all tests
// Watch unless on CI or explicitly running all tests
if (
!process.env.CI &&
argv.indexOf('--no-watch') === -1 &&
argv.indexOf('--watchAll') === -1
) {
// https://github.com/facebook/create-react-app/issues/5210
const hasSourceControl = isInGitRepository() || isInMercurialRepository();
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');
Expand Down