[v6.x backport] 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.
Ref: https://github.com/nodejs/node/pull/17257
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
NOTE: This commit also includes common.canCreateSymlink()
, for which the documentation has been backported, but not the implementation. If desired, this can be removed - it came along for the ride when cherry-picking.
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
documentation is changed or added -
commit message follows commit guidelines