diff --git a/packages/react-scripts/scripts/test.js b/packages/react-scripts/scripts/test.js index ac07e4792a..3659e8bc15 100644 --- a/packages/react-scripts/scripts/test.js +++ b/packages/react-scripts/scripts/test.js @@ -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');