Skip to content

Commit fb1422e

Browse files
committed
Update tests
1 parent 78f5ba3 commit fb1422e

File tree

5 files changed

+12
-5
lines changed

5 files changed

+12
-5
lines changed

TestUtils.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ const DEFAULT_GLOBAL_CONFIG: GlobalConfig = {
5656
testNamePattern: '',
5757
testPathPattern: '',
5858
testResultsProcessor: null,
59+
testRetries: 0,
5960
updateSnapshot: 'none',
6061
useStderr: false,
6162
verbose: false,
@@ -108,6 +109,7 @@ const DEFAULT_PROJECT_CONFIG: ProjectConfig = {
108109
testMatch: [],
109110
testPathIgnorePatterns: [],
110111
testRegex: '.test.js$',
112+
testRetries: 0,
111113
testRunner: 'jest-jasmine2',
112114
testURL: '',
113115
timers: 'real',

e2e/__tests__/__snapshots__/show_config.test.js.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ exports[`--showConfig outputs config info and exits 1`] = `
5757
\\"/node_modules/\\"
5858
],
5959
\\"testRegex\\": \\"\\",
60+
\\"testRetries\\": 0,
6061
\\"testRunner\\": \\"<<REPLACED_JEST_PACKAGES_DIR>>/jest-jasmine2/build/index.js\\",
6162
\\"testURL\\": \\"about:blank\\",
6263
\\"timers\\": \\"real\\",
@@ -106,6 +107,7 @@ exports[`--showConfig outputs config info and exits 1`] = `
106107
\\"testFailureExitCode\\": 1,
107108
\\"testPathPattern\\": \\"\\",
108109
\\"testResultsProcessor\\": null,
110+
\\"testRetries\\": 0,
109111
\\"updateSnapshot\\": \\"all\\",
110112
\\"useStderr\\": false,
111113
\\"verbose\\": null,

packages/jest-cli/src/cli/args.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,10 @@ export const check = (argv: Argv) => {
5252
}
5353

5454
const intRetries = parseInt(argv.testRetries, 10);
55-
if (isNaN(intRetries) || intRetries < 0) {
55+
if (
56+
(argv.hasOwnProperty('testRetries') && isNaN(intRetries)) ||
57+
intRetries < 0
58+
) {
5659
throw new Error(
5760
'The --testRetries option requires a positive integer to be specified.\n' +
5861
'Example usage: jest --testRetries=3',

types/Argv.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ export type Argv = {|
8282
testPathPattern: Array<string>,
8383
testRegex: string,
8484
testResultsProcessor: ?string,
85-
testRetries: ?string,
85+
testRetries: number,
8686
testRunner: string,
8787
testURL: string,
8888
timers: 'real' | 'fake',

types/Config.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export type DefaultOptions = {|
7474
testPathIgnorePatterns: Array<string>,
7575
testRegex: string,
7676
testResultsProcessor: ?string,
77-
testRetries: string | number,
77+
testRetries: ?number,
7878
testRunner: ?string,
7979
testURL: string,
8080
timers: 'real' | 'fake',
@@ -164,7 +164,7 @@ export type InitialOptions = {
164164
testPathIgnorePatterns?: Array<string>,
165165
testRegex?: string,
166166
testResultsProcessor?: ?string,
167-
testRetries?: string | number,
167+
testRetries?: ?number,
168168
testRunner?: string,
169169
testURL?: string,
170170
timers?: 'real' | 'fake',
@@ -279,7 +279,7 @@ export type ProjectConfig = {|
279279
testLocationInResults: boolean,
280280
testPathIgnorePatterns: Array<string>,
281281
testRegex: string,
282-
testRetries: ?string,
282+
testRetries: number,
283283
testRunner: string,
284284
testURL: string,
285285
timers: 'real' | 'fake',

0 commit comments

Comments
 (0)