-
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
Cypress Component Testing is not running in a new Vite+React+TypeScript project #23114
Comments
Hey @jude-lawson, thanks for providing a reproduction repo! Unfortunately, I was not able to reproduce the error using that repo. I also tried following the steps in your Can you check the console in the browser when it gets stuck on |
Thanks @rockindahizzy ! That is so bizarre, I've tried on a couple of different machines and had a colleague try on their's, and we were seeing similar frozen results across the board. I wonder if it has something to do with operating system or even shell configurations? On my colleagues machine they received the following:
I checked in the Chrome console while the freezing was occurring and did not get any messages (other than that the Cypress favicon could not be found). In the Cypress shell log itself, this is what I see. I'm not sure if you see anything concerning there that I don't:
Let me know if maybe a video of the GUI or something would help? Is there a Cypress log file I can inspect to dig in further? It looks like there's probably just some variable that I am missing, so I'm happy to try whatever you think is best! |
@jude-lawson Seems this issue has to do with the new node version, 18.6.0, and some new features added to it. If your local machine is using that version of node, currently Cypress fails with it. I recommend keeping your local node version on whatever it was just before the update. At least unless Cypress catches up and has a fix for this in the future. |
Thanks @elijahstorm ! I think my colleague was on 18.6.0, so that's definitely whats causing that hook error. Is the freezing issue related to this though? I am currently on node 17.9.0. Is that a supported node version? Happy to switch it up if not! |
It's worth giving it a shot to and trying 18.2.0. That worked for us via docker and auto CI deployments. But honestly my local machine was running version 16 just fine, until I updated it recently. So I'm not totally sure if it'll fix your freezing issue. |
Hey, same issue here. Vite+React and indefinite "Tests are loading" with essentially the same symptons as described by jude-lawson. I quickly checked how your reproduction would perform locally, @jude-lawson, and observed it to work when using node 16.15.1 (just what I currently was on), but not to do so with 18.2.0 (and 18.6.0 already failed when running But that's for the mentioned reproduction. In my actual project, tests won't load for any of these node versions.. I've got React v 18.2.0, vite v 3.0.3 & cypress 10.4.0 with the |
@elijahstorm / @urecha I ran some more tests with a colleague yesterday evening and it looks like we got this behavior based on different node versions:
I tried this out and got similar results (which is great because it looks like the current LTS version of node works!):
Here's a short video example of me switching between cy_vite_repro.movDefinitely looks to be like the LTS is working, but Current is freezing. Let me know if you'd like me to test anything else! |
Hey everyone, Thanks for helping get to the root of the issue. I was able to recreate this by changing my node version. It actually looks like we have a PR that has been recently merged that should fix this issue. In the meantime, you may be able to workaround this by adjusting your server: {
host: '127.0.0.1'
} I tired it in your reproduction, @jude-lawson, and it seemed to work! |
@ZachJW34 assigning to you since you have a PR to fix this issue. |
I'm going to close this issue since we have merged #23048 which will be included in our next release. If you are seeing an error that isn't related to Vite hanging due to node version >=17, we can reopen or you can create another issue! |
Awesome, thanks everyone who looked in to this and helped provide workarounds. Looking forward to the next release, and thanks for building great software 🎉 Also, this is a complete side note, but Cypress's documentation is some of the best I've ever utilized, and I often point to it as an archetype of great documentation. Thank you for writing useful documentation as well! |
Current behavior
Hi Cypress Team!
First off, thanks for making a great tool. I've been using Cypress for awhile and I just wanted to take the briefest of moments to appreciate the work you've done.
My issue is related specifically to Cypress Component Testing. I am adding Cypress Component Testing to a project that uses Vite+React+TypeScript. After setting up the project with the standard settings from Vite's React-TS template, adding Cypress, and running the automated configuration to set up component testing and running the new test, the Cypress app freezes on the "Your tests are loading..." screen.
Desired behavior
When I start the newly created test, the test should load and show the default
<App />
component I am rendering withcy.mount
in the test.Test code to reproduce
I've set up a repo to replicate the issue. I'm using Cypress Component Testing in a little different context, but I distilled the issue down to a minimum reproducible example found here: https://github.com/jude-lawson/cy_vite_repro
The steps to reproduce are in the repo's README!
Cypress Version
10.4.0
Other
I've reached out for help on the Cypress Discord and was directed here to get some additional help. As mentioned before I am trying to use Cypress Component Testing in a little different context (a monorepo), but the isolated workspace is still a brand new Vite+React+TS project, just like the minimum reproducible example (which is not a monorepo).
I'm using
pnpm
, but I've also tried this withnpm
as well just to eliminatepnpm
as a variable and the issue still occurred.Thanks for any help you can provide, and please let me know if there are any other steps I can take or additional information that I can provide.
The text was updated successfully, but these errors were encountered: