-
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
fix(vitest-pool-workers): add node lib timers implementation #6444
Conversation
|
If it is this simple, I wonder why @mrbbot didn't add this in the first place? |
A wrangler prerelease is available for testing. You can install this latest build in your project with: npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/10298648616/npm-package-wrangler-6444 You can reference the automatically updated head of this PR with: npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/prs/6444/npm-package-wrangler-6444 Or you can use npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/10298648616/npm-package-wrangler-6444 dev path/to/script.js Additional artifacts:npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/10298648616/npm-package-create-cloudflare-6444 --no-auto-update npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/10298648616/npm-package-cloudflare-kv-asset-handler-6444 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/10298648616/npm-package-miniflare-6444 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/10298648616/npm-package-cloudflare-pages-shared-6444 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/10298648616/npm-package-cloudflare-vitest-pool-workers-6444 Note that these links will no longer work once the GitHub Actions artifact expires.
Please ensure constraints are pinned, and |
I wanted to minimise the additional Node polyfills to just those required by Vitest to reduce the likelihood of behaviour mismatches with regular |
Thanks for your quick replies! We're trying to test our worker, and before deployment, we use esbuild to resolve
Then, the It would be great if the files in |
So if we change the resolution to check the aliases before the built-in modules that would solve it for you? |
That would fix this specific issue, but not the others I've opened. Also as mrbbot mentioned the lib files being available in tests is quite a big difference between tests & production. There are multiple things that can be improved in our situation:
I will look at the codebase and try to see what I can do, and then I will get back to this PR, maybe with a more holistic solution 🙂 |
I'm closing this for now, as |
What this PR solves / how to test
Adds node lib timers implementation, so that the following code works:
setImmediate
,active
,unroll
, andpromises
are not implemented.Author has addressed the following