Skip to content

Desperately try to fix AppVeyor #2628

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

Closed
wants to merge 17 commits into from
2 changes: 2 additions & 0 deletions packages/react-scripts/bin/react-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ switch (script) {
[require.resolve('../scripts/' + script)].concat(args),
{ stdio: 'inherit' }
);
console.log('Okay now status: ', result.status)
console.log(result)
if (result.signal) {
if (result.signal === 'SIGKILL') {
console.log(
Expand Down
27 changes: 20 additions & 7 deletions packages/react-scripts/scripts/eject.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
// Makes the script crash on unhandled rejections instead of silently
// ignoring them. In the future, promise rejections that are not handled will
// terminate the Node.js process with a non-zero exit code.
process.on('unhandledRejection', err => {
throw err;
});
// process.on('unhandledRejection', err => {
// throw err;
// });

const fs = require('fs-extra');
const path = require('path');
Expand All @@ -23,7 +23,6 @@ const chalk = require('chalk');
const paths = require('../config/paths');
const createJestConfig = require('./utils/createJestConfig');
const inquirer = require('react-dev-utils/inquirer');
const spawnSync = require('react-dev-utils/crossSpawn').sync;

const green = chalk.green;
const cyan = chalk.cyan;
Expand Down Expand Up @@ -215,14 +214,22 @@ inquirer
// It's not essential that this succeeds
}
}

if (fs.existsSync(paths.yarnLockFile)) {
console.log(cyan('Running yarn...'));
spawnSync('yarnpkg', [], { stdio: 'inherit' });
//execSync('yarnpkg');
} else {
console.log(cyan('Running npm install...'));
spawnSync('npm', ['install'], { stdio: 'inherit' });
//execSync('npm install');
}

try {
execSync('yarn.cmd', {stdio: 'inherit'});
console.log(' OR ME ')
} catch (err) {
console.log(' PLEASE PRINT ME PLEASE ')
}

console.log(green('Ejected successfully!'));
console.log();

Expand All @@ -231,4 +238,10 @@ inquirer
);
console.log(green(' http://goo.gl/forms/Bi6CZjk1EqsdelXk1'));
console.log();

});


process.on('exit', code => {
console.log('OH OH NO GONNA EXIT!!!!', code)
});
167 changes: 5 additions & 162 deletions tasks/e2e-simple.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function cleanup {
cd "$root_path"
# Uncomment when snapshot testing is enabled by default:
# rm ./packages/react-scripts/template/src/__snapshots__/App.test.js.snap
rm -rf "$temp_cli_path" $temp_app_path
# rm -rf "$temp_cli_path" $temp_app_path
}

# Error messages are redirected to stderr
Expand Down Expand Up @@ -122,39 +122,10 @@ then
fi

# Lint own code
./node_modules/.bin/eslint --max-warnings 0 packages/babel-preset-react-app/
./node_modules/.bin/eslint --max-warnings 0 packages/create-react-app/
./node_modules/.bin/eslint --max-warnings 0 packages/eslint-config-react-app/
./node_modules/.bin/eslint --max-warnings 0 packages/react-dev-utils/
./node_modules/.bin/eslint --max-warnings 0 packages/react-scripts/
cd packages/react-error-overlay/
./node_modules/.bin/eslint --max-warnings 0 src/
npm test
npm run build:prod
cd ../..

# ******************************************************************************
# First, test the create-react-app development environment.
# This does not affect our users but makes sure we can develop it.
# ******************************************************************************

# Test local build command
npm run build
# Check for expected output
exists build/*.html
exists build/static/js/*.js
exists build/static/css/*.css
exists build/static/media/*.svg
exists build/favicon.ico

# Run tests with CI flag
CI=true npm test
# Uncomment when snapshot testing is enabled by default:
# exists template/src/__snapshots__/App.test.js.snap

# Test local start command
npm start -- --smoke-test

# ******************************************************************************
# Next, pack react-scripts and create-react-app so we can verify they work.
# ******************************************************************************
Expand Down Expand Up @@ -198,143 +169,15 @@ npm install "$cli_path"
cd $temp_app_path
create_react_app --scripts-version="$scripts_path" test-app

# ******************************************************************************
# 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.
# ******************************************************************************

function verify_env_url {
# Backup package.json because we're going to make it dirty
cp package.json package.json.orig

# Test default behavior
grep -F -R --exclude=*.map "\"/static/" build/ -q; test $? -eq 0 || exit 1

# Test relative path build
awk -v n=2 -v s=" \"homepage\": \".\"," 'NR == n {print s} {print}' package.json > tmp && mv tmp package.json

npm run build
# Disabled until this can be tested
# grep -F -R --exclude=*.map "../../static/" build/ -q; test $? -eq 0 || exit 1
grep -F -R --exclude=*.map "\"./static/" build/ -q; test $? -eq 0 || exit 1
grep -F -R --exclude=*.map "\"/static/" build/ -q; test $? -eq 1 || exit 1

PUBLIC_URL="/anabsolute" npm run build
grep -F -R --exclude=*.map "/anabsolute/static/" build/ -q; test $? -eq 0 || exit 1
grep -F -R --exclude=*.map "\"/static/" build/ -q; test $? -eq 1 || exit 1

# Test absolute path build
sed "2s/.*/ \"homepage\": \"\/testingpath\",/" package.json > tmp && mv tmp package.json

