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

e2e tests incorrectly caching react-scripts #2399

Closed
ro-savage opened this issue May 28, 2017 · 0 comments · Fixed by #2400
Closed

e2e tests incorrectly caching react-scripts #2399

ro-savage opened this issue May 28, 2017 · 0 comments · Fixed by #2400

Comments

@ro-savage
Copy link
Contributor

ro-savage commented May 28, 2017

This caused me a lot of grief and many many hours of lost time on PR #2285.

Yarn is caching old react-scripts when running the e2e tests, which means old versions are being used during the build process. Fine for CI where each build is on a clean machine but breaks e2e in unforeseen ways on local machines.

This might be related to yarnpkg/yarn/issues/2165

The fix was to yarn clean cache before running the e2e tests.

One possible solution would be to add

if hash yarnpkg 2>/dev/null
then
  yarn cache clean
fi

if hash npm 2>/dev/null
then
  npm cache clean
fi

to each of the bash scripts.

Another would be to install using the yarn install --force which will refetch all the packages. However I think that the install part is coming from within react-scripts and therefore it would force everyone to install with --force. I couldn't see an install command inside the bash scripts.

Reproduction

  • Clone the create-react-app repo.
  • npm install
  • Run tasks/e2e-kitchensink.sh.
  • Open e2e-kitchensink.sh and remove the line rm -rf "$temp_cli_path" "$temp_app_path" "$temp_module_path" || $CI so that you can keep the folders.
  • Edit the description in packages/react-scripts/package.json.
  • Re-run `tasks/e2e-kitchensink.sh.
  • Find the tmp folder the project is made into on the command line
  • cd to the tmp folder
  • open up the package.json found in test-kitchensink/node_modules/react-scripts
  • Check the description and see it hasn't changed.

This causes issues because when running e2e-kitchensink.sh is builds a CRA in a tmp folder. It then runs npm test internally in this folder.
This runs react-scripts test --env=jsdom which looks up it's node_modules to find react-scripts so that it can run scripts/test.js. Which is old one, meaning if you edited this file or other related files the e2e will be running the cached version not the newly modified version.

@lock lock bot locked and limited conversation to collaborators Jan 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant