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

Component testing broken on next@11.0.2-canary.20 #17476

Closed
WillSquire opened this issue Jul 25, 2021 · 6 comments
Closed

Component testing broken on next@11.0.2-canary.20 #17476

WillSquire opened this issue Jul 25, 2021 · 6 comments

Comments

@WillSquire
Copy link

WillSquire commented Jul 25, 2021

Current behavior

Using an early release of next (11.0.2-canary.20) breaks cypress component testing. This release is critical to many users as it fixes a performance issue with their Image component, blocking usage for many. See vercel/next.js#23637

Running tests with this version throws Error: Cannot find module 'next/dist/next-server/server/config'.

Desired behavior

Not throw an error.

Test code to reproduce

Running component tests.

Cypress Version

8.0.0

Other

"@cypress/react": "^5.9.2",
"@cypress/webpack-dev-server": "^1.4.0",
"@testing-library/cypress": "^8.0.0",
"cypress": "^8.0.0",
"html-webpack-plugin": "5",
"webpack": "5",
"webpack-dev-server": "3"
@WillSquire
Copy link
Author

WillSquire commented Aug 1, 2021

Are there any releases that fix the moved config yet? It's a bit of a show stopper for me, as the Next.js update has a critical bug fix and the project uses Cypress 'whole hog' - i.e. everything is tested with Cypress.

@WillSquire
Copy link
Author

Is there any release date or a pre-release version available for this?

@elevatebart
Copy link
Contributor

It has been release in version @cypress/react@5.9.3

@WillSquire
Copy link
Author

WillSquire commented Aug 9, 2021

This is still erroring with Cannot find module 'next/dist/next-server/server/config'?

Is this update meant to read next/dist/server/config.js instead? Can we override this path? It's a major blocker, the project can't run without tests.

EDIT:
Looking at the code commit, you've got throw e in the catch block. Is this meant to be wrapped in an else {} to stop it from throwing after the path is corrected?

@elevatebart
Copy link
Contributor

I do, you are right. It should be in a else statement. How did we miss that.
Let me fix that.

In the meantime, I invite you to use patch-package.

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Aug 10, 2021

The code for this is done in cypress-io/cypress#17658, but has yet to be released.
We'll update this issue and reference the changelog when it's released.

@cypress-bot cypress-bot bot removed the stage: needs review The PR code is done & tested, needs review label Aug 10, 2021
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

No branches or pull requests

4 participants