-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
Add better messaging on Vitest Pool Workers and nodejs_compat #18495
Conversation
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.
1 files reviewed, 1 total issue(s) found.
src/content/docs/workers/testing/vitest-integration/isolation-and-concurrency.mdx
Outdated
Show resolved
Hide resolved
Deploying cloudflare-docs with Cloudflare Pages
|
Files with changes (up to 15) |
|
||
:::caution | ||
|
||
|
||
Using the pool may cause your Worker to behave differently when deployed than during testing, as Node-style resolution and additional polyfills will be available to your Worker's source code and dependencies too. | ||
Using Vitest Pool Workers may cause your Worker to behave differently when deployed than during testing as the `nodejs_compat` flag is enabled by default. This means that Node.js-specific APIs and modules are available when running your tests. However, Cloudflare Workers do not support these Node.js APIs in the production environment unless you specify this flag in your Worker configuration. |
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.
Can we explicitly link people at this point to add the flag
And maybe give basic example? Like — in your tests, you'll see that your Worker's code can use xyz node.js API. But when you deploy, unless flag is enabled, this wont' work, so your tests can give you false positive.
Think this is really close but showing vs. telling will really help to clarify
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.
Agreed, I'll make that update. Thanks for the input @irvinebroque 👍
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.
I've added a more detailed explanation with code example.
0d8f7c5
to
b681bb9
Compare
Summary
Improves the messaging surrounding
nodejs_compat
and Vitest Pool Workers as a result of this PR which automatically injectsnodejs_compat
flag into the pool Worker.Documentation checklist