Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix couple errors missing codes #3666

Merged
merged 2 commits into from Jan 17, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 9 additions & 4 deletions lib/cli/run.js
Expand Up @@ -11,6 +11,7 @@ const Mocha = require('../mocha');
const ansi = require('ansi-colors');
const errors = require('../errors');
const createInvalidArgumentValueError = errors.createInvalidArgumentValueError;
const createMissingArgumentError = errors.createMissingArgumentError;

const {
list,
Expand Down Expand Up @@ -258,15 +259,19 @@ exports.builder = yargs =>

// yargs.implies() isn't flexible enough to handle this
if (argv.invert && !('fgrep' in argv || 'grep' in argv)) {
throw new Error(
'"--invert" requires one of "--fgrep <str>" or "--grep <regexp>"'
throw createMissingArgumentError(
'"--invert" requires one of "--fgrep <str>" or "--grep <regexp>"',
'--invert',
vkarpov15 marked this conversation as resolved.
Show resolved Hide resolved
argv.invert
vkarpov15 marked this conversation as resolved.
Show resolved Hide resolved
);
}

if (argv.compilers) {
throw new Error(
throw createInvalidArgumentValueError(
`--compilers is DEPRECATED and no longer supported.
See ${ansi.cyan('https://git.io/vdcSr')} for migration information.`
See ${ansi.cyan('https://git.io/vdcSr')} for migration information.`,
'--compilers',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-- not needed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps more to the point:

        throw createNotSupportedError(
          `--compilers is DEPRECATED and no longer supported.
          See ${ansi.cyan('https://git.io/vdcSr')} for migration information.`
        );

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not addressed

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll fix it after merge.

argv.compilers
);
}

Expand Down
20 changes: 20 additions & 0 deletions test/integration/options.spec.js
Expand Up @@ -346,6 +346,26 @@ describe('options', function() {
done();
});
});

it('fails if no --grep', function(done) {
vkarpov15 marked this conversation as resolved.
Show resolved Hide resolved
args = ['--invert'];
runMocha(
'options/grep.fixture.js',
args,
function(err, res) {
if (err) {
done(err);
return;
}
expect(res, 'to satisfy', {
code: 1,
output: /fgrep/
vkarpov15 marked this conversation as resolved.
Show resolved Hide resolved
vkarpov15 marked this conversation as resolved.
Show resolved Hide resolved
});
done();
},
{stdio: 'pipe'}
);
});
});
});

Expand Down