Skip to content

Commit

Permalink
ensure all CLI options have an assigned type; closes #3683
Browse files Browse the repository at this point in the history
  • Loading branch information
boneskull committed Jan 25, 2019
1 parent 27688bc commit 91ca367
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/cli/run-option-metadata.js
Expand Up @@ -28,16 +28,20 @@ exports.types = {
'bail',
'check-leaks',
'color',
'delay',
'diff',
'exit',
'forbid-only',
'forbid-pending',
'full-trace',
'growl',
'inline-diffs',
'interfaces',
'invert',
'no-colors',
'recursive',
'reporters',
'sort',
'watch'
],
number: ['retries', 'slow', 'timeout'],
Expand Down
24 changes: 24 additions & 0 deletions test/node-unit/cli/run.spec.js
@@ -0,0 +1,24 @@
'use strict';

const {builder} = require('../../../lib/cli/run');
const {types} = require('../../../lib/cli/run-option-metadata');

describe('command', function() {
describe('run', function() {
describe('builder', function() {
const IGNORED_OPTIONS = new Set(['help', 'version']);
const options = builder(require('yargs')).getOptions();
['number', 'string', 'boolean', 'array'].forEach(type => {
describe(`${type} type`, function() {
Array.from(new Set(options[type])).forEach(option => {
if (!IGNORED_OPTIONS.has(option)) {
it(`should include option ${option}`, function() {
expect(types[type], 'to contain', option);
});
}
});
});
});
});
});
});

0 comments on commit 91ca367

Please sign in to comment.