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.

Jest 23 throws errors on `test` cases without a callback defined

See original GitHub issue

🐛 Bug Report

The latest version of Jest (23) now throws errors on test statements without a callback.

To Reproduce

Create a test file with the following in it:

describe('my-tests', () => {
   test('requires testing');
});

Expected behavior

Tests without a callback are marked as “pending” and do not throw errors.


We very, very commonly write out test cases before implementing the tests. These serve as reminders, or as a plan, of what the functional code we are going to write should actually do. With the latest changes in Jest 23, all of these throw errors now and our test suite fails.

Please revert this change or make this behavior toggleable.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

8reactions
SimenBcommented, May 24, 2018

This is by design, see #5558. You can do test.skip('bla bla', () => {}) and it should serve the same purpose

5reactions
mririgoyencommented, May 24, 2018

That is a terrible design. You have thrown a wrench in anyone who implements Test-Driven Development (TDD).

Please reopen this bug as a feature request to make this configurable.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to test the type of a thrown exception in Jest
My current testing framework is AVA and I can test it as a second argument t.throws method, like here: it('should throw Error with...
Read more >
Testing Asynchronous Code - Jest
Jest will throw an error, if the same test function is passed a done() callback and returns a promise. This is done as...
Read more >
How to Test Asynchronous Code with Jest
For callback-based code, Jest provides a done callback as the argument of the test function. We should invoke this function after we are...
Read more >
A Comprehensive Guide To Error Handling In Node.js
You can propagate it up the stack by passing it to a different callback, but make sure not to throw an exception from...
Read more >
Mocha - the fun, simple, flexible JavaScript test framework
If you use callback-based async tests, Mocha will throw an error if done() is called multiple times. This is handy for catching accidental...
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