Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails to clean all internal Node.js frames #63

Open
jaydenseric opened this issue Nov 2, 2021 · 3 comments
Open

Fails to clean all internal Node.js frames #63

jaydenseric opened this issue Nov 2, 2021 · 3 comments

Comments

@jaydenseric
Copy link

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.

jaydenseric added a commit to jaydenseric/test-director that referenced this issue Nov 2, 2021
@conartist6
Copy link

I'm sounding like a broken record but this is fixed in stack-tools.

@conartist6
Copy link

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?

@conartist6
Copy link

OK now it's fixed in stack-tools.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants