Skip to content

armgit / mocha

Public Imported from GitHub
0

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

_mocha: Allow boolean --reporter-options

Andreas Lind637941430d4a
diff --git a/bin/_mocha b/bin/_mocha
index aa999a28..63ab9a42 100755
--- a/bin/_mocha
+++ b/bin/_mocha
@@ -195,10 +195,13 @@ var reporterOptions = {};
if (program.reporterOptions !== undefined) {
program.reporterOptions.split(",").forEach(function(opt) {
var L = opt.split("=");
- if (L.length != 2) {
+ if (L.length > 2 || L.length === 0) {
throw new Error("invalid reporter option '" + opt + "'");
+ } else if (L.length === 2) {
+ reporterOptions[L[0]] = L[1];
+ } else {
+ reporterOptions[L[0]] = true;
}
- reporterOptions[L[0]] = L[1];
});
}