v8/test/message
Benedikt Meurer ad21d212fc Preserve "proper method names" as-is in error.stack.
This changes the logic for generating method names in `error.stack` to
prepend an inferred type name only when the function name is a valid
ECMAScript identifiers and does not equal the inferred type name, to

(1) give developers more control over the exact name shown in
    `error.stack`, as well as
(2) avoid confusion in the presence of renaming of local variables.

Previously we'd leave the function name as-is if it was prefixed by the
inferred type name, but that condition is unnecessarily strict, and led
to a bunch of inconsistencies around special names like
`<instance_member_initializer>` where this dynamic approached often
prefixed it with the correct type name, but also sometimes got it wrong
and prepended `Object.`, which is very unfortunate and misleading.
Specifically for these special names, we'll add logic later in the
parser to infer a useful (complete) name.

The design doc (https://bit.ly/devtools-method-names-in-stack-traces)
contains more background and examples of why we do this change.

Doc: https://bit.ly/devtools-method-names-in-stack-traces
Fixed: chromium:1294619
Bug: chromium:1283435
Change-Id: Ib8b528ba25255dcd07e9d11044c562c11d699bcb
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3565724
Reviewed-by: Yang Guo <yangguo@chromium.org>
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Cr-Commit-Position: refs/heads/main@{#79748}
2022-04-04 14:08:56 +00:00
..
fail Preserve "proper method names" as-is in error.stack. 2022-04-04 14:08:56 +00:00
mjsunit [test] Pretty print object properties on assert failure 2022-03-04 14:30:51 +00:00
regress/fail [runtime] Ensure JSMessageObject has source positions 2021-11-12 17:43:31 +00:00
asm-assignment-undeclared.js [test] Automatically add --no-stress-opt to message tests 2022-02-18 08:51:12 +00:00
asm-assignment-undeclared.out
asm-function-mismatch-def.js [test] Automatically add --no-stress-opt to message tests 2022-02-18 08:51:12 +00:00
asm-function-mismatch-def.out
asm-function-mismatch-use.js [test] Automatically add --no-stress-opt to message tests 2022-02-18 08:51:12 +00:00
asm-function-mismatch-use.out
asm-function-redefined.js [test] Automatically add --no-stress-opt to message tests 2022-02-18 08:51:12 +00:00
asm-function-redefined.out
asm-function-undefined.js [test] Automatically add --no-stress-opt to message tests 2022-02-18 08:51:12 +00:00
asm-function-undefined.out
asm-function-variable-collision.js [test] Automatically add --no-stress-opt to message tests 2022-02-18 08:51:12 +00:00
asm-function-variable-collision.out
asm-import-wrong-annotation.js [test] Automatically add --no-stress-opt to message tests 2022-02-18 08:51:12 +00:00
asm-import-wrong-annotation.out
asm-import-wrong-object.js [test] Automatically add --no-stress-opt to message tests 2022-02-18 08:51:12 +00:00
asm-import-wrong-object.out
asm-linking-bogus-heap.js [test] Automatically add --no-stress-opt to message tests 2022-02-18 08:51:12 +00:00
asm-linking-bogus-heap.out
asm-linking-bogus-stdlib.js [test] Automatically add --no-stress-opt to message tests 2022-02-18 08:51:12 +00:00
asm-linking-bogus-stdlib.out
asm-linking-missing-heap.js [test] Automatically add --no-stress-opt to message tests 2022-02-18 08:51:12 +00:00
asm-linking-missing-heap.out
asm-missing-parameter-annotation.js [test] Automatically add --no-stress-opt to message tests 2022-02-18 08:51:12 +00:00
asm-missing-parameter-annotation.out
asm-missing-return-annotation.js [test] Automatically add --no-stress-opt to message tests 2022-02-18 08:51:12 +00:00
asm-missing-return-annotation.out
asm-table-mismatch-def.js [test] Automatically add --no-stress-opt to message tests 2022-02-18 08:51:12 +00:00
asm-table-mismatch-def.out
asm-table-mismatch-use.js [test] Automatically add --no-stress-opt to message tests 2022-02-18 08:51:12 +00:00
asm-table-mismatch-use.out
asm-table-redefined.js [test] Automatically add --no-stress-opt to message tests 2022-02-18 08:51:12 +00:00
asm-table-redefined.out
asm-table-undefined.js [test] Automatically add --no-stress-opt to message tests 2022-02-18 08:51:12 +00:00
asm-table-undefined.out
asm-table-variable-collision.js [test] Automatically add --no-stress-opt to message tests 2022-02-18 08:51:12 +00:00
asm-table-variable-collision.out
BUILD.gn
empty.js
empty.out
message.status Only run Set/Map grow failure tests on x64 release bots 2022-03-31 18:35:59 +00:00
non-use-strict-hex-escape.js
non-use-strict-hex-escape.out
non-use-strict-octal-escape.js
non-use-strict-octal-escape.out
non-use-strict-uhex-escape.js
non-use-strict-uhex-escape.out
nonstrict-arguments.js
nonstrict-arguments.out
nonstrict-eval.js
nonstrict-eval.out
nonstrict-with.js
nonstrict-with.out
object-binding-pattern-await-computed-name.js
object-binding-pattern-await-computed-name.out
README.md [test] Automatically add --no-stress-opt to message tests 2022-02-18 08:51:12 +00:00
strict-octal-indirect-regexp.js
strict-octal-indirect-regexp.out
strict-octal-regexp.js
strict-octal-regexp.out
testcfg.py [test] Automatically add --no-stress-opt to message tests 2022-02-18 08:51:12 +00:00
try-catch-finally-no-message.js
try-catch-finally-no-message.out
try-catch-finally-return-in-finally.js
try-catch-finally-return-in-finally.out
try-finally-return-in-finally.js
try-finally-return-in-finally.out
wasm-finish-compilation.js [test] Automatically add --no-stress-opt to message tests 2022-02-18 08:51:12 +00:00
wasm-finish-compilation.out
wasm-function-name-async.js [test] Automatically add --no-stress-opt to message tests 2022-02-18 08:51:12 +00:00
wasm-function-name-async.out [wasm] Print hash of anonymous scripts in stack traces 2021-08-06 17:14:55 +00:00
wasm-function-name-streaming.js [test] Automatically add --no-stress-opt to message tests 2022-02-18 08:51:12 +00:00
wasm-function-name-streaming.out [wasm] Print hash of anonymous scripts in stack traces 2021-08-06 17:14:55 +00:00
wasm-module-and-function-name-async.js [test] Automatically add --no-stress-opt to message tests 2022-02-18 08:51:12 +00:00
wasm-module-and-function-name-async.out [wasm] Print hash of anonymous scripts in stack traces 2021-08-06 17:14:55 +00:00
wasm-module-and-function-name-streaming.js [test] Automatically add --no-stress-opt to message tests 2022-02-18 08:51:12 +00:00
wasm-module-and-function-name-streaming.out [wasm] Print hash of anonymous scripts in stack traces 2021-08-06 17:14:55 +00:00
wasm-module-name-async.js [test] Automatically add --no-stress-opt to message tests 2022-02-18 08:51:12 +00:00
wasm-module-name-async.out [wasm] Print hash of anonymous scripts in stack traces 2021-08-06 17:14:55 +00:00
wasm-module-name-streaming.js [test] Automatically add --no-stress-opt to message tests 2022-02-18 08:51:12 +00:00
wasm-module-name-streaming.out [wasm] Print hash of anonymous scripts in stack traces 2021-08-06 17:14:55 +00:00
wasm-no-name-async.js [test] Automatically add --no-stress-opt to message tests 2022-02-18 08:51:12 +00:00
wasm-no-name-async.out [wasm] Print hash of anonymous scripts in stack traces 2021-08-06 17:14:55 +00:00
wasm-no-name-streaming.js [test] Automatically add --no-stress-opt to message tests 2022-02-18 08:51:12 +00:00
wasm-no-name-streaming.out [wasm] Print hash of anonymous scripts in stack traces 2021-08-06 17:14:55 +00:00
wasm-trace-liftoff.js [test] Automatically add --no-stress-opt to message tests 2022-02-18 08:51:12 +00:00
wasm-trace-liftoff.out [wasm] Fix register uses in wasm tracing 2020-06-15 11:13:18 +00:00
wasm-trace-memory-liftoff.js [test] Automatically add --no-stress-opt to message tests 2022-02-18 08:51:12 +00:00
wasm-trace-memory-liftoff.out [wasm] Change trace memory instr offset to be relative to module 2021-04-21 20:01:50 +00:00
wasm-trace-memory.js [test] Automatically add --no-stress-opt to message tests 2022-02-18 08:51:12 +00:00
wasm-trace-memory.out [wasm] Change trace memory instr offset to be relative to module 2021-04-21 20:01:50 +00:00
wasm-trace-turbofan.js [test] Automatically add --no-stress-opt to message tests 2022-02-18 08:51:12 +00:00
wasm-trace-turbofan.out [wasm] Fix register uses in wasm tracing 2020-06-15 11:13:18 +00:00
weakref-finalizationregistry-error.js [test] Automatically add --no-stress-opt to message tests 2022-02-18 08:51:12 +00:00
weakref-finalizationregistry-error.out

JavaScript tests with expected output

Tests in test/message pass if the output matches the expected output. Message tests are particularly useful when checking for exact error messages.

Tests and their expected output must have the same filename, with the .js and .out extension.

foo.js
foo.out

You can use a regex in the expected output instead of the exact path:

*%(basename)s:7: SyntaxError: Detected cycle while resolving name 'a'

Empty lines are ignored in the comparison, but whitespaces are not.

Exact details of the test runner are in testcfg.py.