jest.retryTimes doesn't work
See original GitHub issueI’m trying to setup retry mechanism that uses jest-circus runner. I did follow exactly sample but it didn’t work. I remember it used to work before, but now it couldn’t work anymore. My code is below, could you please give me some glue?
jest.retryTimes(3)
it('will fail', () => {
expect(true).toBe(false)
})
My running command is: yarn test "<path to the test>" --testRunner="jest-circus/runner" --runInBand
Type script: 4.0.2
Jest: 24.0.13
Jest-circus: 26.6.3
Node: 10.12.27
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:7 (1 by maintainers)
Top Results From Across the Web
how to make a jest test fail at first time even using jest ...
not working. i'm setting retryTimes(4) in a script loaded by setupFilesAfterEnv in the jest.config.js , but even setting retryTimes(1) in ...
Read more >The Jest Object
retryTimes(numRetries, options) . Runs failed tests n-times until they pass or until the max number of retries is exhausted. options are ...
Read more >Why auto-retry test execution in a test framework is wrong?
jest.retryTimes(3) //set maximum retries number describe('Test', ... that adding 'retryTimes' to a test framework does not sound 'right'.
Read more >Jest Object (API Reference) - w3resource
This will only work with jest-circus! A test Example: jest.retryTimes(3); test('will fail', () => { expect(true).toBe( ...
Read more >The Jest Object - API Manual
Runs failed tests n-times until they pass or until the max number of retries is exhausted. This only works with jest-circus! Example in...
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
So I actually found myself here thinking the same thing, i.e. that
jest.retryTimes
was not working…However I just realized I was being misled since it just doesn’t output anything in console to tell you it is retrying the test – instead it just does it silently
So it is indeed actually working as expected, as the e2e tests linked above actually shows if you run it yourself
So the OP’s example test will always say failing even with his retry statement since true will never become false by itself, even after 3 tries
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.