Skip to content

Commit 736caa6

Browse files
committed
test(commonjs): document expected stub throw; align snapshots
1 parent 7dd4935 commit 736caa6

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

packages/commonjs/test/fixtures/function/module-side-effects-external-node-builtin-wrapped-stub/main.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ function unused() {
1010

1111
try {
1212
unused();
13-
} catch {}
13+
} catch (_err) {
14+
// Expected: in this fixture we configure `externalBuiltinsRequire: 'stub'`,
15+
// so calling the proxy's `__require()` throws. We swallow the error so the
16+
// test can assert on the generated code (no `node:module` import) without
17+
// failing at runtime.
18+
}
1419

1520
module.exports = 1;

packages/commonjs/test/snapshots/function.js.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6762,7 +6762,12 @@ Generated by [AVA](https://avajs.dev).
67626762
67636763
try {␊
67646764
unused();␊
6765-
} catch {}␊
6765+
} catch (_err) {␊
6766+
// Expected: in this fixture we configure \`externalBuiltinsRequire: 'stub'\`,␊
6767+
// so calling the proxy's \`__require()\` throws. We swallow the error so the␊
6768+
// test can assert on the generated code (no \`node:module\` import) without␊
6769+
// failing at runtime.␊
6770+
}␊
67666771
67676772
main$1 = 1;␊
67686773
return main$1;␊
98 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)