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