ava icon indicating copy to clipboard operation
ava copied to clipboard

Address error in tap reporter when originalError is undefined

Open evmiguel opened this issue 1 year ago • 2 comments

This is a follow up from the discussion in https://github.com/avajs/ava/discussions/3322. The tap reporter was failing when ava timed out because of https://github.com/avajs/ava/blob/01ec2804ab9db0ab3ef11e3b5b0c5697d68f8bc5/lib/reporters/tap.js#L27 being undefined.

The suggestion was to use optional chaining on the left side of the assignment, but I ran into the tests failing, so I wrapped the assignment in an if condition.

evmiguel avatar Apr 22 '24 18:04 evmiguel

The suggestion was to use optional chaining on the left side of the assignment, but I ran into the tests failing, so I wrapped the assignment in an if condition.

Yes that's my bad, you can't use optional chaining on the left hand side in an assignment.

novemberborn avatar May 05 '24 19:05 novemberborn

@evmiguel looking at the rest of the function, the originalError.stack assignment would also fail.

Looking at how dumpError is called, I don't see how it would be called with an undefined value. Could you provide a reproduction of the error?

novemberborn avatar May 05 '24 19:05 novemberborn