Skip to content

armgit / mocha

Public Imported from GitHub
0

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

Add prefix `list-` to --interfaces and --reporters options (#3962)

Park Seong-beom9d3c58421ff8
diff --git a/docs/index.md b/docs/index.md
index 8bb36e26..3e00e346 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -892,8 +892,8 @@ Positional Arguments
Other Options
--help, -h Show usage information & exit [boolean]
--version, -V Show version number & exit [boolean]
- --interfaces List built-in user interfaces & exit [boolean]
- --reporters List built-in reporters & exit [boolean]
+ --list-interfaces List built-in user interfaces & exit [boolean]
+ --list-reporters List built-in reporters & exit [boolean]
Mocha Resources
Chat: https://gitter.im/mochajs/mocha
diff --git a/lib/cli/one-and-dones.js b/lib/cli/one-and-dones.js
index c981b4bb..56fc1af0 100644
--- a/lib/cli/one-and-dones.js
+++ b/lib/cli/one-and-dones.js
@@ -48,14 +48,14 @@ exports.ONE_AND_DONES = {
* Dump list of built-in interfaces
* @private
*/
- interfaces: () => {
+ 'list-interfaces': () => {
showKeys(Mocha.interfaces);
},
/**
* Dump list of built-in reporters
* @private
*/
- reporters: () => {
+ 'list-reporters': () => {
showKeys(Mocha.reporters);
}
};
diff --git a/lib/cli/run-option-metadata.js b/lib/cli/run-option-metadata.js
index fbc4ea90..d146ceec 100644
--- a/lib/cli/run-option-metadata.js
+++ b/lib/cli/run-option-metadata.js
@@ -36,11 +36,11 @@ exports.types = {
'full-trace',
'growl',
'inline-diffs',
- 'interfaces',
'invert',
+ 'list-interfaces',
+ 'list-reporters',
'no-colors',
'recursive',
- 'reporters',
'sort',
'watch'
],
diff --git a/lib/cli/run.js b/lib/cli/run.js
index bb7c0219..dc94c101 100644
--- a/lib/cli/run.js
+++ b/lib/cli/run.js
@@ -147,14 +147,18 @@ exports.builder = yargs =>
'Display actual/expected differences inline within each string',
group: GROUPS.OUTPUT
},
- interfaces: {
- conflicts: Array.from(ONE_AND_DONE_ARGS),
- description: 'List built-in user interfaces & exit'
- },
invert: {
description: 'Inverts --grep and --fgrep matches',
group: GROUPS.FILTERS
},
+ 'list-interfaces': {
+ conflicts: Array.from(ONE_AND_DONE_ARGS),
+ description: 'List built-in user interfaces & exit'
+ },
+ 'list-reporters': {
+ conflicts: Array.from(ONE_AND_DONE_ARGS),
+ description: 'List built-in reporters & exit'
+ },
'no-colors': {
description: 'Force-disable color output',
group: GROUPS.OUTPUT,
@@ -183,10 +187,6 @@ exports.builder = yargs =>
group: GROUPS.OUTPUT,
requiresArg: true
},
- reporters: {
- conflicts: Array.from(ONE_AND_DONE_ARGS),
- description: 'List built-in reporters & exit'
- },
'reporter-option': {
coerce: opts =>
list(opts).reduce((acc, opt) => {
diff --git a/test/integration/options/interfaces.spec.js b/test/integration/options/listInterfaces.spec.js
similarity index 89%
rename from test/integration/options/interfaces.spec.js
rename to test/integration/options/listInterfaces.spec.js
index 7c58b89d..a9c18a11 100644
--- a/test/integration/options/interfaces.spec.js
+++ b/test/integration/options/listInterfaces.spec.js
@@ -5,7 +5,7 @@ var invokeMocha = helpers.invokeMocha;
var escapeRegExp = helpers.escapeRegExp;
var interfaces = require('../../../lib/mocha').interfaces;
-describe('--interfaces', function() {
+describe('--list-interfaces', function() {
it('should dump a list of all interfaces with descriptions', function(done) {
var expected = Object.keys(interfaces)
.filter(function(name) {
@@ -18,7 +18,7 @@ describe('--interfaces', function() {
};
});
- invokeMocha(['--interfaces'], function(err, result) {
+ invokeMocha(['--list-interfaces'], function(err, result) {
if (err) {
return done(err);
}
diff --git a/test/integration/options/reporters.spec.js b/test/integration/options/listReporters.spec.js
similarity index 90%
rename from test/integration/options/reporters.spec.js
rename to test/integration/options/listReporters.spec.js
index 650c65ed..6cf06e94 100644
--- a/test/integration/options/reporters.spec.js
+++ b/test/integration/options/listReporters.spec.js
@@ -5,7 +5,7 @@ var invokeMocha = helpers.invokeMocha;
var escapeRegExp = helpers.escapeRegExp;
var reporters = require('../../../lib/mocha').reporters;
-describe('--reporters', function() {
+describe('--list-reporters', function() {
it('should dump a list of all reporters with descriptions', function(done) {
var expected = Object.keys(reporters)
.filter(function(name) {
@@ -21,7 +21,7 @@ describe('--reporters', function() {
};
});
- invokeMocha(['--reporters'], function(err, result) {
+ invokeMocha(['--list-reporters'], function(err, result) {
if (err) {
return done(err);
}