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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Watch plugin support: terminate test run per test basis #7622

Closed
unional opened this issue Jan 14, 2019 · 6 comments
Closed

Watch plugin support: terminate test run per test basis #7622

unional opened this issue Jan 14, 2019 · 6 comments

Comments

@unional
Copy link
Contributor

unional commented Jan 14, 2019

馃殌 Feature Proposal

Add a function onTestComplete() to jestHooks which, if the callback returns false (or Promise resolves to false), will end the test run.

Motivation

When making changes, you can break multiple tests at the same time.
I want the bail ability during watch mode so that I can focus on one test at a time.

Currently, I have to use t/p and change specific test to test.only(), one at a time.

Supporting this allows me to work immediately on one error at a time without being overloaded with all the errors.

@jeysal
Copy link
Contributor

jeysal commented Jan 14, 2019

Does updateConfigAndRun({ bail: true }) not work for this use case?

@unional
Copy link
Contributor Author

unional commented Jan 14, 2019

Nope, it does not work. I use jest-watch-toggle-config to toggle it and it still runs all tests.

@jeysal
Copy link
Contributor

jeysal commented Jan 14, 2019

I've just checked and setting bail to true in a watch mode plugin definitely works (though I didn't use jest-watch-toggle-config to check).
Of course Jest does not bail after a single test case failed though, only after an entire test file was run with 1+ failing tests in it, which is what it also does when invoked with --bail right away.

@unional
Copy link
Contributor Author

unional commented Jan 14, 2019

I see. I always thought bail will bail on the first test error. So it is for one test suite.

Does it make sense to have bail fail that way or another flag that quit on the first failed test?

@SimenB
Copy link
Member

SimenB commented Jan 14, 2019

As @jeysal points out, this works as intended.

Does it make sense to have bail fail that way or another flag that quit on the first failed test?

#7453

@SimenB SimenB closed this as completed Jan 14, 2019
@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.
Projects
None yet
Development

No branches or pull requests

3 participants