Skip to content

Commit 9848a75

Browse files
add nodejs test to vitest-pool-workers fixture
1 parent 0e70408 commit 9848a75

File tree

4 files changed

+30
-1
lines changed

4 files changed

+30
-1
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { afterEach, beforeEach, expect, it, vi } from "vitest";
2+
3+
it("runs in Node.js compatibility mode", () => {
4+
expect(typeof process).toBe("object");
5+
expect(process.versions).toBeDefined();
6+
expect(process.versions.node).toBeDefined();
7+
expect(typeof Buffer).toBe("function");
8+
});

fixtures/vitest-pool-workers-examples/misc/vitest.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default defineWorkersProject({
77
"CONFIG_NESTED.DEFINED.THING": "[1,2,3]",
88
},
99
test: {
10-
exclude: ["test/assets.test.ts"],
10+
exclude: ["test/assets.test.ts", "test/nodejs.test.ts"],
1111
poolOptions: {
1212
workers: {
1313
singleWorker: true,
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { defineWorkersProject } from "@cloudflare/vitest-pool-workers/config";
2+
3+
export default defineWorkersProject({
4+
test: {
5+
name: "misc-nodejs",
6+
include: ["test/nodejs.test.ts"],
7+
poolOptions: {
8+
workers: {
9+
singleWorker: true,
10+
wrangler: {
11+
configPath: "./wrangler.nodejs.jsonc",
12+
},
13+
},
14+
},
15+
},
16+
});
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"$schema": "../node_modules/wrangler/config-schema.json",
3+
// don't provide compatibility_date so that vitest will infer the latest one
4+
"compatibility_flags": ["nodejs_compat"],
5+
}

0 commit comments

Comments
 (0)