-
Notifications
You must be signed in to change notification settings - Fork 266
fix: fix module resolution for esm file #1484
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
Conversation
✅ Deploy Preview for vue-test-utils-docs ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
Also, this should help with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, thanks.
Docs for this is anyone else (like me) was not familiar w/ the exports
key: https://nodejs.org/api/packages.html#subpath-exports
How do I ensure that the esm package is called when I use jsdom? I have the problem that it will load the browser package, which search for Vue in globalThis. There is a dirty workaround with
But this can't be the soltuion. |
Vite should be loading the ESM version - I don't think this is an issue in Test Utils. Can you make a minimal reproduction and share it (probably in the Vitest repo)? |
It might not relate to Vitest but to jest, because there I receive this problem since the update. I can try to create a repo where I reproduce the issue. |
The error happens, because Jest prioritises "browser" condition, when jsdom is enabled |
Yeah but this should be the case. Because if I use jsdom I wanna test the behavior like I'm in the browser. So in my opinion prioritizing the browser would be correct. But I'm not sure why we need a browser package for vue test utils which depends on a global registered vue version. |
You should not expect browser packages behave the same in Node as they do in browser. These are two different environments, so I wouldn't say that jest does anyone good by including it by default, since it's running inside Node. |
This kind of thing is why I moved a lot of my tests to Cypress instead of Jest + jsdom... If there's action to be taken here to improve the testing experience with Test Utils here, happy to do so, but we definitely need 1) minimal repro and 2) verify with the runner(s) or environments in question that there's actually a bug. |
Fixes #1483