Commit 597b3d19 authored by Ben Noordhuis's avatar Ben Noordhuis
Browse files

module: print better message on esm syntax error

Include the offending line in the output and underline the bad token.

Before this commit, it printed "SyntaxError: Unexpected reserved word"
without indicating where the syntax error is.

Now it prints the line and underlines the offending token, like it does
for syntax errors in CJS scripts.

Minor changes are made to the test runner in order to support `*.mjs`
files in test/message.

Fixes: https://github.com/nodejs/node/issues/17277
PR-URL: https://github.com/nodejs/node/pull/17281


Reviewed-By: default avatarAnna Henningsen <anna@addaleax.net>
Reviewed-By: default avatarColin Ihrig <cjihrig@gmail.com>
Reviewed-By: default avatarEvan Lucas <evanlucas@me.com>
Reviewed-By: default avatarMichaël Zasso <targos@protonmail.com>
parent 6c470330
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment