lib: fix assert shows diff messages in ESM and CJS · nodejs/node@f1cf1c3 · GitHub
Skip to content

Commit f1cf1c3

Browse files
MrJithilUlisesGascon
authored andcommitted
lib: fix assert shows diff messages in ESM and CJS
This PR addresses an issue which was caused by the design in the ESM loader. The ESM loader was modifying the file path and replacing the 'file' property with the file proto in the stack trace. This, in turn, led to unhandled exceptions when the assert module attempted to open the file to display erroneous code. The changes in this PR resolve this issue by handling the file path correctly, ensuring that the remaining message formatting code can execute as expected. PR-URL: #50634 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 9043ba4 commit f1cf1c3

2 files changed

Lines changed: 61 additions & 1 deletion

File tree

lib/assert.js

Lines changed: 10 additions & 1 deletion
Lines changed: 51 additions & 0 deletions

0 commit comments

Comments
 (0)