@@ -45,6 +45,13 @@ function create_react_app {
4545 node " $temp_cli_path " /node_modules/create-react-app/index.js $*
4646}
4747
48+ # Check for the existence of one or more files.
49+ function exists {
50+ for f in $* ; do
51+ test -e " $f "
52+ done
53+ }
54+
4855# Exit the script with a helpful error message when any error is encountered
4956trap ' set +x; handle_error $LINENO $BASH_COMMAND' ERR
5057
8693# Test local build command
8794npm run build
8895# Check for expected output
89- test -e build/* .html
90- test -e build/static/js/* .js
91- test -e build/static/css/* .css
92- test -e build/static/media/* .svg
93- test -e build/favicon.ico
96+ exists build/* .html
97+ exists build/static/js/* .js
98+ exists build/static/css/* .css
99+ exists build/static/media/* .svg
100+ exists build/favicon.ico
94101
95102# Run tests with CI flag
96103CI=true npm test
97104# Uncomment when snapshot testing is enabled by default:
98- # test -e template/src/__snapshots__/App.test.js.snap
105+ # exists template/src/__snapshots__/App.test.js.snap
99106
100107# Test local start command
101108npm start -- --smoke-test
@@ -197,16 +204,16 @@ cd test-app
197204# Test the build
198205npm run build
199206# Check for expected output
200- test -e build/* .html
201- test -e build/static/js/* .js
202- test -e build/static/css/* .css
203- test -e build/static/media/* .svg
204- test -e build/favicon.ico
207+ exists build/* .html
208+ exists build/static/js/* .js
209+ exists build/static/css/* .css
210+ exists build/static/media/* .svg
211+ exists build/favicon.ico
205212
206213# Run tests with CI flag
207214CI=true npm test
208215# Uncomment when snapshot testing is enabled by default:
209- # test -e src/__snapshots__/App.test.js.snap
216+ # exists src/__snapshots__/App.test.js.snap
210217
211218# Test the server
212219npm start -- --smoke-test
@@ -230,19 +237,19 @@ npm link $root_path/packages/react-scripts
230237# Test the build
231238npm run build
232239# Check for expected output
233- test -e build/* .html
234- test -e build/static/js/* .js
235- test -e build/static/css/* .css
236- test -e build/static/media/* .svg
237- test -e build/favicon.ico
240+ exists build/* .html
241+ exists build/static/js/* .js
242+ exists build/static/css/* .css
243+ exists build/static/media/* .svg
244+ exists build/favicon.ico
238245
239246# Run tests, overring the watch option to disable it.
240247# `CI=true npm test` won't work here because `npm test` becomes just `jest`.
241248# We should either teach Jest to respect CI env variable, or make
242249# `scripts/test.js` survive ejection (right now it doesn't).
243250npm test -- --watch=no
244251# Uncomment when snapshot testing is enabled by default:
245- # test -e src/__snapshots__/App.test.js.snap
252+ # exists src/__snapshots__/App.test.js.snap
246253
247254# Test the server
248255npm start -- --smoke-test
0 commit comments