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

Jest 23 throws errors on test cases without a callback defined #6256

Closed
mririgoyen opened this issue May 24, 2018 · 5 comments
Closed

Jest 23 throws errors on test cases without a callback defined #6256

mririgoyen opened this issue May 24, 2018 · 5 comments

Comments

@mririgoyen
Copy link

mririgoyen commented May 24, 2018

🐛 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.

@SimenB
Copy link
Member

SimenB commented May 24, 2018

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

@SimenB SimenB closed this as completed May 24, 2018
@mririgoyen
Copy link
Author

mririgoyen commented 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.

@elyobo
Copy link

elyobo commented Jun 13, 2018

@goyney the change seems a bit over the top (ensuring the the second arg was undefined or a function seems fine to me), but I'm happy enough with the test.skip() workaround provided - seems fine for TDD.

@rickhanlonii
Copy link
Member

@goyney I'm sorry that this breaks your workflow, but it's not really fair to call it "terrible design".

Nevertheless, we're happy to see someone revert and replace as a lint rule (see comment here)

seblucas added a commit to seblucas/firebase-sensor that referenced this issue Jun 15, 2018
Had to change the way pending tests are done (jestjs/jest#6256)
All snapshot were updated due to whitespace (except for chart-detail)
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants