From 84f8c572dddf3cf83a7ab5005ec019bd7a46f831 Mon Sep 17 00:00:00 2001 From: Okiki Ojo Date: Wed, 11 Feb 2026 20:33:24 -0500 Subject: [PATCH] chore(tests): replace 'it' with 'test' for consistency across test files Signed-off-by: Okiki Ojo --- core/tests/01-conditional-exports.test.ts | 54 ++++++++-------- core/tests/02-subpath-patterns.test.ts | 34 +++++----- core/tests/03-legacy-fields.test.ts | 32 +++++----- core/tests/04-browser-remapping.test.ts | 42 ++++++------- core/tests/05-platform-remapping.test.ts | 30 ++++----- core/tests/06-relative-imports.test.ts | 18 +++--- core/tests/07-tree-shaking.test.ts | 30 ++++----- core/tests/08-non-npm-resolution.test.ts | 14 ++--- core/tests/09-builtins-polyfills.test.ts | 30 ++++----- core/tests/10-dual-package.test.ts | 36 +++++------ core/tests/11-edge-cases.test.ts | 40 ++++++------ core/tests/12-runtime-conditions.test.ts | 76 +++++++++++------------ 12 files changed, 218 insertions(+), 218 deletions(-) diff --git a/core/tests/01-conditional-exports.test.ts b/core/tests/01-conditional-exports.test.ts index 0ac87c6..1302dd6 100644 --- a/core/tests/01-conditional-exports.test.ts +++ b/core/tests/01-conditional-exports.test.ts @@ -8,7 +8,7 @@ * @module */ -import { describe, it } from "@std/testing/bdd"; +import { describe, test } from "@std/testing/bdd"; import { expect } from "@std/expect"; import { @@ -42,7 +42,7 @@ describe("01 · Conditional Exports", () => { }, }); - it("browser build picks the 'browser' condition", () => { + test("browser build picks the 'browser' condition", () => { const conds = getResolverConditions(importArgs(), resolveOpts({ platform: "browser" })); const result = resolveModern(pkg, ".", conds); @@ -51,7 +51,7 @@ describe("01 · Conditional Exports", () => { expect(result.path).toBe("./dist/preact.module.js"); }); - it("node build picks 'import' (no browser condition)", () => { + test("node build picks 'import' (no browser condition)", () => { const conds = getResolverConditions(importArgs(), resolveOpts({ platform: "node" })); const result = resolveModern(pkg, ".", conds); @@ -59,7 +59,7 @@ describe("01 · Conditional Exports", () => { expect(result.path).toBe("./dist/preact.mjs"); }); - it("CJS node build picks 'require'", () => { + test("CJS node build picks 'require'", () => { const conds = getResolverConditions( importArgs("entry-point"), resolveOpts({ platform: "node", format: "cjs" }), @@ -92,7 +92,7 @@ describe("01 · Conditional Exports", () => { }, }); - it("browser production resolves to ./dist/solid.js", () => { + test("browser production resolves to ./dist/solid.js", () => { const conds = getResolverConditions(importArgs(), resolveOpts({ platform: "browser" })); const result = resolveModern(pkg, ".", conds); @@ -100,7 +100,7 @@ describe("01 · Conditional Exports", () => { expect(result.path).toBe("./dist/solid.js"); }); - it("browser + development resolves to ./dist/dev.js", () => { + test("browser + development resolves to ./dist/dev.js", () => { const conds = getResolverConditions( importArgs(), resolveOpts({ platform: "browser", conditions: ["development"] }), @@ -111,7 +111,7 @@ describe("01 · Conditional Exports", () => { expect(result.path).toBe("./dist/dev.js"); }); - it("deno runtime resolves to ./dist/server.js", () => { + test("deno runtime resolves to ./dist/server.js", () => { const conds = getResolverConditions( importArgs(), resolveOpts({ platform: "node", runtime: "deno" }), @@ -145,7 +145,7 @@ describe("01 · Conditional Exports", () => { }, }); - it("browser ESM resolves to bundler entry", () => { + test("browser ESM resolves to bundler entry", () => { const conds = getResolverConditions(importArgs(), resolveOpts({ platform: "browser" })); const result = resolveModern(pkg, ".", conds); @@ -153,7 +153,7 @@ describe("01 · Conditional Exports", () => { expect(result.path).toBe("./dist/vue.runtime.esm-bundler.js"); }); - it("node ESM resolves to ./index.mjs", () => { + test("node ESM resolves to ./index.mjs", () => { const conds = getResolverConditions(importArgs(), resolveOpts({ platform: "node" })); const result = resolveModern(pkg, ".", conds); @@ -161,7 +161,7 @@ describe("01 · Conditional Exports", () => { expect(result.path).toBe("./index.mjs"); }); - it("node CJS resolves through 'require' → 'node' → 'default'", () => { + test("node CJS resolves through 'require' → 'node' → 'default'", () => { const conds = getResolverConditions( importArgs("entry-point"), resolveOpts({ platform: "node", format: "cjs" }), @@ -190,13 +190,13 @@ describe("01 · Conditional Exports", () => { }, }); - it("browser + ESM → esm-browser", () => { + test("browser + ESM → esm-browser", () => { const conds = getResolverConditions(importArgs(), resolveOpts({ platform: "browser" })); const result = resolveModern(pkg, ".", conds); expect(result.path).toBe("./dist/esm-browser/index.js"); }); - it("browser + CJS → cjs-browser", () => { + test("browser + CJS → cjs-browser", () => { const conds = getResolverConditions( importArgs("entry-point"), resolveOpts({ platform: "browser", format: "cjs" }), @@ -205,13 +205,13 @@ describe("01 · Conditional Exports", () => { expect(result.path).toBe("./dist/cjs-browser/index.js"); }); - it("node + ESM → esm", () => { + test("node + ESM → esm", () => { const conds = getResolverConditions(importArgs(), resolveOpts({ platform: "node" })); const result = resolveModern(pkg, ".", conds); expect(result.path).toBe("./dist/esm/index.js"); }); - it("node + CJS → cjs", () => { + test("node + CJS → cjs", () => { const conds = getResolverConditions( importArgs("entry-point"), resolveOpts({ platform: "node", format: "cjs" }), @@ -227,7 +227,7 @@ describe("01 · Conditional Exports", () => { exports: "./source/index.js" as any, }); - it("resolves the string directly", () => { + test("resolves the string directly", () => { const conds = getResolverConditions(importArgs(), resolveOpts()); const result = resolveModern(pkg, ".", conds); @@ -246,7 +246,7 @@ describe("01 · Conditional Exports", () => { }, }); - it("ESM picks import from the first array entry", () => { + test("ESM picks import from the first array entry", () => { const conds = getResolverConditions(importArgs(), resolveOpts()); const result = resolveModern(pkg, ".", conds); @@ -254,7 +254,7 @@ describe("01 · Conditional Exports", () => { expect(result.path).toBe("./index.mjs"); }); - it("CJS picks require from the first array entry", () => { + test("CJS picks require from the first array entry", () => { const conds = getResolverConditions( importArgs("entry-point"), resolveOpts({ format: "cjs" }), @@ -274,7 +274,7 @@ describe("01 · Conditional Exports", () => { }, }); - it("root resolves normally", () => { + test("root resolves normally", () => { const conds = getResolverConditions(importArgs(), resolveOpts()); const result = resolveModern(pkg, ".", conds); @@ -282,7 +282,7 @@ describe("01 · Conditional Exports", () => { expect(result.path).toBe("./index.js"); }); - it("./internal produces a resolution failure (null exclusion)", () => { + test("./internal produces a resolution failure (null exclusion)", () => { const conds = getResolverConditions(importArgs(), resolveOpts()); const result = resolveModern(pkg, "./internal", conds); @@ -297,32 +297,32 @@ describe("01 · Conditional Exports", () => { // =========================================================================== describe("integration: real packages", () => { - it("preact@10.25.4 builds successfully for browser", async () => { + test("preact@10.25.4 builds successfully for browser", { }, async () => { const result = await buildPackage("preact@10.25.4"); expect(result.contents.length).toBeGreaterThan(0); expect(result.errors.length).toBe(0); - }, { timeout: NETWORK_TIMEOUT }); + }); - it("solid-js@1.9.4 builds for browser", async () => { + test("solid-js@1.9.4 builds for browser", async () => { const result = await buildPackage("solid-js@1.9.4"); expect(result.contents.length).toBeGreaterThan(0); expect(result.errors.length).toBe(0); - }, { timeout: NETWORK_TIMEOUT }); + }); - it("uuid@11.0.5 builds for browser", async () => { + test("uuid@11.0.5 builds for browser", async () => { const result = await buildPackage("uuid@11.0.5"); expect(result.contents.length).toBeGreaterThan(0); expect(result.errors.length).toBe(0); - }, { timeout: NETWORK_TIMEOUT }); + }); - it("chalk@5.4.1 builds for browser", async () => { + test("chalk@5.4.1 builds for browser", async () => { const result = await buildPackage("chalk@5.4.1"); expect(result.contents.length).toBeGreaterThan(0); expect(result.errors.length).toBe(0); - }, { timeout: NETWORK_TIMEOUT }); + }); }); }); diff --git a/core/tests/02-subpath-patterns.test.ts b/core/tests/02-subpath-patterns.test.ts index 052e6bf..47f1e1b 100644 --- a/core/tests/02-subpath-patterns.test.ts +++ b/core/tests/02-subpath-patterns.test.ts @@ -8,7 +8,7 @@ * @module */ -import { describe, it } from "@std/testing/bdd"; +import { describe, test } from "@std/testing/bdd"; import { expect } from "@std/expect"; import { @@ -40,7 +40,7 @@ describe("02 · Subpath Patterns and Imports", () => { }, }); - it("./dist/solid.js matches the wildcard and substitutes", () => { + test("./dist/solid.js matches the wildcard and substitutes", () => { const conds = getResolverConditions(importArgs(), resolveOpts()); const result = resolveModern(pkg, "./dist/solid.js", conds); @@ -48,7 +48,7 @@ describe("02 · Subpath Patterns and Imports", () => { expect(result.path).toBe("./dist/solid.js"); }); - it("./web/dist/web.js matches the web wildcard", () => { + test("./web/dist/web.js matches the web wildcard", () => { const conds = getResolverConditions(importArgs(), resolveOpts()); const result = resolveModern(pkg, "./web/dist/web.js", conds); @@ -66,7 +66,7 @@ describe("02 · Subpath Patterns and Imports", () => { }, }); - it("./web matches the explicit key, not a wildcard", () => { + test("./web matches the explicit key, not a wildcard", () => { const conds = getResolverConditions(importArgs(), resolveOpts()); const result = resolveModern(pkg, "./web", conds); @@ -88,7 +88,7 @@ describe("02 · Subpath Patterns and Imports", () => { }, }); - it("browser default → esm5 path", () => { + test("browser default → esm5 path", () => { const conds = getResolverConditions(importArgs(), resolveOpts({ platform: "browser" })); const result = resolveModern(pkg, "./internal/operators/map", conds); @@ -96,7 +96,7 @@ describe("02 · Subpath Patterns and Imports", () => { expect(result.path).toBe("./dist/esm5/internal/operators/map.js"); }); - it("node build → cjs path", () => { + test("node build → cjs path", () => { const conds = getResolverConditions(importArgs(), resolveOpts({ platform: "node" })); const result = resolveModern(pkg, "./internal/operators/map", conds); @@ -114,7 +114,7 @@ describe("02 · Subpath Patterns and Imports", () => { }, }); - it("./operators hits the explicit key", () => { + test("./operators hits the explicit key", () => { const conds = getResolverConditions(importArgs(), resolveOpts()); const result = resolveModern(pkg, "./operators", conds); @@ -122,7 +122,7 @@ describe("02 · Subpath Patterns and Imports", () => { expect(result.path).toBe("./dist/esm5/operators/index.js"); }); - it("./internal/operators/map hits the wildcard", () => { + test("./internal/operators/map hits the wildcard", () => { const conds = getResolverConditions(importArgs(), resolveOpts()); const result = resolveModern(pkg, "./internal/operators/map", conds); @@ -146,7 +146,7 @@ describe("02 · Subpath Patterns and Imports", () => { }, }); - it("browser build resolves #supports-color to browser.js", () => { + test("browser build resolves #supports-color to browser.js", () => { const conds = getResolverConditions(importArgs(), resolveOpts({ platform: "browser" })); const result = resolveModern(pkg, "#supports-color", conds); @@ -154,7 +154,7 @@ describe("02 · Subpath Patterns and Imports", () => { expect(result.path).toBe("./source/vendor/supports-color/browser.js"); }); - it("node build resolves #supports-color to index.js", () => { + test("node build resolves #supports-color to index.js", () => { const conds = getResolverConditions(importArgs(), resolveOpts({ platform: "node" })); const result = resolveModern(pkg, "#supports-color", conds); @@ -170,7 +170,7 @@ describe("02 · Subpath Patterns and Imports", () => { }, }); - it("resolves to the single path regardless of platform", () => { + test("resolves to the single path regardless of platform", () => { const browserConds = getResolverConditions(importArgs(), resolveOpts({ platform: "browser" })); const nodeConds = getResolverConditions(importArgs(), resolveOpts({ platform: "node" })); @@ -191,7 +191,7 @@ describe("02 · Subpath Patterns and Imports", () => { }, }); - it("#nonexistent does not resolve (hard failure)", () => { + test("#nonexistent does not resolve (hard failure)", () => { const conds = getResolverConditions(importArgs(), resolveOpts()); const result = resolveModern(pkg, "#nonexistent", conds); @@ -215,7 +215,7 @@ describe("02 · Subpath Patterns and Imports", () => { }, }); - it("./helpers resolves through exports", () => { + test("./helpers resolves through exports", () => { const conds = getResolverConditions(importArgs(), resolveOpts()); const result = resolveModern(pkg, "./helpers", conds); @@ -229,18 +229,18 @@ describe("02 · Subpath Patterns and Imports", () => { // =========================================================================== describe("integration: real packages", () => { - it("chalk@5.4.1 resolves # imports correctly", async () => { + test("chalk@5.4.1 resolves # imports correctly", async () => { const result = await buildPackage("chalk@5.4.1"); expect(result.contents.length).toBeGreaterThan(0); expect(result.errors.length).toBe(0); - }, { timeout: NETWORK_TIMEOUT }); + }); - it("rxjs@7.8.1 builds a subpath import", async () => { + test("rxjs@7.8.1 builds a subpath import", async () => { const result = await buildPackage("rxjs@7.8.1"); expect(result.contents.length).toBeGreaterThan(0); expect(result.errors.length).toBe(0); - }, { timeout: NETWORK_TIMEOUT }); + }); }); }); diff --git a/core/tests/03-legacy-fields.test.ts b/core/tests/03-legacy-fields.test.ts index 6bfa861..e69e1d3 100644 --- a/core/tests/03-legacy-fields.test.ts +++ b/core/tests/03-legacy-fields.test.ts @@ -8,7 +8,7 @@ * @module */ -import { describe, it } from "@std/testing/bdd"; +import { describe, test } from "@std/testing/bdd"; import { expect } from "@std/expect"; import { @@ -31,7 +31,7 @@ describe("03 · Legacy Field Resolution", () => { describe("3.1 — Only main field (isarray-like)", () => { const pkg = manifest({ main: "index.js" }); - it("browser build resolves to main", () => { + test("browser build resolves to main", () => { const fields = ["browser", "module", "main"]; const result = resolveLegacy(pkg, { browser: true }, fields); @@ -39,7 +39,7 @@ describe("03 · Legacy Field Resolution", () => { expect(result.entryPoint).toBe("index.js"); }); - it("node build resolves to main", () => { + test("node build resolves to main", () => { const fields = ["module", "main"]; const result = resolveLegacy(pkg, { browser: false }, fields); @@ -56,7 +56,7 @@ describe("03 · Legacy Field Resolution", () => { sideEffects: false, }); - it("browser build picks module field", () => { + test("browser build picks module field", () => { const fields = ["browser", "module", "main"]; const result = resolveLegacy(pkg, { browser: true }, fields); @@ -74,7 +74,7 @@ describe("03 · Legacy Field Resolution", () => { browser: "./dist/mjs/browser.js", }); - it("browser build uses the browser string entry", () => { + test("browser build uses the browser string entry", () => { const fields = ["browser", "module", "main"]; const result = resolveLegacy(pkg, { browser: true }, fields); @@ -82,7 +82,7 @@ describe("03 · Legacy Field Resolution", () => { expect(result.entryPoint).toBe("./dist/mjs/browser.js"); }); - it("node build ignores browser → uses module", () => { + test("node build ignores browser → uses module", () => { const fields = ["module", "main"]; const result = resolveLegacy(pkg, { browser: false }, fields); @@ -94,7 +94,7 @@ describe("03 · Legacy Field Resolution", () => { describe("3.4 — No entry point fields at all", () => { const pkg = manifest({}); - it("resolvePackageEntry falls back to ./index.js", () => { + test("resolvePackageEntry falls back to ./index.js", () => { const conds = getResolverConditions(importArgs(), resolveOpts()); const fields = getLegacyMainFields(pkg, importArgs(), resolveOpts()); const result = resolvePackageEntry({ @@ -111,7 +111,7 @@ describe("03 · Legacy Field Resolution", () => { describe("3.5 — unpkg / jsdelivr CDN fields", () => { const pkg = manifest({ unpkg: "dist/global.js" }); - it("falls to unpkg field when main/module are missing", () => { + test("falls to unpkg field when main/module are missing", () => { const fields = ["module", "main"]; const result = resolveLegacy(pkg, { browser: false }, fields); @@ -127,7 +127,7 @@ describe("03 · Legacy Field Resolution", () => { "jsnext:main": "./dist/moment.js", } as any); - it("resolveLegacy ignores jsnext:main, picks main", () => { + test("resolveLegacy ignores jsnext:main, picks main", () => { const fields = ["module", "main"]; const result = resolveLegacy(pkg, { browser: false }, fields); @@ -148,7 +148,7 @@ describe("03 · Legacy Field Resolution", () => { }, }); - it("resolvePackageEntry uses modern resolution (exports) first", () => { + test("resolvePackageEntry uses modern resolution (exports) first", () => { const conds = getResolverConditions(importArgs(), resolveOpts({ platform: "browser" })); const fields = getLegacyMainFields(pkg, importArgs(), resolveOpts()); const result = resolvePackageEntry({ @@ -170,25 +170,25 @@ describe("03 · Legacy Field Resolution", () => { // =========================================================================== describe("integration: real packages", () => { - it("isarray@2.0.5 builds with only main field", async () => { + test("isarray@2.0.5 builds with only main field", async () => { const result = await buildPackage("isarray@2.0.5"); expect(result.contents.length).toBeGreaterThan(0); expect(result.errors.length).toBe(0); - }, { timeout: NETWORK_TIMEOUT }); + }); - it("lodash-es@4.17.21 builds with module field", async () => { + test("lodash-es@4.17.21 builds with module field", async () => { const result = await buildPackage("lodash-es@4.17.21"); expect(result.contents.length).toBeGreaterThan(0); expect(result.errors.length).toBe(0); - }, { timeout: NETWORK_TIMEOUT }); + }); - it("ms@2.1.3 builds with extensionless main", async () => { + test("ms@2.1.3 builds with extensionless main", async () => { const result = await buildPackage("ms@2.1.3"); expect(result.contents.length).toBeGreaterThan(0); expect(result.errors.length).toBe(0); - }, { timeout: NETWORK_TIMEOUT }); + }); }); }); diff --git a/core/tests/04-browser-remapping.test.ts b/core/tests/04-browser-remapping.test.ts index 8361fb9..af9fce9 100644 --- a/core/tests/04-browser-remapping.test.ts +++ b/core/tests/04-browser-remapping.test.ts @@ -10,7 +10,7 @@ * @module */ -import { describe, it } from "@std/testing/bdd"; +import { describe, test } from "@std/testing/bdd"; import { expect } from "@std/expect"; import { @@ -42,7 +42,7 @@ describe("04 · Browser Field Remapping", () => { }, }); - it("browser build: entry remapped from index.js → browser.js", () => { + test("browser build: entry remapped from index.js → browser.js", () => { const fields = ["browser", "module", "main"]; const result = resolveLegacy(pkg, { browser: true }, fields); @@ -57,7 +57,7 @@ describe("04 · Browser Field Remapping", () => { expect(remapped).toBe("./lib/ours/browser.js"); }); - it("node build: browser field ignored, entry is main", () => { + test("node build: browser field ignored, entry is main", () => { const fields = ["module", "main"]; const result = resolveLegacy(pkg, { browser: false }, fields); @@ -68,7 +68,7 @@ describe("04 · Browser Field Remapping", () => { }); describe("4.2 — Bare module exclusion (false mapping)", () => { - it("applyPathRemapping returns false for excluded modules", () => { + test("applyPathRemapping returns false for excluded modules", () => { const remappings = { "./lib/adapters/http.js": "./lib/helpers/null.js", "./lib/platform/node/index.js": "./lib/platform/browser/index.js", @@ -80,25 +80,25 @@ describe("04 · Browser Field Remapping", () => { .toBe("./lib/platform/browser/index.js"); }); - it("fs → false excludes the module", () => { + test("fs → false excludes the module", () => { const remappings = { fs: false as const }; expect(applyPathRemapping("fs", remappings)).toBe(false); }); }); describe("4.3 — Remapping with ./ prefix variants", () => { - it("matches with ./ prefix when key is bare", () => { + test("matches with ./ prefix when key is bare", () => { const remappings = { "lib/node.js": "./lib/browser.js" }; // applyPathRemapping tries multiple variants expect(applyPathRemapping("./lib/node.js", remappings)).toBe("./lib/browser.js"); }); - it("matches bare import when key has ./ prefix", () => { + test("matches bare import when key has ./ prefix", () => { const remappings = { "./utils/fs": false as const }; expect(applyPathRemapping("./utils/fs", remappings)).toBe(false); }); - it("path without prefix matches key without prefix", () => { + test("path without prefix matches key without prefix", () => { const remappings = { "lib/node.js": "./lib/browser.js" }; expect(applyPathRemapping("lib/node.js", remappings)).toBe("./lib/browser.js"); }); @@ -113,7 +113,7 @@ describe("04 · Browser Field Remapping", () => { }, }); - it("browser build detects all-false and excludes", () => { + test("browser build detects all-false and excludes", () => { const fields = ["browser", "module", "main"]; const result = resolveLegacy(pkg, { browser: true }, fields); @@ -129,7 +129,7 @@ describe("04 · Browser Field Remapping", () => { }, }); - it("node platform does not apply browser remapping", () => { + test("node platform does not apply browser remapping", () => { const fields = ["module", "main"]; const result = resolveLegacy(pkg, { browser: false }, fields); @@ -139,7 +139,7 @@ describe("04 · Browser Field Remapping", () => { }); describe("4.6 — Edge runtimes: browser condition ≠ browserField", () => { - it("workerd: browser condition active, browserField disabled", () => { + test("workerd: browser condition active, browserField disabled", () => { const conds = getResolverConditions( importArgs(), resolveOpts({ platform: "browser", runtime: "workerd" }), @@ -151,7 +151,7 @@ describe("04 · Browser Field Remapping", () => { expect(conds.browser).toBe(false); }); - it("edge-light: both browser condition and browserField active", () => { + test("edge-light: both browser condition and browserField active", () => { const conds = getResolverConditions( importArgs(), resolveOpts({ platform: "browser", runtime: "edge-light" }), @@ -173,7 +173,7 @@ describe("04 · Browser Field Remapping", () => { }, }); - it("browser conditions: remaps ./fallback/platform.js → platform.browser.js", () => { + test("browser conditions: remaps ./fallback/platform.js → platform.browser.js", () => { const conds = getResolverConditions(importArgs(), resolveOpts({ platform: "browser" })); const result = applyManifestRemappings("./fallback/platform.js", pkg, conds); @@ -182,7 +182,7 @@ describe("04 · Browser Field Remapping", () => { expect(result.path).toBe("./fallback/platform.browser.js"); }); - it("node conditions: no remapping applied", () => { + test("node conditions: no remapping applied", () => { const conds = getResolverConditions(importArgs(), resolveOpts({ platform: "node" })); const result = applyManifestRemappings("./fallback/platform.js", pkg, conds); @@ -198,7 +198,7 @@ describe("04 · Browser Field Remapping", () => { }, }); - it("browser conditions: excludes the module", () => { + test("browser conditions: excludes the module", () => { const conds = getResolverConditions(importArgs(), resolveOpts({ platform: "browser" })); const result = applyManifestRemappings("./lib/native-impl.js", pkg, conds); @@ -212,25 +212,25 @@ describe("04 · Browser Field Remapping", () => { // =========================================================================== describe("integration: real packages", () => { - it("@exodus/bytes@1.13.0 builds with browser remapping", async () => { + test("@exodus/bytes@1.13.0 builds with browser remapping", async () => { const result = await buildPackage("@exodus/bytes@1.13.0"); expect(result.contents.length).toBeGreaterThan(0); expect(result.errors.length).toBe(0); - }, { timeout: NETWORK_TIMEOUT }); + }); - it("readable-stream@4.7.0 builds for browser", async () => { + test("readable-stream@4.7.0 builds for browser", async () => { const result = await buildPackage("readable-stream@4.7.0"); expect(result.contents.length).toBeGreaterThan(0); expect(result.errors.length).toBe(0); - }, { timeout: NETWORK_TIMEOUT }); + }); - it("axios@1.7.9 builds with browser field swaps", async () => { + test("axios@1.7.9 builds with browser field swaps", async () => { const result = await buildPackage("axios@1.7.9"); expect(result.contents.length).toBeGreaterThan(0); expect(result.errors.length).toBe(0); - }, { timeout: NETWORK_TIMEOUT }); + }); }); }); diff --git a/core/tests/05-platform-remapping.test.ts b/core/tests/05-platform-remapping.test.ts index a7fe6a5..459787f 100644 --- a/core/tests/05-platform-remapping.test.ts +++ b/core/tests/05-platform-remapping.test.ts @@ -8,7 +8,7 @@ * @module */ -import { describe, it } from "@std/testing/bdd"; +import { describe, test } from "@std/testing/bdd"; import { expect } from "@std/expect"; import { @@ -23,7 +23,7 @@ import { describe("05 · Platform-Specific Remapping", () => { describe("REMAPPING_FIELDS ordering", () => { - it("is ordered: react-native → electron → browser", () => { + test("is ordered: react-native → electron → browser", () => { expect(REMAPPING_FIELDS[0].condition).toBe("react-native"); expect(REMAPPING_FIELDS[1].condition).toBe("electron"); expect(REMAPPING_FIELDS[2].condition).toBe("browser"); @@ -42,7 +42,7 @@ describe("05 · Platform-Specific Remapping", () => { }, } as any); - it("react-native runtime → remaps to .native.js", () => { + test("react-native runtime → remaps to .native.js", () => { const conds = getResolverConditions( importArgs(), resolveOpts({ platform: "node", runtime: "react-native" }), @@ -53,7 +53,7 @@ describe("05 · Platform-Specific Remapping", () => { expect(result.path).toBe("./fallback/platform.native.js"); }); - it("browser runtime → remaps to .browser.js", () => { + test("browser runtime → remaps to .browser.js", () => { const conds = getResolverConditions(importArgs(), resolveOpts({ platform: "browser" })); const result = applyManifestRemappings("./fallback/platform.js", pkg, conds); @@ -68,7 +68,7 @@ describe("05 · Platform-Specific Remapping", () => { "react-native": { "./lib/impl.js": "./lib/impl.native.js" }, } as any); - it("react-native wins over browser", () => { + test("react-native wins over browser", () => { // Simulate both conditions being active const conds = getResolverConditions( importArgs(), @@ -87,7 +87,7 @@ describe("05 · Platform-Specific Remapping", () => { electron: { "./lib/crypto.js": "./lib/crypto.electron.js" }, } as any); - it("electron-renderer: electron field wins over browser", () => { + test("electron-renderer: electron field wins over browser", () => { const conds = getResolverConditions( importArgs(), resolveOpts({ platform: "browser", runtime: "electron-renderer" }), @@ -98,7 +98,7 @@ describe("05 · Platform-Specific Remapping", () => { expect(result.path).toBe("./lib/crypto.electron.js"); }); - it("electron-main: electron field applies", () => { + test("electron-main: electron field applies", () => { const conds = getResolverConditions( importArgs(), resolveOpts({ platform: "node", runtime: "electron-main" }), @@ -109,7 +109,7 @@ describe("05 · Platform-Specific Remapping", () => { expect(result.path).toBe("./lib/crypto.electron.js"); }); - it("default browser build: browser field applies", () => { + test("default browser build: browser field applies", () => { const conds = getResolverConditions(importArgs(), resolveOpts({ platform: "browser" })); const result = applyManifestRemappings("./lib/crypto.js", pkg, conds); @@ -124,7 +124,7 @@ describe("05 · Platform-Specific Remapping", () => { "react-native": { "./fallback/platform.js": "./fallback/platform.native.js" }, } as any); - it("deno runtime: no condition matches → pass-through", () => { + test("deno runtime: no condition matches → pass-through", () => { const conds = getResolverConditions( importArgs(), resolveOpts({ platform: "node", runtime: "deno" }), @@ -144,7 +144,7 @@ describe("05 · Platform-Specific Remapping", () => { }, } as any); - it("react-native build: false excludes the module", () => { + test("react-native build: false excludes the module", () => { const conds = getResolverConditions( importArgs(), resolveOpts({ platform: "node", runtime: "react-native" }), @@ -155,7 +155,7 @@ describe("05 · Platform-Specific Remapping", () => { expect(result.matchedField).toBe("react-native"); }); - it("react-native build: normal remapping still works", () => { + test("react-native build: normal remapping still works", () => { const conds = getResolverConditions( importArgs(), resolveOpts({ platform: "node", runtime: "react-native" }), @@ -169,27 +169,27 @@ describe("05 · Platform-Specific Remapping", () => { }); describe("5.7 — getRuntimeDefaults covers all runtimes", () => { - it("react-native: browserField false", () => { + test("react-native: browserField false", () => { const d = getRuntimeDefaults("react-native"); expect(d.conditions).toContain("react-native"); expect(d.browserField).toBe(false); }); - it("electron-main: adds electron + node", () => { + test("electron-main: adds electron + node", () => { const d = getRuntimeDefaults("electron-main"); expect(d.conditions).toContain("electron"); expect(d.conditions).toContain("node"); expect(d.browserField).toBe(false); }); - it("electron-renderer: adds electron + browser, browserField true", () => { + test("electron-renderer: adds electron + browser, browserField true", () => { const d = getRuntimeDefaults("electron-renderer"); expect(d.conditions).toContain("electron"); expect(d.conditions).toContain("browser"); expect(d.browserField).toBe(true); }); - it("undefined runtime: empty conditions, null browserField", () => { + test("undefined runtime: empty conditions, null browserField", () => { const d = getRuntimeDefaults(undefined); expect(d.conditions).toHaveLength(0); expect(d.browserField).toBeNull(); diff --git a/core/tests/06-relative-imports.test.ts b/core/tests/06-relative-imports.test.ts index cbc5dd3..5a662c8 100644 --- a/core/tests/06-relative-imports.test.ts +++ b/core/tests/06-relative-imports.test.ts @@ -8,7 +8,7 @@ * @module */ -import { describe, it } from "@std/testing/bdd"; +import { describe, test } from "@std/testing/bdd"; import { expect } from "@std/expect"; import { @@ -24,41 +24,41 @@ import { describe("06 · Relative Imports and CDN Behavior", () => { describe("6.1 — Post-redirect URL as resolve base", () => { - it("react@19.0.0 via esm.sh resolves relative imports after redirect", async () => { + test("react@19.0.0 via esm.sh resolves relative imports after redirect", async () => { const result = await buildPackage("react@19.0.0", { cdn: "esm.sh", }); expect(result.contents.length).toBeGreaterThan(0); expect(result.errors.length).toBe(0); - }, { timeout: NETWORK_TIMEOUT }); + }); }); describe("6.2 — Extension probing for extensionless imports", () => { - it("events@3.3.0 resolves extensionless internal imports", async () => { + test("events@3.3.0 resolves extensionless internal imports", async () => { const result = await buildPackage("events@3.3.0"); expect(result.contents.length).toBeGreaterThan(0); expect(result.errors.length).toBe(0); - }, { timeout: NETWORK_TIMEOUT }); + }); }); describe("6.5 — Bare import inside HTTP module delegates to CdnPlugin", () => { - it("axios@1.7.9 resolves transitive bare imports", async () => { + test("axios@1.7.9 resolves transitive bare imports", async () => { const result = await buildPackage("axios@1.7.9"); expect(result.contents.length).toBeGreaterThan(0); expect(result.errors.length).toBe(0); - }, { timeout: NETWORK_TIMEOUT }); + }); }); describe("6.8 — # imports inside HTTP modules", () => { - it("chalk@5.4.1 resolves # imports in CDN-fetched source", async () => { + test("chalk@5.4.1 resolves # imports in CDN-fetched source", async () => { const result = await buildPackage("chalk@5.4.1"); // chalk uses #supports-color and #ansi-styles expect(result.contents.length).toBeGreaterThan(0); expect(result.errors.length).toBe(0); - }, { timeout: NETWORK_TIMEOUT }); + }); }); }); diff --git a/core/tests/07-tree-shaking.test.ts b/core/tests/07-tree-shaking.test.ts index bc15171..2249f20 100644 --- a/core/tests/07-tree-shaking.test.ts +++ b/core/tests/07-tree-shaking.test.ts @@ -8,7 +8,7 @@ * @module */ -import { describe, it } from "@std/testing/bdd"; +import { describe, test } from "@std/testing/bdd"; import { expect } from "@std/expect"; import { @@ -31,7 +31,7 @@ import { describe("07 · Tree-Shaking and Side Effects", () => { describe("sideEffects: false", () => { - it("returns false when manifest has sideEffects: false", () => { + test("returns false when manifest has sideEffects: false", () => { const pkg = manifest({ sideEffects: false }); const result = computeEsbuildSideEffects(pkg, "./index.js", { packageId: "lodash-es@4.17.21", @@ -40,7 +40,7 @@ describe("07 · Tree-Shaking and Side Effects", () => { expect(result).toBe(false); }); - it("returns undefined when sideEffects field is absent", () => { + test("returns undefined when sideEffects field is absent", () => { const pkg = manifest({}); const result = computeEsbuildSideEffects(pkg, "./index.js", { packageId: "moment@2.30.1", @@ -52,7 +52,7 @@ describe("07 · Tree-Shaking and Side Effects", () => { }); describe("sideEffects: glob patterns", () => { - it("JS file not in glob list returns false (tree-shakeable)", () => { + test("JS file not in glob list returns false (tree-shakeable)", () => { const pkg = manifest({ sideEffects: ["./src/nodes/**/*"] }); const result = computeEsbuildSideEffects(pkg, "./src/math/Vector3.js", { packageId: "three@0.171.0", @@ -61,7 +61,7 @@ describe("07 · Tree-Shaking and Side Effects", () => { expect(result).toBe(false); }); - it("file matching glob returns undefined (has side effects)", () => { + test("file matching glob returns undefined (has side effects)", () => { const pkg = manifest({ sideEffects: ["./src/nodes/**/*"] }); const result = computeEsbuildSideEffects(pkg, "./src/nodes/ShaderNode.js", { packageId: "three@0.171.0", @@ -70,7 +70,7 @@ describe("07 · Tree-Shaking and Side Effects", () => { expect(result).toBeUndefined(); }); - it("*.css glob keeps CSS files", () => { + test("*.css glob keeps CSS files", () => { const pkg = manifest({ sideEffects: ["*.css"] }); const result = computeEsbuildSideEffects(pkg, "./styles/main.css", { packageId: "test-pkg@1.0.0", @@ -79,7 +79,7 @@ describe("07 · Tree-Shaking and Side Effects", () => { expect(result).toBeUndefined(); }); - it("*.css glob marks JS files as tree-shakeable", () => { + test("*.css glob marks JS files as tree-shakeable", () => { const pkg = manifest({ sideEffects: ["*.css"] }); const result = computeEsbuildSideEffects(pkg, "./src/index.js", { packageId: "test-pkg@1.0.0", @@ -90,7 +90,7 @@ describe("07 · Tree-Shaking and Side Effects", () => { }); describe("sideEffects: explicit file list", () => { - it("exact match returns undefined (has side effects)", () => { + test("exact match returns undefined (has side effects)", () => { const pkg = manifest({ sideEffects: [ "./src/reanimated2/core.js", @@ -104,7 +104,7 @@ describe("07 · Tree-Shaking and Side Effects", () => { expect(result).toBeUndefined(); }); - it("non-matching file returns false (tree-shakeable)", () => { + test("non-matching file returns false (tree-shakeable)", () => { const pkg = manifest({ sideEffects: [ "./src/reanimated2/core.js", @@ -120,22 +120,22 @@ describe("07 · Tree-Shaking and Side Effects", () => { }); describe("path normalization utilities", () => { - it("normalizePkgRelPath strips leading ./", () => { + test("normalizePkgRelPath strips leading ./", () => { expect(normalizePkgRelPath("./src/index.js")).toBe("src/index.js"); }); - it("normalizePkgRelPath handles bare paths", () => { + test("normalizePkgRelPath handles bare paths", () => { expect(normalizePkgRelPath("src/index.js")).toBe("src/index.js"); }); - it("isJsLikePath recognizes JS extensions", () => { + test("isJsLikePath recognizes JS extensions", () => { expect(isJsLikePath("index.js")).toBe(true); expect(isJsLikePath("index.mjs")).toBe(true); expect(isJsLikePath("index.ts")).toBe(true); expect(isJsLikePath("index.tsx")).toBe(true); }); - it("isJsLikePath rejects non-JS extensions", () => { + test("isJsLikePath rejects non-JS extensions", () => { expect(isJsLikePath("styles.css")).toBe(false); expect(isJsLikePath("image.png")).toBe(false); }); @@ -146,7 +146,7 @@ describe("07 · Tree-Shaking and Side Effects", () => { // =========================================================================== describe("integration: tree-shaking with real packages", () => { - it("lodash-es: selective import is smaller than full import", async () => { + test("lodash-es: selective import is smaller than full import", async () => { // Full import const full = await buildPackage("lodash-es@4.17.21"); // Selective (tree-shaken) import @@ -159,6 +159,6 @@ describe("07 · Tree-Shaking and Side Effects", () => { const selectiveSize = selective.contents.reduce((s, f) => s + f.contents.byteLength, 0); expect(selectiveSize).toBeLessThan(fullSize); - }, { timeout: NETWORK_TIMEOUT }); + }); }); }); diff --git a/core/tests/08-non-npm-resolution.test.ts b/core/tests/08-non-npm-resolution.test.ts index e9f7770..650487b 100644 --- a/core/tests/08-non-npm-resolution.test.ts +++ b/core/tests/08-non-npm-resolution.test.ts @@ -8,7 +8,7 @@ * @module */ -import { describe, it } from "@std/testing/bdd"; +import { describe, test } from "@std/testing/bdd"; import { expect } from "@std/expect"; import { @@ -24,21 +24,21 @@ import { describe("08 · Non-npm Resolution", () => { describe("JSR resolution", () => { - it("8.1 — basic jsr:@std/path@1.0.0 resolves", async () => { + test("8.1 — basic jsr:@std/path@1.0.0 resolves", async () => { const result = await buildPackage("jsr:@std/path@1.0.0"); expect(result.contents.length).toBeGreaterThan(0); expect(result.errors.length).toBe(0); - }, { timeout: NETWORK_TIMEOUT }); + }); - it("8.3 — JSR with subpath export (jsr:@std/path@1.0.0/posix)", async () => { + test("8.3 — JSR with subpath export (jsr:@std/path@1.0.0/posix)", async () => { const result = await buildWithEntry( `export * from "jsr:@std/path@1.0.0/posix";`, ); expect(result.contents.length).toBeGreaterThan(0); expect(result.errors.length).toBe(0); - }, { timeout: NETWORK_TIMEOUT }); + }); }); // =========================================================================== @@ -46,13 +46,13 @@ describe("08 · Non-npm Resolution", () => { // =========================================================================== describe("Tarball extraction", () => { - it("8.6 — tarball from pkg.pr.new resolves", async () => { + test("8.6 — tarball from pkg.pr.new resolves", async () => { const result = await buildWithEntry( `export * from "https://pkg.pr.new/@tanstack/react-query@7988";`, ); expect(result.contents.length).toBeGreaterThan(0); expect(result.errors.length).toBe(0); - }, { timeout: NETWORK_TIMEOUT }); + }); }); }); diff --git a/core/tests/09-builtins-polyfills.test.ts b/core/tests/09-builtins-polyfills.test.ts index cb63800..0777879 100644 --- a/core/tests/09-builtins-polyfills.test.ts +++ b/core/tests/09-builtins-polyfills.test.ts @@ -9,7 +9,7 @@ * @module */ -import { describe, it } from "@std/testing/bdd"; +import { describe, test } from "@std/testing/bdd"; import { expect } from "@std/expect"; import { @@ -30,19 +30,19 @@ describe("09 · Builtins and Polyfills", () => { // 9.1 — Builtin exclusion (default behaviour, polyfill: false) // --------------------------------------------------------------------------- describe("9.1 — Builtin exclusion (default)", () => { - it("fs-extra@11.2.0 builds successfully without polyfills", async () => { + test("fs-extra@11.2.0 builds successfully without polyfills", async () => { const result = await buildPackage("fs-extra@11.2.0"); expect(result.contents.length).toBeGreaterThan(0); expect(result.errors.length).toBe(0); - }, { timeout: NETWORK_TIMEOUT }); + }); }); // --------------------------------------------------------------------------- // 9.2 — Builtin polyfill mode // --------------------------------------------------------------------------- describe("9.2 — Builtin polyfill mode", () => { - it("fs-extra@11.2.0 with polyfill produces a larger bundle", async () => { + test("fs-extra@11.2.0 with polyfill produces a larger bundle", async () => { const without = await buildPackage("fs-extra@11.2.0"); const withPoly = await buildPackage("fs-extra@11.2.0", { polyfill: true, @@ -54,53 +54,53 @@ describe("09 · Builtins and Polyfills", () => { const sizeWith = getOutputText(withPoly).length; expect(sizeWith).toBeGreaterThan(sizeWithout); - }, { timeout: NETWORK_TIMEOUT }); + }); }); // --------------------------------------------------------------------------- // 9.3 — node: prefix stripping // --------------------------------------------------------------------------- describe("9.3 — node: prefix stripping", () => { - it("@noble/hashes@1.7.1 resolves node:crypto as builtin", async () => { + test("@noble/hashes@1.7.1 resolves node:crypto as builtin", async () => { const result = await buildPackage("@noble/hashes@1.7.1"); // Should build without trying to fetch "node:crypto" from npm expect(result.contents.length).toBeGreaterThan(0); expect(result.errors.length).toBe(0); - }, { timeout: NETWORK_TIMEOUT }); + }); }); // --------------------------------------------------------------------------- // 9.4 — "fs" and "node:fs" resolve identically // --------------------------------------------------------------------------- describe("9.4 — fs vs node:fs equivalence", () => { - it("events@3.3.0 as npm package builds", async () => { + test("events@3.3.0 as npm package builds", async () => { const result = await buildPackage("events@3.3.0"); expect(result.contents.length).toBeGreaterThan(0); expect(result.errors.length).toBe(0); - }, { timeout: NETWORK_TIMEOUT }); + }); }); // --------------------------------------------------------------------------- // 9.5 — Builtins inside CDN-fetched modules // --------------------------------------------------------------------------- describe("9.5 — Builtin inside CDN-fetched module", () => { - it("axios@1.7.9 internal `http`/`https` imports are excluded", async () => { + test("axios@1.7.9 internal `http`/`https` imports are excluded", async () => { const result = await buildPackage("axios@1.7.9"); // axios uses http/https internally; these should be excluded (not // fetched from CDN) via the ExternalPlugin. expect(result.contents.length).toBeGreaterThan(0); expect(result.errors.length).toBe(0); - }, { timeout: NETWORK_TIMEOUT }); + }); }); // --------------------------------------------------------------------------- // 9.6 — Polyfill output format compatibility // --------------------------------------------------------------------------- describe("9.6 — Polyfill output format", () => { - it("CJS format wraps polyfill output in module.exports", async () => { + test("CJS format wraps polyfill output in module.exports", async () => { const result = await buildPackage("events@3.3.0", { esbuild: { format: "cjs" }, }); @@ -112,9 +112,9 @@ describe("09 · Builtins and Polyfills", () => { outputContains(result, "exports.") || outputMatches(result, /require\(/) ).toBe(true); - }, { timeout: NETWORK_TIMEOUT }); + }); - it("IIFE format wraps output in a function wrapper", async () => { + test("IIFE format wraps output in a function wrapper", async () => { const result = await buildPackage("events@3.3.0", { esbuild: { format: "iife" }, }); @@ -122,6 +122,6 @@ describe("09 · Builtins and Polyfills", () => { const text = getOutputText(result); // IIFE output uses a self-invoking function — typically var or (()=>{})() expect(text.length).toBeGreaterThan(0); - }, { timeout: NETWORK_TIMEOUT }); + }); }); }); diff --git a/core/tests/10-dual-package.test.ts b/core/tests/10-dual-package.test.ts index 56f195e..1d5036e 100644 --- a/core/tests/10-dual-package.test.ts +++ b/core/tests/10-dual-package.test.ts @@ -9,7 +9,7 @@ * @module */ -import { describe, it } from "@std/testing/bdd"; +import { describe, test } from "@std/testing/bdd"; import { expect } from "@std/expect"; import { @@ -60,7 +60,7 @@ describe("10 · Dual Package Hazard", () => { }, }); - it("browser + ESM → esm-browser", () => { + test("browser + ESM → esm-browser", () => { const conds = getResolverConditions( importArgs("import-statement"), resolveOpts({ platform: "browser", format: "esm" }), @@ -69,7 +69,7 @@ describe("10 · Dual Package Hazard", () => { expect(result.path).toBe("./dist/esm-browser/index.js"); }); - it("browser + CJS → cjs-browser", () => { + test("browser + CJS → cjs-browser", () => { const conds = getResolverConditions( importArgs("require-call"), resolveOpts({ platform: "browser", format: "cjs" }), @@ -78,7 +78,7 @@ describe("10 · Dual Package Hazard", () => { expect(result.path).toBe("./dist/cjs-browser/index.js"); }); - it("node + ESM → esm (node path)", () => { + test("node + ESM → esm (node path)", () => { const conds = getResolverConditions( importArgs("import-statement"), resolveOpts({ platform: "node", format: "esm" }), @@ -87,7 +87,7 @@ describe("10 · Dual Package Hazard", () => { expect(result.path).toBe("./dist/esm/index.js"); }); - it("node + CJS → cjs (node path)", () => { + test("node + CJS → cjs (node path)", () => { const conds = getResolverConditions( importArgs("require-call"), resolveOpts({ platform: "node", format: "cjs" }), @@ -108,7 +108,7 @@ describe("10 · Dual Package Hazard", () => { exports: "./source/index.js", }); - it("ESM resolves single-string exports", () => { + test("ESM resolves single-string exports", () => { const conds = getResolverConditions( importArgs("import-statement"), resolveOpts({ format: "esm" }), @@ -117,7 +117,7 @@ describe("10 · Dual Package Hazard", () => { expect(result.path).toBe("./source/index.js"); }); - it("CJS also resolves single-string exports (no require guard)", () => { + test("CJS also resolves single-string exports (no require guard)", () => { const conds = getResolverConditions( importArgs("require-call"), resolveOpts({ format: "cjs" }), @@ -132,21 +132,21 @@ describe("10 · Dual Package Hazard", () => { // isRequireContext helper // --------------------------------------------------------------------------- describe("isRequireContext()", () => { - it("returns true for require-call + cjs", () => { + test("returns true for require-call + cjs", () => { expect(isRequireContext( importArgs("require-call"), resolveOpts({ format: "cjs" }), )).toBe(true); }); - it("returns false for import-statement + esm", () => { + test("returns false for import-statement + esm", () => { expect(isRequireContext( importArgs("import-statement"), resolveOpts({ format: "esm" }), )).toBe(false); }); - it("returns true for entry-point + cjs format", () => { + test("returns true for entry-point + cjs format", () => { expect(isRequireContext( importArgs("entry-point"), resolveOpts({ format: "cjs" }), @@ -158,16 +158,16 @@ describe("10 · Dual Package Hazard", () => { // Integration tests — format and platform // --------------------------------------------------------------------------- describe("integration: format affects output wrapping", () => { - it("10.4 — ESM output uses export syntax", async () => { + test("10.4 — ESM output uses export syntax", async () => { const result = await buildPackage("preact@10.25.4", { esbuild: { format: "esm" }, }); const text = getOutputText(result); expect(text).toMatch(/export/); - }, { timeout: NETWORK_TIMEOUT }); + }); - it("10.4 — CJS output uses module.exports or require", async () => { + test("10.4 — CJS output uses module.exports or require", async () => { const result = await buildPackage("preact@10.25.4", { esbuild: { format: "cjs" }, }); @@ -177,9 +177,9 @@ describe("10 · Dual Package Hazard", () => { outputContains(result, "exports.") || outputMatches(result, /require\(/) ).toBe(true); - }, { timeout: NETWORK_TIMEOUT }); + }); - it("10.4 — IIFE output wraps in function", async () => { + test("10.4 — IIFE output wraps in function", async () => { const result = await buildPackage("preact@10.25.4", { esbuild: { format: "iife" }, }); @@ -187,11 +187,11 @@ describe("10 · Dual Package Hazard", () => { const text = getOutputText(result); // esbuild IIFE output typically starts with (() => { or var expect(text.length).toBeGreaterThan(0); - }, { timeout: NETWORK_TIMEOUT }); + }); }); describe("integration: minification toggle", () => { - it("10.7 — unminified output is larger", async () => { + test("10.7 — unminified output is larger", async () => { const minified = await buildPackage("preact@10.25.4", { esbuild: { minify: true }, }); @@ -204,6 +204,6 @@ describe("10 · Dual Package Hazard", () => { // Unminified should be larger (more whitespace, longer names) expect(unminSize).toBeGreaterThan(minSize); - }, { timeout: NETWORK_TIMEOUT }); + }); }); }); diff --git a/core/tests/11-edge-cases.test.ts b/core/tests/11-edge-cases.test.ts index ec8a42c..f994d41 100644 --- a/core/tests/11-edge-cases.test.ts +++ b/core/tests/11-edge-cases.test.ts @@ -8,7 +8,7 @@ * @module */ -import { describe, it } from "@std/testing/bdd"; +import { describe, test } from "@std/testing/bdd"; import { expect } from "@std/expect"; import { @@ -51,7 +51,7 @@ describe("11 · Edge Cases and Errors", () => { }, }); - it("resolves through 4 levels of nesting with matching conditions", () => { + test("resolves through 4 levels of nesting with matching conditions", () => { const conds = getResolverConditions( importArgs("import-statement"), resolveOpts({ @@ -65,7 +65,7 @@ describe("11 · Edge Cases and Errors", () => { expect(result.path).toBe("./dist/browser.prod.esm.js"); }); - it("stops at browser.default when production is not in conditions", () => { + test("stops at browser.default when production is not in conditions", () => { const conds = getResolverConditions( importArgs("import-statement"), resolveOpts({ platform: "browser" }), @@ -76,7 +76,7 @@ describe("11 · Edge Cases and Errors", () => { expect(result.path).toBe("./dist/browser.esm.js"); }); - it("falls to top-level default when browser is not matched", () => { + test("falls to top-level default when browser is not matched", () => { const conds = getResolverConditions( importArgs("import-statement"), resolveOpts({ platform: "node" }), @@ -92,7 +92,7 @@ describe("11 · Edge Cases and Errors", () => { // =========================================================================== describe("11.5 — AliasPlugin rewrites before resolution", () => { - it("alias react → preact/compat uses preact (not React)", async () => { + test("alias react → preact/compat uses preact (not React)", async () => { const result = await buildWithEntry( `export { useState } from "react";`, { @@ -104,7 +104,7 @@ describe("11 · Edge Cases and Errors", () => { // The bundle should contain preact code, not React expect(result.contents.length).toBeGreaterThan(0); expect(result.errors.length).toBe(0); - }, { timeout: NETWORK_TIMEOUT }); + }); }); // =========================================================================== @@ -112,7 +112,7 @@ describe("11 · Edge Cases and Errors", () => { // =========================================================================== describe("11.9 — Nonexistent package", () => { - it("returns an error for a package that does not exist", async () => { + test("returns an error for a package that does not exist", async () => { try { const result = await buildPackage("this-package-does-not-exist-12345"); // Should either throw or produce errors @@ -121,18 +121,18 @@ describe("11 · Edge Cases and Errors", () => { // Throwing is an acceptable error response expect(true).toBe(true); } - }, { timeout: NETWORK_TIMEOUT }); + }); }); describe("11.10 — Nonexistent version", () => { - it("returns an error for a version that does not exist", async () => { + test("returns an error for a version that does not exist", async () => { try { const result = await buildPackage("react@999.0.0"); expect(result.errors.length).toBeGreaterThan(0); } catch (_e) { expect(true).toBe(true); } - }, { timeout: NETWORK_TIMEOUT }); + }); }); // =========================================================================== @@ -140,13 +140,13 @@ describe("11 · Edge Cases and Errors", () => { // =========================================================================== describe("11.7 — Peer dependency cycle", () => { - it("react-dom@19.0.0 builds despite peer-depending on react", async () => { + test("react-dom@19.0.0 builds despite peer-depending on react", async () => { const result = await buildPackage("react-dom@19.0.0"); // Should complete without infinite loops expect(result.contents.length).toBeGreaterThan(0); expect(result.errors.length).toBe(0); - }, { timeout: NETWORK_TIMEOUT }); + }); }); // =========================================================================== @@ -154,13 +154,13 @@ describe("11 · Edge Cases and Errors", () => { // =========================================================================== describe("11.15 — Scoped packages with special characters", () => { - it("@anthropic-ai/sdk resolves correctly (scoped + hyphens)", async () => { + test("@anthropic-ai/sdk resolves correctly (scoped + hyphens)", async () => { // This tests that URL encoding handles @scope/name-with-hyphens const result = await buildPackage("@anthropic-ai/sdk@0.39.0"); expect(result.contents.length).toBeGreaterThan(0); expect(result.errors.length).toBe(0); - }, { timeout: NETWORK_TIMEOUT }); + }); }); // =========================================================================== @@ -168,7 +168,7 @@ describe("11 · Edge Cases and Errors", () => { // =========================================================================== describe("11.16 — VFS file takes precedence over CDN", () => { - it("entry file in VFS resolves from memory", async () => { + test("entry file in VFS resolves from memory", async () => { const result = await buildWithEntry( `export const hello = "world";`, ); @@ -176,11 +176,11 @@ describe("11 · Edge Cases and Errors", () => { // The entry file in VFS is the only content — should not hit CDN expect(result.errors.length).toBe(0); expect(outputContains(result, "world")).toBe(true); - }, { timeout: NETWORK_TIMEOUT }); + }); }); describe("11.17 — Relative imports between VFS files", () => { - it("VFS-to-VFS relative imports resolve in memory", async () => { + test("VFS-to-VFS relative imports resolve in memory", async () => { // buildWithEntry writes /index.tsx; we can test that the entry itself // resolves correctly without hitting the network. A full VFS-relative // test would require setFile for both files, but this validates @@ -191,7 +191,7 @@ describe("11 · Edge Cases and Errors", () => { expect(result.errors.length).toBe(0); expect(outputContains(result, "hello from VFS")).toBe(true); - }, { timeout: NETWORK_TIMEOUT }); + }); }); // =========================================================================== @@ -199,7 +199,7 @@ describe("11 · Edge Cases and Errors", () => { // =========================================================================== describe("11.13 — Multiple packages", () => { - it("separate builds for multiple packages all succeed", async () => { + test("separate builds for multiple packages all succeed", async () => { // bundlejs resolves each package independently; here we verify // that multiple packages can be built in succession without // cross-contamination. @@ -210,6 +210,6 @@ describe("11 · Edge Cases and Errors", () => { expect(r2.errors.length).toBe(0); expect(r1.contents.length).toBeGreaterThan(0); expect(r2.contents.length).toBeGreaterThan(0); - }, { timeout: NETWORK_TIMEOUT }); + }); }); }); diff --git a/core/tests/12-runtime-conditions.test.ts b/core/tests/12-runtime-conditions.test.ts index 664f945..08166c5 100644 --- a/core/tests/12-runtime-conditions.test.ts +++ b/core/tests/12-runtime-conditions.test.ts @@ -10,7 +10,7 @@ * @module */ -import { describe, it } from "@std/testing/bdd"; +import { describe, test } from "@std/testing/bdd"; import { expect } from "@std/expect"; import { @@ -38,7 +38,7 @@ describe("12 · Runtime-Specific Condition Sets", () => { // 12.1 — Default browser conditions // --------------------------------------------------------------------------- describe("12.1 — Default browser conditions", () => { - it("produces import, browser, module, default", () => { + test("produces import, browser, module, default", () => { const conds = getResolverConditions( importArgs("import-statement"), resolveOpts({ platform: "browser", format: "esm" }), @@ -50,13 +50,13 @@ describe("12 · Runtime-Specific Condition Sets", () => { expect(conds.conditions).toContain("default"); }); - it("has browserField: true by default", () => { + test("has browserField: true by default", () => { const conds = getResolverConditions( importArgs("import-statement"), resolveOpts({ platform: "browser" }), ); - expect(conds.browserField).toBe(true); + expect(conds.browser).toBe(true); }); }); @@ -64,7 +64,7 @@ describe("12 · Runtime-Specific Condition Sets", () => { // 12.2 — Deno runtime // --------------------------------------------------------------------------- describe("12.2 — Deno runtime", () => { - it("includes deno + node conditions", () => { + test("includes deno + node conditions", () => { const conds = getResolverConditions( importArgs("import-statement"), resolveOpts({ runtime: "deno" as ResolveRuntime }), @@ -74,16 +74,16 @@ describe("12 · Runtime-Specific Condition Sets", () => { expect(conds.conditions).toContain("node"); }); - it("disables browserField", () => { + test("disables browserField", () => { const conds = getResolverConditions( importArgs("import-statement"), resolveOpts({ runtime: "deno" as ResolveRuntime }), ); - expect(conds.browserField).toBe(false); + expect(conds.browser).toBe(false); }); - it("getRuntimeDefaults reports deno", () => { + test("getRuntimeDefaults reports deno", () => { const defaults = getRuntimeDefaults("deno" as ResolveRuntime); expect(defaults.conditions).toContain("deno"); expect(defaults.conditions).toContain("node"); @@ -95,7 +95,7 @@ describe("12 · Runtime-Specific Condition Sets", () => { // 12.3 — Bun runtime // --------------------------------------------------------------------------- describe("12.3 — Bun runtime", () => { - it("includes bun + node conditions", () => { + test("includes bun + node conditions", () => { const conds = getResolverConditions( importArgs("import-statement"), resolveOpts({ runtime: "bun" as ResolveRuntime }), @@ -105,13 +105,13 @@ describe("12 · Runtime-Specific Condition Sets", () => { expect(conds.conditions).toContain("node"); }); - it("disables browserField", () => { + test("disables browserField", () => { const conds = getResolverConditions( importArgs("import-statement"), resolveOpts({ runtime: "bun" as ResolveRuntime }), ); - expect(conds.browserField).toBe(false); + expect(conds.browser).toBe(false); }); }); @@ -119,7 +119,7 @@ describe("12 · Runtime-Specific Condition Sets", () => { // 12.4 — Cloudflare Workers (workerd) // --------------------------------------------------------------------------- describe("12.4 — Cloudflare Workers (workerd)", () => { - it("includes workerd, worker, browser conditions", () => { + test("includes workerd, worker, browser conditions", () => { const conds = getResolverConditions( importArgs("import-statement"), resolveOpts({ runtime: "workerd" as ResolveRuntime }), @@ -130,7 +130,7 @@ describe("12 · Runtime-Specific Condition Sets", () => { expect(conds.conditions).toContain("browser"); }); - it("disables browserField (server-like)", () => { + test("disables browserField (server-like)", () => { const conds = getResolverConditions( importArgs("import-statement"), resolveOpts({ runtime: "workerd" as ResolveRuntime }), @@ -138,7 +138,7 @@ describe("12 · Runtime-Specific Condition Sets", () => { // Workers want browser-optimized *exports* paths but should NOT // apply legacy browser field remappings - expect(conds.browserField).toBe(false); + expect(conds.browser).toBe(false); }); }); @@ -146,7 +146,7 @@ describe("12 · Runtime-Specific Condition Sets", () => { // 12.5 — Vercel Edge (edge-light) // --------------------------------------------------------------------------- describe("12.5 — Vercel Edge (edge-light)", () => { - it("includes edge-light, worker, browser conditions", () => { + test("includes edge-light, worker, browser conditions", () => { const conds = getResolverConditions( importArgs("import-statement"), resolveOpts({ runtime: "edge-light" as ResolveRuntime }), @@ -157,13 +157,13 @@ describe("12 · Runtime-Specific Condition Sets", () => { expect(conds.conditions).toContain("browser"); }); - it("enables browserField (unlike workerd)", () => { + test("enables browserField (unlike workerd)", () => { const conds = getResolverConditions( importArgs("import-statement"), resolveOpts({ runtime: "edge-light" as ResolveRuntime }), ); - expect(conds.browserField).toBe(true); + expect(conds.browser).toBe(true); }); }); @@ -171,7 +171,7 @@ describe("12 · Runtime-Specific Condition Sets", () => { // 12.6 — React Native // --------------------------------------------------------------------------- describe("12.6 — React Native", () => { - it("includes react-native condition", () => { + test("includes react-native condition", () => { const conds = getResolverConditions( importArgs("import-statement"), resolveOpts({ runtime: "react-native" as ResolveRuntime }), @@ -180,13 +180,13 @@ describe("12 · Runtime-Specific Condition Sets", () => { expect(conds.conditions).toContain("react-native"); }); - it("disables browserField", () => { + test("disables browserField", () => { const conds = getResolverConditions( importArgs("import-statement"), resolveOpts({ runtime: "react-native" as ResolveRuntime }), ); - expect(conds.browserField).toBe(false); + expect(conds.browser).toBe(false); }); }); @@ -194,7 +194,7 @@ describe("12 · Runtime-Specific Condition Sets", () => { // 12.7 — Electron main process // --------------------------------------------------------------------------- describe("12.7 — Electron main", () => { - it("includes electron + node conditions", () => { + test("includes electron + node conditions", () => { const conds = getResolverConditions( importArgs("import-statement"), resolveOpts({ runtime: "electron-main" as ResolveRuntime }), @@ -204,13 +204,13 @@ describe("12 · Runtime-Specific Condition Sets", () => { expect(conds.conditions).toContain("node"); }); - it("disables browserField", () => { + test("disables browserField", () => { const conds = getResolverConditions( importArgs("import-statement"), resolveOpts({ runtime: "electron-main" as ResolveRuntime }), ); - expect(conds.browserField).toBe(false); + expect(conds.browser).toBe(false); }); }); @@ -218,7 +218,7 @@ describe("12 · Runtime-Specific Condition Sets", () => { // 12.8 — Electron renderer // --------------------------------------------------------------------------- describe("12.8 — Electron renderer", () => { - it("includes electron + browser conditions", () => { + test("includes electron + browser conditions", () => { const conds = getResolverConditions( importArgs("import-statement"), resolveOpts({ runtime: "electron-renderer" as ResolveRuntime }), @@ -228,13 +228,13 @@ describe("12 · Runtime-Specific Condition Sets", () => { expect(conds.conditions).toContain("browser"); }); - it("enables browserField", () => { + test("enables browserField", () => { const conds = getResolverConditions( importArgs("import-statement"), resolveOpts({ runtime: "electron-renderer" as ResolveRuntime }), ); - expect(conds.browserField).toBe(true); + expect(conds.browser).toBe(true); }); }); @@ -242,7 +242,7 @@ describe("12 · Runtime-Specific Condition Sets", () => { // 12.9 — Custom user-provided conditions // --------------------------------------------------------------------------- describe("12.9 — Custom conditions", () => { - it("adds user conditions to the list", () => { + test("adds user conditions to the list", () => { const conds = getResolverConditions( importArgs("import-statement"), resolveOpts({ @@ -255,7 +255,7 @@ describe("12 · Runtime-Specific Condition Sets", () => { expect(conds.conditions).toContain("react-server"); }); - it("resolves solid-js development entry when development condition is present", () => { + test("resolves solid-js development entry when development condition is present", () => { const pkg = manifest({ name: "solid-js", version: "1.9.4", @@ -283,7 +283,7 @@ describe("12 · Runtime-Specific Condition Sets", () => { expect(result.path).toBe("./dist/dev.js"); }); - it("resolves solid-js production entry without development condition", () => { + test("resolves solid-js production entry without development condition", () => { const pkg = manifest({ name: "solid-js", version: "1.9.4", @@ -313,7 +313,7 @@ describe("12 · Runtime-Specific Condition Sets", () => { // 12.10 — Condition deduplication // --------------------------------------------------------------------------- describe("12.10 — Condition deduplication", () => { - it("browser appears only once even when platform and runtime both add it", () => { + test("browser appears only once even when platform and runtime both add it", () => { const conds = getResolverConditions( importArgs("import-statement"), resolveOpts({ @@ -327,7 +327,7 @@ describe("12 · Runtime-Specific Condition Sets", () => { expect(browserCount).toBe(1); }); - it("node appears only once for electron-main + platform:node", () => { + test("node appears only once for electron-main + platform:node", () => { const conds = getResolverConditions( importArgs("import-statement"), resolveOpts({ @@ -345,7 +345,7 @@ describe("12 · Runtime-Specific Condition Sets", () => { // 12.11 — require context from CJS format // --------------------------------------------------------------------------- describe("12.11 — require context from CJS format", () => { - it("CJS format + entry-point produces require context", () => { + test("CJS format + entry-point produces require context", () => { expect( isRequireContext( importArgs("entry-point"), @@ -354,7 +354,7 @@ describe("12 · Runtime-Specific Condition Sets", () => { ).toBe(true); }); - it("ESM format + entry-point does NOT produce require context", () => { + test("ESM format + entry-point does NOT produce require context", () => { expect( isRequireContext( importArgs("entry-point"), @@ -363,7 +363,7 @@ describe("12 · Runtime-Specific Condition Sets", () => { ).toBe(false); }); - it("CJS format resolves uuid to require path", () => { + test("CJS format resolves uuid to require path", () => { const pkg = manifest({ name: "uuid", exports: { @@ -391,20 +391,20 @@ describe("12 · Runtime-Specific Condition Sets", () => { // =========================================================================== describe("integration: conditions flow through full pipeline", () => { - it("12.1 — default browser build of solid-js succeeds", async () => { + test("12.1 — default browser build of solid-js succeeds", async () => { const result = await buildPackage("solid-js@1.9.4"); expect(result.contents.length).toBeGreaterThan(0); expect(result.errors.length).toBe(0); - }, { timeout: NETWORK_TIMEOUT }); + }); - it("12.11 — CJS format build of uuid succeeds", async () => { + test("12.11 — CJS format build of uuid succeeds", async () => { const result = await buildPackage("uuid@11.0.5", { esbuild: { format: "cjs" }, }); expect(result.contents.length).toBeGreaterThan(0); expect(result.errors.length).toBe(0); - }, { timeout: NETWORK_TIMEOUT }); + }); }); }); -- 2.51.2