-
Notifications
You must be signed in to change notification settings - Fork 376
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updates test framework to check for config and give a better error me…
…ssage Also, don't run a protocol if not configured (and specially don't return error code for it)
- Loading branch information
Showing
3 changed files
with
57 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
var util = require("util"); | ||
|
||
exports.info = buildMethod(process.stdout, "[i]", 34); | ||
exports.error = buildMethod(process.stderr, "[!]", 31); | ||
|
||
function buildMethod(stream, prefix, color) { | ||
return function () { | ||
var params = Array.prototype.slice.apply(arguments); | ||
var text = params.shift(); | ||
|
||
return printTo(stream, prefix + " ", color, text, params); | ||
}; | ||
} | ||
|
||
function printTo(stream, prefix, color, text, params) { | ||
params.unshift(text); | ||
text = util.format.apply(util, params); | ||
|
||
stream.write(printColor(color, true) + prefix + printColor(color) + text.replace(/\*\*(.+?)\*\*/, function (m, t) { | ||
return printColor(color, true) + t + printColor(color); | ||
}) + printColor(null) + "\n"); | ||
} | ||
|
||
function printColor(color, bold) { | ||
if (color === null) { | ||
return "\033[0m"; | ||
} | ||
return "\033[" + (bold ? "1" : "0") + ";" + color + "m"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters