question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cypress Component Testing is not running in a new Vite+React+TypeScript project

See original GitHub issue

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 with cy.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 with npm as well just to eliminate pnpm 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.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:11 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
ZachJW34commented, Aug 9, 2022

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!

0reactions
jude-lawsoncommented, Aug 9, 2022

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!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Vite 3 not working with Cypress Component Testing #22784
I tried updating to Vite 3.0.2 in my project, worked fine, no need for any workaround. I'm not sure why Cypress internal tests...
Read more >
Upcoming Changes to Component Testing
Back to Cypress blog. Cypress 7 introduced the alpha version of a new testing type – the first since Cypress' inception – Component...
Read more >
Cypress component testing not recognizing new tests
tsx , and cypress says it won't recognize any tests in my newly created Button.test.tsx . This is my Button.tsx component: import React...
Read more >
How to set up a Front-End project with Vite, React, and ...
Unit testing. Unit tests are crucial to ensuring our software is reliable. We must not skip writing them and also not skip running...
Read more >
How to write component tests with Cypress - YouTube
In this video, you will learn how to write component tests with Cypress. Not only will you learn the basics of component testing...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found