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:
- Created 5 years ago
- Comments:5 (1 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This is by design, see #5558. You can do
test.skip('bla bla', () => {})
and it should serve the same purposeThat 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.