-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
add next 12.x support to @cypress/react #19382
Comments
Sorry for the slow reply. We will spend some time to investigate updating Do you know what is involved in this? I haven't looked at the new middleware API yet. |
I know yarn run v1.22.17
$ cypress run-ct
It looks like this is your first time using Cypress: 9.6.1
✔ Verified Cypress! /Users/.../Library/Caches/Cypress/9.6.1/Cypress.app
Opening Cypress...
<i> [webpack-dev-server] Project is running at:
<i> [webpack-dev-server] Loopback: http://localhost:8080/, http://127.0.0.1:8080/
<i> [webpack-dev-server] Content not from webpack is served from '/Users/.../Desktop/cypress testing/with-cypress-app-nextjs-12/public' directory
====================================================================================================
(Run Starting)
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Cypress: 9.6.1 │
│ Browser: Electron 94 (headless) │
│ Node Version: v14.19.0 (/usr/local/Cellar/node@14/14.19.0_1/bin/node) │
│ Specs: 1 found (lala.spec.tsx) │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
────────────────────────────────────────────────────────────────────────────────────────────────────
Running: lala.spec.tsx (1 of 1)
assets by path static/chunks/*.js 7.61 KiB
asset static/chunks/cypress_support_index_js.js 3.94 KiB [emitted]
asset static/chunks/spec-0.js 3.67 KiB [emitted] (name: spec-0)
asset main.js 13.9 KiB [emitted] (name: main)
asset index.html 391 bytes [emitted]
cached modules 2.09 KiB [cached] 7 modules
runtime modules 2.32 KiB 7 modules
./node_modules/@cypress/webpack-dev-server/dist/loader.js!./node_modules/@cypress/webpack-dev-server/dist/browser.js 934 bytes [not cacheable] [built]
client (webpack 5.72.0) compiled successfully in 326 ms
1) An uncaught error was detected outside of a test
0 passing (235ms)
1 failing
1) An uncaught error was detected outside of a test:
ReferenceError: The following error originated from your test code, not from Cypress.
> require is not defined
When Cypress detects uncaught errors originating from your test code it will automatically fail the current test.
Cypress could not associate this error to any specific test.
We dynamically generated a new test to display this failure.
at Object.__webpack_require__.f.require (http://localhost:8080/__cypress/src/main.js:194:15)
at http://localhost:8080/__cypress/src/main.js:133:40
at Array.reduce (<anonymous>)
at Function.__webpack_require__.e (http://localhost:8080/__cypress/src/main.js:132:67)
at loadSupportFile (webpack-internal:///./node_modules/@cypress/webpack-dev-server/dist/loader.js!./node_modules/@cypress/webpack-dev-server/dist/browser.js:2:51)
at http://localhost:8080/__cypress/runner/cypress_runner.js:203384:86
at tryCatcher (http://localhost:8080/__cypress/runner/cypress_runner.js:26302:23)
at Object.gotValue (http://localhost:8080/__cypress/runner/cypress_runner.js:25444:18)
at Object.gotAccum (http://localhost:8080/__cypress/runner/cypress_runner.js:25433:25)
at Object.tryCatcher (http://localhost:8080/__cypress/runner/cypress_runner.js:26302:23)
(Results)
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Tests: 1 │
│ Passing: 0 │
│ Failing: 1 │
│ Pending: 0 │
│ Skipped: 0 │
│ Screenshots: 1 │
│ Video: false │
│ Duration: 0 seconds │
│ Spec Ran: lala.spec.tsx │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
(Screenshots)
- /Users/.../Desktop/cypress testing/with-cypress-app-nextjs-12/cypress/screensh (1280x720)
ots/lala.spec.tsx/An uncaught error was detected outside of a test (failed).png
====================================================================================================
(Run Finished)
Spec Tests Passing Failing Pending Skipped
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ ✖ lala.spec.tsx 230ms 1 - 1 - - │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
✖ 1 of 1 failed (100%) 230ms 1 - 1 - -
error Command failed with exit code 1. @lmiller1990 do you have an idea where the problem might be? (which cypress library) |
It's been a while but I would like to draw some attention here. I created an example repo which outlines the issue. https://github.com/gearsdigital/cypress-next-19382 I'm using Cypress 9.6.1 and next.js 12.1.6. It seems related to fact that nextjs switched to webpack 5.
|
After some fiddling it seems to break only in nextjs 12.1.6 and upwards. 12.1.5 and below works fine so far. vercel/next.js@v12.1.5...v12.1.6 Only 559 files have changed 😵💫 |
Same here. |
The latest Next.js (v12.1.6) is broken with Cypress right now (it just came out a few days ago). We have a ticket for this in our internal planning and someone will fix it, probably next week. Please wait a little. If anyone knows what broke and how to fix it, please let me know, otherwise I will just go over the 559 files that changed and find out. In the meantime, the only real option is to use Next.js 12.1.5. Sorry about the inconvenience; Next.js is a fast moving target! |
Hey there! Sorry about this – would this happen to be related to vercel/next.js#36794? |
Hey @gearsdigital , I can't reproduce your error in https://github.com/gearsdigital/cypress-next-19382
|
@Brooooooklyn Thanks for verfying! You need to run cypress in component test mode. I checked my example myself and I still can reproduce the behaviour. My steps:
|
Absolutely. Thank you very very much @lmiller1990 for taking care. Same to @leerob for jumping in. |
Looks like the API for getNextJsBaseWebpackConfig has changed from v12.1.5 to v12.1.6 which is the API we rely on to grab the Next webpack config. Quick test changing |
The code for this is done in cypress-io/cypress#21516, but has yet to be released. |
This was released in @cypress/react@5.12.5! |
Released in This comment thread has been locked. If you are still experiencing this issue after upgrading to |
What would you like?
We would like
@cypress/react
to supportnextjs
12.x
Why is this needed?
We'd like to be able to upgrade to nextjs 12.x - in order to take advantage of the new middleware API. Sadly though, it looks like
@cypress/react
is not quite ready to support nextjs 12.x atm.Other
No response
The text was updated successfully, but these errors were encountered: