question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Proposal: classify uncaught errors in tests as "errors" not as "failures"

See original GitHub issue

Do you want to request a feature or report a bug?

Feature

What is the current behavior?

Jest treats failed assertions and uncaught errors in a test case both as failures.

What is the expected behavior?

I maintain jest-junit, a testResultsProcessor that provides valid jUnit xml files for CI & reporting systems. This spec differentiates a test failure and a test error.

A test error, according to the junit spec, is classified as:

An errored test is one that had an unanticipated problem, for example an unchecked throwable; or a problem with the implementation of the test.

What I am proposing is that Jest adds an additional test status of “error” for these cases. The current documentation for testResultsProcessors shows the following test statuses:

"status": "failed" | "pending" | "passed",

I am more than happy to contribute and willing to take this work on myself, if necessary. But before I do I wanted to get feedback from Jest maintainers and the community if this would cause problems.

Please provide your exact Jest configuration

System: OS: macOS Sierra 10.12.6 CPU: x64 Intel® Core™ i7-4980HQ CPU @ 2.80GHz Binaries: Node: 8.5.0 Yarn: 1.5.1 npm: 5.3.0 npmPackages: jest: wanted: ^22.4.3 installed: 22.4.3

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:14 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
ljharbcommented, Apr 27, 2018

Yes, it would be amazing if runners could inject their own statuses, and colors for those statuses.

Basically, jest is really two things that would be really nice to make more separable: a test framework (a jasmine fork) and a super awesome parallel test runner/watcher.

1reaction
SimenBcommented, May 19, 2018

@palmerj3 Were you able to look into it?

FWIW, I support error in addition to failed, but if we could implement it in a way which allows us to also support other statuses, such as warning, that’s be awesome.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Mocha Uncaught Error for catch exceptions - Stack Overflow
I am getting error for the above test case: Uncaught Error: ENOENT, no such file or directory 'invalid-file.txt' at Binding.
Read more >
Errors | Cloud APIs - Google Cloud
These cover the most common needs for API errors, such as quota failure and invalid parameters. Like error codes, developers should use these...
Read more >
Assertions, Exceptions and Errors
Any exception which is not an assertion is considered an 'error', or in other words, an unexpected error, failing the test. Like many...
Read more >
Identify and resolve client errors
Identify client errors and resolve them in client-side scripts.
Read more >
Most Common Java Exceptions | Rollbar
Exceptions are important because they provide a mechanism to ensure program integrity and present a reliable code base. Failure to provide ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found