Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions bin/nodeunit
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ var usage = "Usage: nodeunit [options] testmodule1.js testfolder [...] \n" +
" --list-reporters list available build-in reporters\n" +
" -t name, specify a test to run\n" +
" -f fullname, specify a specific test to run. fullname is built so: \"outerGroup - .. - innerGroup - testName\"\n" +
" -nc, --nocolor suppress colorized output\n" +
" -h, --help display this help and exit\n" +
" -v, --version output version information and exit";

Expand Down Expand Up @@ -70,6 +71,8 @@ args.forEach(function (arg) {
testspec_param_found = false;
} else if (arg === '-f') {
testFullSpec_param_found = true;
} else if (arg === '-nc' || arg === '--nocolor') {
options.suppressReporterColor = true;
} else if (testFullSpec_param_found) {
options.testFullSpec= arg;
testFullSpec_param_found = false;
Expand Down
3 changes: 2 additions & 1 deletion bin/nodeunit.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
"bold_prefix": "\u001B[1m",
"bold_suffix": "\u001B[22m",
"assertion_prefix": "\u001B[35m",
"assertion_suffix": "\u001B[39m"
"assertion_suffix": "\u001B[39m",
"suppressReporterColor": false
}
8 changes: 4 additions & 4 deletions lib/reporters/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@ exports.run = function (files, options, callback) {
}

var error = function (str) {
return options.error_prefix + str + options.error_suffix;
return options.suppressReporterColor ? str : options.error_prefix + str + options.error_suffix;
};
var ok = function (str) {
return options.ok_prefix + str + options.ok_suffix;
return options.suppressReporterColor ? str : options.ok_prefix + str + options.ok_suffix;
};
var bold = function (str) {
return options.bold_prefix + str + options.bold_suffix;
return options.suppressReporterColor ? str : options.bold_prefix + str + options.bold_suffix;
};
var assertion_message = function (str) {
return options.assertion_prefix + str + options.assertion_suffix;
return options.suppressReporterColor ? str : options.assertion_prefix + str + options.assertion_suffix;
};

var start = new Date().getTime();
Expand Down