Skip to content

test: remove CommonJS loader from stack traces

Partially resolves #44168.

This PR refactors all the tests that are verifying a particular stack trace that includes the CommonJS loader. None of these tests are modules tests, and are asserting a longer stack trace than is necessary for the systems that the tests are intended for. These excessive traces make refactoring the CommonJS loader difficult, as any changes that affect the functions called within the loader break these unrelated tests.

For the most part I used Error.stackTraceLimit to request only the number of trace frames that were relevant to the particular test, excluding the CommonJS loader from the output. This approach didn’t work for the tests that were testing --trace-uncaught, as that flag doesn’t seem to respect Error.stackTraceLimit; I rewrote those tests to use the child process pattern that many of the modules tests use, where we’re explicit about what we’re looking for in the output.

@targos can you please verify that I edited error_with_nul.out correctly and didn’t break the file somehow by saving it wrong? cc @nodejs/testing

Merge request reports

Loading