assert: handle undefined filename in getErrMessage
When generating an assertion error message,
filename
might be undefined,
e.g. if assert
is called in eval
.
Handle this case gracefully instead of failing with
Cannot read property 'endsWith' of undefined
.
Fixes: https://github.com/nodejs/node/issues/20847
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
commit message follows commit guidelines