Commit Graph

3 Commits

Author SHA1 Message Date
Antoine du Hamel
5114c46c69
test: fix common.mustNotCall error message
When using `util.inspect` as a callback, the array index (second
argument) is picked up as the `showHidden` param, and the argument
array (third argument) as the `depth` param. This fails with a seemingly
unrelated error message when the argument array contains a
`Symbol`-related property.

PR-URL: https://github.com/nodejs/node/pull/42917
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2022-06-12 11:40:18 +02:00
Denys Otrishko
225a03c5bb
test: print arguments passed to mustNotCall function
Refs: https://github.com/nodejs/node/pull/33949#discussion_r442473532
Signed-off-by: Denys Otrishko <shishugi@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/33951
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2020-06-24 15:41:44 -07:00
Lance Ball
a322b8e316
test: make common.mustNotCall show file:linenumber
When a test fails via `common.mustNotCall` it is sometimes hard to
determine exactly what was called. This modification stores the
caller's file and line number by using the V8 Error API to capture
a stack at the time `common.mustNotCall()` is called. In the event
of failure, this information is printed.

This change also exposes a new function in test/common, `getCallSite()`
which accepts a `function` and returns a `String` with the file name and
line number for the function.

PR-URL: https://github.com/nodejs/node/pull/17257
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Khaidi Chu <i@2333.moe>
2017-12-04 11:43:43 -05:00