(argv: Config.Argv)
| 10 | import {constants, isJSONString} from 'jest-config'; |
| 11 | |
| 12 | export function check(argv: Config.Argv): true { |
| 13 | if ( |
| 14 | argv.runInBand && |
| 15 | Object.prototype.hasOwnProperty.call(argv, 'maxWorkers') |
| 16 | ) { |
| 17 | throw new Error( |
| 18 | 'Both --runInBand and --maxWorkers were specified, only one is allowed.', |
| 19 | ); |
| 20 | } |
| 21 | |
| 22 | for (const key of [ |
| 23 | 'onlyChanged', |
| 24 | 'lastCommit', |
| 25 | 'changedFilesWithAncestor', |
| 26 | 'changedSince', |
| 27 | ]) { |
| 28 | if (argv[key] && argv.watchAll) { |
| 29 | throw new Error( |
| 30 | `Both --${key} and --watchAll were specified, but cannot be used ` + |
| 31 | 'together. Try the --watch option which reruns only tests ' + |
| 32 | 'related to changed files.', |
| 33 | ); |
| 34 | } |
| 35 | } |
| 36 | |
| 37 | if (argv.onlyFailures && argv.watchAll) { |
| 38 | throw new Error( |
| 39 | 'Both --onlyFailures and --watchAll were specified, only one is allowed.', |
| 40 | ); |
| 41 | } |
| 42 | |
| 43 | if (argv.findRelatedTests && argv._.length === 0) { |
| 44 | throw new Error( |
| 45 | 'The --findRelatedTests option requires file paths to be specified.\n' + |
| 46 | 'Example usage: jest --findRelatedTests ./src/source.js ' + |
| 47 | './src/index.js.', |
| 48 | ); |
| 49 | } |
| 50 | |
| 51 | if ( |
| 52 | Object.prototype.hasOwnProperty.call(argv, 'maxWorkers') && |
| 53 | argv.maxWorkers === undefined |
| 54 | ) { |
| 55 | throw new Error( |
| 56 | 'The --maxWorkers (-w) option requires a number or string to be specified.\n' + |
| 57 | 'Example usage: jest --maxWorkers 2\n' + |
| 58 | 'Example usage: jest --maxWorkers 50%\n' + |
| 59 | 'Or did you mean --watch?', |
| 60 | ); |
| 61 | } |
| 62 | |
| 63 | if (argv.selectProjects && argv.selectProjects.length === 0) { |
| 64 | throw new Error( |
| 65 | 'The --selectProjects option requires the name of at least one project to be specified.\n' + |
| 66 | 'Example usage: jest --selectProjects my-first-project my-second-project', |
| 67 | ); |
| 68 | } |
| 69 |
no test coverage detected