Skip to content

Commit

Permalink
Merge 7db4cf2 into 81d57a0
Browse files Browse the repository at this point in the history
  • Loading branch information
yatharthx committed May 7, 2017
2 parents 81d57a0 + 7db4cf2 commit 46df084
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/cli.js
Expand Up @@ -118,6 +118,10 @@ exports.run = () => {
throw new Error(colors.error(figures.cross) + ' Watch mode is not available in CI, as it prevents AVA from terminating.');
}

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.');
}

if (hasFlag('--require') || hasFlag('-r')) {
throw new Error(colors.error(figures.cross) + ' The --require and -r flags are deprecated. Requirements should be configured in package.json - see documentation.');
}
Expand Down
19 changes: 19 additions & 0 deletions test/cli.js
Expand Up @@ -364,6 +364,25 @@ test('bails when config contains `"tap": true` and `"watch": true`', t => {
});
});

['--concurrency', '-c'].forEach(concurrencyFlag => {
test(`bails when ${concurrencyFlag} provided without value`, t => {
execCli(['test.js', concurrencyFlag], {dirname: 'fixture/concurrency'}, (err, stdout, stderr) => {
t.is(err.code, 1);
t.match(stderr, 'The --concurrency and -c flags must be provided the maximum number of test files to run at once.');
t.end();
});
});
});

['--concurrency', '-c'].forEach(concurrencyFlag => {
test(`works when ${concurrencyFlag} provided with value`, t => {
execCli([`${concurrencyFlag}=1`, 'test.js'], {dirname: 'fixture/concurrency'}, err => {
t.ifError(err);
t.end();
});
});
});

test('--match works', t => {
execCli(['-m=foo', '-m=bar', '-m=!baz', '-m=t* a* f*', '-m=!t* a* n* f*', 'fixture/matcher-skip.js'], err => {
t.ifError(err);
Expand Down
5 changes: 5 additions & 0 deletions test/fixture/concurrency/test.js
@@ -0,0 +1,5 @@
import test from '../../../';

test('works', t => {
t.pass();
});

0 comments on commit 46df084

Please sign in to comment.