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