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

Use "commander" for cli argv handling #1195

Merged
merged 6 commits into from
Dec 11, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
language: node_js
node_js:
- 0.10
- 4
- 6
cache:
Expand Down
20 changes: 14 additions & 6 deletions tasks/e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
# Start in tasks/ even if run from root directory
cd "$(dirname "$0")"

# CLI and app temporary locations
# http://unix.stackexchange.com/a/84980
temp_cli_path=`mktemp -d 2>/dev/null || mktemp -d -t 'temp_cli_path'`
temp_app_path=`mktemp -d 2>/dev/null || mktemp -d -t 'temp_app_path'`

function cleanup {
echo 'Cleaning up.'
cd $root_path
Expand Down Expand Up @@ -53,15 +58,22 @@ set -x
cd ..
root_path=$PWD

npm install

# If the node version is < 4, the script should just give an error.
if [ `node --version | sed -e 's/^v//' -e 's/\..\+//g'` -lt 4 ]
then
cd $temp_app_path
node "$root_path"/packages/create-react-app/index.js test-node-version && exit 1 || exit 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should verify that it prints a nice message instead of failing with e.g. a parse error.

fi

if [ "$USE_YARN" = "yes" ]
then
# Install Yarn so that the test can use it to install packages.
npm install -g yarn@0.17.10 # TODO: remove version when https://github.com/yarnpkg/yarn/issues/2142 is fixed.
yarn cache clean
fi

npm install

# Lint own code
./node_modules/.bin/eslint --ignore-path .gitignore ./

Expand Down Expand Up @@ -117,13 +129,10 @@ mv package.json.orig package.json
# ******************************************************************************

# Install the CLI in a temporary location
# http://unix.stackexchange.com/a/84980
temp_cli_path=`mktemp -d 2>/dev/null || mktemp -d -t 'temp_cli_path'`
cd $temp_cli_path
npm install $cli_path

# Install the app in a temporary location
temp_app_path=`mktemp -d 2>/dev/null || mktemp -d -t 'temp_app_path'`
cd $temp_app_path
create_react_app --scripts-version=$scripts_path test-app

Expand Down Expand Up @@ -185,7 +194,6 @@ npm test -- --watch=no
# Test the server
npm start -- --smoke-test


# ******************************************************************************
# Test --scripts-version with a version number
# ******************************************************************************
Expand Down