-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Change in behaviour from 12.17.3 to 12.17.4 #27641
Comments
Hi @marmaladebacon , thanks for opening this issue. It may be helpful to add something in the documentation around this specific use case. If you are interested you could open a PR in https://github.com/cypress-io/cypress-documentation which we could look over. |
Newer versions of Cypress (12.17.4+) do not load commands.ts because of sideEffects: false in package.json: cypress-io/cypress#27641 This is probably caused by Webpack 5 skipping the import. The fix is to explicitly register the commands without relying on side effects. This allows upgrading Cypress to 12.17.4+ or 13+.
IMO this is a breaking change that'd be helpful to list in the migration guide. Thanks @marmaladebacon cause I would have never found this as the issue. |
This issue has not had any activity in 180 days. Cypress evolves quickly and the reported behavior should be tested on the latest version of Cypress to verify the behavior is still occurring. It will be closed in 14 days if no updates are provided. |
This issue has been closed due to inactivity. |
Current behavior
Hi,
Upgrading from [email protected] to [email protected] introduces a breaking change whereby if you have
sideEffects:false
set in your package.json, and you're using TypeScript, custom cypress commands will not be registered using the recommended/scaffolded path mentioned in the docs: https://docs.cypress.io/api/cypress-api/custom-commands#__docusaurus_skipToContent_fallbackShould we add a note to the documentation so that users are aware of the need to either have
sideEffects
undefined, set to 'true', or set to the array containing the path for the command files eg['cypress/**/*']
.Alternatively, we liked wrapping the commands in a exported function and then importing and calling that function in the supportFile so that we don't rely on importing for side-effects in the first place.
At the very least we think that a documentation update should be made to clarify this change in behavior regarding
sideEffects: false
in a package.json.It might be nice if cypress would automatically flag the cypress directory for side effects.
Desired behavior
In this situation, Cypress should work even with sideEffects set to false in a TypeScript project, or it should be documented.
Test code to reproduce
forked from https://github.com/cypress-io/cypress-test-tiny
marmaladebacon/cypress-repo-tiny-sideeffects#1
git clone and run
npm run cypress:run
Cypress Version
12.17.4
Node version
v18.16.1
Operating System
macOs 13.4.1
Debug Logs
No response
Other
No response
The text was updated successfully, but these errors were encountered: