Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error cause not printed #233

Open
dwoznicki opened this issue Apr 27, 2023 · 0 comments · May be fixed by #234
Open

Error cause not printed #233

dwoznicki opened this issue Apr 27, 2023 · 0 comments · May be fixed by #234

Comments

@dwoznicki
Copy link

dwoznicki commented Apr 27, 2023

When a test encounters an unexpected error, only the top level error is printed. This makes it difficult to debug the actual underlying cause of these test failures.

For example, I have the following test which throws a null pointer.

const {test} = require("uvu");

test("error cause", () => {
    try {
        let a = null;
        a.hello();
    } catch (error) {
        throw new Error("Oh no! Something went wrong", {cause: error});
    }
});
test.run();

Running this test produces the following output.

✘   (0 / 1)

   FAIL  "error cause"
    Oh no! Something went wrong

    at Object.handler (/home/danwoz/testo/testo.js:8:15)
    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.59ms

This error would be a lot easier to debug if the original null pointer showed up in the stack trace.

@dwoznicki dwoznicki linked a pull request Apr 27, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant