mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-31 15:27:50 +00:00
Update vendor/qunit-clib and validate assert counts in each unit test.
This commit is contained in:
798
test/test.js
798
test/test.js
File diff suppressed because it is too large
Load Diff
33
vendor/qunit-clib/qunit-clib.js
vendored
33
vendor/qunit-clib/qunit-clib.js
vendored
@@ -118,9 +118,38 @@
|
||||
/** Used as a horizontal rule in console output */
|
||||
var hr = '----------------------------------------';
|
||||
|
||||
/** Used by `logInline` to clear previously logged messages */
|
||||
var prevLine = '';
|
||||
|
||||
/** Shorten `context.QUnit.QUnit` to `context.QUnit` */
|
||||
var QUnit = context.QUnit = context.QUnit.QUnit || context.QUnit;
|
||||
|
||||
/**
|
||||
* Logs an inline message to standard output.
|
||||
*
|
||||
* @private
|
||||
* @param {string} text The text to log.
|
||||
*/
|
||||
var logInline = (function() {
|
||||
// exit early if not Node.js
|
||||
if (!(typeof process == 'object' && process && process.on && process.stdout)) {
|
||||
return function() {};
|
||||
}
|
||||
// cleanup any inline logs when exited via `ctrl+c`
|
||||
process.on('SIGINT', function() {
|
||||
logInline('');
|
||||
process.exit();
|
||||
});
|
||||
return function(text) {
|
||||
var blankLine = Array(prevLine.length + 1).join(' ');
|
||||
if (text.length > hr.length) {
|
||||
text = text.slice(0, hr.length - 3) + '...';
|
||||
}
|
||||
prevLine = text;
|
||||
process.stdout.write(text + blankLine.slice(text.length) + '\r');
|
||||
}
|
||||
}());
|
||||
|
||||
/**
|
||||
* A logging callback triggered when all testing is completed.
|
||||
*
|
||||
@@ -137,6 +166,7 @@
|
||||
}
|
||||
ran = true;
|
||||
|
||||
logInline('');
|
||||
console.log(hr);
|
||||
console.log(' PASS: ' + details.passed + ' FAIL: ' + details.failed + ' TOTAL: ' + details.total);
|
||||
console.log(' Finished in ' + details.runtime + ' milliseconds.');
|
||||
@@ -230,6 +260,7 @@
|
||||
testName = details.name;
|
||||
|
||||
if (details.failed > 0) {
|
||||
logInline('');
|
||||
if (!modulePrinted) {
|
||||
modulePrinted = true;
|
||||
console.log(hr);
|
||||
@@ -240,6 +271,8 @@
|
||||
assertions.forEach(function(value) {
|
||||
console.log(' ' + value);
|
||||
});
|
||||
} else {
|
||||
logInline('Testing ' + moduleName + '...');
|
||||
}
|
||||
assertions.length = 0;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user