Add better messaging on Vitest Pool Workers and nodejs_compat#18495
Merged
andyjessop merged 5 commits intoproductionfrom Jan 8, 2025
Merged
Add better messaging on Vitest Pool Workers and nodejs_compat#18495andyjessop merged 5 commits intoproductionfrom
andyjessop merged 5 commits intoproductionfrom
Conversation
Merged
9 tasks
Deploying cloudflare-docs with
|
| Latest commit: |
cd39881
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://3c325fb3.cloudflare-docs-7ou.pages.dev |
| Branch Preview URL: | https://aj-vitest-pool-workers-node.cloudflare-docs-7ou.pages.dev |
Contributor
|
Files with changes (up to 15) |
|
|
||
|
|
||
| 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. |
Contributor
There was a problem hiding this comment.
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
Contributor
Author
There was a problem hiding this comment.
Agreed, I'll make that update. Thanks for the input @irvinebroque 👍
Contributor
Author
There was a problem hiding this comment.
I've added a more detailed explanation with code example.
0d8f7c5 to
b681bb9
Compare
irvinebroque
approved these changes
Jan 7, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Improves the messaging surrounding
nodejs_compatand Vitest Pool Workers as a result of this PR which automatically injectsnodejs_compatflag into the pool Worker.Documentation checklist