This PR adds support for printing error cause. Causes appear as part of the stack trace, and are checked recursively. For example, the following snippet
const {test} = require("uvu");
test("error cause", () => {
throw new Error("top level", {cause: new Error("mid level", {cause: new Error("bottom level")})});
});
test.run();
produces the following output
✘ (0 / 1)
FAIL "error cause"
top level
at Object.handler (/home/danwoz/testo/test/t.js:4:11)
at Number.runner (/home/danwoz/testo/node_modules/uvu/dist/index.js:88:16)
at Timeout.exec [as _onTimeout] (/home/danwoz/testo/node_modules/uvu/dist/index.js:151:39)
Caused by: mid level
at Object.handler (/home/danwoz/testo/test/t.js:4:42)
at Number.runner (/home/danwoz/testo/node_modules/uvu/dist/index.js:88:16)
at Timeout.exec [as _onTimeout] (/home/danwoz/testo/node_modules/uvu/dist/index.js:151:39)
Caused by: bottom level
at Object.handler (/home/danwoz/testo/test/t.js:4:73)
at Number.runner (/home/danwoz/testo/node_modules/uvu/dist/index.js:88:16)
at Timeout.exec [as _onTimeout] (/home/danwoz/testo/node_modules/uvu/dist/index.js:151:39)
Total: 1
Passed: 0
Skipped: 0
Duration: 2.76ms
This PR adds support for printing error cause. Causes appear as part of the stack trace, and are checked recursively. For example, the following snippet
produces the following output
Fixes #233