Fails to clean all internal Node.js frames
jaydenseric opened this issue · 3 comments
In recent versions of Node.js (e.g. v17.0.1, but also earlier versions), there is an extra stack frame at async Promise.all (index 0)
, e.g:
Error: Message.
at file://[redacted]/test-director/test/fixtures/fails.mjs:7:9
at TestDirector.run (file://[redacted]/test-director/index.mjs:121:15)
at file://[redacted]/test-director/test/fixtures/fails.mjs:49:7
at ModuleJob.run (node:internal/modules/esm/module_job:185:25)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:281:24)
at async loadESM (node:internal/process/esm_loader:88:5)
at async handleMainPromise (node:internal/modules/run_main:65:12)
The StackUtils.clean
method fails to remove this extra frame:
file://test/fixtures/fails.mjs:7:9
TestDirector.run (file://index.mjs:121:15)
file://test/fixtures/fails.mjs:49:7
async Promise.all (index 0)
This leads to very confusing error stacks when presented to users that don't use Promise.all
anywhere in their project.
This also leads to very annoying situations where snapshot tests of cleaned error traces that run in both older and newer Node.js versions fail in whichever environment is not the one the snapshots were saved in.
It's not clear the best way to work around this dilemma until the bug is fixed here in stack-utils
, as using regex to remove async Promise.all (index 0)
before running StackUtils.clean
would have to be careful not to remove Promise.all
frames that don't relate to Node.js internals and originate in project code.
I'm sounding like a broken record but this is fixed in stack-tools
.
Oh, or it can be? I can't remember what I do with those frames. I still need to do an audit over what should and should not be considered internal. Maybe you'd like to help?
OK now it's fixed in stack-tools
.