@@ -46,6 +46,26 @@ function exists {
4646 done
4747}
4848
49+ # Check for accidental dependencies in package.json
50+ function checkDependencies {
51+ if ! awk ' /"dependencies": {/{y=1;next}/},/{y=0; next}y' package.json | \
52+ grep -v -q -E ' ^\s*"react(-dom|-scripts)?"' ; then
53+ echo " Dependencies are correct"
54+ else
55+ echo " There are extraneous dependencies in package.json"
56+ exit 1
57+ fi
58+
59+
60+ if ! awk ' /"devDependencies": {/{y=1;next}/},/{y=0; next}y' package.json | \
61+ grep -v -q -E ' ^\s*"react(-dom|-scripts)?"' ; then
62+ echo " Dev Dependencies are correct"
63+ else
64+ echo " There are extraneous devDependencies in package.json"
65+ exit 1
66+ fi
67+ }
68+
4969function create_react_app {
5070 node " $temp_cli_path " /node_modules/create-react-app/index.js $*
5171}
@@ -95,6 +115,7 @@ cd test-app-version-number
95115# Check corresponding scripts version is installed.
96116exists node_modules/react-scripts
97117grep ' "version": "0.4.0"' node_modules/react-scripts/package.json
118+ checkDependencies
98119
99120# ******************************************************************************
100121# Test --scripts-version with a tarball url
@@ -107,6 +128,7 @@ cd test-app-tarball-url
107128# Check corresponding scripts version is installed.
108129exists node_modules/react-scripts
109130grep ' "version": "0.4.0"' node_modules/react-scripts/package.json
131+ checkDependencies
110132
111133# ******************************************************************************
112134# Test --scripts-version with a custom fork of react-scripts
@@ -161,7 +183,7 @@ exists node_modules/@enoah_netzach/react-scripts
161183# Test nested folder path as the project name
162184# ******************************************************************************
163185
164- # Testing a path that exists
186+ # Testing a path that exists
165187cd " $temp_app_path "
166188mkdir test-app-nested-paths-t1
167189cd test-app-nested-paths-t1
@@ -170,13 +192,13 @@ create_react_app test-app-nested-paths-t1/aa/bb/cc/dd
170192cd test-app-nested-paths-t1/aa/bb/cc/dd
171193npm start -- --smoke-test
172194
173- # Testing a path that does not exist
195+ # Testing a path that does not exist
174196cd " $temp_app_path "
175197create_react_app test-app-nested-paths-t2/aa/bb/cc/dd
176198cd test-app-nested-paths-t2/aa/bb/cc/dd
177199npm start -- --smoke-test
178200
179- # Testing a path that is half exists
201+ # Testing a path that is half exists
180202cd " $temp_app_path "
181203mkdir -p test-app-nested-paths-t3/aa
182204create_react_app test-app-nested-paths-t3/aa/bb/cc/dd
0 commit comments