diff options
Diffstat (limited to 'node_modules/ava/lib/cli.js')
-rw-r--r-- | node_modules/ava/lib/cli.js | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/node_modules/ava/lib/cli.js b/node_modules/ava/lib/cli.js index 5649a8190..0c2c2f82f 100644 --- a/node_modules/ava/lib/cli.js +++ b/node_modules/ava/lib/cli.js @@ -43,7 +43,7 @@ exports.run = () => { --match, -m Only run tests with matching title (Can be repeated) --watch, -w Re-run tests when tests and source files change --timeout, -T Set global timeout - --concurrency, -c Maximum number of test files running at the same time (EXPERIMENTAL) + --concurrency, -c Max number of test files running at the same time (Default: CPU cores) --update-snapshots, -u Update snapshots Examples @@ -75,7 +75,7 @@ exports.run = () => { ], default: { cache: conf.cache, - color: 'color' in conf ? conf.color : require('supports-color') !== false, + color: 'color' in conf ? conf.color : require('supports-color').stdout !== false, concurrency: conf.concurrency, failFast: conf.failFast, init: conf.init, @@ -119,7 +119,12 @@ exports.run = () => { } if (cli.flags.concurrency === '') { - throw new Error(colors.error(figures.cross) + ' The --concurrency and -c flags must be provided the maximum number of test files to run at once.'); + throw new Error(colors.error(figures.cross) + ' The --concurrency and -c flags must be provided.'); + } + + if (cli.flags.concurrency && + (!Number.isInteger(Number.parseFloat(cli.flags.concurrency)) || parseInt(cli.flags.concurrency, 10) < 0)) { + throw new Error(colors.error(figures.cross) + ' The --concurrency and -c flags must be a nonnegative integer.'); } if (hasFlag('--require') || hasFlag('-r')) { @@ -144,6 +149,7 @@ exports.run = () => { timeout: conf.timeout, concurrency: conf.concurrency ? parseInt(conf.concurrency, 10) : 0, updateSnapshots: conf.updateSnapshots, + snapshotDir: conf.snapshotDir ? path.resolve(projectDir, conf.snapshotDir) : null, color: conf.color }); @@ -152,7 +158,7 @@ exports.run = () => { if (conf.tap && !conf.watch) { reporter = new TapReporter(); } else if (conf.verbose || isCi) { - reporter = new VerboseReporter({color: conf.color}); + reporter = new VerboseReporter({color: conf.color, watching: conf.watch}); } else { reporter = new MiniReporter({color: conf.color, watching: conf.watch}); } |