Commit 0c6c94c0 authored by Iuri Matias's avatar Iuri Matias

track passing/failing tests

parent d0ba2f34
...@@ -16,7 +16,9 @@ function runTest(testName, testObject, callback) { ...@@ -16,7 +16,9 @@ function runTest(testName, testObject, callback) {
runList.push({name: func.name, type: 'test', constant: func.constant}); runList.push({name: func.name, type: 'test', constant: func.constant});
} }
console.log("#" + testName); let passingNum = 0, failureNum = 0;
console.log(("#" + testName).green);
async.eachOfLimit(runList, 1, function(func, index, next) { async.eachOfLimit(runList, 1, function(func, index, next) {
let method = testObject.methods[func.name].apply(testObject.methods[func.name], []); let method = testObject.methods[func.name].apply(testObject.methods[func.name], []);
if (func.constant) { if (func.constant) {
...@@ -26,8 +28,10 @@ function runTest(testName, testObject, callback) { ...@@ -26,8 +28,10 @@ function runTest(testName, testObject, callback) {
// decide how to handle the output (so works both in console and // decide how to handle the output (so works both in console and
// browser) // browser)
console.log("\t✓ ".green.bold + changeCase.sentenceCase(func.name).grey); console.log("\t✓ ".green.bold + changeCase.sentenceCase(func.name).grey);
passingNum += 1;
} else { } else {
console.log("\t✘ ".bold.red + changeCase.sentenceCase(func.name).red); console.log("\t✘ ".bold.red + changeCase.sentenceCase(func.name).red);
failureNum += 1;
} }
next(); next();
}); });
...@@ -37,8 +41,12 @@ function runTest(testName, testObject, callback) { ...@@ -37,8 +41,12 @@ function runTest(testName, testObject, callback) {
}); });
} }
}, function() { }, function() {
console.log("1 passing".green); if (passingNum > 0) {
console.log("1 failing".red); console.log((passingNum + " passing").green);
}
if (failureNum > 0) {
console.log((failureNum + " failing").red);
}
}); });
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment