Make qunit-clib less chatty for passed tests.

This commit is contained in:
John-David Dalton
2013-09-26 08:12:33 -07:00
parent 62d038b547
commit 639178dbdc

View File

@@ -108,15 +108,19 @@
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
/** Used to report the test module for failing tests */
var moduleName,
modulePrinted;
/** Add `console.log()` support for Narwhal, Rhino, and RingoJS */ /** Add `console.log()` support for Narwhal, Rhino, and RingoJS */
var console = context.console || (context.console = { 'log': context.print }); var console = context.console || (context.console = { 'log': context.print });
/** Shorten `context.QUnit.QUnit` to `context.QUnit` */
var QUnit = context.QUnit = context.QUnit.QUnit || context.QUnit;
/** Used as a horizontal rule in console output */ /** Used as a horizontal rule in console output */
var hr = '----------------------------------------'; var hr = '----------------------------------------';
/** Shorten `context.QUnit.QUnit` to `context.QUnit` */
var QUnit = context.QUnit = context.QUnit.QUnit || context.QUnit;
/** /**
* A logging callback triggered when all testing is completed. * A logging callback triggered when all testing is completed.
* *
@@ -186,9 +190,11 @@
* @param {Object} details An object with property `name`. * @param {Object} details An object with property `name`.
*/ */
QUnit.moduleStart(function(details) { QUnit.moduleStart(function(details) {
console.log(hr); var newModuleName = details.name;
console.log(details.name); if (moduleName != newModuleName) {
console.log(hr); moduleName = newModuleName;
modulePrinted = false;
}
}); });
/** /**
@@ -224,14 +230,17 @@
testName = details.name; testName = details.name;
if (details.failed > 0) { if (details.failed > 0) {
if (!modulePrinted) {
modulePrinted = true;
console.log(hr);
console.log(moduleName);
console.log(hr);
}
console.log(' FAIL - '+ testName); console.log(' FAIL - '+ testName);
assertions.forEach(function(value) { assertions.forEach(function(value) {
console.log(' ' + value); console.log(' ' + value);
}); });
} }
else {
console.log(' PASS - ' + testName);
}
assertions.length = 0; assertions.length = 0;
}); });
@@ -244,7 +253,7 @@
QUnit.config.testStats = { QUnit.config.testStats = {
/** /**
* An array of test summaries (pipe separated). * An array of test summaries.
* *
* @memberOf QUnit.config.testStats * @memberOf QUnit.config.testStats
* @type Array * @type Array