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

StackUtils parseLine method chokes on stack traces containing constructor calls #69

Closed
FUDCo opened this issue Aug 12, 2022 · 1 comment

Comments

@FUDCo
Copy link

FUDCo commented Aug 12, 2022

In version 2.0.5 of stack-utils, the parseLine method will commit suicide on line 263 of index.js if there is a constructor call in the stack trace being parsed. This is due to an assignment to res.constructor which clobbers the res constructor and throws. I suspect this was intended to be an assignment to res.ctor, but in any case probably should be given some other property name than constructor.

I've patched my copy of the file and verified that changing res.constructor to res.ctor corrects the problem, but since my use case is not inspecting the returned res value for ctor or constructor I'll leave it to you to determine whether making this change would cause a compatibility issue for users of the package.

However, the problem breaks the Ava test framework when failing test assertions contain such stack traces. The assignment to res.constructor clobbers test execution with a Could not serialize error complaint.

There may be a similar issue on line 164, in the at method.

@FUDCo
Copy link
Author

FUDCo commented Sep 28, 2022

Closing in favor of #70, which includes a more correct diagnosis of the problem and a patch to fix it.

@FUDCo FUDCo closed this as completed Sep 28, 2022
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

1 participant