Skip to content

Commit ee8d022

Browse files
committed
fixup! update module tests
1 parent 27dab23 commit ee8d022

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

packages/unenv-preset/src/preset.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@ import { version } from "../package.json";
22
import type { Preset } from "unenv";
33

44
// Built-in APIs provided by workerd.
5+
//
56
// https://developers.cloudflare.com/workers/runtime-apis/nodejs/
67
// https://github.com/cloudflare/workerd/tree/main/src/node
8+
//
79
// Last checked: 2025-01-24
8-
const cloudflareNodeCompatModules = [
10+
//
11+
// NOTE: Please sync any changes to `testNodeCompatModules`.
12+
const nodeCompatModules = [
913
"_stream_duplex",
1014
"_stream_passthrough",
1115
"_stream_readable",
@@ -53,7 +57,7 @@ export const cloudflare: Preset = {
5357
},
5458
alias: {
5559
...Object.fromEntries(
56-
cloudflareNodeCompatModules.flatMap((p) => [
60+
nodeCompatModules.flatMap((p) => [
5761
[p, p],
5862
[`node:${p}`, `node:${p}`],
5963
])
@@ -92,5 +96,5 @@ export const cloudflare: Preset = {
9296
],
9397
},
9498
polyfill: [],
95-
external: cloudflareNodeCompatModules.flatMap((p) => [p, `node:${p}`]),
99+
external: nodeCompatModules.flatMap((p) => [p, `node:${p}`]),
96100
};

packages/unenv-preset/tests/worker/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import assert from "node:assert";
55
export const TESTS = {
66
testCryptoGetRandomValues,
77
testImplementsBuffer,
8-
testModules,
8+
testNodeCompatModules,
99
testUtilImplements,
1010
testPath,
1111
testDns,
@@ -75,7 +75,7 @@ async function testImplementsBuffer() {
7575
assert.strictEqual(typeof buffer.resolveObjectURL, "function");
7676
}
7777

78-
async function testModules() {
78+
async function testNodeCompatModules() {
7979
const module = await import("node:module");
8080
// @ts-expect-error exposed by workerd
8181
const require = module.createRequire("/");

0 commit comments

Comments
 (0)