Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

lodash

Package Overview
Dependencies
Maintainers
1
Versions
114
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lodash - npm Package Compare versions

Comparing version 0.3.0 to 0.3.1

vendor/qunit/addons/phantomjs/README.md

2

package.json
{
"name": "lodash",
"version": "0.3.0",
"version": "0.3.1",
"description": "A drop-in replacement for Underscore.js that delivers performance improvements, bug fixes, and additional features.",

@@ -5,0 +5,0 @@ "homepage": "http://lodash.com",

@@ -152,5 +152,5 @@ (function(window) {

slowestHz = slowest[0] == this[0] ? lodashHz : underscoreHz,
percent = formatNumber(Math.round(((fastestHz / slowestHz) - 1) * 100));
percent = ((fastestHz / slowestHz) - 1) * 100;
log(fastest[0].name + ' is ' + percent + '% faster.');
log(fastest[0].name + ' is ' + formatNumber(percent < 1 ? percent.toFixed(2) : Math.round(percent)) + '% faster.');
}

@@ -484,2 +484,14 @@ // add score adjusted for margin of error

suites.push(
Benchmark.Suite('shuffle')
.add('Lo-Dash', function() {
lodash.shuffle(numbers);
})
.add('Underscore', function() {
_.shuffle(numbers);
})
);
/*--------------------------------------------------------------------------*/
suites.push(
Benchmark.Suite('sortBy callback')

@@ -609,6 +621,6 @@ .add('Lo-Dash', function() {

.add('Lo-Dash', function() {
lodash.values(objects);
lodash.values(object);
})
.add('Underscore', function() {
_.values(objects);
_.values(object);
})

@@ -615,0 +627,0 @@ );

@@ -1,2 +0,2 @@

# Lo-Dash <sup>v0.3.0</sup>
# Lo-Dash <sup>v0.3.1</sup>

@@ -9,4 +9,4 @@ A drop-in replacement for Underscore.js, from the devs behind [jsPerf.com](http://jsperf.com), that delivers [performance improvements](http://lodash.com/benchmarks), [bug fixes](https://github.com/bestiejs/lodash#closed-underscorejs-issues), and [additional features](https://github.com/bestiejs/lodash#features).

* [Development source](https://raw.github.com/bestiejs/lodash/v0.3.0/lodash.js)
* [Production source](https://raw.github.com/bestiejs/lodash/v0.3.0/lodash.min.js)
* [Development source](https://raw.github.com/bestiejs/lodash/v0.3.1/lodash.js)
* [Production source](https://raw.github.com/bestiejs/lodash/v0.3.1/lodash.min.js)
* For optimal performance, [create a custom build](https://github.com/bestiejs/lodash#custom-builds) with only the features you need

@@ -29,3 +29,3 @@

* AMD loader support (RequireJS, curl.js, etc.)
* AMD loader support ([RequireJS](http://requirejs.org/), [curl.js](https://github.com/cujojs/curl), etc.)
* [_.bind](http://lodash.com/docs#bind) supports *"lazy"* binding

@@ -51,4 +51,8 @@ * [_.debounce](http://lodash.com/docs#debounce)’ed functions match [_.throttle](http://lodash.com/docs#throttle)’ed functions’ return value behavior

Mobile builds, with IE bug fixes and method compilation removed, may be created by using the `mobile` argument.
* Backbone builds, containing all methods required by Backbone, may be created using the `backbone` modifier argument.
~~~ bash
node build backbone
~~~
* Mobile builds, with IE bug fixes and method compilation removed, may be created using the `mobile` modifier argument.
~~~ bash

@@ -65,19 +69,23 @@ node build mobile

node build category="collections, functions"
node build mobile category=collections,functions
~~~
2. Use the `include` argument to pass the names of the methods to include in the build.
2. Use the `include` argument to pass the names of methods to include in the build.
~~~ bash
node build include=each,filter,map
node build include="each, filter, map"
node build mobile include=each,filter,map
~~~
3. Use the `exclude` argument to pass the names of the methods to exclude from the build.
3. Use the `exclude` argument to pass the names of methods to exclude from the build.
~~~ bash
node build exclude=union,uniq,zip
node build exclude="union, uniq, zip"
node build mobile exclude=union,uniq,zip
~~~
All arguments, except `include` and `exlcude`, may be combined.
~~~ bash
node build backbone mobile category=functions include=pick,uniq
node build backbone mobile category=utilities exclude=first,last
~~~
Custom builds are saved to `lodash.custom.js` and `lodash.custom.min.js`.

@@ -149,16 +157,17 @@

* Allow iteration of objects with a `length` property [[#148](https://github.com/documentcloud/underscore/issues/148), [#154](https://github.com/documentcloud/underscore/issues/154), [#252](https://github.com/documentcloud/underscore/issues/252), [#448](https://github.com/documentcloud/underscore/issues/448), [test](https://github.com/bestiejs/lodash/blob/c07e1567a7a12cff2c5ee6cda81306c8bcf126f0/test/test.js#L266-272)]
* Ensure array-like objects with invalid `length` properties are treated like regular objects [[test](https://github.com/bestiejs/lodash/blob/c07e1567a7a12cff2c5ee6cda81306c8bcf126f0/test/test.js#L237-243), [test](https://github.com/bestiejs/lodash/blob/c07e1567a7a12cff2c5ee6cda81306c8bcf126f0/test/test.js#L533-542), [test](https://github.com/bestiejs/lodash/blob/c07e1567a7a12cff2c5ee6cda81306c8bcf126f0/test/test.js#L661-664)]
* Ensure `_(...)` returns passed wrapper instances [[test](https://github.com/bestiejs/lodash/blob/c07e1567a7a12cff2c5ee6cda81306c8bcf126f0/test/test.js#L106-109)]
* Ensure `_.groupBy` adds values to own, not inherited, properties [[test](https://github.com/bestiejs/lodash/blob/c07e1567a7a12cff2c5ee6cda81306c8bcf126f0/test/test.js#L317-324)]
* Ensure `_.sortedIndex` supports arrays with high `length` values [[test](https://github.com/bestiejs/lodash/blob/c07e1567a7a12cff2c5ee6cda81306c8bcf126f0/test/test.js#L586-595)]
* Ensure `_.throttle` works when called in tight loops [[#502](https://github.com/documentcloud/underscore/issues/502), [test](https://github.com/bestiejs/lodash/blob/c07e1567a7a12cff2c5ee6cda81306c8bcf126f0/test/test.js#L629-639)]
* Fix Firefox, IE, Opera, and Safari object iteration bugs [[#376](https://github.com/documentcloud/underscore/issues/376), [test](https://github.com/bestiejs/lodash/blob/c07e1567a7a12cff2c5ee6cda81306c8bcf126f0/test/test.js#L175-187), [test](https://github.com/bestiejs/lodash/blob/c07e1567a7a12cff2c5ee6cda81306c8bcf126f0/test/test.js#L277-302), [test](https://github.com/bestiejs/lodash/blob/c07e1567a7a12cff2c5ee6cda81306c8bcf126f0/test/test.js#L379-390), [test](https://github.com/bestiejs/lodash/blob/c07e1567a7a12cff2c5ee6cda81306c8bcf126f0/test/test.js#L398-400), [test](https://github.com/bestiejs/lodash/blob/c07e1567a7a12cff2c5ee6cda81306c8bcf126f0/test/test.js#L418-438), [test](https://github.com/bestiejs/lodash/blob/c07e1567a7a12cff2c5ee6cda81306c8bcf126f0/test/test.js#L554-556)]
* Allow iteration of objects with a `length` property [[#148](https://github.com/documentcloud/underscore/issues/148), [#154](https://github.com/documentcloud/underscore/issues/154), [#252](https://github.com/documentcloud/underscore/issues/252), [#448](https://github.com/documentcloud/underscore/issues/448), [test](https://github.com/bestiejs/lodash/blob/801e8a5b3a963157fceaad15075690f59c22de9c/test/test.js#L266-272)]
* Ensure "Arrays" category methods allow falsey `array` arguments [[test](https://github.com/bestiejs/lodash/blob/801e8a5b3a963157fceaad15075690f59c22de9c/test/test.js#L714-748)]
* Ensure array-like objects with invalid `length` properties are treated like regular objects [[test](https://github.com/bestiejs/lodash/blob/801e8a5b3a963157fceaad15075690f59c22de9c/test/test.js#L237-243), [test](https://github.com/bestiejs/lodash/blob/801e8a5b3a963157fceaad15075690f59c22de9c/test/test.js#L533-542), [test](https://github.com/bestiejs/lodash/blob/801e8a5b3a963157fceaad15075690f59c22de9c/test/test.js#L661-664)]
* Ensure `_(...)` returns passed wrapper instances [[test](https://github.com/bestiejs/lodash/blob/801e8a5b3a963157fceaad15075690f59c22de9c/test/test.js#L106-109)]
* Ensure `_.groupBy` adds values to own, not inherited, properties [[test](https://github.com/bestiejs/lodash/blob/801e8a5b3a963157fceaad15075690f59c22de9c/test/test.js#L317-324)]
* Ensure `_.sortedIndex` supports arrays with high `length` values [[test](https://github.com/bestiejs/lodash/blob/801e8a5b3a963157fceaad15075690f59c22de9c/test/test.js#L586-595)]
* Ensure `_.throttle` works when called in tight loops [[#502](https://github.com/documentcloud/underscore/issues/502), [test](https://github.com/bestiejs/lodash/blob/801e8a5b3a963157fceaad15075690f59c22de9c/test/test.js#L629-639)]
* Fix Firefox, IE, Opera, and Safari object iteration bugs [[#376](https://github.com/documentcloud/underscore/issues/376), [test](https://github.com/bestiejs/lodash/blob/801e8a5b3a963157fceaad15075690f59c22de9c/test/test.js#L175-187), [test](https://github.com/bestiejs/lodash/blob/801e8a5b3a963157fceaad15075690f59c22de9c/test/test.js#L277-302), [test](https://github.com/bestiejs/lodash/blob/801e8a5b3a963157fceaad15075690f59c22de9c/test/test.js#L379-390), [test](https://github.com/bestiejs/lodash/blob/801e8a5b3a963157fceaad15075690f59c22de9c/test/test.js#L398-400), [test](https://github.com/bestiejs/lodash/blob/801e8a5b3a963157fceaad15075690f59c22de9c/test/test.js#L418-438), [test](https://github.com/bestiejs/lodash/blob/801e8a5b3a963157fceaad15075690f59c22de9c/test/test.js#L554-556)]
* Handle arrays with `undefined` values correctly in IE < 9 [[#601](https://github.com/documentcloud/underscore/issues/601)]
* Methods should work on pages with incorrectly shimmed native methods [[#7](https://github.com/documentcloud/underscore/issues/7), [test](https://github.com/bestiejs/lodash/blob/c07e1567a7a12cff2c5ee6cda81306c8bcf126f0/test/test.js#L88-94)]
* Register as AMD module, but still export to global [[#431](https://github.com/documentcloud/underscore/pull/431), [test](https://github.com/bestiejs/lodash/blob/c07e1567a7a12cff2c5ee6cda81306c8bcf126f0/test/test.js#L72-86)]
* `_.forEach` should be chainable [[#142](https://github.com/documentcloud/underscore/issues/142), [test](https://github.com/bestiejs/lodash/blob/c07e1567a7a12cff2c5ee6cda81306c8bcf126f0/test/test.js#L232-235)]
* `_isNaN(new Number(NaN))` should return `true` [[test](https://github.com/bestiejs/lodash/blob/c07e1567a7a12cff2c5ee6cda81306c8bcf126f0/test/test.js#L408-410)]
* `_.reduceRight` should pass correct callback arguments when iterating objects [[test](https://github.com/bestiejs/lodash/blob/c07e1567a7a12cff2c5ee6cda81306c8bcf126f0/test/test.js#L521-531)]
* `_.size` should return the `length` of string values [[test](https://github.com/bestiejs/lodash/blob/c07e1567a7a12cff2c5ee6cda81306c8bcf126f0/test/test.js#L550-552)]
* Methods should work on pages with incorrectly shimmed native methods [[#7](https://github.com/documentcloud/underscore/issues/7), [test](https://github.com/bestiejs/lodash/blob/801e8a5b3a963157fceaad15075690f59c22de9c/test/test.js#L88-94)]
* Register as AMD module, but still export to global [[#431](https://github.com/documentcloud/underscore/pull/431), [test](https://github.com/bestiejs/lodash/blob/801e8a5b3a963157fceaad15075690f59c22de9c/test/test.js#L72-86)]
* `_.forEach` should be chainable [[#142](https://github.com/documentcloud/underscore/issues/142), [test](https://github.com/bestiejs/lodash/blob/801e8a5b3a963157fceaad15075690f59c22de9c/test/test.js#L232-235)]
* `_isNaN(new Number(NaN))` should return `true` [[test](https://github.com/bestiejs/lodash/blob/801e8a5b3a963157fceaad15075690f59c22de9c/test/test.js#L408-410)]
* `_.reduceRight` should pass correct callback arguments when iterating objects [[test](https://github.com/bestiejs/lodash/blob/801e8a5b3a963157fceaad15075690f59c22de9c/test/test.js#L521-531)]
* `_.size` should return the `length` of string values [[test](https://github.com/bestiejs/lodash/blob/801e8a5b3a963157fceaad15075690f59c22de9c/test/test.js#L550-552)]

@@ -223,2 +232,9 @@ ## Optimized methods <sup>(50+)</sup>

### <sup>v0.3.1</sup>
* Added `backbone` build option
* Ensured "Arrays" category methods allow falsey `array` arguments
* Removed `_.isArguments` fallback from the `mobile` build
* Simplified `_.pluck`, `_.values` and `_(...)` method wrappers
### <sup>v0.3.0</sup>

@@ -225,0 +241,0 @@

@@ -711,2 +711,78 @@ (function(window, undefined) {

QUnit.module('lodash "Arrays" methods');
(function() {
test('should allow a falsey `array` argument', function() {
_.each([
'compact',
'difference',
'first',
'flatten',
'groupBy',
'indexOf',
'initial',
'intersection',
'invoke',
'last',
'lastIndexOf',
'max',
'min',
'pluck',
'range',
'rest',
'shuffle',
'sortBy',
'sortedIndex',
'union',
'uniq',
'without',
'zip'
], function(methodName) {
var pass = true;
try {
_[methodName]();
} catch(e) {
pass = false;
}
ok(pass, methodName + ' allows a falsey `array` argument');
});
});
}());
/*--------------------------------------------------------------------------*/
QUnit.module('lodash "Collections" methods');
(function() {
test('should allow a falsey `collection` argument', function() {
_.each([
'contains',
'every',
'filter',
'find',
'forEach',
'map',
'reduce',
'reduceRight',
'reject',
'some',
'toArray'
], function(methodName) {
var pass = true;
try {
if (/^(?:contains|toArray)$/.test(methodName)) {
_[methodName](null);
} else {
_[methodName](null, _.identity);
}
} catch(e) {
pass = false;
}
ok(pass, methodName + ' allows a falsey `collection` argument');
});
});
}());
/*--------------------------------------------------------------------------*/
// explicitly call `QUnit.start()` for Narwhal, Rhino, and RingoJS

@@ -713,0 +789,0 @@ QUnit.start();

@@ -8,1 +8,6 @@ Composite - A QUnit Addon For Running Multiple Test Files

The Rerun link next to each suite allows you to quickly rerun that suite,
outside the composite runner.
If you want to see what assertion failed in a long list of assertions,
just use the regular "Hide passed tests" checkbox.

@@ -17,3 +17,3 @@ /*global config:true, task:true*/

qunit: 'qunit/qunit.js',
addons: 'addons/**/*.js',
// addons: 'addons/**/*.js',
grunt: 'grunt.js'

@@ -40,3 +40,4 @@ // TODO need to figure out which warnings to fix and which to disable

eqnull: true,
proto: true
proto: true,
smarttabs: true
},

@@ -89,3 +90,3 @@ globals: {

authToken: config.qunit.authToken,
jobName: 'QUnit commit #<a href="https://github.com/jquery/qunit/commit/' + commit + '">' + commit + '</a>',
jobName: 'QUnit commit #<a href="https://github.com/jquery/qunit/commit/' + commit + '">' + commit.substr( 0, 10 ) + '</a>',
runMax: 3,

@@ -92,0 +93,0 @@ "runNames[]": "QUnit",

@@ -0,1 +1,18 @@

1.7.0 / 2012-06-07
==================
* Add config.requireExpects. Fixes #207 - Add option to require all tests to call expect().
* Improve extractStacktrace() implementation. Fixes #254 - Include all relevant stack lines
* Make filters case-insensitive. Partial fix for #252
* is() expects lowercase types. Fixes #250 - Expected Date value is not displayed properly
* Fix phantomjs addon header and add readme. Fixes #239
* Add some hints to composite addon readme. Fixes #251
* Track tests by the order in which they were run and create rerun links based on that number. Fixes #241 - Make Rerun link run only a single test.
* Use QUnit.push for raises implementation. Fixes #243
* CLI runner for phantomjs
* Fix jshint validation until they deal with /** */ comments properly
* Update validTest() : Simplify logic, clarify vars and add comments
* Refactor assertion helpers into QUnit.assert (backwards compatible)
* Add Rerun link to placeholders. Fixes #240
1.6.0 / 2012-05-04

@@ -2,0 +19,0 @@ ==================

@@ -5,3 +5,3 @@ {

"description": "An easy-to-use JavaScript Unit Testing framework.",
"version": "1.6.0",
"version": "1.7.0",
"author": "The jQuery Project",

@@ -32,4 +32,4 @@ "contributors": [

"grunt": "0.3.x",
"testswarm": "0.2.1"
"testswarm": "0.2.2"
}
}
/**
* QUnit v1.6.0 - A JavaScript Unit Testing Framework
* QUnit v1.7.0 - A JavaScript Unit Testing Framework
*

@@ -16,2 +16,3 @@ * http://docs.jquery.com/QUnit

testId = 0,
fileName = (sourceFromStacktrace( 0 ) || "" ).replace(/(:\d+)+\)?/, "").replace(/.+\//, ""),
toString = Object.prototype.toString,

@@ -33,14 +34,13 @@ hasOwn = Object.prototype.hasOwnProperty,

function Test( name, testName, expected, async, callback ) {
this.name = name;
this.testName = testName;
this.expected = expected;
this.async = async;
this.callback = callback;
function Test( settings ) {
extend( this, settings );
this.assertions = [];
this.testNumber = ++Test.count;
}
Test.count = 0;
Test.prototype = {
init: function() {
var b, li,
var a, b, li,
tests = id( "qunit-tests" );

@@ -50,6 +50,12 @@

b = document.createElement( "strong" );
b.innerHTML = "Running " + this.name;
b.innerHTML = this.name;
// `a` initialized at top of scope
a = document.createElement( "a" );
a.innerHTML = "Rerun";
a.href = QUnit.url({ testNumber: this.testNumber });
li = document.createElement( "li" );
li.appendChild( b );
li.appendChild( a );
li.className = "running";

@@ -125,3 +131,3 @@ li.id = this.id = "qunit-test-output" + testId++;

if ( config.notrycatch ) {
this.callback.call( this.testEnvironment );
this.callback.call( this.testEnvironment, QUnit.assert );
return;

@@ -131,5 +137,5 @@ }

try {
this.callback.call( this.testEnvironment );
this.callback.call( this.testEnvironment, QUnit.assert );
} catch( e ) {
QUnit.pushFailure( "Died on test #" + (this.assertions.length + 1) + ": " + e.message, extractStacktrace( e, 1 ) );
QUnit.pushFailure( "Died on test #" + (this.assertions.length + 1) + " " + this.stack + ": " + e.message, extractStacktrace( e, 0 ) );
// else next test will carry the responsibility

@@ -160,3 +166,5 @@ saveGlobal();

config.current = this;
if ( this.expected != null && this.expected != this.assertions.length ) {
if ( config.requireExpects && this.expected == null ) {
QUnit.pushFailure( "Expected number of assertions to be defined, but expect() was not called.", this.stack );
} else if ( this.expected != null && this.expected != this.assertions.length ) {
QUnit.pushFailure( "Expected " + this.expected + " assertions, but " + this.assertions.length + " were run", this.stack );

@@ -168,2 +176,3 @@ } else if ( this.expected == null && !this.assertions.length ) {

var assertion, a, b, i, li, ol,
test = this,
good = 0,

@@ -213,7 +222,2 @@ bad = 0,

// `a` initialized at top of scope
a = document.createElement( "a" );
a.innerHTML = "Rerun";
a.href = QUnit.url({ filter: getText([b]).replace( /\([^)]+\)$/, "" ).replace( /(^\s*|\s*$)/g, "" ) });
addEvent(b, "click", function() {

@@ -231,5 +235,3 @@ var next = b.nextSibling.nextSibling,

if ( window.location && target.nodeName.toLowerCase() === "strong" ) {
window.location = QUnit.url({
filter: getText([target]).replace( /\([^)]+\)$/, "" ).replace( /(^\s*|\s*$)/g, "" )
});
window.location = QUnit.url({ testNumber: test.testNumber });
}

@@ -242,4 +244,5 @@ });

li.removeChild( li.firstChild );
a = li.firstChild;
li.appendChild( b );
li.appendChild( a );
li.appendChild ( a );
li.appendChild( ol );

@@ -304,2 +307,3 @@

// Root QUnit object.
// `QUnit` initialized at top of scope

@@ -336,10 +340,17 @@ QUnit = {

if ( !validTest(config.currentModule + ": " + testName) ) {
test = new Test({
name: name,
testName: testName,
expected: expected,
async: async,
callback: callback,
module: config.currentModule,
moduleTestEnvironment: config.currentModuleTestEnviroment,
stack: sourceFromStacktrace( 2 )
});
if ( !validTest( test ) ) {
return;
}
test = new Test( name, testName, expected, async, callback );
test.module = config.currentModule;
test.moduleTestEnvironment = config.currentModuleTestEnviroment;
test.stack = sourceFromStacktrace( 2 );
test.queue();

@@ -353,4 +364,55 @@ },

// Asserts true.
// @example ok( "asdfasdf".length > 5, "There must be at least 5 chars" );
start: function( count ) {
config.semaphore -= count || 1;
// don't start until equal number of stop-calls
if ( config.semaphore > 0 ) {
return;
}
// ignore if start is called more often then stop
if ( config.semaphore < 0 ) {
config.semaphore = 0;
}
// A slight delay, to avoid any current callbacks
if ( defined.setTimeout ) {
window.setTimeout(function() {
if ( config.semaphore > 0 ) {
return;
}
if ( config.timeout ) {
clearTimeout( config.timeout );
}
config.blocking = false;
process( true );
}, 13);
} else {
config.blocking = false;
process( true );
}
},
stop: function( count ) {
config.semaphore += count || 1;
config.blocking = true;
if ( config.testTimeout && defined.setTimeout ) {
clearTimeout( config.timeout );
config.timeout = window.setTimeout(function() {
QUnit.ok( false, "Test timed out" );
config.semaphore = 1;
QUnit.start();
}, config.testTimeout );
}
}
};
// Asssert helpers
// All of these must call either QUnit.push() or manually do:
// - runLoggingCallbacks( "log", .. );
// - config.current.assertions.push({ .. });
QUnit.assert = {
/**
* Asserts rough true-ish result.
* @example ok( "asdfasdf".length > 5, "There must be at least 5 chars" );
*/
ok: function( result, msg ) {

@@ -385,4 +447,7 @@ if ( !config.current ) {

// Checks that the first two arguments are equal, with an optional message. Prints out both actual and expected values.
// @example equal( format( "Received {0} bytes.", 2), "Received 2 bytes." );
/**
* Assert that the first two arguments are equal, with an optional message.
* Prints out both actual and expected values.
* @example equal( format( "Received {0} bytes.", 2), "Received 2 bytes.", "format() replaces {0} with next argument" );
*/
equal: function( actual, expected, message ) {

@@ -443,48 +508,19 @@ QUnit.push( expected == actual, actual, expected, message );

QUnit.ok( ok, message );
},
QUnit.push( ok, actual, null, message );
}
};
start: function( count ) {
config.semaphore -= count || 1;
// don't start until equal number of stop-calls
if ( config.semaphore > 0 ) {
return;
}
// ignore if start is called more often then stop
if ( config.semaphore < 0 ) {
config.semaphore = 0;
}
// A slight delay, to avoid any current callbacks
if ( defined.setTimeout ) {
window.setTimeout(function() {
if ( config.semaphore > 0 ) {
return;
}
if ( config.timeout ) {
clearTimeout( config.timeout );
}
// @deprecated: Kept assertion helpers in root for backwards compatibility
extend( QUnit, QUnit.assert );
config.blocking = false;
process( true );
}, 13);
} else {
config.blocking = false;
process( true );
}
},
stop: function( count ) {
config.semaphore += count || 1;
config.blocking = true;
if ( config.testTimeout && defined.setTimeout ) {
clearTimeout( config.timeout );
config.timeout = window.setTimeout(function() {
QUnit.ok( false, "Test timed out" );
config.semaphore = 1;
QUnit.start();
}, config.testTimeout );
}
}
/**
* @deprecated: Kept for backwards compatibility
* next step: remove entirely
*/
QUnit.equals = function() {
QUnit.push( false, false, false, "QUnit.equals has been deprecated since 2009 (e88049a0), use QUnit.equal instead" );
};
QUnit.same = function() {
QUnit.push( false, false, false, "QUnit.same has been deprecated since 2009 (e88049a0), use QUnit.deepEqual instead" );
};

@@ -500,13 +536,7 @@ // We want access to the constructor's prototype

// deprecated; still export them to window to provide clear error messages
// next step: remove entirely
QUnit.equals = function() {
QUnit.push( false, false, false, "QUnit.equals has been deprecated since 2009 (e88049a0), use QUnit.equal instead" );
};
QUnit.same = function() {
QUnit.push( false, false, false, "QUnit.same has been deprecated since 2009 (e88049a0), use QUnit.deepEqual instead" );
};
// Maintain internal state
// `config` initialized at top of scope
/**
* Config object: Maintain internal state
* Later exposed as QUnit.config
* `config` initialized at top of scope
*/
config = {

@@ -530,2 +560,5 @@ // The queue of tests to run

// when enabled, all tests must call expect()
requireExpects: false,
urlConfig: [ "noglobals", "notrycatch" ],

@@ -543,3 +576,3 @@

// Load paramaters
// Initialize more QUnit.config and QUnit.urlParams
(function() {

@@ -565,2 +598,3 @@ var i,

config.filter = urlParams.filter;
config.testNumber = parseInt( urlParams.testNumber, 10 ) || null;

@@ -571,10 +605,13 @@ // Figure out if we're running the tests from a server or not

// Expose the API as global variables, unless an 'exports' object exists,
// in that case we assume we're in CommonJS - export everything at the end
// Export global variables, unless an 'exports' object exists,
// in that case we assume we're in CommonJS (dealt with on the bottom of the script)
if ( typeof exports === "undefined" ) {
extend( window, QUnit );
// Expose QUnit object
window.QUnit = QUnit;
}
// define these after exposing globals to keep them in these QUnit namespace only
// Extend QUnit object,
// these after set here because they should not be exposed as global functions
extend( QUnit, {

@@ -787,21 +824,33 @@ config: config,

addEvent: addEvent
// load, equiv, jsDump, diff: Attached later
});
// QUnit.constructor is set to the empty F() above so that we can add to it's prototype later
// Doing this allows us to tell if the following methods have been overwritten on the actual
// QUnit object, which is a deprecated way of using the callbacks.
/**
* @deprecated: Created for backwards compatibility with test runner that set the hook function
* into QUnit.{hook}, instead of invoking it and passing the hook function.
* QUnit.constructor is set to the empty F() above so that we can add to it's prototype here.
* Doing this allows us to tell if the following methods have been overwritten on the actual
* QUnit object.
*/
extend( QUnit.constructor.prototype, {
// Logging callbacks; all receive a single argument with the listed properties
// run test/logs.html for any related changes
begin: registerLoggingCallback( "begin" ),
// done: { failed, passed, total, runtime }
done: registerLoggingCallback( "done" ),
// log: { result, actual, expected, message }
log: registerLoggingCallback( "log" ),
// testStart: { name }
testStart: registerLoggingCallback( "testStart" ),
// testDone: { name, failed, passed, total }
testDone: registerLoggingCallback( "testDone" ),
// moduleStart: { name }
moduleStart: registerLoggingCallback( "moduleStart" ),
// moduleDone: { name, failed, passed, total }

@@ -986,7 +1035,11 @@ moduleDone: registerLoggingCallback( "moduleDone" )

function validTest( name ) {
var not,
filter = config.filter,
run = false;
function validTest( test ) {
var include,
filter = config.filter && config.filter.toLowerCase(),
fullName = (test.module + ": " + test.testName).toLowerCase();
if ( config.testNumber ) {
return test.testNumber === config.testNumber;
}
if ( !filter ) {

@@ -996,17 +1049,14 @@ return true;

not = filter.charAt( 0 ) === "!";
if ( not ) {
include = filter.charAt( 0 ) !== "!";
if ( !include ) {
filter = filter.slice( 1 );
}
if ( name.indexOf( filter ) !== -1 ) {
return !not;
// If the filter matches, we need to honour include
if ( fullName.indexOf( filter ) !== -1 ) {
return include;
}
if ( not ) {
run = true;
}
return run;
// Otherwise, do the opposite
return !include;
}

@@ -1018,5 +1068,5 @@

function extractStacktrace( e, offset ) {
offset = offset || 3;
offset = offset === undefined ? 3 : offset;
var stack;
var stack, include, i, regex;

@@ -1032,2 +1082,14 @@ if ( e.stacktrace ) {

}
if ( fileName ) {
include = [];
for ( i = offset; i < stack.length; i++ ) {
if ( stack[ i ].indexOf( fileName ) != -1 ) {
break;
}
include.push( stack[ i ] );
}
if ( include.length ) {
return include.join( "\n" );
}
}
return stack[ offset ];

@@ -1447,7 +1509,7 @@ } else if ( e.sourceURL ) {

type = "undefined";
} else if ( QUnit.is( "RegExp", obj) ) {
} else if ( QUnit.is( "regexp", obj) ) {
type = "regexp";
} else if ( QUnit.is( "Date", obj) ) {
} else if ( QUnit.is( "date", obj) ) {
type = "date";
} else if ( QUnit.is( "Function", obj) ) {
} else if ( QUnit.is( "function", obj) ) {
type = "function";

@@ -1454,0 +1516,0 @@ } else if ( typeof obj.setInterval !== undefined && typeof obj.document !== "undefined" && typeof obj.nodeType === "undefined" ) {

@@ -16,2 +16,17 @@ test("module without setup/teardown (default)", function() {

QUnit.module("assertion helpers");
QUnit.test( "QUnit.assert compatibility", function( assert ) {
QUnit.expect(4);
assert.ok( true, "Calling method on `assert` argument to test() callback" );
// Should also work, although not documented
QUnit.assert.ok( true, "Calling method on QUnit.assert object" );
// Test compatibility aliases
QUnit.ok( true, "Calling aliased method in QUnit root object" );
ok( true, "Calling aliased function in global namespace" );
});
module("setup test", {

@@ -18,0 +33,0 @@ setup: function() {

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc