-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Describe, bail and each don't work as written in the doc #7434
Comments
A "test suite" in jest's terminology means a test file, not a
Regarding Regarding verbosity - we know jest is pretty verbose, and it's probably gonna stay that way. There's a couple of things you can do
|
Thanks for your reply.
I'm not sure about the relevance of the
Shouldn't this be reflected into the doc?
In my use case, I provide students with a project that have already the tests written for them. In this case, if they run Fortunately, I finally could work around this by hacking my way through |
Sorry guys, but I slept on this, and it really bugs me. When you decide to use an option to stop the tests after the first failure, in what kind of context would it be the expected behavior that it keeps failing all the tests in the current file? Moreover, you are telling me that with jest, if I want to create 20 tests and I want the tests to stop at the first failure, my only choice is to create 20 test files?! |
Hey @Sharcoux sorry for the confusion - I think we would be interested in making bail work at a test-level but I think the way it works today is accurate to the documentation (though it could be clearer) Do you want to submit a feature proposal to update bail to stop at the first failing test instead of the first failing test suite/test file? |
You might find me narrow-minded, but I don't think that
that I can read there, would normally be interpreted by:
Actually, I think that most people would understand: I'll check if I'm able to provide a PR about this if you are willing to change the way bail is working. |
I'm fine with that. I can see advantages of both but showing just one error may be less confusing for people. |
Yeah I agree @Sharcoux if you want to take a stab go ahead! |
Pull Request to resolve issue in documentation regarding the |
Just got bitten by this as well. I'd say that the current description of
Bail currently keeps running the remaining tests in a file even when the first one fails i.e. it does not appear to "exit the suite immediately". Or does it mean that it should exit jest (not the test suite) immediately after a single test suite fails? Either way the language and grammar are rather confusing. |
Bail doesn't exit the test suite and is meaningless. This is a bug. Bail should stop testing immediately upon n number of failing and n defaults to 1. Please make sure everyone understands, because you won't understand that this is a bug until you understand this statement: It does not stop immediately upon n (where n=1 as default) fails. Given you understand this, it is a bug and not a "feature" |
@SimenB , what, still no assignee? How many people or likes would it take to finally do anything about this bug? There are two ways: update the docs, reveal the sour truth about "the great misleading of bail", or, to change its behavior to match the docs. The latter is preferable. Who do I need to CC in order to incite the action? |
@dartandrevinsky Please cc yourself and send a PR with a fix. It's an open source project and you're very welcome to help fixing issues you have with it :) |
With all due respect (and do mean respect), Michal, the 'collaborator' badge that you and several other people sport here, suggests you are more capable to address this issue (with no need of assuming the offensive). I apologize if I sounded rude, sorry - I wanted to draw attention to this issue. Apparently it is an issue - it was reported a year ago - there was an argument, yet the OP's reasons seem to outweigh the responses. There is no working |
I still wonder if I have to write different test files for bail to work? Do i need to duplicate same test test to make it work parallel and work with the bail option? Do you have any plans to
using something like |
Opened 2 years ago and still no progress..Well, I have a similar question. How can I force the "describe" test to be counted as a suite? I don't care now if you have a bug or misunderstanding in ocumentation, I just want to tell the Jest what to consider as a test suite, cause now I have 1 test file and several "describe" tests inside and I want each of this "describe" tests to be considered as a Suite, not the file entirely. I need this to see the success/fail rate through the "describe" tests. |
That is the thing, you can't. |
That's sad( I can't seperate my describe block because they are generated inside one file in a foreach loop for cucumber feature files((( |
I'm trying to adopt Jest for a project I'm working on and I got here because it appears "bail" still doesn't halt after a test fails. Is this just a super low priority or what? To me this is a big shortcoming for a test runner to have. I'm surprised this hasn't been fixed. Was there any progress towards a fix or a design to implement this? I'd be happy to help work on a PR if anyone else has an idea where to start. |
Every other test system I've used means I can add Not jest. Please, please, please, fix this? |
To run our large E2E solution that needs to run in order, we needed to have this feature. As a workaround for that, we decided to split tests into different tests files. We replaced:
Hope this will helps folks coming here. |
This issue is stale because it has been open for 1 year with no activity. Remove stale label or comment or this will be closed in 30 days. |
Not stale. Waiting for fix. |
This issue is stale because it has been open for 1 year with no activity. Remove stale label or comment or this will be closed in 30 days. |
Still waiting for a fix |
🐛 Bug Report
Describe doesn't start a test suite, bail doesn't stop the tests after a fail, each doesn't format names correctly, and jest output is so verbose that it overflows my terminal.
To Reproduce
git clone https://github.com/Sharcoux/GoldMines.git
npm i
npm run test
Expected behavior
describe
According to the documentation:
This should start 2 tests suite:
Actual result:
=>
Test Suites: 1 failed, 1 total
bail
According to the documentation:
Running:
npx jest -b
Actual result:
=>
Tests: 23 failed, 10 passed, 33 total
How could 23 tests fail if jest did stop at first failure?
each
According to the documentation:
So this test's name should be 'name', but instead, it's name is '1'...
Actual result:
By the way, "%4$s" doesn't work either....
Link to repl or repo (highly encouraged)
A small repo with a single test file that perfectly illustrate the issue
Run
npx envinfo --preset jest
Paste the results here:
The text was updated successfully, but these errors were encountered: