avajs / ava

Node.js test runner that lets you develop with confidence 🚀
MIT License
20.74k stars 1.41k forks source link

Address error in tap reporter when originalError is undefined #3325

Open evmiguel opened 7 months ago

evmiguel commented 7 months ago

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.

novemberborn commented 6 months ago

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 commented 6 months ago

@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?