Update vendor/qunit-extras.

This commit is contained in:
John-David Dalton
2014-04-28 00:47:21 -07:00
parent e86144bb06
commit a24ee0a331

View File

@@ -1,5 +1,5 @@
/*!
* QUnit Extras v1.0.0
* QUnit Extras v1.1.0
* Copyright 2011-2014 John-David Dalton <http://allyoucanleet.com/>
* Based on a gist by Jörn Zaefferer <https://gist.github.com/722381>
* Available under MIT license <http://mths.be/mit>
@@ -24,10 +24,12 @@
reMessage = /^<span class='test-message'>([\s\S]*?)<\/span>/;
/** Used to associate color names with their corresponding codes */
var colorCodes = {
'blue': 34,
var ansiCodes = {
'bold': 1,
'green': 32,
'red': 31
'magenta': 35,
'red': 31,
'white': 37
};
/** Used to convert HTML entities to characters */
@@ -177,7 +179,7 @@
var isSilent = document && !isPhantomPage;
/** Used to indicate if running in Windows */
var isWindows = /win/i.test(os);
var isWindows = /\bwin/i.test(os);
/** Used to display the wait throbber */
var throbberDelay = 500,
@@ -275,10 +277,10 @@
* @returns {string} Returns the colored string.
*/
function color(colorName, string) {
var code = colorCodes[colorName];
var code = ansiCodes[colorName];
return isWindows
? string
: ('\x1b[' + code + 'm' + string + '\x1b[0m');
: ('\x1B[' + code + 'm' + string + '\x1B[0m');
}
/**
@@ -454,11 +456,11 @@
ran = true;
var failures = details.failed;
var statusColor = failures ? 'magenta' : 'green';
logInline('');
console.log(hr);
console.log(color('blue', ' PASS: ' + details.passed + ' FAIL: ' + failures + ' TOTAL: ' + details.total));
console.log(color(failures ? 'red' : 'green',' Finished in ' + details.runtime + ' milliseconds.'));
console.log(color(statusColor, ' PASS: ' + details.passed + ' FAIL: ' + failures + ' TOTAL: ' + details.total));
console.log(color(statusColor, ' Finished in ' + details.runtime + ' milliseconds.'));
console.log(hr);
// exit out of Node.js or PhantomJS
@@ -513,10 +515,10 @@
if (!modulePrinted) {
modulePrinted = true;
console.log(hr);
console.log(color('blue', moduleName));
console.log(color('bold', moduleName));
console.log(hr);
}
console.log(' ' + (failures ? color('red', 'FAIL') : color('green', 'PASS')) + ' - ' + color('blue', testName));
console.log(' ' + (failures ? color('red', 'FAIL') : color('green', 'PASS')) + ' - ' + testName);
if (!failures) {
return;
@@ -535,12 +537,12 @@
var message = [
result ? color('green', 'PASS') : color('red', 'FAIL'),
color('blue', type),
color('blue', entry.message || 'ok')
type,
entry.message || 'ok'
];
if (!result && type == 'EQ') {
message.push(color('blue', 'Expected: ' + expected + ', Actual: ' + entry.actual));
message.push(color('magenta', 'Expected: ' + expected + ', Actual: ' + entry.actual));
}
console.log(' ' + message.join(' | '));
}