-
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
fix: fix third party reporters and cy.origin calls in Cypress #24614
fix: fix third party reporters and cy.origin calls in Cypress #24614
Conversation
Thanks for taking the time to open a PR!
|
…at-binary-rather-than-monorepo
@@ -249,7 +249,7 @@ const preprocessor: WebpackPreprocessor = (options: PreprocessorOptions = {}): F | |||
webpackOptions.module.rules.unshift({ | |||
test: /\.(js|ts|jsx|tsx)$/, | |||
use: [{ | |||
loader: path.join(__dirname, 'lib/cross-origin-callback-loader'), | |||
loader: require.resolve('@cypress/webpack-preprocessor/dist/lib/cross-origin-callback-loader.js'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we need to do require.resolve() within the NPM module, is there risk that custom webpack configuration will be problematic or is this only for snapshot resolution in the binary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is only for snapshot resolution in the binary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
& vite doesn't have issues because we don't ship with the binary? https://github.com/cypress-io/cypress/blob/develop/npm/vite-dev-server/src/resolveConfig.ts#L14
@@ -20,6 +20,7 @@ | |||
"watch": "rimraf dist && tsc --watch" | |||
}, | |||
"dependencies": { | |||
"@babel/parser": "7.13.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why does this need @babel/parser?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Binary changes seem to be working for the various scenarios I tried. 👍🏻
…at-binary-rather-than-monorepo
cypress run
->Error: Cannot find module 'mocha-7.0.1'
#24607v11.0.0
Broken withexperimentalSessionAndOrigin: true
#24611User facing changelog
Cypress will no longer crash when using a third party reporter like
mochawesome
.Cypress will no longer crash when using the
experimentalSessionAndOrigin
flag.Additional details
When cleaning up the binary due to the v8 snapshot work, there were a couple of dependencies that were removed that shouldn't have been.
In the case of third party mocha reporters, we do some swizzling at runtime with a hard coded version of mocha (mocha-7.0.1). In order to allow this to work properly, we need to leave
mocha-7.0.1
in the binary.In the case of the
experimentalSessionAndOrigin
flag, we have a dynamically loaded loader whose dependencies were not being flagged as something that shouldn't be removed. We will ensure that these dependencies are kept by wrapping this dependency in arequire.resolve
.Steps to test
Run the binary with a third party reporter like
mochaawesome
Run the binary with
experimentalSessionAndOrigin
turned onHow has the user experience changed?
The app no longer crashes in the above scenarios.
PR Tasks
cypress-documentation
?type definitions
?