Commit a52b697d authored by Dan Abramov's avatar Dan Abramov Committed by GitHub
Browse files

Enable watch implicitly unless on CI (#533)

Fixes #532
parent e48b6171
Showing with 14 additions and 8 deletions
+14 -8
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
"create-react-app": "node global-cli/index.js --scripts-version \"$PWD/`npm pack`\"", "create-react-app": "node global-cli/index.js --scripts-version \"$PWD/`npm pack`\"",
"e2e": "tasks/e2e.sh", "e2e": "tasks/e2e.sh",
"start": "node scripts/start.js --debug-template", "start": "node scripts/start.js --debug-template",
"test": "node scripts/test.js --debug-template --watch --env=jsdom" "test": "node scripts/test.js --debug-template --env=jsdom"
}, },
"files": [ "files": [
"PATENTS", "PATENTS",
......
...@@ -101,7 +101,7 @@ prompt( ...@@ -101,7 +101,7 @@ prompt(
delete appPackage.scripts['eject']; delete appPackage.scripts['eject'];
Object.keys(appPackage.scripts).forEach(function (key) { Object.keys(appPackage.scripts).forEach(function (key) {
appPackage.scripts[key] = appPackage.scripts[key] appPackage.scripts[key] = appPackage.scripts[key]
.replace(/react-scripts test/g, 'jest') .replace(/react-scripts test/g, 'jest --watch')
.replace(/react-scripts (\w+)/g, 'node scripts/$1.js'); .replace(/react-scripts (\w+)/g, 'node scripts/$1.js');
}); });
......
...@@ -26,7 +26,7 @@ module.exports = function(appPath, appName, verbose, originalDirectory) { ...@@ -26,7 +26,7 @@ module.exports = function(appPath, appName, verbose, originalDirectory) {
appPackage.scripts = { appPackage.scripts = {
'start': 'react-scripts start', 'start': 'react-scripts start',
'build': 'react-scripts build', 'build': 'react-scripts build',
'test': 'react-scripts test --watch --env=jsdom', 'test': 'react-scripts test --env=jsdom',
'eject': 'react-scripts eject' 'eject': 'react-scripts eject'
}; };
......
...@@ -22,6 +22,11 @@ if (debugTemplateIndex !== -1) { ...@@ -22,6 +22,11 @@ if (debugTemplateIndex !== -1) {
argv.splice(debugTemplateIndex, 1); argv.splice(debugTemplateIndex, 1);
} }
// Watch unless on CI
if (!process.env.CI) {
argv.push('--watch');
}
argv.push('--config', JSON.stringify(createJestConfig( argv.push('--config', JSON.stringify(createJestConfig(
relativePath => path.resolve(__dirname, '..', relativePath), relativePath => path.resolve(__dirname, '..', relativePath),
path.resolve(paths.appSrc, '..') path.resolve(paths.appSrc, '..')
......
...@@ -67,8 +67,8 @@ test -e build/static/css/*.css ...@@ -67,8 +67,8 @@ test -e build/static/css/*.css
test -e build/static/media/*.svg test -e build/static/media/*.svg
test -e build/favicon.ico test -e build/favicon.ico
# Run tests, overriding watch option to disable it # Run tests with CI flag
npm test -- --watch=no CI=true npm test
# Uncomment when snapshot testing is enabled by default: # Uncomment when snapshot testing is enabled by default:
# test -e template/src/__snapshots__/App.test.js.snap # test -e template/src/__snapshots__/App.test.js.snap
...@@ -101,8 +101,8 @@ test -e build/static/css/*.css ...@@ -101,8 +101,8 @@ test -e build/static/css/*.css
test -e build/static/media/*.svg test -e build/static/media/*.svg
test -e build/favicon.ico test -e build/favicon.ico
# Run tests, overriding watch option to disable it # Run tests with CI flag
npm test -- --watch=no CI=true npm test
# Uncomment when snapshot testing is enabled by default: # Uncomment when snapshot testing is enabled by default:
# test -e src/__snapshots__/App.test.js.snap # test -e src/__snapshots__/App.test.js.snap
...@@ -120,7 +120,8 @@ test -e build/static/css/*.css ...@@ -120,7 +120,8 @@ test -e build/static/css/*.css
test -e build/static/media/*.svg test -e build/static/media/*.svg
test -e build/favicon.ico test -e build/favicon.ico
# Run tests, overriding watch option to disable it # Run tests, overring the watch option to disable it
# TODO: make CI flag respected after ejecting as well
npm test -- --watch=no npm test -- --watch=no
# Uncomment when snapshot testing is enabled by default: # Uncomment when snapshot testing is enabled by default:
# test -e src/__snapshots__/App.test.js.snap # test -e src/__snapshots__/App.test.js.snap
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment