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

Enable watch implicitly unless on CI #533

Merged
merged 1 commit into from
Sep 1, 2016
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 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