Skip to content

Commit 99c14e7

Browse files
authored
Separate old Node E2E test (#3742)
* Separate old Node E2E test * Try this for old node
1 parent d29d41b commit 99c14e7

File tree

3 files changed

+63
-17
lines changed

3 files changed

+63
-17
lines changed

.travis.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ script:
1414
- 'if [ $TEST_SUITE = "simple" ]; then tasks/e2e-simple.sh; fi'
1515
- 'if [ $TEST_SUITE = "installs" ]; then tasks/e2e-installs.sh; fi'
1616
- 'if [ $TEST_SUITE = "kitchensink" ]; then tasks/e2e-kitchensink.sh; fi'
17+
- 'if [ $TEST_SUITE = "old-node" ]; then tasks/e2e-old-node.sh; fi'
1718
env:
1819
matrix:
1920
- TEST_SUITE=simple
@@ -22,4 +23,4 @@ env:
2223
matrix:
2324
include:
2425
- node_js: 0.10
25-
env: TEST_SUITE=simple
26+
env: TEST_SUITE=old-node

tasks/e2e-old-node.sh

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#!/bin/bash
2+
# Copyright (c) 2015-present, Facebook, Inc.
3+
#
4+
# This source code is licensed under the MIT license found in the
5+
# LICENSE file in the root directory of this source tree.
6+
7+
# ******************************************************************************
8+
# This is an end-to-end test intended to run on CI.
9+
# You can also run it locally but it's slow.
10+
# ******************************************************************************
11+
12+
# Start in tasks/ even if run from root directory
13+
cd "$(dirname "$0")"
14+
15+
temp_app_path=`mktemp -d 2>/dev/null || mktemp -d -t 'temp_app_path'`
16+
17+
function cleanup {
18+
echo 'Cleaning up.'
19+
cd "$root_path"
20+
rm -rf $temp_app_path
21+
}
22+
23+
# Error messages are redirected to stderr
24+
function handle_error {
25+
echo "$(basename $0): ERROR! An error was encountered executing line $1." 1>&2;
26+
cleanup
27+
echo 'Exiting with error.' 1>&2;
28+
exit 1
29+
}
30+
31+
function handle_exit {
32+
cleanup
33+
echo 'Exiting without error.' 1>&2;
34+
exit
35+
}
36+
37+
# Exit the script with a helpful error message when any error is encountered
38+
trap 'set +x; handle_error $LINENO $BASH_COMMAND' ERR
39+
40+
# Cleanup before exit on any termination signal
41+
trap 'set +x; handle_exit' SIGQUIT SIGTERM SIGINT SIGKILL SIGHUP
42+
43+
# Echo every command being executed
44+
set -x
45+
46+
# Go to root
47+
cd ..
48+
root_path=$PWD
49+
50+
# We need to install create-react-app deps to test it
51+
cd "$root_path"/packages/create-react-app
52+
npm install
53+
cd "$root_path"
54+
55+
# If the node version is < 6, the script should just give an error.
56+
cd $temp_app_path
57+
err_output=`node "$root_path"/packages/create-react-app/index.js test-node-version 2>&1 > /dev/null || echo ''`
58+
[[ $err_output =~ You\ are\ running\ Node ]] && exit 0 || exit 1
59+
60+
# Cleanup
61+
cleanup

tasks/e2e-simple.sh

-16
Original file line numberDiff line numberDiff line change
@@ -102,22 +102,6 @@ grep -v "postinstall" package.json > temp && mv temp package.json
102102
yarn
103103
mv package.json.bak package.json
104104

105-
# We need to install create-react-app deps to test it
106-
cd "$root_path"/packages/create-react-app
107-
yarn
108-
cd "$root_path"
109-
110-
# If the node version is < 6, the script should just give an error.
111-
nodeVersion=`node --version | cut -d v -f2`
112-
nodeMajor=`echo $nodeVersion | cut -d. -f1`
113-
nodeMinor=`echo $nodeVersion | cut -d. -f2`
114-
if [[ nodeMajor -lt 6 ]]
115-
then
116-
cd $temp_app_path
117-
err_output=`node "$root_path"/packages/create-react-app/index.js test-node-version 2>&1 > /dev/null || echo ''`
118-
[[ $err_output =~ You\ are\ running\ Node ]] && exit 0 || exit 1
119-
fi
120-
121105
# We removed the postinstall, so do it manually here
122106
node bootstrap.js
123107

0 commit comments

Comments
 (0)