-
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: ct testing support for node 17+ #21430
Conversation
Thanks for taking the time to open a PR!
|
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.
Some general comments 👍
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.
@ZachJW34 We already have some tests that validate running --e2e
in Node versions (including 17.3.0), I think it would be a good idea to add a test for CT as well: https://github.com/cypress-io/cypress/blob/b0c8db34348be31f32795f3f67c3408403d59ace/system-tests/test-binary/node_versions_spec.ts
Otherwise I can see this issue cropping back up. Let me know if I can assist with this, the Docker test experience on Mac is not great, you may want to create a Linux VM.
@@ -68,7 +68,7 @@ function webpackDevServer4 ( | |||
const { devServerConfig: { cypressConfig: { devServerPublicPathRoute } } } = config | |||
const WebpackDevServer = config.sourceWebpackModulesResult.webpackDevServer.module | |||
const webpackDevServerConfig = { | |||
host: 'localhost', | |||
host: '127.0.0.1', |
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.
In general, we should never use 'localhost'
in the App due to issues like this. We've even had users with an incorrect localhost
entry in /etc/hosts
, which causes mind boggling issues.
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.
I was absolutely baffled as to what was going on until I stumbled upon the issues I listed above.
packages/extension/package.json
Outdated
@@ -4,7 +4,7 @@ | |||
"private": true, | |||
"main": "index.js", | |||
"scripts": { | |||
"build": "gulp build", | |||
"build": "cross-env NODE_OPTIONS=\"$(node ../../scripts/use-legacy-openssl.js)\" gulp build", |
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.
Does this work in Windows? IDK how the command substitution is handled cross-platform
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.
Good point I'll give it a test!
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.
Didn't work on Windows, changed to running webpack in a child process so the env variables could be manipulated more easily
@flotwig I'll see how far I can get adding the tests and if I get stuck I'll reach out! |
@flotwig Added binary system tests, tried it out on WSL which was painful but I eventually got it working |
@@ -9,6 +9,15 @@ function smokeTestDockerImage (dockerImage: string) { | |||
specDir: 'tests', | |||
project: 'todos', | |||
}) | |||
|
|||
systemTests.it(`can run in ${dockerImage}`, { |
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.
clean up the hierarchy of tests here? right now it's:
e2e binary node versions > can run in ${dockerImage}
e2e binary node versions > can run in ${dockerImage}
but something like this would be better:
binary node versions > ct > can run in ${dockerImage}
binary node versions > e2e > can run in ${dockerImage}
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.
Good catch, addressed in 0654882
See cypress-io/github-action#534 (comment) (thanks @charlie-tf ) The default webpack configuration's host value was changed from localhost to 127.0.0.1 to support the Node 17+ changes with how DNS names are resolved. Addressed in cypress-io/cypress#21430.
User facing changelog
Fix ct apps using webpack-dev-server v4 not working for Node >= 17
Additional details
Node 17+ changed how they resolve DNS names. Changing
localhost
to127.0.0.1
is the fix for this issuenodejs/node#40537
Automattic/mongoose#10917
chimurai/http-proxy-middleware#705
To test this (using Node 17+), I had to make a few changes to the wherever we were building Webpack. Since we are using an older version of Webpack (< 5.6.1), we have to set
NODE_OPTIONS=--openssl-legacy-provider
for all Webpack build scripts. Without these changes,yarn
andyarn dev
will not work as it will fail with digital envelope routines::unsupportedHow has the user experience changed?
CT works for Node 17+
Screen.Recording.2022-05-10.at.5.58.32.PM.mov
PR Tasks
cypress-documentation
?type definitions
?cypress.schema.json
?