From 50b503ea3c31fe86c6c2533c2928ebe6f6e5c7c2 Mon Sep 17 00:00:00 2001 From: Joe Haddad Date: Sat, 4 Feb 2017 21:03:38 -0500 Subject: [PATCH] Use react-app preset --- .../react-scripts/fixtures/kitchensink/.babelrc | 3 +-- .../kitchensink/.template.dependencies.json | 2 -- tasks/e2e-kitchensink.sh | 15 ++++++++++++--- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/packages/react-scripts/fixtures/kitchensink/.babelrc b/packages/react-scripts/fixtures/kitchensink/.babelrc index e2f4ed63f00..c14b2828d16 100644 --- a/packages/react-scripts/fixtures/kitchensink/.babelrc +++ b/packages/react-scripts/fixtures/kitchensink/.babelrc @@ -1,4 +1,3 @@ { - "presets": ["latest"], - "plugins": ["transform-class-properties"] + "presets": ["react-app"] } diff --git a/packages/react-scripts/fixtures/kitchensink/.template.dependencies.json b/packages/react-scripts/fixtures/kitchensink/.template.dependencies.json index 0363856d34b..50511b3d16a 100644 --- a/packages/react-scripts/fixtures/kitchensink/.template.dependencies.json +++ b/packages/react-scripts/fixtures/kitchensink/.template.dependencies.json @@ -1,9 +1,7 @@ { "dependencies": { - "babel-preset-latest": "6.16.0", "babel-register": "6.22.0", "babel-polyfill": "6.20.0", - "babel-plugin-transform-class-properties": "6.22.0", "chai": "3.5.0", "jsdom": "9.8.3", "mocha": "3.2.0" diff --git a/tasks/e2e-kitchensink.sh b/tasks/e2e-kitchensink.sh index 892230ab747..8005f230cc1 100755 --- a/tasks/e2e-kitchensink.sh +++ b/tasks/e2e-kitchensink.sh @@ -110,8 +110,11 @@ create_react_app --scripts-version=$scripts_path --internal-testing-template=$ro # Enter the app directory cd test-kitchensink +# Link to our preset +npm link $root_path/packages/babel-preset-react-app + # Test the build -NODE_PATH=src REACT_APP_SHELL_ENV_MESSAGE=fromtheshell npm run build +NODE_PATH=src NODE_ENV=test REACT_APP_SHELL_ENV_MESSAGE=fromtheshell npm run build # Check for expected output test -e build/*.html test -e build/static/js/main.*.js @@ -120,6 +123,7 @@ test -e build/static/js/main.*.js REACT_APP_SHELL_ENV_MESSAGE=fromtheshell \ CI=true \ NODE_PATH=src \ + NODE_ENV=test \ npm test -- --no-cache --testPathPattern="/src/" # Test "development" environment @@ -127,17 +131,20 @@ tmp_server_log=`mktemp` PORT=3001 \ REACT_APP_SHELL_ENV_MESSAGE=fromtheshell \ NODE_PATH=src \ + NODE_ENV=development \ nohup npm start &>$tmp_server_log & grep -q 'The app is running at:' <(tail -f $tmp_server_log) E2E_URL="http://localhost:3001" \ REACT_APP_SHELL_ENV_MESSAGE=fromtheshell \ CI=true NODE_PATH=src \ + NODE_ENV=development \ node node_modules/.bin/mocha --require babel-register --require babel-polyfill integration/*.test.js # Test "production" environment E2E_FILE=./build/index.html \ CI=true \ NODE_PATH=src \ + NODE_ENV=production \ node_modules/.bin/mocha --require babel-register --require babel-polyfill integration/*.test.js # ****************************************************************************** @@ -153,7 +160,7 @@ npm link $root_path/packages/eslint-config-react-app npm link $root_path/packages/react-dev-utils npm link $root_path/packages/react-scripts -# ...and we need to remove template's .babelrc +# ...and we need to remove template's .babelrc rm .babelrc # Test the build @@ -166,6 +173,7 @@ test -e build/static/js/main.*.js REACT_APP_SHELL_ENV_MESSAGE=fromtheshell \ CI=true \ NODE_PATH=src \ + NODE_ENV=test \ npm test -- --no-cache --testPathPattern="/src/" # Test "development" environment @@ -173,12 +181,13 @@ tmp_server_log=`mktemp` PORT=3002 \ REACT_APP_SHELL_ENV_MESSAGE=fromtheshell \ NODE_PATH=src \ + NODE_ENV=development \ nohup npm start &>$tmp_server_log & grep -q 'The app is running at:' <(tail -f $tmp_server_log) E2E_URL="http://localhost:3002" \ REACT_APP_SHELL_ENV_MESSAGE=fromtheshell \ CI=true NODE_PATH=src \ - NODE_ENV=production \ + NODE_ENV=development \ node_modules/.bin/mocha --require babel-register --require babel-polyfill integration/*.test.js # Test "production" environment