Path: blob/main/lang/bun/files/patch-test_regression_issue_24314.test.ts
46591 views
-- Skip gracefully when bun:internal-for-testing is unavailable (release builds).1-- bun:internal-for-testing is only compiled into debug/development builds of bun.2-- FreeBSD ports always build a release binary, so this module is never available.3-- Without this patch, the test file crashes at module load time with ENOENT,4-- causing "Unhandled error between tests" in the bun test output.5--- test/regression/issue/24314.test.ts.orig 2026-04-27 17:51:47 UTC6+++ test/regression/issue/24314.test.ts7@@ -1,4 +1,10 @@8-import { readTarball } from "bun:internal-for-testing";9+// bun:internal-for-testing is only available in debug builds; skip gracefully in release builds.10+let readTarball: ((path: string) => any) | undefined;11+try {12+ ({ readTarball } = require("bun:internal-for-testing") as any);13+} catch {14+ readTarball = undefined;15+}16import { expect, test } from "bun:test";17import { bunEnv, bunExe, tempDir } from "harness";18import path from "node:path";19@@ -8,7 +14,7 @@ function normalizePath(p: string): string {20return p.replace(/\\/g, "/");21}2223-test("bun pm pack respects changes to package.json from prepack scripts", async () => {24+test.skipIf(!readTarball)("bun pm pack respects changes to package.json from prepack scripts", async () => {25using dir = tempDir("pack-prepack", {26"package.json": JSON.stringify(27{28@@ -61,7 +67,7 @@ fs.writeFileSync('package.json', JSON.stringify(pkg, n29expect(extractedPkg.description).toBe("MODIFIED BY PREPACK");30});3132-test("bun pm pack respects changes to package.json from prepare scripts", async () => {33+test.skipIf(!readTarball)("bun pm pack respects changes to package.json from prepare scripts", async () => {34using dir = tempDir("pack-prepare", {35"package.json": JSON.stringify(36{373839