-
Notifications
You must be signed in to change notification settings - Fork 778
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
🐛 BUG: vitest-pool-workers
doesn't correctly resolve require
d modules if no extension is provided
#6591
🐛 BUG: vitest-pool-workers
doesn't correctly resolve require
d modules if no extension is provided
#6591
Comments
I think this is the same issue as #6405 |
I'm not sure, the error message is different, in #6405 the error seems to be:
while here it's
feels to me like one is resolving the module incorrectly while the other is not resolving it at all 🤔 |
I recently encountered this same issue. My minimal repro (which appears quite similar to Dario's) is here: https://github.com/mattrubin/discord-worker-vitest-bug The issue goes away if I switch my sample project to use Vitest without Notably, this issue appeared on an old project that was previously testing without any issues. When I updated UPDATE with additional info:
|
We have just added Vite dependency pre-bundling support on v0.6.14 that resolve this issue with the following config: export default defineWorkersConfig({
test: {
deps: {
optimizer: {
ssr: {
enabled: true,
include: ["discord-api-types/v10"],
},
},
},
poolOptions: {
workers: {
// ...
},
},
},
}); |
Thanks for the fix! 🎉 FWIW, in order to get my tests to run with no errors, I ended up needing the |
Which Cloudflare product(s) does this pertain to?
Workers Vitest Integration
What version(s) of the tool(s) are you using?
0.4.25
What version of Node are you using?
20
What operating system and version are you using?
Mac
Describe the Bug
vitest-pool-workers
can fail to apply the correct module resolution onrequire
calls that don't include a file extensionFor example me and @WalshyDev noticed this with the discord api types package, in which, the package.json includes both cjs and esm versions for the various exports but
vitest-pool-workers
doesn't seem to correctly take those into consideration causing errors when trying to import from the package.Please provide a link to a minimal reproduction
https://github.com/dario-piotrowicz/vitest-pool-workers-ext-repro
Please provide any relevant error logs
No response
The text was updated successfully, but these errors were encountered: