Skip to content

Commit

Permalink
Enable watch implicitly unless on CI (#533)
Browse files Browse the repository at this point in the history
Fixes #532
  • Loading branch information
gaearon committed Sep 1, 2016
1 parent e48b617 commit a52b697
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"create-react-app": "node global-cli/index.js --scripts-version \"$PWD/`npm pack`\"",
"e2e": "tasks/e2e.sh",
"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": [
"PATENTS",
Expand Down
2 changes: 1 addition & 1 deletion scripts/eject.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ prompt(
delete appPackage.scripts['eject'];
Object.keys(appPackage.scripts).forEach(function (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');
});

Expand Down
2 changes: 1 addition & 1 deletion scripts/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module.exports = function(appPath, appName, verbose, originalDirectory) {
appPackage.scripts = {
'start': 'react-scripts start',
'build': 'react-scripts build',
'test': 'react-scripts test --watch --env=jsdom',
'test': 'react-scripts test --env=jsdom',
'eject': 'react-scripts eject'
};

Expand Down
5 changes: 5 additions & 0 deletions scripts/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ if (debugTemplateIndex !== -1) {
argv.splice(debugTemplateIndex, 1);
}

// Watch unless on CI
if (!process.env.CI) {
argv.push('--watch');
}

argv.push('--config', JSON.stringify(createJestConfig(
relativePath => path.resolve(__dirname, '..', relativePath),
path.resolve(paths.appSrc, '..')
Expand Down
11 changes: 6 additions & 5 deletions tasks/e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ test -e build/static/css/*.css
test -e build/static/media/*.svg
test -e build/favicon.ico

# Run tests, overriding watch option to disable it
npm test -- --watch=no
# Run tests with CI flag
CI=true npm test
# Uncomment when snapshot testing is enabled by default:
# test -e template/src/__snapshots__/App.test.js.snap

Expand Down Expand Up @@ -101,8 +101,8 @@ test -e build/static/css/*.css
test -e build/static/media/*.svg
test -e build/favicon.ico

# Run tests, overriding watch option to disable it
npm test -- --watch=no
# Run tests with CI flag
CI=true npm test
# Uncomment when snapshot testing is enabled by default:
# test -e src/__snapshots__/App.test.js.snap

Expand All @@ -120,7 +120,8 @@ test -e build/static/css/*.css
test -e build/static/media/*.svg
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
# Uncomment when snapshot testing is enabled by default:
# test -e src/__snapshots__/App.test.js.snap
Expand Down

0 comments on commit a52b697

Please sign in to comment.