Skip to content

Commit 6cffa1b

Browse files
committed
update api description, add type test
1 parent b58faf3 commit 6cffa1b

File tree

4 files changed

+6
-2
lines changed

4 files changed

+6
-2
lines changed

docs/JestObjectAPI.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1139,7 +1139,7 @@ test('will fail', () => {
11391139
});
11401140
```
11411141

1142-
`immediately` option is used to retry the failed test immediately.
1142+
`immediately` option is used to retry the failed test immediately after the failure. If this option is not specified, the tests are retried after Jest is finished running all test in a file.
11431143

11441144
```js
11451145
jest.retryTimes(3, {immediately: true});

packages/jest-circus/src/run.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ const _runTestsForDescribeBlock = async (
7878
(global as Global.Global)[WAIT_BEFORE_RETRY] as string,
7979
10,
8080
) || 0;
81+
8182
const retryImmediately: boolean =
8283
// eslint-disable-next-line no-restricted-globals
8384
((global as Global.Global)[IMMEDIATELY] as any) || false;

packages/jest-environment/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,9 +309,9 @@ export interface Jest {
309309
retryTimes(
310310
numRetries: number,
311311
options?: {
312+
immediately?: boolean;
312313
logErrorsBeforeRetry?: boolean;
313314
waitBeforeRetry?: number;
314-
immediately?: boolean;
315315
},
316316
): Jest;
317317
/**

packages/jest-types/__typetests__/jest.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -667,6 +667,9 @@ expect(jest.retryTimes(3, {logErrorsBeforeRetry: 'all'})).type.toRaiseError();
667667
expect(jest.retryTimes({logErrorsBeforeRetry: true})).type.toRaiseError();
668668
expect(jest.retryTimes(3, {waitBeforeRetry: 1000})).type.toEqual<typeof jest>();
669669
expect(jest.retryTimes(3, {waitBeforeRetry: true})).type.toRaiseError();
670+
expect(jest.retryTimes(3, {immediately: true})).type.toEqual<typeof jest>();
671+
expect(jest.retryTimes(3, {immediately: 'now'})).type.toRaiseError();
672+
expect(jest.retryTimes(3, {immediately: 1000})).type.toRaiseError();
670673
expect(jest.retryTimes({logErrorsBeforeRetry: 'all'})).type.toRaiseError();
671674
expect(jest.retryTimes()).type.toRaiseError();
672675

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy