Skip to content
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

feat: support webpack-dev-server v4 #17918

Merged
merged 6 commits into from
Aug 30, 2021
Merged

Conversation

ZachJW34
Copy link
Contributor

@ZachJW34 ZachJW34 commented Aug 27, 2021

User facing changelog

Support for webpack-dev-server v4

Additional details

This work is based on #17869 (thanks @BBB), with a few tweaks and some added test coverage of webpack-dev-server@3.
Pinned http-proxy types for @packages/server-ct since the newly added types for webpack-dev-server was resolving a newer version and causing type issues.
Changed align-items: start; to align-items: flex-start; since the newer version of webpack-dev-server was surfacing the compile warning as an overlay. I didn't want to disable the overlay since it's nice DX and it was a small change to resolve the warning.

How to test

I tested this by running the component tests inside the npm/{vue/react/angular} packages as well as linking the locally built package into the https://github.com/cypress-io/cypress-component-testing-examples repo and running those component tests. For the examples that don't explicitly depend on webpack-dev-server, I installed both v3 and v4 and made sure the server was using the corresponding package.

How has the user experience changed?

PR Tasks

  • Have tests been added/updated?
  • Has the original issue or this PR been tagged with a release in ZenHub?
  • Has a PR for user-facing changes been opened in cypress-documentation?
  • Have API changes been updated in the type definitions?
  • Have new configuration options been added to the cypress.schema.json?

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Aug 27, 2021

Thanks for taking the time to open a PR!

@CLAassistant
Copy link

CLAassistant commented Aug 27, 2021

CLA assistant check
All committers have signed the CLA.

@giampaolo44
Copy link

@ZachJW34 @BBB is it possible that your work could solve this issue of mine? It happened just after the upgrade to WP5 and WP-dev-server4

@ZachJW34 ZachJW34 changed the title feat: migrate to new webpack-dev-server public api feat: support webpack-dev-server v4 Aug 27, 2021
@@ -53,25 +53,33 @@ export async function start ({ webpackConfig: userWebpackConfig, template, optio
hot: false,
}

if (webpackDevServerPkg.version.match(/3\./)) {
if (webpackDevServerFacts.isV3()) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A debug message would be nice to print the version of WDS being used.

@JessicaSachs
Copy link
Contributor

JessicaSachs commented Aug 27, 2021

The build step for @packages/server-ct is failing due to type issues. In general the PR looks good. To debug this, run

yarn workspace @packages/server-ct build

@JessicaSachs
Copy link
Contributor

@ZachJW34 @BBB is it possible that your work could solve this issue of mine? It happened just after the upgrade to WP5 and WP-dev-server4

It could! This will go out during continuous deployment and you'll be notified.

@cypress
Copy link

cypress bot commented Aug 27, 2021



Test summary

13000 0 159 5Flakiness 4


Run details

Project cypress
Status Passed
Commit f26f555
Started Aug 30, 2021 8:37 PM
Ended Aug 30, 2021 8:47 PM
Duration 10:39 💡
OS Linux Debian - 10.9
Browser Multiple

View run in Cypress Dashboard ➡️


Flakiness

cypress/proxy-logging-spec.ts Flakiness
1 Proxy Logging > request logging > fetch log shows resource type, url, method, and status code and has expected snapshots and consoleProps
commands/xhr_spec.js Flakiness
1 ... > no status when request isnt forced 404
2 src/cy/commands/xhr > abort > aborts xhrs currently in flight
commands/net_stubbing_spec.ts Flakiness
1 network stubbing > intercepting request > can intercept utf-8 request bodies without crashing

This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

@JessicaSachs
Copy link
Contributor

To debug the specific "webpack overlay" compilation issues, you should check out the following steps that we discussed:

Steps to debug a particular usage of webpack dev server:
1. Open a "user project' (AKA the one that failed in CI) and run cypress:open
2. Open cypress/plugins/index.js (or wherever on('dev-server:start') is called)
3. Go to npm/react OR npm/webpack-dev-server depending on what's used in dev-server:start
4. Watch (if you have to) the npm/react or npm/webpack-dev-server plugin and when you modify it, bounce the server
5. The "user project" should pass

@giampaolo44
Copy link

@ZachJW34 @BBB is it possible that your work could solve this issue of mine? It happened just after the upgrade to WP5 and WP-dev-server4

It could! This will go out during continuous deployment and you'll be notified.

Thank you @JessicaSachs!

@ZachJW34 ZachJW34 requested a review from a team as a code owner August 27, 2021 21:55
@ZachJW34 ZachJW34 requested review from jennifer-shehane and kuceb and removed request for a team August 27, 2021 21:55
Copy link
Contributor

@lmiller1990 lmiller1990 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some small comments

process.exit(exitCode)
}

pkg.devDependencies['webpack-dev-server'] = '^3.11.0'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, should we specify the exact version during CI runs to ensure the tests always us the same one? eg 3.11.0 (no ^)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense I'll pin it.

@@ -47,7 +47,7 @@ class RunsListEmpty extends Component {
url: 'https://on.cypress.io/ci',
params: {
utm_medium,
utm_campaign: 'Run Guide',
utm_campaign: 'CI',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this file changed intentionally?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JessicaSachs recommended that I pull latest develop into this branch since there were certain tests failing on master. These changes are from fa4b9d7 which fixes some of those tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Talked with @JessicaSachs and reverted the merge from develop!

@ZachJW34 ZachJW34 force-pushed the issue-17869-support-wds-4 branch from 9a30e0a to f26f555 Compare August 30, 2021 20:19
@ShashankHegde16
Copy link

It is still hanging for me with next js typescript. When i run yarn cypress open-ct the test runner hangs indefinitly.

@lmiller1990
Copy link
Contributor

@ShashankHegde16 can you please share a repository with a minimal reproduction?

@ShashankHegde16
Copy link

ShashankHegde16 commented Sep 16, 2021

image
image
image

cypress.json - {
"baseUrl": "http://localhost:3000",
"integrationFolder": "cypress/tests",
"component": {
"componentFolder": "src/modules",
"testFiles": "tests/*.spec.{ts,tsx}",
"viewportHeight": 500,
"viewportWidth": 700
},

"projectId": "512hep"
}

The component test hangs forever.

@ShashankHegde16
Copy link

image
Also there is an error when i run ct

@ZachJW34
Copy link
Contributor Author

@ShashankHegde16 Your error seems to be related to the newest version of Next #17992. Is your problem solved if you pin your version of Next to "next": "11.1.0"?

@ShashankHegde16
Copy link

ShashankHegde16 commented Sep 19, 2021

@ShashankHegde16 Your error seems to be related to the newest version of Next #17992. Is your problem solved if you pin your version of Next to "next": "11.1.0"?

Pinning it worked. Thanks

@ShashankHegde16
Copy link

image
But im getting this error as no tests file found

@lmiller1990
Copy link
Contributor

Recreating a bug from screenshots of package.json is difficult. Can you provide a repo @ShashankHegde16? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants