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

CT + Vite 3.0 does not work with Node >= 17 #23042

Closed
ZachJW34 opened this issue Aug 1, 2022 · 4 comments · Fixed by #23048
Closed

CT + Vite 3.0 does not work with Node >= 17 #23042

ZachJW34 opened this issue Aug 1, 2022 · 4 comments · Fixed by #23048
Labels
CT Issue related to component testing

Comments

@ZachJW34
Copy link
Contributor

ZachJW34 commented Aug 1, 2022

Current behavior

A Cypress CT project using the new Vite 3.0 support does not work out of the box if the user is using a node version >=17. There is a workaround by explicitly setting the host to 127.0.0.1 in the vite.config.js (or the overrides in cypress.config.js), but we should not have to rely on user workarounds.

For details, see the vite migration guide regarding dev-server changes.

Desired behavior

Cypress CT projects using Vite 3.0.0 and Node version >=17 should work without user provided workarounds.

Test code to reproduce

  1. nvm install 18
  2. npx init vite => I chose a react js app
  3. cd into project and run yarn add -D https://cdn.cypress.io/beta/npm/10.4.0/darwin-x64/develop-4d3ad9edaa9b4b19ed10094279f72ed5657b851c/cypress.tgz (Vite 3.0 hasn't been released yet so I'm using a binary from develop)
  4. yarn cypress open => walk through CT setup
  5. Create a CT test => I created src/App.cy.jsx with contents:
import App from "./App";

it("should render", () => {
  cy.mount(<App />);
});

  1. Click on CT test, runner will hang
Screen.Recording.2022-08-01.at.11.50.55.AM.mov

Cypress Version

10.4.0 (binary from develop)

Other

We did the same change for webpack a while back, so it's makes sense to do it here as well.
#21430

@ZachJW34 ZachJW34 added the CT Issue related to component testing label Aug 1, 2022
@cypress-bot cypress-bot bot added stage: needs review The PR code is done & tested, needs review stage: review and removed stage: fire watch stage: needs review The PR code is done & tested, needs review labels Aug 1, 2022
@baus
Copy link

baus commented Aug 1, 2022

@OrenciucEvghenii
Copy link

OrenciucEvghenii commented Aug 2, 2022

Hey guys. Same issue hier.
vite: v3.0.4
cypress: v10.3.1
node: v18.6.0

Page cannot request 'cy.js' file. Here is the network request in chrome:

Screenshot 2022-08-02 at 09 25 15

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Aug 2, 2022

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

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Aug 15, 2022

Released in 10.5.0.

This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v10.5.0, please open a new issue.

@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Aug 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CT Issue related to component testing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants