Skip to content

Commit 8aec44e

Browse files
test: compare a crash after a noted error by its kind, not its wording
Acorn and the port both throw a TypeError on `class A { set a() {} }` once the setter's missing parameter is only noted; JavaScriptCore words it after the expression that failed, so the messages differ on Bun. Claude-Session: https://claude.ai/code/session_017TkBWTk3wcyUcJYDp5ZhaP
1 parent 1cf4077 commit 8aec44e

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

‎test/unitCases/javascript/parser.unittest.js‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4591,7 +4591,15 @@ describe("Parser", () => {
45914591
try {
45924592
return { ast: parse(source, options), noted };
45934593
} catch (err) {
4594-
return { error: /** @type {Error} */ (err).message, noted };
4594+
// a parse error by its message; a crash after a noted error only by
4595+
// its kind, as engines word a TypeError each their own way
4596+
return {
4597+
error:
4598+
err instanceof SyntaxError
4599+
? err.message
4600+
: /** @type {Error} */ (err).name,
4601+
noted
4602+
};
45954603
}
45964604
};
45974605
for (const [name, options] of OPTION_SETS) {

0 commit comments

Comments
 (0)