Skip to content

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), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines

Merge request reports

Loading