npm run build
grep -F -R --exclude=*.map "/testingpath/static/" build/ -q; test $? -eq 0 || exit 1
grep -F -R --exclude=*.map "\"/static/" build/ -q; test $? -eq 1 || exit 1

PUBLIC_URL="https://www.example.net/overridetest" npm run build
grep -F -R --exclude=*.map "https://www.example.net/overridetest/static/" build/ -q; test $? -eq 0 || exit 1
grep -F -R --exclude=*.map "\"/static/" build/ -q; test $? -eq 1 || exit 1
grep -F -R --exclude=*.map "testingpath/static" build/ -q; test $? -eq 1 || exit 1

# Test absolute url build
sed "2s/.*/ \"homepage\": \"https:\/\/www.example.net\/testingpath\",/" package.json > tmp && mv tmp package.json

npm run build
grep -F -R --exclude=*.map "/testingpath/static/" build/ -q; test $? -eq 0 || exit 1
grep -F -R --exclude=*.map "\"/static/" build/ -q; test $? -eq 1 || exit 1

PUBLIC_URL="https://www.example.net/overridetest" npm run build
grep -F -R --exclude=*.map "https://www.example.net/overridetest/static/" build/ -q; test $? -eq 0 || exit 1
grep -F -R --exclude=*.map "\"/static/" build/ -q; test $? -eq 1 || exit 1
grep -F -R --exclude=*.map "testingpath/static" build/ -q; test $? -eq 1 || exit 1

# Restore package.json
rm package.json
mv package.json.orig package.json
}

function verify_module_scope {
# Create stub json file
echo "{}" >> sample.json

# Save App.js, we're going to modify it
cp src/App.js src/App.js.bak

# Add an out of scope import
echo "import sampleJson from '../sample'" | cat - src/App.js > src/App.js.temp && mv src/App.js.temp src/App.js

# Make sure the build fails
npm run build; test $? -eq 1 || exit 1
# TODO: check for error message

# Restore App.js
rm src/App.js
mv src/App.js.bak src/App.js
}

# Enter the app directory
cd test-app

# Test the build
npm run build
# Check for expected output
exists build/*.html
exists build/static/js/*.js
exists build/static/css/*.css
exists build/static/media/*.svg
exists build/favicon.ico

# Run tests with CI flag
CI=true npm test
# Uncomment when snapshot testing is enabled by default:
# exists src/__snapshots__/App.test.js.snap

# Test the server
npm start -- --smoke-test

# Test environment handling
verify_env_url

# Test reliance on webpack internals
verify_module_scope

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

# Eject...
echo yes | npm run eject

# ...but still link to the local packages
npm link "$root_path"/packages/babel-preset-react-app
npm link "$root_path"/packages/eslint-config-react-app
npm link "$root_path"/packages/react-dev-utils
npm link "$root_path"/packages/react-scripts

# Test the build
npm run build
# Check for expected output
exists build/*.html
exists build/static/js/*.js
exists build/static/css/*.css
exists build/static/media/*.svg
exists build/favicon.ico

# Run tests, overring the watch option to disable it.
# `CI=true npm test` won't work here because `npm test` becomes just `jest`.
# We should either teach Jest to respect CI env variable, or make
# `scripts/test.js` survive ejection (right now it doesn't).
npm test -- --watch=no
# Uncomment when snapshot testing is enabled by default:
# exists src/__snapshots__/App.test.js.snap

# Test the server
npm start -- --smoke-test

# Test environment handling
verify_env_url

# Test reliance on webpack internals
verify_module_scope
cd test-app
echo yes | yarn.cmd eject


# Cleanup
cleanup
#cleanup