You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
❯ npx ava 1 passed 1 exception Uncaught Exception Error: Failed to serialize uncaught exception at process.on.exception (/private/var/folders/2_/qczp184x76b2nl034sq5hvxw0000gn/T/tmp.dcvW5BUyA5/node_modules/ava/lib/test-worker.js:93:15) at emitOne (events.js:115:13) at process.emit (events.js:210:7) at process._fatalException (bootstrap_node.js:374:26)
Similarly, if a primitive is thrown, the output is terrible:
Threw non-error: 1
YOU SHOULD NOT THROW NON-ERRORS. GO THINK ABOUT WHAT YOU DID.
Jokes aside, I'm serious about including the first sentence in some form. People should learn. The fact that it's even allowed in JS is very JS, but also very annoying.
Here we're dealing with errors that are not handled in the test or by assertions. They could even be bugs (throw err where err is an undefined variable). I don't think we need to proselytize in the uncaught exception handler. That's what t.throws() is for.
serialize-error
currently does not guard against being called with anull
orundefined
value.results in:
Similarly, if a primitive is thrown, the output is terrible:
The same goes when throwing objects:
If the error doesn't seem to be an error we should format it and print that instead.
The text was updated successfully, but these errors were encountered: