-
Notifications
You must be signed in to change notification settings - Fork 1k
Fix vitest-pool-workers when nodejs_compat is enabled #11047
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
Merged
petebacondarwin
merged 15 commits into
main
from
pbd/vitest-pool-workers/infer-compat-date
Oct 22, 2025
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
1c47ad9
chore: remove deprecated workspace config from vitest-pool-workers fi…
petebacondarwin 0d78f48
allow vitest-pool-workers to infer the latest compatibility date if n…
petebacondarwin 587b7bc
update vitest-pool-workers tests to use the latest compatibility date
petebacondarwin 1484394
fix missing await on async expectation in vitest-pool-workers fixture
petebacondarwin 6a90b5d
add nodejs test to vitest-pool-workers fixture
petebacondarwin 8060119
ensure that vitest specific nodejs polyfills override native modules
petebacondarwin db6f291
url polyfill is not needed
petebacondarwin aed5d25
remove unnecessary polyfills from Vitest pool workers, ensuring that …
petebacondarwin 8ef01dc
rework helper to make its purpose more clear
petebacondarwin e48c7bc
revert simplification of console polyfill
petebacondarwin d55d162
move timeout options param as the current location is deprecated
petebacondarwin c9270f6
add an extra debugging log in when the devregistry fails to dispose
petebacondarwin 4521fbe
Bump up the hook timeout on vitest-pool-workers tests
petebacondarwin f80a517
ensure chunking test has a big enough max buffer
petebacondarwin 134ddad
escalate the signal if a vitest-pool-workers test fails because it is…
petebacondarwin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@cloudflare/vitest-pool-workers": minor | ||
| --- | ||
|
|
||
| Infer latest locally available compatibility date if none is provided in the test configuration |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@cloudflare/vitest-pool-workers": patch | ||
| --- | ||
|
|
||
| ensure that vitest specific nodejs polyfills override native modules |
1 change: 1 addition & 0 deletions
1
fixtures/vitest-pool-workers-examples/ai-vectorize/wrangler.jsonc
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
1 change: 1 addition & 0 deletions
1
fixtures/vitest-pool-workers-examples/basics-integration-auxiliary/wrangler.jsonc
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| { | ||
| "name": "basics-integration-auxiliary", | ||
| "main": "src/index.ts", | ||
| // compatibility_date is required so we can run `wrangler build` | ||
| "compatibility_date": "2024-01-01", | ||
| } |
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
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
2 changes: 1 addition & 1 deletion
2
fixtures/vitest-pool-workers-examples/basics-unit-integration-self/wrangler.jsonc
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| { | ||
| "name": "basics-unit-integration-self", | ||
| "main": "src/index.ts", | ||
| "compatibility_date": "2024-01-01", | ||
| // don't provide compatibility_date so that vitest will infer the latest one | ||
| } |
2 changes: 1 addition & 1 deletion
2
fixtures/vitest-pool-workers-examples/container-app/wrangler.jsonc
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
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
2 changes: 1 addition & 1 deletion
2
fixtures/vitest-pool-workers-examples/durable-objects/wrangler.jsonc
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
2 changes: 1 addition & 1 deletion
2
fixtures/vitest-pool-workers-examples/hyperdrive/wrangler.jsonc
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
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
2 changes: 1 addition & 1 deletion
2
fixtures/vitest-pool-workers-examples/kv-r2-caches/wrangler.jsonc
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
8 changes: 8 additions & 0 deletions
8
fixtures/vitest-pool-workers-examples/misc/test/nodejs.test.ts
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| import { afterEach, beforeEach, expect, it, vi } from "vitest"; | ||
|
|
||
| it("runs in Node.js compatibility mode", () => { | ||
| expect(typeof process).toBe("object"); | ||
| expect(process.versions).toBeDefined(); | ||
| expect(process.versions.node).toBeDefined(); | ||
| expect(typeof Buffer).toBe("function"); | ||
| }); |
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
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
16 changes: 16 additions & 0 deletions
16
fixtures/vitest-pool-workers-examples/misc/vitest.nodejs.config.ts
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| import { defineWorkersProject } from "@cloudflare/vitest-pool-workers/config"; | ||
|
|
||
| export default defineWorkersProject({ | ||
| test: { | ||
| name: "misc-nodejs", | ||
| include: ["test/nodejs.test.ts"], | ||
| poolOptions: { | ||
| workers: { | ||
| singleWorker: true, | ||
| wrangler: { | ||
| configPath: "./wrangler.nodejs.jsonc", | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| }); |
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
5 changes: 5 additions & 0 deletions
5
fixtures/vitest-pool-workers-examples/misc/wrangler.nodejs.jsonc
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| { | ||
| "$schema": "../node_modules/wrangler/config-schema.json", | ||
| // don't provide compatibility_date so that vitest will infer the latest one | ||
| "compatibility_flags": ["nodejs_compat"], | ||
| } |
2 changes: 1 addition & 1 deletion
2
fixtures/vitest-pool-workers-examples/module-resolution/wrangler.jsonc
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| { | ||
| "name": "module-resolution", | ||
| "main": "src/index.ts", | ||
| "compatibility_date": "2024-04-05", | ||
| // don't provide compatibility_date so that vitest will infer the latest one | ||
| } |
2 changes: 1 addition & 1 deletion
2
fixtures/vitest-pool-workers-examples/multiple-workers/api-service/wrangler.jsonc
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
1 change: 1 addition & 0 deletions
1
fixtures/vitest-pool-workers-examples/multiple-workers/auth-service/wrangler.jsonc
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
1 change: 1 addition & 0 deletions
1
fixtures/vitest-pool-workers-examples/multiple-workers/database-service/wrangler.jsonc
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
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
2 changes: 1 addition & 1 deletion
2
fixtures/vitest-pool-workers-examples/pages-with-config/wrangler.jsonc
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| { | ||
| "name": "pages-with-config", | ||
| "compatibility_date": "2024-09-19", | ||
| // don't provide compatibility_date so that vitest will infer the latest one | ||
| "pages_build_output_dir": "public", | ||
| } |
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
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
2 changes: 1 addition & 1 deletion
2
fixtures/vitest-pool-workers-examples/request-mocking/wrangler.jsonc
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| { | ||
| "name": "request-mocking", | ||
| "main": "src/index.ts", | ||
| "compatibility_date": "2024-01-01", | ||
| // don't provide compatibility_date so that vitest will infer the latest one | ||
| } |
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
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
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
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
fixtures/vitest-pool-workers-examples/web-assembly/wrangler.jsonc
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| { | ||
| "name": "web-assembly", | ||
| "main": "src/index.ts", | ||
| "compatibility_date": "2024-01-01", | ||
| // don't provide compatibility_date so that vitest will infer the latest one | ||
| } |
2 changes: 1 addition & 1 deletion
2
fixtures/vitest-pool-workers-examples/workers-assets-only/wrangler.jsonc
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
2 changes: 1 addition & 1 deletion
2
fixtures/vitest-pool-workers-examples/workers-assets-run-worker-first/wrangler.jsonc
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
2 changes: 1 addition & 1 deletion
2
fixtures/vitest-pool-workers-examples/workers-assets/wrangler.jsonc
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.