Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
palmerj3 committed Jun 21, 2018
1 parent 65cdbc8 commit e011fe9
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 5 deletions.
2 changes: 2 additions & 0 deletions TestUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ const DEFAULT_GLOBAL_CONFIG: GlobalConfig = {
testNamePattern: '',
testPathPattern: '',
testResultsProcessor: null,
testRetries: 0,
updateSnapshot: 'none',
useStderr: false,
verbose: false,
Expand Down Expand Up @@ -108,6 +109,7 @@ const DEFAULT_PROJECT_CONFIG: ProjectConfig = {
testMatch: [],
testPathIgnorePatterns: [],
testRegex: '.test.js$',
testRetries: 0,
testRunner: 'jest-jasmine2',
testURL: '',
timers: 'real',
Expand Down
2 changes: 2 additions & 0 deletions e2e/__tests__/__snapshots__/show_config.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ exports[`--showConfig outputs config info and exits 1`] = `
\\"/node_modules/\\"
],
\\"testRegex\\": \\"\\",
\\"testRetries\\": 0,
\\"testRunner\\": \\"<<REPLACED_JEST_PACKAGES_DIR>>/jest-jasmine2/build/index.js\\",
\\"testURL\\": \\"about:blank\\",
\\"timers\\": \\"real\\",
Expand Down Expand Up @@ -106,6 +107,7 @@ exports[`--showConfig outputs config info and exits 1`] = `
\\"testFailureExitCode\\": 1,
\\"testPathPattern\\": \\"\\",
\\"testResultsProcessor\\": null,
\\"testRetries\\": 0,
\\"updateSnapshot\\": \\"all\\",
\\"useStderr\\": false,
\\"verbose\\": null,
Expand Down
5 changes: 4 additions & 1 deletion packages/jest-cli/src/cli/args.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ export const check = (argv: Argv) => {
}

const intRetries = parseInt(argv.testRetries, 10);
if (isNaN(intRetries) || intRetries < 0) {
if (
(argv.hasOwnProperty('testRetries') && isNaN(intRetries)) ||
intRetries < 0
) {
throw new Error(
'The --testRetries option requires a positive integer to be specified.\n' +
'Example usage: jest --testRetries=3',
Expand Down
2 changes: 1 addition & 1 deletion types/Argv.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export type Argv = {|
testPathPattern: Array<string>,
testRegex: string,
testResultsProcessor: ?string,
testRetries: ?string,
testRetries: number,
testRunner: string,
testURL: string,
timers: 'real' | 'fake',
Expand Down
6 changes: 3 additions & 3 deletions types/Config.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export type DefaultOptions = {|
testPathIgnorePatterns: Array<string>,
testRegex: string,
testResultsProcessor: ?string,
testRetries: string | number,
testRetries: ?number,
testRunner: ?string,
testURL: string,
timers: 'real' | 'fake',
Expand Down Expand Up @@ -164,7 +164,7 @@ export type InitialOptions = {
testPathIgnorePatterns?: Array<string>,
testRegex?: string,
testResultsProcessor?: ?string,
testRetries?: string | number,
testRetries?: ?number,
testRunner?: string,
testURL?: string,
timers?: 'real' | 'fake',
Expand Down Expand Up @@ -280,7 +280,7 @@ export type ProjectConfig = {|
testLocationInResults: boolean,
testPathIgnorePatterns: Array<string>,
testRegex: string,
testRetries: ?string,
testRetries: number,
testRunner: string,
testURL: string,
timers: 'real' | 'fake',
Expand Down

0 comments on commit e011fe9

Please sign in to comment.