-
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
vite-dev-server "process is not defined" when attempting to execute vue test script #17902
Comments
Should mention this is on Win10 |
Could you make sure to update to the latest versions of the Cypress packages? This issue may have already been fixed. Thanks. |
No problem. Here is my updated package.json: { I deleted node_modules and reinstalled. Error is still happening. Additional information:
|
FWIW - the very last error (initCypressTests.js:22:18) comes from 17 if (!CypressInstance) { Also - if I run 'cypress open' (not open-ct) all is well |
I have also run into this problem today with Cypress 8.3.1 on a vite-vue project, also on windows 10 in my project I'm also using cypress to run unit tests on a handful of composibles, and the tests for those work great. So I think this error is tied to the rendering of mounted components to the Vite server |
I rolled back my dependencies, and cypress-ct worked for me, I re-updated my dependencies one by one to see where it would break. and from that testing the issue seems to come from @vue/compiler-sfc when I upgraded @vue/compiler-sfc from 3.0.5 to 3.2.6 I got the |
I'm getting this too. Looking through the stack traces, it goes like this:
Not sure why this is needed at runtime, but you can work around it by adding |
Can confirm. Adding the define to vite.config.js solved the problem |
See vuejs/core#4531
|
Sounds like we should be shipping an additional ESM bundle. I think we already ship one though - what needs to be different about this one? Here's our rollup config: https://github.com/cypress-io/cypress/blob/develop/npm/vue/rollup.config.js#L47 |
This should be fixed now in Vue 3.2.10 |
😅 Sorry I missed that. Now I have to dig further to find out why Vite resolved to the CJS build of |
Got it: cypress/npm/vite-dev-server/src/startServer.ts Lines 35 to 43 in e216ae2
|
Now that Vue 3.2.10 removes the runtime dependency on As for removing the CJS alias in Let's discuss it in the |
Confusing - so it sounds like if you update your deps to the latest version of Vue (3.2.6, for example, and the compiler-sfc, etc etc) everything is okay? Not clear if anything actually needs to be done in our Vite dev server at this point. |
Been trying to get vue3 vite cypress working, but no matter which version I've tried I can't seem to get rid of this. Does anyone know a version that works with vue >=3.2.0 or if there's any workaround to get around this issue? Relevant packages:
Update:
Didn't find a way to change server config option in plugins/index.ts, so I ended up creating seperate vite config files. |
I just created a new project using vite, installed the cypress bits, and it worked. I did have to tweak cypress/plugins/index.js to add startDevServer, but that was just to get cypress open-ct to work. Anyway, it basically worked out of the box. Is there any chance ../../node_modules/component-emitter is out of date? |
I have seen that If you can share your minimal reproduction @olemarius, happy to take a look! |
@lmiller1990 I think you're right, it's unrelated. It worked after I removed the ssl certs but the emit error persisted if I remember correctly. If you still would like a reproduction I can try to put that together, but can't promise when as things are a bit busy right now. |
No actionable info, closing for now. |
Current behavior
I'm running the example project found here:
https://github.com/cypress-io/cypress-component-examples/tree/main/vite-vue
When I run cypress open-ct the test browser opens. Selecting the HellowWorld.spec.js test results in a: Reference Error "process is not defined" message.
The console shows:
The stack trace is:
Desired behavior
The test should execute
Test code to reproduce
See above - I'm using the example code. My only modification to the code is to add
"cy" : "cypress open-ct"
to the scripts section of package.json
I execute the following from a visual studio terminal
npm run cy
Cypress Version
8.0.0
Other
Here are the dependencies from package.json:
The text was updated successfully, but these errors were encountered: