Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
27985a2
convert mocha tests to jest
Jun 2, 2018
a53f4fb
jest 23
Jun 2, 2018
4408910
add jest configs
Jun 2, 2018
08c7b6b
use material css
Jun 3, 2018
c9e1e75
fix windows
Jun 3, 2018
c445b93
forceExit jest test
Jun 3, 2018
411e016
force exit eject
Jun 4, 2018
737ba13
test
Jun 4, 2018
236c779
Merge pull request #2 from facebook/next
Jun 4, 2018
152d059
test
Jun 4, 2018
230931f
retrigger test
Jun 10, 2018
9d6e0cf
remove appveyor comment
Jun 10, 2018
bd6bc73
try to remove pretendToBeVisual option
Jun 10, 2018
d27b1c1
use jsdom env
Jun 10, 2018
a3b37ef
test environment
Jun 10, 2018
987df9e
no cache
Jun 10, 2018
3f881c6
test no close
Jun 10, 2018
8da4061
bring back raf
Jun 10, 2018
a872f0c
test revert all broken changes
Jun 10, 2018
7cba08e
add back jsdom
Jun 10, 2018
bed3ec3
remove jsdom
Jun 10, 2018
511b163
node test environment
Jun 10, 2018
59584c0
use latest change
Jun 10, 2018
3295054
runInBand
Jun 10, 2018
b5da335
runInBand
Jun 10, 2018
a99d693
comment test run
Jun 10, 2018
7601f1b
try different jest option
Jun 11, 2018
42200e3
standardize jest test options
Jun 11, 2018
ff8507d
increase heap size
Jun 11, 2018
5c4f644
remove heap size config
Jun 11, 2018
0acaa44
Merge pull request #3 from facebook/next
Jun 24, 2018
f554fa9
support scoped packages for cra --scripts-version option
Jun 24, 2018
90d5f0b
Merge pull request #4 from facebook/next
Jun 30, 2018
4083468
upgrade jest version
Jul 6, 2018
dbbe691
fix windows
Jul 6, 2018
7ddd298
fix windows again
Jul 6, 2018
e7ecaae
jest 23.4.1
Jul 14, 2018
793e419
babel-jest
Jul 14, 2018
3750164
babel-jest
Jul 14, 2018
08d233d
split out kitchhensink
Jul 14, 2018
9ced58c
travis node 6
Jul 14, 2018
0f9347d
travis node 6 config
Jul 14, 2018
b33442a
node 6 travis eject
Jul 14, 2018
51568d6
cache yarn
Jul 17, 2018
d63790d
only cache yarn
Jul 17, 2018
123a75e
Merge pull request #6 from facebook/next
Jul 17, 2018
fd126ae
Merge branch 'yarn-cache' into next
Jul 17, 2018
9c568a6
Merge pull request #8 from facebook/next
Sep 21, 2018
31ae6af
Merge branch 'next' into jest
Sep 21, 2018
3fea1cd
remove unrelated changes
Sep 21, 2018
6c1c10e
typo
Sep 21, 2018
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
Prev Previous commit
Next Next commit
split out kitchhensink
  • Loading branch information
Jack Zhao committed Jul 14, 2018
commit 08d233d189a05c6f8e1e5029fe6448a7a8791ff3
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,20 @@ script:
- 'if [ $TEST_SUITE = "simple" ]; then tasks/e2e-simple.sh; fi'
- 'if [ $TEST_SUITE = "installs" ]; then tasks/e2e-installs.sh; fi'
- 'if [ $TEST_SUITE = "kitchensink" ]; then tasks/e2e-kitchensink.sh; fi'
- 'if [ $TEST_SUITE = "kitchensink-eject" ]; then tasks/e2e-kitchensink-eject.sh; fi'
- 'if [ $TEST_SUITE = "old-node" ]; then tasks/e2e-old-node.sh; fi'
- 'if [ $TEST_SUITE = "monorepos" ]; then tasks/e2e-monorepos.sh; fi'
env:
matrix:
- TEST_SUITE=simple
- TEST_SUITE=installs
- TEST_SUITE=kitchensink
- TEST_SUITE=kitchensink-eject
- TEST_SUITE=monorepos
matrix:
include:
- node_js: 0.10
env: TEST_SUITE=old-node
- node_js: 6
env: TEST_SUITE=kitchensink
env: TEST_SUITE=kitchensink-eject
4 changes: 4 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ environment:
test_suite: "installs"
- nodejs_version: 8
test_suite: "kitchensink"
- nodejs_version: 8
test_suite: "kitchensink-eject"
- nodejs_version: 8
test_suite: "monorepos"
- nodejs_version: 6
Expand All @@ -16,6 +18,8 @@ environment:
test_suite: "installs"
- nodejs_version: 6
test_suite: "kitchensink"
- nodejs_version: 6
test_suite: "kitchensink-eject"
- nodejs_version: 6
test_suite: "monorepos"
cache:
Expand Down
174 changes: 174 additions & 0 deletions tasks/e2e-kitchensink-eject.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
#!/bin/bash
# Copyright (c) 2015-present, Facebook, Inc.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

# ******************************************************************************
# This is an end-to-end kitchensink test intended to run on CI.
# You can also run it locally but it's slow.
# ******************************************************************************

# Start in tasks/ even if run from root directory
cd "$(dirname "$0")"

# CLI, app, and test module temporary locations
# http://unix.stackexchange.com/a/84980
temp_app_path=`mktemp -d 2>/dev/null || mktemp -d -t 'temp_app_path'`
temp_module_path=`mktemp -d 2>/dev/null || mktemp -d -t 'temp_module_path'`
custom_registry_url=http://localhost:4873
original_npm_registry_url=`npm get registry`
original_yarn_registry_url=`yarn config get registry`

function cleanup {
echo 'Cleaning up.'
unset BROWSERSLIST
ps -ef | grep 'react-scripts' | grep -v grep | awk '{print $2}' | xargs kill -9
cd "$root_path"
# TODO: fix "Device or resource busy" and remove ``|| $CI`
rm -rf "$temp_app_path" "$temp_module_path" || $CI
npm set registry "$original_npm_registry_url"
yarn config set registry "$original_yarn_registry_url"
}

# Error messages are redirected to stderr
function handle_error {
echo "$(basename $0): ERROR! An error was encountered executing line $1." 1>&2;
cleanup
echo 'Exiting with error.' 1>&2;
exit 1
}

function handle_exit {
cleanup
echo 'Exiting without error.' 1>&2;
exit
}

# Check for the existence of one or more files.
function exists {
for f in $*; do
test -e "$f"
done
}

# Exit the script with a helpful error message when any error is encountered
trap 'set +x; handle_error $LINENO $BASH_COMMAND' ERR

# Cleanup before exit on any termination signal
trap 'set +x; handle_exit' SIGQUIT SIGTERM SIGINT SIGKILL SIGHUP

# Echo every command being executed
set -x

# Go to root
cd ..
root_path=$PWD

if hash npm 2>/dev/null
then
npm i -g npm@latest
fi

# Bootstrap monorepo
yarn

# ******************************************************************************
# First, publish the monorepo.
# ******************************************************************************

# Start local registry
tmp_registry_log=`mktemp`
nohup npx [email protected] -c tasks/verdaccio.yaml &>$tmp_registry_log &
# Wait for `verdaccio` to boot
grep -q 'http address' <(tail -f $tmp_registry_log)

# Set registry to local registry
npm set registry "$custom_registry_url"
yarn config set registry "$custom_registry_url"

# Login so we can publish packages
npx [email protected] -u user -p password -e [email protected] -r "$custom_registry_url" --quotes

# Publish the monorepo
git clean -df
./tasks/publish.sh --yes --force-publish=* --skip-git --cd-version=prerelease --exact --npm-tag=latest

# ******************************************************************************
# Now that we have published them, create a clean app folder and install them.
# ******************************************************************************

# Install the app in a temporary location
cd $temp_app_path
npx create-react-app --internal-testing-template="$root_path"/packages/react-scripts/fixtures/kitchensink test-kitchensink

# Install the test module
cd "$temp_module_path"
yarn add test-integrity@^2.0.1

# ******************************************************************************
# Now that we used create-react-app to create an app depending on react-scripts,
# let's make sure all npm scripts are in the working state.
# ******************************************************************************

# Enter the app directory
cd "$temp_app_path/test-kitchensink"

# In kitchensink, we want to test all transforms
export BROWSERSLIST='ie 9'

# Link to test module
npm link "$temp_module_path/node_modules/test-integrity"

# ******************************************************************************
# Finally, let's check that everything still works after ejecting.
# ******************************************************************************

# Eject...
echo yes | npm run eject

# Link to test module
npm link "$temp_module_path/node_modules/test-integrity"

# Test the build
REACT_APP_SHELL_ENV_MESSAGE=fromtheshell \
NODE_PATH=src \
PUBLIC_URL=http://www.example.org/spa/ \
yarn build

# Check for expected output
exists build/*.html
exists build/static/js/main.*.js

# Unit tests
REACT_APP_SHELL_ENV_MESSAGE=fromtheshell \
CI=true \
NODE_PATH=src \
NODE_ENV=test \
yarn test --no-cache --runInBand --testPathPattern=src

# Test "development" environment
tmp_server_log=`mktemp`
PORT=3002 \
REACT_APP_SHELL_ENV_MESSAGE=fromtheshell \
NODE_PATH=src \
nohup yarn start &>$tmp_server_log &
grep -q 'You can now view' <(tail -f $tmp_server_log)
E2E_URL="http://localhost:3002" \
REACT_APP_SHELL_ENV_MESSAGE=fromtheshell \
CI=true NODE_PATH=src \
NODE_ENV=development \
BABEL_ENV=test \
node_modules/.bin/jest --no-cache --runInBand --config='jest.integration.config.js'

# Test "production" environment
E2E_FILE=./build/index.html \
CI=true \
NODE_ENV=production \
BABEL_ENV=test \
NODE_PATH=src \
PUBLIC_URL=http://www.example.org/spa/ \
node_modules/.bin/jest --no-cache --runInBand --config='jest.integration.config.js'

# Cleanup
cleanup
50 changes: 0 additions & 50 deletions tasks/e2e-kitchensink.sh
Original file line number Diff line number Diff line change
Expand Up @@ -162,55 +162,5 @@ E2E_FILE=./build/index.html \
PUBLIC_URL=http://www.example.org/spa/ \
node_modules/.bin/jest --no-cache --runInBand --config='jest.integration.config.js'

# ******************************************************************************
# Finally, let's check that everything still works after ejecting.
# ******************************************************************************

# Eject...
echo yes | npm run eject

# Link to test module
npm link "$temp_module_path/node_modules/test-integrity"

# Test the build
REACT_APP_SHELL_ENV_MESSAGE=fromtheshell \
NODE_PATH=src \
PUBLIC_URL=http://www.example.org/spa/ \
yarn build

# Check for expected output
exists build/*.html
exists build/static/js/main.*.js

# Unit tests
REACT_APP_SHELL_ENV_MESSAGE=fromtheshell \
CI=true \
NODE_PATH=src \
NODE_ENV=test \
yarn test --no-cache --runInBand --testPathPattern=src

# Test "development" environment
tmp_server_log=`mktemp`
PORT=3002 \
REACT_APP_SHELL_ENV_MESSAGE=fromtheshell \
NODE_PATH=src \
nohup yarn start &>$tmp_server_log &
grep -q 'You can now view' <(tail -f $tmp_server_log)
E2E_URL="http://localhost:3002" \
REACT_APP_SHELL_ENV_MESSAGE=fromtheshell \
CI=true NODE_PATH=src \
NODE_ENV=development \
BABEL_ENV=test \
node_modules/.bin/jest --no-cache --runInBand --config='jest.integration.config.js'

# Test "production" environment
E2E_FILE=./build/index.html \
CI=true \
NODE_ENV=production \
BABEL_ENV=test \
NODE_PATH=src \
PUBLIC_URL=http://www.example.org/spa/ \
node_modules/.bin/jest --no-cache --runInBand --config='jest.integration.config.js'

# Cleanup
cleanup