test: protect yarn modern pnp example against cypress script redefinition #967
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.
For the Yarn Modern Plug'n'Plug example this PR changes the command used to run Cypress from
command: yarn cypress run
to
command: yarn run --binaries-only cypress run
This makes sure that the Cypress binary is called instead of a possible user-defined script with the name of
cypress
.This follows on from issue #941 where it emerged that users had been defining such a script name which effectively overwrites the cypress name. When there is a script and a binary with the same name
yarn run
(Yarn Classic and Modern) selects the script. Yarn Modern offers the--binaries-only
option to make the choice deterministic. Yarn Classic does not offer this option.Verification
Run the following local and GitHub tests.
Run them again after temporarily adding a script to
examples/yarn-modern-pnp/package.json
wherecypress
is defined ascypress open
:Local test
Confirm that Cypress runs in headless mode and that the Cypress app does not open.
GitHub test
Manually run .github/workflows/example-yarn-modern-pnp.yml with the above
cypress
script defined.Confirm that the workflow runs to completion in headless mode and does not hang up.
Reference