-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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: add v8 snapshot usage to cypress in cypress testing #24860
Conversation
Thanks for taking the time to open a PR!
|
@@ -21,7 +21,7 @@ | |||
"@babel/parser": "^7", | |||
"@babel/plugin-syntax-typescript": "^7", | |||
"@babel/plugin-transform-typescript": "^7", | |||
"@babel/traverse": "^7", | |||
"@babel/traverse": "7.15.4", |
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.
Updated this to match the rest of the repo.
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.
Great, I have a question, but no blocker.
@@ -310,6 +319,17 @@ export class ProjectConfigIpc extends EventEmitter { | |||
debug(`no typescript found, just use regular Node.js`) | |||
} | |||
|
|||
if (process.env.CYPRESS_INTERNAL_E2E_TESTING_SELF_PARENT_PROJECT) { |
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.
Bit of a shame we need to ship test code to prod :'(
This is "the change" that lets v8 snapshots run in cy-in-cy?
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.
Is there anyway to verify it now uses snapshots in the tests? How do we know it works (and catch it if stops?)
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.
Yeah it's unfortunate, but I'm not sure of a clean way to do it otherwise with how everything is structured.
And, I like your idea. I added a check to ensure that we fail in cypress in cypress if the snapshot is unavailable.
User facing changelog
n/a
Additional details
This adds support for utilizing the v8 snapshot in cypress in cypress testing. In order to do this, we need to ensure that when the child process is started it is done via the
spawn
command since electron has special logic in itsfork
command which effectively disables the snapshot. This has the implication of having an additional Cypress icon in the dock on Macs, but that will only happen during development and is a small inconvenience given that we will be able to more accurately simulate prod during cypress in cypress tests.In addition, as just general cleanup, I cleaned up the
bytenode
logic and was able to make it a dev dependency by bundling it into the electron entry pointSteps to test
Running the app and launchpad tests is the best way to see this in action
How has the user experience changed?
n/a
PR Tasks
cypress-documentation
?type definitions
?