@@ -45,6 +45,13 @@ function create_react_app {
45
45
node " $temp_cli_path " /node_modules/create-react-app/index.js $*
46
46
}
47
47
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
+
48
55
# Exit the script with a helpful error message when any error is encountered
49
56
trap ' set +x; handle_error $LINENO $BASH_COMMAND' ERR
50
57
86
93
# Test local build command
87
94
npm run build
88
95
# 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
94
101
95
102
# Run tests with CI flag
96
103
CI=true npm test
97
104
# 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
99
106
100
107
# Test local start command
101
108
npm start -- --smoke-test
@@ -197,16 +204,16 @@ cd test-app
197
204
# Test the build
198
205
npm run build
199
206
# 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
205
212
206
213
# Run tests with CI flag
207
214
CI=true npm test
208
215
# 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
210
217
211
218
# Test the server
212
219
npm start -- --smoke-test
@@ -230,19 +237,19 @@ npm link $root_path/packages/react-scripts
230
237
# Test the build
231
238
npm run build
232
239
# 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
238
245
239
246
# Run tests, overring the watch option to disable it.
240
247
# `CI=true npm test` won't work here because `npm test` becomes just `jest`.
241
248
# We should either teach Jest to respect CI env variable, or make
242
249
# `scripts/test.js` survive ejection (right now it doesn't).
243
250
npm test -- --watch=no
244
251
# 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
246
253
247
254
# Test the server
248
255
npm start -- --smoke-test
0 commit comments