tapjs/stack-utils

`StackUtils` `parseLine` method chokes on stack traces containing constructor calls

Closed this issue · 1 comments

FUDCo commented

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 commented

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