From dca4c6306ce48779fd8eadb413617c4fa60d8c0f Mon Sep 17 00:00:00 2001 From: Garry Tan Date: Fri, 17 Apr 2026 05:54:29 +0800 Subject: [PATCH] fix: preserve bun:test sub-APIs in relink test wrapper The previous commit wrapped bun:test's `test` to bump the per-test timeout default to 15s but cast the wrapper `as typeof _bunTest` without copying the sub-properties (`.only`, `.skip`, `.each`, `.todo`, `.failing`, `.if`) from the original. The cast was a lie: the wrapper was a plain function, not the full callable with those chained properties attached. The file doesn't use any of them today, but a future test.only or test.skip would fail with a cryptic "undefined is not a function." Object.assign the original _bunTest's properties onto the wrapper so sub-APIs chain correctly forever. Surfaced by /ship's adversarial subagent. Co-Authored-By: Claude Opus 4.7 (1M context) --- test/relink.test.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/relink.test.ts b/test/relink.test.ts index 7692a90e..e5cd5206 100644 --- a/test/relink.test.ts +++ b/test/relink.test.ts @@ -7,8 +7,12 @@ import * as os from 'os'; // Every test in this file shells out to gstack-config + gstack-relink (bash scripts // invoking subprocess work). Under parallel bun test load, subprocess spawn contends // with other suites and each test can drift ~200ms past the 5s default. Bump to 15s. -const test = ((name: any, fn: any, timeout?: number) => - _bunTest(name, fn, timeout ?? 15_000)) as typeof _bunTest; +// Object.assign preserves test.only / test.skip / test.each / test.todo sub-APIs. +const test = Object.assign( + ((name: any, fn: any, timeout?: number) => + _bunTest(name, fn, timeout ?? 15_000)) as typeof _bunTest, + _bunTest, +); const ROOT = path.resolve(import.meta.dir, '..'); const BIN = path.join(ROOT, 'bin');