Skip to content

armgit / mocha

Public Imported from GitHub
0

☕️ Classic, reliable, trusted test framework for Node.js and the browser

ensure all CLI options have an assigned type; closes #3683

Christopher Hiller91ca36700a46
diff --git a/lib/cli/run-option-metadata.js b/lib/cli/run-option-metadata.js
index a8975701..0838e605 100644
--- a/lib/cli/run-option-metadata.js
+++ b/lib/cli/run-option-metadata.js
@@ -28,6 +28,7 @@ exports.types = {
'bail',
'check-leaks',
'color',
+ 'delay',
'diff',
'exit',
'forbid-only',
@@ -35,9 +36,12 @@ exports.types = {
'full-trace',
'growl',
'inline-diffs',
+ 'interfaces',
'invert',
'no-colors',
'recursive',
+ 'reporters',
+ 'sort',
'watch'
],
number: ['retries', 'slow', 'timeout'],
diff --git a/test/node-unit/cli/run.spec.js b/test/node-unit/cli/run.spec.js
new file mode 100644
index 00000000..6dfe5aaa
--- /dev/null
+++ b/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);
+ });
+ }
+ });
+ });
+ });
+ });
+ });
+});