Page MenuHomePhorge

test_promise_chained_catch_unhandled.cjs
No OneTemporary

Size
646 B
Referenced Files
None
Subscribers
None

test_promise_chained_catch_unhandled.cjs

const assert = require("node:assert");
const { spawnSync } = require("child_process");
const source = [
"async function explode(){ throw new Error('boom') }",
"explode().then(() => {}).catch(() => console.log('chained-caught'))",
].join(" ");
const result = spawnSync(process.execPath, ["-e", source], {
encoding: "utf8",
});
if (result.error) {
throw result.error;
}
assert.strictEqual(result.status, 0, result.stderr || result.stdout);
assert.match(result.stdout, /chained-caught/);
assert.doesNotMatch(result.stderr, /Uncaught \\(in promise\\)/);
console.log("promise chains with downstream catch are not reported as unhandled");

File Metadata

Mime Type
application/javascript
Expires
Sat, May 2, 10:21 AM (1 d, 23 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
544202
Default Alt Text
test_promise_chained_catch_unhandled.cjs (646 B)

Event Timeline