You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.
The text was updated successfully, but these errors were encountered:
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
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 withinreact-scripts
and therefore it would force everyone to install with--force
. I couldn't see an install command inside the bash scripts.Reproduction
npm install
tasks/e2e-kitchensink.sh
.e2e-kitchensink.sh
and remove the linerm -rf "$temp_cli_path" "$temp_app_path" "$temp_module_path" || $CI
so that you can keep the folders.description
inpackages/react-scripts/package.json
.cd
to the tmp folderpackage.json
found intest-kitchensink/node_modules/react-scripts
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 runsnpm test
internally in this folder.This runs
react-scripts test --env=jsdom
which looks up it'snode_modules
to findreact-scripts
so that it can runscripts/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.The text was updated successfully, but these errors were encountered: