You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Following the steps in https://developers.cloudflare.com/workers/testing/vitest-integration/, testing a discord bot but having problems when it tries to import discord-api-types with the following error when trying to run vitest. Of note, when using the same test without the cloudflare vitest integration, the test passes, meaning that the issue really is more to do with the vitest integration module rather than with discord-api-types.
FAIL src/impl.test.mts [ src/impl.test.mts ]
Error: No such module "C:/git/vitest-wrangler-discord-api-types/node_modules/discord-api-types/v10.js".
imported from "C:/git/vitest-wrangler-discord-api-types/node_modules/discord-api-types/v10.mjs"
Dug into discord and found guidance on turning on debug details NODE_DEBUG=vitest-pool-workers:module-fallback which I've added into the log section.
closing this as a duplicate of #6591, although if you go to the reproduction linked in that issue (https://github.com/dario-piotrowicz/vitest-pool-workers-ext-repro) see how to sort of get around this by patching the imports in the discord-api package. this is obviously not an ideal solution. we're going to be doing some work around the vitest integration in the new year, so hopefully a proper fix should be incoming.
Which Cloudflare product(s) does this pertain to?
Workers Vitest Integration
What version(s) of the tool(s) are you using?
0.5.28 [@cloudflare/vitest-pool-workers]
What version of Node are you using?
22.11.0
What operating system and version are you using?
Windows 11
Describe the Bug
Observed behavior
Following the steps in https://developers.cloudflare.com/workers/testing/vitest-integration/, testing a discord bot but having problems when it tries to import
discord-api-types
with the following error when trying to runvitest
. Of note, when using the same test without the cloudflare vitest integration, the test passes, meaning that the issue really is more to do with the vitest integration module rather than with discord-api-types.Dug into discord and found guidance on turning on debug details
NODE_DEBUG=vitest-pool-workers:module-fallback
which I've added into the log section.Expected behavior
Unit tests should be able to run successfully.
Steps to reproduce
npm install
npm test
Please provide a link to a minimal reproduction
https://github.com/davidhouweling/vitest-wrangler-discord-api-types
Please provide any relevant error logs
The text was updated successfully, but these errors were encountered: