-
-
Notifications
You must be signed in to change notification settings - Fork 27k
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 --bail #6496
Comments
you can pass your own command line arguments to yarn test and it will get forwarded. So: |
@bugzpodder I tried your advice, it seems subsequent tests are still run after a test or hook fails. That's not what I expect from
Maybe I'm misinterpreting the expected behavior here? Isn't supposed to |
I just ran: |
@bugzpodder Here is a minimal repro I prepared: https://github.com/leontastic/react-scripts-test-script-doesnt-accept-jest-bail-config The repro was created by calling Here is my output running leonli@Leons-MBP:react-scripts-test-script-doesnt-accept-jest-bail-config (master)$ yarn test --watchAll=false --bail
yarn run v1.12.3
$ react-scripts test --watchAll=false --bail
FAIL src/App.test.js
✓ renders without crashing (22ms)
✕ should fail (4ms)
✕ should not run this test
● should fail
fail
10 |
11 | it('should fail', () => {
> 12 | throw new Error('fail')
| ^
13 | });
14 |
15 | it('should not run this test', () => {
at Object.<anonymous>.it (src/App.test.js:12:9)
● should not run this test
fail
14 |
15 | it('should not run this test', () => {
> 16 | throw new Error('fail')
| ^
17 | });
18 |
at Object.<anonymous>.it (src/App.test.js:16:9)
Test Suites: 1 failed, 1 total
Tests: 2 failed, 1 passed, 3 total
Snapshots: 0 total
Time: 1.017s
Ran all test suites.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. Clearly the subsequent failing test is being run here, where I would expect |
Note that jest runs a small number of tests in parallel by default, you'll have to disable it using another flag: https://jestjs.io/docs/en/cli#maxconcurrency-num |
I did more digging and it looks like this behavior is by design 😱jestjs/jest#7434 I guess this makes this issue out of CRA's control, I'll close this issue and hope someone fixes this in Jest soon or PR Jest myself if there's no progress 😕 Thank you for your time and patience looking into this @bugzpodder 😄 |
Is this a bug report?
No
Feature Request: Support jest
--bail
I would like to override the CRA test script with
--bail
. I can't imagine this would break anything in CRA, but I don't want tonpm run eject
just because I can't bail on the first test.The text was updated successfully, but these errors were encountered: