(yargs: Yargs.Argv<T>)
| 39 | } |
| 40 | |
| 41 | export function commandLineArgs<T = Record<string, unknown>>(yargs: Yargs.Argv<T>) { |
| 42 | return yargs |
| 43 | .parserConfiguration({ |
| 44 | 'camel-case-expansion': false, |
| 45 | }) |
| 46 | // TODO: add description |
| 47 | .command('$0 [tests..]', '') |
| 48 | .option('debug', { |
| 49 | type: 'boolean', |
| 50 | default: false, |
| 51 | desc: 'Execute tests in debug mode', |
| 52 | }) |
| 53 | .option('headless', { |
| 54 | type: 'boolean', |
| 55 | desc: 'Whether to run tests headless. If unspecified, the default depends on the `debug` option', |
| 56 | }) |
| 57 | .option('coverage', { |
| 58 | type: 'boolean', |
| 59 | default: false, |
| 60 | desc: 'Enable coverage reporting', |
| 61 | }) |
| 62 | .option('artifacts-dir', { |
| 63 | type: 'string', |
| 64 | desc: 'Path to a directory to store test artifacts in (e.g. coverage reports)', |
| 65 | }) |
| 66 | .option('chrome-binary', { |
| 67 | type: 'string', |
| 68 | desc: 'Path to a custom Chrome binary to run', |
| 69 | }) |
| 70 | .option('on-diff', { |
| 71 | type: 'string', |
| 72 | coerce: validateDiffBehaviors, |
| 73 | choices: Object.values(DiffBehaviors), |
| 74 | desc: 'Define how to deal with diffs in snapshots/screenshots', |
| 75 | }) |
| 76 | .option('verbose', { |
| 77 | alias: 'v', |
| 78 | type: 'count', |
| 79 | desc: 'Increases the log level', |
| 80 | }) |
| 81 | .option('shuffle', { |
| 82 | type: 'boolean', |
| 83 | desc: 'Execute tests in random order', |
| 84 | default: false, |
| 85 | }) |
| 86 | .option('repeat', { |
| 87 | type: 'number', |
| 88 | default: 1, |
| 89 | desc: 'Reruns the test X number of times regardless of result (e2e tests only)', |
| 90 | }) |
| 91 | .option('retries', { |
| 92 | type: 'number', |
| 93 | desc: 'Reruns the tests if upon failure at max X number of times', |
| 94 | default: 0, |
| 95 | }) |
| 96 | .option('grep', { |
| 97 | type: 'string', |
| 98 | conflicts: 'fgrep', |
no test coverage detected