tests: set yarn classic examples as corepack compatible #1068
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue
If a user has Node.js' experimental Corepack enabled, then invoking
yarn
(install) in any examples that are intended to use Yarn Classic (version 1) could cause instead Yarn Modern (version 2 and later) to be used. This could be confusing for a user trying out the examples locally. The following examples are affected:Note that Yarn Modern > Starting with Yarn > Installation describes the preferred way to manage Yarn as being through Corepack. Users may have other projects on their client system, besides
github-action
, which use Yarn Modern, and so the possibility that Corepack is enabled should be covered.Changes
The following commands set the desired Yarn Classic version in the
examples/yarn-classic
directory.npm uninstall yarn -g corepack enable corepack prepare yarn@stable --activate
Then in each directory listed above where Yarn Classic is intended,
cd
into the respectiveexamples
directory and execute the following:yarn set version classic
Now, if
corepack
is enabled it will use Yarn Classic and not Yarn Modern.Verification
Using Node.js
20
according to .node-version, for instancev20.9.0
. The following assumes that the repo is already up-to-date with the latest Cypress version.Yarn Classic
Install Yarn Classic globally and run the update script for Yarn and pnpm:
Confirm that Yarn
v1.22.19
is used to install in the examples listed above, that there are no errors as follows:Yarn Modern
Install Yarn Modern globally using corepack and run the update script again:
npm uninstall yarn -g corepack enable corepack prepare yarn@stable --activate git clean -x -d -f npm ci ./scripts/update-cypress-latest-other.sh git status
Again, confirm that Yarn
v1.22.19
is used to install in the examples above and that there are no errors.