Skip to content

Commit

Permalink
Add '--no-watch' flag for tests (facebook#6285)
Browse files Browse the repository at this point in the history
  • Loading branch information
ricokahler authored and mrmckeb committed Feb 1, 2019
1 parent 714599d commit af339ec
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/react-scripts/scripts/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,24 @@ 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
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

0 comments on commit af339ec

Please sign in to comment.