Skip to content

Commit 84c4cd2

Browse files
committed
compile: make the source-map fixture read the version band it runs in
`--enable-source-maps` is withheld on Node 26.0.0-26.7.x, because enabling it there turns a no-message `assert.ok(false)` into a TypeError (nodejs/node#63169, fixed by 26.8.1). The fixture asserted a mapped frame unconditionally, so on any Node in that band it reported FAIL for an augmentation nub deliberately declines to make - including on the harness's own default of 26.5.0. It now reads the support state off the process, so the row goes vacuous exactly where nub declines to remap. The same branch makes the plain-Node column differ where the flag IS injected: type-stripping preserves line numbers, so plain Node named `app.ts` by itself and the row proved nothing on the versions nub augments. Verified across the boundary with a compiled artifact per band - 24.20.0 and 26.8.1 resolve to `app.ts` in both the reference and the artifact while plain Node does not, and 26.7.0 reports no support in all three columns. A control built with no map still fails the row on both safe bands.
1 parent bcbe419 commit 84c4cd2

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

‎tests/compile-augmentation/fixtures/a-sourcemap.ts‎

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,20 @@
77
// Only file and line are compared. The absolute paths differ by construction (the
88
// artifact reports a path inside its extraction directory) and the columns differ
99
// by a few characters after minification, but the line is the fact a person needs.
10+
//
11+
// Source-map support is not available on every Node, and nub knows it: Node
12+
// 26.0.0–26.7.x corrupts a no-message `assert.ok(false)` into a TypeError once
13+
// maps are on (nodejs/node#63169, fixed by 26.8.1), so `--enable-source-maps` is
14+
// deliberately WITHHELD across that band — `source_maps_safe` in
15+
// `crates/nub-core/src/node/flags.rs`. Asserting a mapped frame there asserts an
16+
// augmentation nub is choosing not to make, and this harness defaults to 26.5.0,
17+
// squarely inside it. So the band is read off the process rather than guessed,
18+
// and the row goes vacuous on a Node where nub declines to remap.
19+
//
20+
// It is a REAL vacuum, not a suppressed failure: the same branch makes the plain
21+
// Node column differ on a version where the flag IS injected, which it did not
22+
// before. Type-stripping preserves line numbers, so plain Node named `app.ts` on
23+
// its own and the row proved nothing on the very versions nub augments.
1024
function inner(): never {
1125
throw new Error("boom");
1226
}
@@ -18,5 +32,6 @@ try {
1832
} catch (e) {
1933
const frame = (e as Error).stack?.split("\n")[1] ?? "";
2034
const at = frame.match(/([^/\\]+\.ts):(\d+):\d+/);
21-
console.log(at ? `ok:${at[1]}:${at[2]}` : `ok:unresolved:${frame.trim().slice(0, 40)}`);
35+
if (!process.sourceMapsEnabled) console.log("ok:no-source-map-support");
36+
else console.log(at ? `ok:${at[1]}:${at[2]}` : `ok:unresolved:${frame.trim().slice(0, 40)}`);
2237
}

0 commit comments

Comments
 (0)