-
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
support config component test verify host #29967
Comments
In some situations, starting vite like this has helped: npx vite --host |
It is always good to be controllable. Obviously, the verification address and vite startup address of the Cypress component test are not well controlled now, which will cause some problems. |
Sorry that my suggestion did not help! You have submitted a feature request rather than an issue report so the details of versions, etc. are missing. If you want to go into more detail, then please add the information about your current setup: Operating system and version: Several frameworks, including Vite, started having problems with localhost IPv4 / IPv6 when Node.js 17 was released, due to a change in the default DNS priority . In the meantime, for most configurations, there are workarounds available. Possibly we can find a workaround for you too. |
@MikeMcC399 I tried many methods, including reading the Cypress source code and consulting network-related people, but the conclusion I came to was that in addition to adjusting the verification address of Cypress, the only way to do it was to rewrite the container hosts. That is not easy, as you know, the underlying container in a company is usually not modifiable. |
If you are still using Node.js Node.js 16 entered end-of-life on Sep 11, 2023, so it is no longer supported. You can read the official Cypress statement about this in https://docs.cypress.io/guides/references/changelog#13-0-0
Have you tried with the current Node.js LTS version Edit: https://vitejs.dev/guide/migration.html#node-js-support says:
|
@MikeMcC399 My project is in a large warehouse in the company, and upgrading the node version rashly may cause impacts that I cannot evaluate. |
I don't expect that updating Node.js will solve the issue, no. |
You were pointing to Cypress code, which has hardcoded cypress/npm/vite-dev-server/src/resolveConfig.ts Lines 128 to 134 in d8884e0
|
@MikeMcC399 My problem is that the verification host address in the Cypress source code is localhost, but vite is fixedly started on the e.g.
|
yes, my screenshots are from Cypress source code, so I can't control Cypress to modify its validation behavior because it is hard-coded in the code. |
@MikeMcC399 |
I'm able to reproduce this issue with supported versions. I tested on Debian 12 and I commented out the IPv4 loopback
The error refers to |
Yes, I'm glad that this problem can be successfully reproduced in your place. Whether it's baseURL or something else, being able to configure the address verified by Cypress, or controlling the vite server startup parameters can solve this problem. So I hope to add a new configuration, or support vite server startup parameter configuration. |
I ran a test, changing cypress/npm/vite-dev-server/src/resolveConfig.ts Lines 128 to 129 in d8884e0
@cypress/vite-dev-server, where this code resides, is bundled with the Cypress binary. I will have to leave any further work to the experts of this module, but at least the problem is now clearer. Do you have the flexibility to replace your IPv6 container with a Cypress Docker image run as a Docker container or are you tied to the IPv6 container? |
If I could, I would have replaced my image a long time ago. As I said above, my project runs on the company's infrastructure and I cannot replace and change the configuration of the container. |
I think the problem has always been clear. I did a long investigation and verification before asking the question. The problem is that Cypress binds the verification address and the address of the vite server and cannot be modified. However, in the ipv6 container, So I hope to add a feature to solve this problem. |
I found it also worked if
|
The premise of your verification should be that the host of the vite server can be controlled from outside, but this is not currently possible within Cypress. Is there anything wrong with what I said? |
The vite server startup for Cypress Component Testing can't be controlled from outside. I was just trying out the effect of source code changes in Cypress itself. I don't think I can make any further progress on researching this issue now. Your original request is fine! |
So, is there any hope of exposing the relevant configuration to users in the future to fix this problem? |
What would you like?
Cypress has some issues running component tests in an ipv6 container. I'm using the vite bundler and cypress can't verify
localhost:port
because the vite server starts on an ipv4 port, but cypress always verifies localhost. This doesn't work on ipv6 hosts machines.If I could specify the server host that Cypress validates against when in component test mode, for example I could specify that it validate 127.0.0.1:port, it might work. But right now, there's no configuration that allows me to do that.
Why is this needed?
Because my project pipeline runs in an ipv6 container, and I don't have a way to modify the container's hosts file. I want cypress to be able to run component tests on this container.
Other
No response
The text was updated successfully, but these errors were encountered: