node/test/message
Ben Noordhuis b719b77215
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: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2017-12-12 03:27:53 -05:00
..
2100bytes.js meta: restore original copyright header 2017-03-10 11:23:48 -08:00
2100bytes.out
console_low_stack_space.js console,test: make message test more accurate 2017-08-03 15:41:14 +02:00
console_low_stack_space.out
core_line_numbers.js
core_line_numbers.out lib: remove _debugger.js 2017-04-21 10:35:49 +02:00
error_exit.js meta: restore original copyright header 2017-03-10 11:23:48 -08:00
error_exit.out errors: AssertionError moved to internal/error 2017-05-23 07:43:53 -07:00
esm_display_syntax_error.mjs module: print better message on esm syntax error 2017-12-12 03:27:53 -05:00
esm_display_syntax_error.out module: print better message on esm syntax error 2017-12-12 03:27:53 -05:00
esm_display_syntax_error_module.mjs module: print better message on esm syntax error 2017-12-12 03:27:53 -05:00
esm_display_syntax_error_module.out module: print better message on esm syntax error 2017-12-12 03:27:53 -05:00
eval_messages.js meta: restore original copyright header 2017-03-10 11:23:48 -08:00
eval_messages.out lib: remove _debugger.js 2017-04-21 10:35:49 +02:00
hello_world.js meta: restore original copyright header 2017-03-10 11:23:48 -08:00
hello_world.out
max_tick_depth.js meta: restore original copyright header 2017-03-10 11:23:48 -08:00
max_tick_depth.out
message.status
nexttick_throw.js meta: restore original copyright header 2017-03-10 11:23:48 -08:00
nexttick_throw.out process: slightly simplify next tick execution 2017-12-12 03:27:46 -05:00
stack_overflow.js test: use JSON.stringify to trigger stack overflow 2017-04-21 11:46:19 +02:00
stack_overflow.out test: use JSON.stringify to trigger stack overflow 2017-04-21 11:46:19 +02:00
stdin_messages.js meta: restore original copyright header 2017-03-10 11:23:48 -08:00
stdin_messages.out process: slightly simplify next tick execution 2017-12-12 03:27:46 -05:00
testcfg.py module: print better message on esm syntax error 2017-12-12 03:27:53 -05:00
throw_custom_error.js meta: restore original copyright header 2017-03-10 11:23:48 -08:00
throw_custom_error.out meta: restore original copyright header 2017-03-10 11:23:48 -08:00
throw_in_line_with_tabs.js test: adjust indentation for stricter linting 2017-07-27 09:24:20 -07:00
throw_in_line_with_tabs.out meta: restore original copyright header 2017-03-10 11:23:48 -08:00
throw_non_error.js meta: restore original copyright header 2017-03-10 11:23:48 -08:00
throw_non_error.out meta: restore original copyright header 2017-03-10 11:23:48 -08:00
throw_null.js meta: restore original copyright header 2017-03-10 11:23:48 -08:00
throw_null.out meta: restore original copyright header 2017-03-10 11:23:48 -08:00
throw_undefined.js meta: restore original copyright header 2017-03-10 11:23:48 -08:00
throw_undefined.out meta: restore original copyright header 2017-03-10 11:23:48 -08:00
timeout_throw.js meta: restore original copyright header 2017-03-10 11:23:48 -08:00
timeout_throw.out
undefined_reference_in_new_context.js meta: restore original copyright header 2017-03-10 11:23:48 -08:00
undefined_reference_in_new_context.out vm: refactor vm module 2017-02-17 10:21:02 -08:00
unhandled_promise_trace_warnings.js test: remove common.noop 2017-07-03 11:39:35 -07:00
unhandled_promise_trace_warnings.out process: slightly simplify next tick execution 2017-12-12 03:27:46 -05:00
vm_caught_custom_runtime_error.js
vm_caught_custom_runtime_error.out
vm_display_runtime_error.js lib,src: fix consistent spacing inside braces 2017-07-21 15:13:47 -04:00
vm_display_runtime_error.out vm: fix displayErrors in runIn.. functions 2017-05-23 20:59:24 +02:00
vm_display_syntax_error.js meta: restore original copyright header 2017-03-10 11:23:48 -08:00
vm_display_syntax_error.out lib: remove _debugger.js 2017-04-21 10:35:49 +02:00
vm_dont_display_runtime_error.js meta: restore original copyright header 2017-03-10 11:23:48 -08:00
vm_dont_display_runtime_error.out lib: remove _debugger.js 2017-04-21 10:35:49 +02:00
vm_dont_display_syntax_error.js meta: restore original copyright header 2017-03-10 11:23:48 -08:00
vm_dont_display_syntax_error.out lib: remove _debugger.js 2017-04-21 10:35:49 +02:00