blob: 9d953cf8205213de14be47fc3d619d25e625231c [file] [log] [blame] [edit]
//@ requireOptions("--useAsyncStackTrace=1", "-m")
function shouldBe(a, b) {
if (a !== b)
throw new Error(`Expected ${b} but got ${a}`);
}
async function foo(x) {
await bar(x);
}
async function bar(x) {
await x;
throw new Error("FOO");
}
try {
await foo();
} catch (e) {
const lines = e.stack.split("\n");
shouldBe(lines.length, 2);
shouldBe(lines[0].slice(0, 4), "bar@");
shouldBe(lines[1].slice(0, 10), "async foo@");
}