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

qunit

Package Overview
Dependencies
Maintainers
1
Versions
105
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

qunit - npm Package Compare versions

Comparing version 0.2.6 to 0.2.7

deps/qunit/History.md

3

deps/qunit/package.json
{
"name": "qunit",
"author": "The jQuery Project",
"version": "1.1.0pre",
"contributors": [

@@ -17,3 +18,3 @@ {

"repositories" : [{
"type": "git",
"type": "git",
"url": "https://github.com/jquery/qunit.git"

@@ -20,0 +21,0 @@ }],

/**
* QUnit - A JavaScript Unit Testing Framework
* QUnit 1.2.0pre - A JavaScript Unit Testing Framework
*

@@ -24,3 +24,5 @@ * http://docs.jquery.com/QUnit

var testId = 0;
var testId = 0,
toString = Object.prototype.toString,
hasOwn = Object.prototype.hasOwnProperty;

@@ -95,2 +97,3 @@ var Test = function(name, testName, expected, testEnvironmentArg, async, callback) {

run: function() {
config.current = this;
if ( this.async ) {

@@ -114,3 +117,3 @@ QUnit.stop();

if ( config.blocking ) {
start();
QUnit.start();
}

@@ -120,2 +123,3 @@ }

teardown: function() {
config.current = this;
try {

@@ -129,3 +133,4 @@ this.testEnvironment.teardown.call(this.testEnvironment);

finish: function() {
if ( this.expected && this.expected != this.assertions.length ) {
config.current = this;
if ( this.expected != null && this.expected != this.assertions.length ) {
QUnit.ok( false, "Expected " + this.expected + " assertions, but " + this.assertions.length + " were run" );

@@ -253,3 +258,3 @@ }

} else {
synchronize(run);
synchronize(run, true);
};

@@ -271,3 +276,3 @@ }

callback = expected;
expected = 0;
expected = null;
}

@@ -420,7 +425,7 @@

config.blocking = false;
process();
process(true);
}, 13);
} else {
config.blocking = false;
process();
process(true);
}

@@ -618,4 +623,3 @@ },

var type = Object.prototype.toString.call( obj )
.match(/^\[object\s(.*)\]$/)[1] || '';
var type = toString.call( obj ).match(/^\[object\s(.*)\]$/)[1] || '';

@@ -682,2 +686,5 @@ switch (type) {

for ( key in params ) {
if ( !hasOwn.call( params, key ) ) {
continue;
}
querystring += encodeURIComponent( key ) + "=" +

@@ -795,2 +802,13 @@ encodeURIComponent( params[ key ] ) + "&";

// addEvent(window, "error") gives us a useless event object
window.onerror = function( message, file, line ) {
if ( QUnit.config.current ) {
ok( false, message + ", " + file + ":" + line );
} else {
test( "global failure", function() {
ok( false, message + ", " + file + ":" + line );
});
}
};
function done() {

@@ -910,22 +928,26 @@ config.autorun = true;

function synchronize( callback ) {
function synchronize( callback, last ) {
config.queue.push( callback );
if ( config.autorun && !config.blocking ) {
process();
process(last);
}
}
function process() {
var start = (new Date()).getTime();
function process( last ) {
var start = new Date().getTime();
config.depth = config.depth ? config.depth + 1 : 1;
while ( config.queue.length && !config.blocking ) {
if ( config.updateRate <= 0 || (((new Date()).getTime() - start) < config.updateRate) ) {
if ( !defined.setTimeout || config.updateRate <= 0 || ( ( new Date().getTime() - start ) < config.updateRate ) ) {
config.queue.shift()();
} else {
window.setTimeout( process, 13 );
window.setTimeout( function(){
process( last );
}, 13 );
break;
}
}
if (!config.blocking && !config.queue.length) {
config.depth--;
if ( last && !config.blocking && !config.queue.length && config.depth === 0 ) {
done();

@@ -940,2 +962,5 @@ }

for ( var key in window ) {
if ( !hasOwn.call( window, key ) ) {
continue;
}
config.pollution.push( key );

@@ -991,3 +1016,5 @@ }

delete a[prop];
} else {
// Avoid "Member not found" error in IE8 caused by setting window.constructor
} else if ( prop !== "constructor" || a !== window ) {
a[prop] = b[prop];

@@ -1055,2 +1082,6 @@ }

var getProto = Object.getPrototypeOf || function (obj) {
return obj.__proto__;
};
var callbacks = function () {

@@ -1145,3 +1176,9 @@

if (a.constructor !== b.constructor) {
return false;
// Allow objects with no prototype to be equivalent to
// objects with Object as their constructor.
if (!((getProto(a) === null && getProto(b) === Object.prototype) ||
(getProto(b) === null && getProto(a) === Object.prototype)))
{
return false;
}
}

@@ -1287,3 +1324,8 @@

type = "node";
} else if (typeof obj === "object" && typeof obj.length === "number" && obj.length >= 0) {
} else if (
// native arrays
toString.call( obj ) === "[object Array]" ||
// NodeList objects
( typeof obj.length === "number" && typeof obj.item !== "undefined" && ( obj.length ? obj.item(0) === obj[0] : ( obj.item( 0 ) === null && typeof obj[0] === "undefined" ) ) )
) {
type = "array";

@@ -1470,2 +1512,5 @@ } else {

for (var i in ns) {
if ( !hasOwn.call( ns, i ) ) {
continue;
}
if (ns[i].rows.length == 1 && typeof(os[i]) != "undefined" && os[i].rows.length == 1) {

@@ -1472,0 +1517,0 @@ n[ns[i].rows[0]] = {

@@ -28,1 +28,11 @@ [QUnit](http://docs.jquery.com/QUnit) - A JavaScript Unit Testing framework.

on the [jQuery Testing Team planning wiki](http://jquerytesting.pbworks.com/w/page/41556026/FrontPage).
Releases
--------
Install git-extras and run `git changelog` to update History.md.
Update qunit/qunit.js|css to the release version, commit and tag, update them
again to the next version, commit and push commits and tags.
Put the 'v' in front of the tag (unlike the 1.1.0 release). Clean up the changelog,
removing merge commits or whitespace cleanups.

@@ -5,110 +5,110 @@ module("equiv");

test("Primitive types and constants", function () {
equals(QUnit.equiv(null, null), true, "null");
equals(QUnit.equiv(null, {}), false, "null");
equals(QUnit.equiv(null, undefined), false, "null");
equals(QUnit.equiv(null, 0), false, "null");
equals(QUnit.equiv(null, false), false, "null");
equals(QUnit.equiv(null, ''), false, "null");
equals(QUnit.equiv(null, []), false, "null");
equal(QUnit.equiv(null, null), true, "null");
equal(QUnit.equiv(null, {}), false, "null");
equal(QUnit.equiv(null, undefined), false, "null");
equal(QUnit.equiv(null, 0), false, "null");
equal(QUnit.equiv(null, false), false, "null");
equal(QUnit.equiv(null, ''), false, "null");
equal(QUnit.equiv(null, []), false, "null");
equals(QUnit.equiv(undefined, undefined), true, "undefined");
equals(QUnit.equiv(undefined, null), false, "undefined");
equals(QUnit.equiv(undefined, 0), false, "undefined");
equals(QUnit.equiv(undefined, false), false, "undefined");
equals(QUnit.equiv(undefined, {}), false, "undefined");
equals(QUnit.equiv(undefined, []), false, "undefined");
equals(QUnit.equiv(undefined, ""), false, "undefined");
equal(QUnit.equiv(undefined, undefined), true, "undefined");
equal(QUnit.equiv(undefined, null), false, "undefined");
equal(QUnit.equiv(undefined, 0), false, "undefined");
equal(QUnit.equiv(undefined, false), false, "undefined");
equal(QUnit.equiv(undefined, {}), false, "undefined");
equal(QUnit.equiv(undefined, []), false, "undefined");
equal(QUnit.equiv(undefined, ""), false, "undefined");
// Nan usually doest not equal to Nan using the '==' operator.
// Only isNaN() is able to do it.
equals(QUnit.equiv(0/0, 0/0), true, "NaN"); // NaN VS NaN
equals(QUnit.equiv(1/0, 2/0), true, "Infinity"); // Infinity VS Infinity
equals(QUnit.equiv(-1/0, 2/0), false, "-Infinity, Infinity"); // -Infinity VS Infinity
equals(QUnit.equiv(-1/0, -2/0), true, "-Infinity, -Infinity"); // -Infinity VS -Infinity
equals(QUnit.equiv(0/0, 1/0), false, "NaN, Infinity"); // Nan VS Infinity
equals(QUnit.equiv(1/0, 0/0), false, "NaN, Infinity"); // Nan VS Infinity
equals(QUnit.equiv(0/0, null), false, "NaN");
equals(QUnit.equiv(0/0, undefined), false, "NaN");
equals(QUnit.equiv(0/0, 0), false, "NaN");
equals(QUnit.equiv(0/0, false), false, "NaN");
equals(QUnit.equiv(0/0, function () {}), false, "NaN");
equals(QUnit.equiv(1/0, null), false, "NaN, Infinity");
equals(QUnit.equiv(1/0, undefined), false, "NaN, Infinity");
equals(QUnit.equiv(1/0, 0), false, "NaN, Infinity");
equals(QUnit.equiv(1/0, 1), false, "NaN, Infinity");
equals(QUnit.equiv(1/0, false), false, "NaN, Infinity");
equals(QUnit.equiv(1/0, true), false, "NaN, Infinity");
equals(QUnit.equiv(1/0, function () {}), false, "NaN, Infinity");
equal(QUnit.equiv(0/0, 0/0), true, "NaN"); // NaN VS NaN
equal(QUnit.equiv(1/0, 2/0), true, "Infinity"); // Infinity VS Infinity
equal(QUnit.equiv(-1/0, 2/0), false, "-Infinity, Infinity"); // -Infinity VS Infinity
equal(QUnit.equiv(-1/0, -2/0), true, "-Infinity, -Infinity"); // -Infinity VS -Infinity
equal(QUnit.equiv(0/0, 1/0), false, "NaN, Infinity"); // Nan VS Infinity
equal(QUnit.equiv(1/0, 0/0), false, "NaN, Infinity"); // Nan VS Infinity
equal(QUnit.equiv(0/0, null), false, "NaN");
equal(QUnit.equiv(0/0, undefined), false, "NaN");
equal(QUnit.equiv(0/0, 0), false, "NaN");
equal(QUnit.equiv(0/0, false), false, "NaN");
equal(QUnit.equiv(0/0, function () {}), false, "NaN");
equal(QUnit.equiv(1/0, null), false, "NaN, Infinity");
equal(QUnit.equiv(1/0, undefined), false, "NaN, Infinity");
equal(QUnit.equiv(1/0, 0), false, "NaN, Infinity");
equal(QUnit.equiv(1/0, 1), false, "NaN, Infinity");
equal(QUnit.equiv(1/0, false), false, "NaN, Infinity");
equal(QUnit.equiv(1/0, true), false, "NaN, Infinity");
equal(QUnit.equiv(1/0, function () {}), false, "NaN, Infinity");
equals(QUnit.equiv(0, 0), true, "number");
equals(QUnit.equiv(0, 1), false, "number");
equals(QUnit.equiv(1, 0), false, "number");
equals(QUnit.equiv(1, 1), true, "number");
equals(QUnit.equiv(1.1, 1.1), true, "number");
equals(QUnit.equiv(0.0000005, 0.0000005), true, "number");
equals(QUnit.equiv(0, ''), false, "number");
equals(QUnit.equiv(0, '0'), false, "number");
equals(QUnit.equiv(1, '1'), false, "number");
equals(QUnit.equiv(0, false), false, "number");
equals(QUnit.equiv(1, true), false, "number");
equal(QUnit.equiv(0, 0), true, "number");
equal(QUnit.equiv(0, 1), false, "number");
equal(QUnit.equiv(1, 0), false, "number");
equal(QUnit.equiv(1, 1), true, "number");
equal(QUnit.equiv(1.1, 1.1), true, "number");
equal(QUnit.equiv(0.0000005, 0.0000005), true, "number");
equal(QUnit.equiv(0, ''), false, "number");
equal(QUnit.equiv(0, '0'), false, "number");
equal(QUnit.equiv(1, '1'), false, "number");
equal(QUnit.equiv(0, false), false, "number");
equal(QUnit.equiv(1, true), false, "number");
equals(QUnit.equiv(true, true), true, "boolean");
equals(QUnit.equiv(true, false), false, "boolean");
equals(QUnit.equiv(false, true), false, "boolean");
equals(QUnit.equiv(false, 0), false, "boolean");
equals(QUnit.equiv(false, null), false, "boolean");
equals(QUnit.equiv(false, undefined), false, "boolean");
equals(QUnit.equiv(true, 1), false, "boolean");
equals(QUnit.equiv(true, null), false, "boolean");
equals(QUnit.equiv(true, undefined), false, "boolean");
equal(QUnit.equiv(true, true), true, "boolean");
equal(QUnit.equiv(true, false), false, "boolean");
equal(QUnit.equiv(false, true), false, "boolean");
equal(QUnit.equiv(false, 0), false, "boolean");
equal(QUnit.equiv(false, null), false, "boolean");
equal(QUnit.equiv(false, undefined), false, "boolean");
equal(QUnit.equiv(true, 1), false, "boolean");
equal(QUnit.equiv(true, null), false, "boolean");
equal(QUnit.equiv(true, undefined), false, "boolean");
equals(QUnit.equiv('', ''), true, "string");
equals(QUnit.equiv('a', 'a'), true, "string");
equals(QUnit.equiv("foobar", "foobar"), true, "string");
equals(QUnit.equiv("foobar", "foo"), false, "string");
equals(QUnit.equiv('', 0), false, "string");
equals(QUnit.equiv('', false), false, "string");
equals(QUnit.equiv('', null), false, "string");
equals(QUnit.equiv('', undefined), false, "string");
equal(QUnit.equiv('', ''), true, "string");
equal(QUnit.equiv('a', 'a'), true, "string");
equal(QUnit.equiv("foobar", "foobar"), true, "string");
equal(QUnit.equiv("foobar", "foo"), false, "string");
equal(QUnit.equiv('', 0), false, "string");
equal(QUnit.equiv('', false), false, "string");
equal(QUnit.equiv('', null), false, "string");
equal(QUnit.equiv('', undefined), false, "string");
// Short annotation VS new annotation
equals(QUnit.equiv(0, new Number()), true, "short annotation VS new annotation");
equals(QUnit.equiv(new Number(), 0), true, "short annotation VS new annotation");
equals(QUnit.equiv(1, new Number(1)), true, "short annotation VS new annotation");
equals(QUnit.equiv(new Number(1), 1), true, "short annotation VS new annotation");
equals(QUnit.equiv(new Number(0), 1), false, "short annotation VS new annotation");
equals(QUnit.equiv(0, new Number(1)), false, "short annotation VS new annotation");
equal(QUnit.equiv(0, new Number()), true, "short annotation VS new annotation");
equal(QUnit.equiv(new Number(), 0), true, "short annotation VS new annotation");
equal(QUnit.equiv(1, new Number(1)), true, "short annotation VS new annotation");
equal(QUnit.equiv(new Number(1), 1), true, "short annotation VS new annotation");
equal(QUnit.equiv(new Number(0), 1), false, "short annotation VS new annotation");
equal(QUnit.equiv(0, new Number(1)), false, "short annotation VS new annotation");
equals(QUnit.equiv(new String(), ""), true, "short annotation VS new annotation");
equals(QUnit.equiv("", new String()), true, "short annotation VS new annotation");
equals(QUnit.equiv(new String("My String"), "My String"), true, "short annotation VS new annotation");
equals(QUnit.equiv("My String", new String("My String")), true, "short annotation VS new annotation");
equals(QUnit.equiv("Bad String", new String("My String")), false, "short annotation VS new annotation");
equals(QUnit.equiv(new String("Bad String"), "My String"), false, "short annotation VS new annotation");
equal(QUnit.equiv(new String(), ""), true, "short annotation VS new annotation");
equal(QUnit.equiv("", new String()), true, "short annotation VS new annotation");
equal(QUnit.equiv(new String("My String"), "My String"), true, "short annotation VS new annotation");
equal(QUnit.equiv("My String", new String("My String")), true, "short annotation VS new annotation");
equal(QUnit.equiv("Bad String", new String("My String")), false, "short annotation VS new annotation");
equal(QUnit.equiv(new String("Bad String"), "My String"), false, "short annotation VS new annotation");
equals(QUnit.equiv(false, new Boolean()), true, "short annotation VS new annotation");
equals(QUnit.equiv(new Boolean(), false), true, "short annotation VS new annotation");
equals(QUnit.equiv(true, new Boolean(true)), true, "short annotation VS new annotation");
equals(QUnit.equiv(new Boolean(true), true), true, "short annotation VS new annotation");
equals(QUnit.equiv(true, new Boolean(1)), true, "short annotation VS new annotation");
equals(QUnit.equiv(false, new Boolean(false)), true, "short annotation VS new annotation");
equals(QUnit.equiv(new Boolean(false), false), true, "short annotation VS new annotation");
equals(QUnit.equiv(false, new Boolean(0)), true, "short annotation VS new annotation");
equals(QUnit.equiv(true, new Boolean(false)), false, "short annotation VS new annotation");
equals(QUnit.equiv(new Boolean(false), true), false, "short annotation VS new annotation");
equal(QUnit.equiv(false, new Boolean()), true, "short annotation VS new annotation");
equal(QUnit.equiv(new Boolean(), false), true, "short annotation VS new annotation");
equal(QUnit.equiv(true, new Boolean(true)), true, "short annotation VS new annotation");
equal(QUnit.equiv(new Boolean(true), true), true, "short annotation VS new annotation");
equal(QUnit.equiv(true, new Boolean(1)), true, "short annotation VS new annotation");
equal(QUnit.equiv(false, new Boolean(false)), true, "short annotation VS new annotation");
equal(QUnit.equiv(new Boolean(false), false), true, "short annotation VS new annotation");
equal(QUnit.equiv(false, new Boolean(0)), true, "short annotation VS new annotation");
equal(QUnit.equiv(true, new Boolean(false)), false, "short annotation VS new annotation");
equal(QUnit.equiv(new Boolean(false), true), false, "short annotation VS new annotation");
equals(QUnit.equiv(new Object(), {}), true, "short annotation VS new annotation");
equals(QUnit.equiv({}, new Object()), true, "short annotation VS new annotation");
equals(QUnit.equiv(new Object(), {a:1}), false, "short annotation VS new annotation");
equals(QUnit.equiv({a:1}, new Object()), false, "short annotation VS new annotation");
equals(QUnit.equiv({a:undefined}, new Object()), false, "short annotation VS new annotation");
equals(QUnit.equiv(new Object(), {a:undefined}), false, "short annotation VS new annotation");
equal(QUnit.equiv(new Object(), {}), true, "short annotation VS new annotation");
equal(QUnit.equiv({}, new Object()), true, "short annotation VS new annotation");
equal(QUnit.equiv(new Object(), {a:1}), false, "short annotation VS new annotation");
equal(QUnit.equiv({a:1}, new Object()), false, "short annotation VS new annotation");
equal(QUnit.equiv({a:undefined}, new Object()), false, "short annotation VS new annotation");
equal(QUnit.equiv(new Object(), {a:undefined}), false, "short annotation VS new annotation");
});
test("Objects Basics.", function() {
equals(QUnit.equiv({}, {}), true);
equals(QUnit.equiv({}, null), false);
equals(QUnit.equiv({}, undefined), false);
equals(QUnit.equiv({}, 0), false);
equals(QUnit.equiv({}, false), false);
equal(QUnit.equiv({}, {}), true);
equal(QUnit.equiv({}, null), false);
equal(QUnit.equiv({}, undefined), false);
equal(QUnit.equiv({}, 0), false);
equal(QUnit.equiv({}, false), false);

@@ -120,15 +120,15 @@ // This test is a hard one, it is very important

// 3) Their properties are the same (doesn't exists)
equals(QUnit.equiv({}, []), false);
equal(QUnit.equiv({}, []), false);
equals(QUnit.equiv({a:1}, {a:1}), true);
equals(QUnit.equiv({a:1}, {a:"1"}), false);
equals(QUnit.equiv({a:[]}, {a:[]}), true);
equals(QUnit.equiv({a:{}}, {a:null}), false);
equals(QUnit.equiv({a:1}, {}), false);
equals(QUnit.equiv({}, {a:1}), false);
equal(QUnit.equiv({a:1}, {a:1}), true);
equal(QUnit.equiv({a:1}, {a:"1"}), false);
equal(QUnit.equiv({a:[]}, {a:[]}), true);
equal(QUnit.equiv({a:{}}, {a:null}), false);
equal(QUnit.equiv({a:1}, {}), false);
equal(QUnit.equiv({}, {a:1}), false);
// Hard ones
equals(QUnit.equiv({a:undefined}, {}), false);
equals(QUnit.equiv({}, {a:undefined}), false);
equals(QUnit.equiv(
equal(QUnit.equiv({a:undefined}, {}), false);
equal(QUnit.equiv({}, {a:undefined}), false);
equal(QUnit.equiv(
{

@@ -141,2 +141,13 @@ a: [{ bar: undefined }]

), false);
// Objects with no prototype, created via Object.create(null), are used e.g. as dictionaries.
// Being able to test equivalence against object literals is quite useful.
if (typeof Object.create === 'function') {
equal(QUnit.equiv(Object.create(null), {}), true, "empty object without prototype VS empty object");
var nonEmptyWithNoProto = Object.create(null);
nonEmptyWithNoProto.foo = "bar";
equal(QUnit.equiv(nonEmptyWithNoProto, { foo: "bar" }), true, "object without prototype VS object");
}
});

@@ -147,3 +158,3 @@

equals(QUnit.equiv([], []), true);
equal(QUnit.equiv([], []), true);

@@ -153,29 +164,29 @@ // May be a hard one, can invoke a crash at execution.

// like a true object, it doesn't have any property at all.
equals(QUnit.equiv([], null), false);
equal(QUnit.equiv([], null), false);
equals(QUnit.equiv([], undefined), false);
equals(QUnit.equiv([], false), false);
equals(QUnit.equiv([], 0), false);
equals(QUnit.equiv([], ""), false);
equal(QUnit.equiv([], undefined), false);
equal(QUnit.equiv([], false), false);
equal(QUnit.equiv([], 0), false);
equal(QUnit.equiv([], ""), false);
// May be a hard one, but less hard
// than {} with [] (note the order)
equals(QUnit.equiv([], {}), false);
equal(QUnit.equiv([], {}), false);
equals(QUnit.equiv([null],[]), false);
equals(QUnit.equiv([undefined],[]), false);
equals(QUnit.equiv([],[null]), false);
equals(QUnit.equiv([],[undefined]), false);
equals(QUnit.equiv([null],[undefined]), false);
equals(QUnit.equiv([[]],[[]]), true);
equals(QUnit.equiv([[],[],[]],[[],[],[]]), true);
equals(QUnit.equiv(
equal(QUnit.equiv([null],[]), false);
equal(QUnit.equiv([undefined],[]), false);
equal(QUnit.equiv([],[null]), false);
equal(QUnit.equiv([],[undefined]), false);
equal(QUnit.equiv([null],[undefined]), false);
equal(QUnit.equiv([[]],[[]]), true);
equal(QUnit.equiv([[],[],[]],[[],[],[]]), true);
equal(QUnit.equiv(
[[],[],[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]],
[[],[],[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]),
true);
equals(QUnit.equiv(
equal(QUnit.equiv(
[[],[],[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]],
[[],[],[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]), // shorter
false);
equals(QUnit.equiv(
equal(QUnit.equiv(
[[],[],[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[{}]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]],

@@ -186,3 +197,3 @@ [[],[],[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]), // deepest element not an array

// same multidimensional
equals(QUnit.equiv(
equal(QUnit.equiv(
[1,2,3,4,5,6,7,8,9, [

@@ -233,3 +244,3 @@ 1,2,3,4,5,6,7,8,9, [

// different multidimensional
equals(QUnit.equiv(
equal(QUnit.equiv(
[1,2,3,4,5,6,7,8,9, [

@@ -280,3 +291,3 @@ 1,2,3,4,5,6,7,8,9, [

// different multidimensional
equals(QUnit.equiv(
equal(QUnit.equiv(
[1,2,3,4,5,6,7,8,9, [

@@ -337,13 +348,13 @@ 1,2,3,4,5,6,7,8,9, [

equals(QUnit.equiv(function() {}, function() {}), false, "Anonymous functions"); // exact source code
equals(QUnit.equiv(function() {}, function() {return true;}), false, "Anonymous functions");
equal(QUnit.equiv(function() {}, function() {}), false, "Anonymous functions"); // exact source code
equal(QUnit.equiv(function() {}, function() {return true;}), false, "Anonymous functions");
equals(QUnit.equiv(f0, f0), true, "Function references"); // same references
equals(QUnit.equiv(f0, f1), false, "Function references"); // exact source code, different references
equals(QUnit.equiv(f2, f3), false, "Function references"); // equivalent source code, different references
equals(QUnit.equiv(f1, f2), false, "Function references"); // different source code, different references
equals(QUnit.equiv(function() {}, true), false);
equals(QUnit.equiv(function() {}, undefined), false);
equals(QUnit.equiv(function() {}, null), false);
equals(QUnit.equiv(function() {}, {}), false);
equal(QUnit.equiv(f0, f0), true, "Function references"); // same references
equal(QUnit.equiv(f0, f1), false, "Function references"); // exact source code, different references
equal(QUnit.equiv(f2, f3), false, "Function references"); // equivalent source code, different references
equal(QUnit.equiv(f1, f2), false, "Function references"); // different source code, different references
equal(QUnit.equiv(function() {}, true), false);
equal(QUnit.equiv(function() {}, undefined), false);
equal(QUnit.equiv(function() {}, null), false);
equal(QUnit.equiv(function() {}, {}), false);
});

@@ -366,7 +377,7 @@

// Anyway their types differs, just in case the code fails in the order in which it deals with date
equals(QUnit.equiv(d1, 0), false); // d1.valueOf() returns 0, but d1 and 0 are different
equal(QUnit.equiv(d1, 0), false); // d1.valueOf() returns 0, but d1 and 0 are different
// test same values date and different instances equality
equals(QUnit.equiv(d1, d2), true);
equal(QUnit.equiv(d1, d2), true);
// test different date and different instances difference
equals(QUnit.equiv(d1, d3), false);
equal(QUnit.equiv(d1, d3), false);
});

@@ -397,18 +408,18 @@

equals(QUnit.equiv(r5, r6), true, "Modifier order");
equals(QUnit.equiv(r5, r7), true, "Modifier order");
equals(QUnit.equiv(r5, r8), true, "Modifier order");
equals(QUnit.equiv(r5, r9), true, "Modifier order");
equals(QUnit.equiv(r5, r10), true, "Modifier order");
equals(QUnit.equiv(r, r5), false, "Modifier");
equal(QUnit.equiv(r5, r6), true, "Modifier order");
equal(QUnit.equiv(r5, r7), true, "Modifier order");
equal(QUnit.equiv(r5, r8), true, "Modifier order");
equal(QUnit.equiv(r5, r9), true, "Modifier order");
equal(QUnit.equiv(r5, r10), true, "Modifier order");
equal(QUnit.equiv(r, r5), false, "Modifier");
equals(QUnit.equiv(ri1, ri2), true, "Modifier");
equals(QUnit.equiv(r, ri1), false, "Modifier");
equals(QUnit.equiv(ri1, rm1), false, "Modifier");
equals(QUnit.equiv(r, rm1), false, "Modifier");
equals(QUnit.equiv(rm1, ri1), false, "Modifier");
equals(QUnit.equiv(rm1, rm2), true, "Modifier");
equals(QUnit.equiv(rg1, rm1), false, "Modifier");
equals(QUnit.equiv(rm1, rg1), false, "Modifier");
equals(QUnit.equiv(rg1, rg2), true, "Modifier");
equal(QUnit.equiv(ri1, ri2), true, "Modifier");
equal(QUnit.equiv(r, ri1), false, "Modifier");
equal(QUnit.equiv(ri1, rm1), false, "Modifier");
equal(QUnit.equiv(r, rm1), false, "Modifier");
equal(QUnit.equiv(rm1, ri1), false, "Modifier");
equal(QUnit.equiv(rm1, rm2), true, "Modifier");
equal(QUnit.equiv(rg1, rm1), false, "Modifier");
equal(QUnit.equiv(rm1, rg1), false, "Modifier");
equal(QUnit.equiv(rg1, rg2), true, "Modifier");

@@ -418,7 +429,7 @@ // Different regex, same modifiers

var r13 = /[0-9]/gi; // oops! different
equals(QUnit.equiv(r11, r13), false, "Regex pattern");
equal(QUnit.equiv(r11, r13), false, "Regex pattern");
var r14 = /0/ig;
var r15 = /"0"/ig; // oops! different
equals(QUnit.equiv(r14, r15), false, "Regex pattern");
equal(QUnit.equiv(r14, r15), false, "Regex pattern");

@@ -430,5 +441,5 @@ var r1 = /[\n\r\u2028\u2029]/g;

equals(QUnit.equiv(r1, r2), true, "Regex pattern");
equals(QUnit.equiv(r1, r3), false, "Regex pattern");
equals(QUnit.equiv(r1, r4), false, "Regex pattern");
equal(QUnit.equiv(r1, r2), true, "Regex pattern");
equal(QUnit.equiv(r1, r3), false, "Regex pattern");
equal(QUnit.equiv(r1, r4), false, "Regex pattern");

@@ -447,11 +458,11 @@ // More complex regex

equals(QUnit.equiv(r21, r22), true, "Complex Regex");
equals(QUnit.equiv(r21, r23), false, "Complex Regex");
equals(QUnit.equiv(r23, r23a), false, "Complex Regex");
equals(QUnit.equiv(r23a, r24a), true, "Complex Regex");
equal(QUnit.equiv(r21, r22), true, "Complex Regex");
equal(QUnit.equiv(r21, r23), false, "Complex Regex");
equal(QUnit.equiv(r23, r23a), false, "Complex Regex");
equal(QUnit.equiv(r23a, r24a), true, "Complex Regex");
// typeof r1 is "function" in some browsers and "object" in others so we must cover this test
var re = / /;
equals(QUnit.equiv(re, function () {}), false, "Regex internal");
equals(QUnit.equiv(re, {}), false, "Regex internal");
equal(QUnit.equiv(re, function () {}), false, "Regex internal");
equal(QUnit.equiv(re, {}), false, "Regex internal");
});

@@ -471,3 +482,3 @@

// It can failed when properties are compared between unsorted arrays.
equals(QUnit.equiv(
equal(QUnit.equiv(
{

@@ -567,3 +578,3 @@ a: 1,

equals(QUnit.equiv(
equal(QUnit.equiv(
{

@@ -663,3 +674,3 @@ a: 1,

equals(QUnit.equiv(
equal(QUnit.equiv(
{

@@ -759,3 +770,3 @@ a: 1,

equals(QUnit.equiv(
equal(QUnit.equiv(
{

@@ -861,5 +872,5 @@ a: 1,

bar: undefined
}, 3, "Hey!", "Κάνε πάντα γνωρίζουμε ας των, μηχανής επιδιόρθωσης επιδιορθώσεις ώς μια. Κλπ ας"
],
unicode: "老 汉语中存在 港澳和海外的华人圈中 贵州 我去了书店 现在尚有争",
}, 3, "Hey!", "Κάνε πάντα γνω�ίζουμε ας των, μηχανής επιδιό�θωσης επιδιο�θώσεις ώς μια. Κλπ ας"
],
unicode: "� 汉语中存在 港澳和海外的�人圈中 贵州 我去了书店 现在尚有争",
b: "b",

@@ -875,5 +886,5 @@ c: fn1

bar: undefined
}, 3, "Hey!", "Κάνε πάντα γνωρίζουμε ας των, μηχανής επιδιόρθωσης επιδιορθώσεις ώς μια. Κλπ ας"
}, 3, "Hey!", "Κάνε πάντα γνω�ίζουμε ας των, μηχανής επιδιό�θωσης επιδιο�θώσεις ώς μια. Κλπ ας"
],
unicode: "老 汉语中存在 港澳和海外的华人圈中 贵州 我去了书店 现在尚有争",
unicode: "� 汉语中存在 港澳和海外的�人圈中 贵州 我去了书店 现在尚有争",
b: "b",

@@ -889,5 +900,5 @@ c: fn1

bar: undefined
}, 3, "Hey!", "Κάνε πάντα γνωρίζουμε ας των, μηχανής επιδιόρθωσης επιδιορθώσεις ώς μια. Κλπ ας"
}, 3, "Hey!", "Κάνε πάντα γνω�ίζουμε ας των, μηχανής επιδιό�θωσης επιδιο�θώσεις ώς μια. Κλπ ας"
],
unicode: "老 汉语中存在 港澳和海外的华人圈中 贵州 我去了书店 现在尚有争",
unicode: "� 汉语中存在 港澳和海外的�人圈中 贵州 我去了书店 现在尚有争",
b: "b",

@@ -904,5 +915,5 @@ c: fn1

bar: undefined
}, 3, "Hey!", "Κάνε πάντα γνωρίζουμε ας των, μηχανής επιδιόρθωσης επιδιορθώσεις ώς μια. Κλπ ας"
}, 3, "Hey!", "Κάνε πάντα γνω�ίζουμε ας των, μηχανής επιδιό�θωσης επιδιο�θώσεις ώς μια. Κλπ ας"
],
unicode: "老 汉语中存在 港澳和海外的华人圈中 贵州 我去了书店 现在尚有争",
unicode: "� 汉语中存在 港澳和海外的�人圈中 贵州 我去了书店 现在尚有争",
b: "b",

@@ -918,5 +929,5 @@ c: fn1

bar: undefined
}, 3, "Hey!", "Κάνε πάντα γνωρίζουμε ας των, μηχανής επιδιόρθωσης επιδιορθώσεις ώς μια. Κλπ α" // different: missing last char
}, 3, "Hey!", "Κάνε πάντα γνω�ίζουμε ας των, μηχανής επιδιό�θωσης επιδιο�θώσεις ώς μια. Κλπ α" // different: missing last char
],
unicode: "老 汉语中存在 港澳和海外的华人圈中 贵州 我去了书店 现在尚有争",
unicode: "� 汉语中存在 港澳和海外的�人圈中 贵州 我去了书店 现在尚有争",
b: "b",

@@ -932,5 +943,5 @@ c: fn1

bar: undefined
}, 3, "Hey!", "Κάνε πάντα γνωρίζουμε ας των, μηχανής επιδιόρθωσης επιδιορθώσεις ώς μια. Κλπ ας"
}, 3, "Hey!", "Κάνε πάντα γνω�ίζουμε ας των, μηχανής επιδιό�θωσης επιδιο�θώσεις ώς μια. Κλπ ας"
],
unicode: "老 汉语中存在 港澳和海外的华人圈中 贵州 我去了书店 现在尚有争",
unicode: "� 汉语中存在 港澳和海外的�人圈中 贵州 我去了书店 现在尚有争",
b: "b",

@@ -946,5 +957,5 @@ c: fn1

bat: undefined // different: property name not "bar"
}, 3, "Hey!", "Κάνε πάντα γνωρίζουμε ας των, μηχανής επιδιόρθωσης επιδιορθώσεις ώς μια. Κλπ ας"
}, 3, "Hey!", "Κάνε πάντα γνω�ίζουμε ας των, μηχανής επιδιό�θωσης επιδιο�θώσεις ώς μια. Κλπ ας"
],
unicode: "老 汉语中存在 港澳和海外的华人圈中 贵州 我去了书店 现在尚有争",
unicode: "� 汉语中存在 港澳和海外的�人圈中 贵州 我去了书店 现在尚有争",
b: "b",

@@ -954,14 +965,14 @@ c: fn1

equals(QUnit.equiv(same1, same2), true);
equals(QUnit.equiv(same2, same1), true);
equals(QUnit.equiv(same2, diff1), false);
equals(QUnit.equiv(diff1, same2), false);
equal(QUnit.equiv(same1, same2), true);
equal(QUnit.equiv(same2, same1), true);
equal(QUnit.equiv(same2, diff1), false);
equal(QUnit.equiv(diff1, same2), false);
equals(QUnit.equiv(same1, diff1), false);
equals(QUnit.equiv(same1, diff2), false);
equals(QUnit.equiv(same1, diff3), false);
equals(QUnit.equiv(same1, diff3), false);
equals(QUnit.equiv(same1, diff4), false);
equals(QUnit.equiv(same1, diff5), false);
equals(QUnit.equiv(diff5, diff1), false);
equal(QUnit.equiv(same1, diff1), false);
equal(QUnit.equiv(same1, diff2), false);
equal(QUnit.equiv(same1, diff3), false);
equal(QUnit.equiv(same1, diff3), false);
equal(QUnit.equiv(same1, diff4), false);
equal(QUnit.equiv(same1, diff5), false);
equal(QUnit.equiv(diff5, diff1), false);
});

@@ -975,3 +986,3 @@

equals(QUnit.equiv(
equal(QUnit.equiv(
[1, 2, 3, true, {}, null, [

@@ -991,3 +1002,3 @@ {

equals(QUnit.equiv(
equal(QUnit.equiv(
[1, 2, 3, true, {}, null, [

@@ -1031,3 +1042,3 @@ {

equals(QUnit.equiv(a,
equal(QUnit.equiv(a,
[{

@@ -1057,3 +1068,3 @@ b: fn,

equals(QUnit.equiv(a,
equal(QUnit.equiv(a,
[{

@@ -1083,3 +1094,3 @@ b: fn,

equals(QUnit.equiv(a,
equal(QUnit.equiv(a,
[{

@@ -1109,3 +1120,3 @@ b: fn,

equals(QUnit.equiv(a,
equal(QUnit.equiv(a,
[{

@@ -1135,3 +1146,3 @@ b: fn,

equals(QUnit.equiv(a,
equal(QUnit.equiv(a,
[{

@@ -1178,3 +1189,3 @@ b: fn,

// to make sure that our code does not mess with last object constructor memoization.
equals(QUnit.equiv(function () {}, function () {}), false);
equal(QUnit.equiv(function () {}, function () {}), false);

@@ -1184,3 +1195,3 @@ // Hoozit inherit from Gizmo

// hoozit instanceof Gizmo; // true
equals(QUnit.equiv(hoozit, gizmo), true);
equal(QUnit.equiv(hoozit, gizmo), true);

@@ -1191,3 +1202,3 @@ Gizmo.prototype.bar = true; // not a function just in case we skip them

// They are equivalent
equals(QUnit.equiv(hoozit, gizmo), true);
equal(QUnit.equiv(hoozit, gizmo), true);

@@ -1197,6 +1208,6 @@ // Make sure this is still true !important

// caller to where it were called from.
equals(QUnit.equiv(function () {}, function () {}), false);
equal(QUnit.equiv(function () {}, function () {}), false);
// Make sure this is still true !important
equals(QUnit.equiv(hoozit, gizmo), true);
equal(QUnit.equiv(hoozit, gizmo), true);

@@ -1209,6 +1220,6 @@ Hoozit.prototype.foo = true; // not a function just in case we skip them

// They are not equivalent
equals(QUnit.equiv(hoozit, gizmo), false);
equal(QUnit.equiv(hoozit, gizmo), false);
// Make sure this is still true !important
equals(QUnit.equiv(function () {}, function () {}), false);
equal(QUnit.equiv(function () {}, function () {}), false);
});

@@ -1228,8 +1239,8 @@

equals(QUnit.equiv(a1, a2), true, "Same property, same constructor");
equal(QUnit.equiv(a1, a2), true, "Same property, same constructor");
// b1.fn and b2.fn are functions but they are different references
// But we decided to skip function for instances.
equals(QUnit.equiv(b1, b2), true, "Same property, same constructor");
equals(QUnit.equiv(a1, b1), false, "Same properties but different constructor"); // failed
equal(QUnit.equiv(b1, b2), true, "Same property, same constructor");
equal(QUnit.equiv(a1, b1), false, "Same properties but different constructor"); // failed

@@ -1266,6 +1277,6 @@ function Car(year) {

equals(QUnit.equiv(car, car), true);
equals(QUnit.equiv(car, carDiff), false);
equals(QUnit.equiv(car, carSame), true);
equals(QUnit.equiv(car, human), false);
equal(QUnit.equiv(car, car), true);
equal(QUnit.equiv(car, carDiff), false);
equal(QUnit.equiv(car, carSame), true);
equal(QUnit.equiv(car, human), false);
});

@@ -1372,21 +1383,21 @@

var a2 = new A(function () {});
equals(QUnit.equiv(a1, a2), true);
equal(QUnit.equiv(a1, a2), true);
equals(QUnit.equiv(a1, a2), true); // different instances
equal(QUnit.equiv(a1, a2), true); // different instances
var b1 = new B(function () {});
var b2 = new B(function () {});
equals(QUnit.equiv(b1, b2), true);
equal(QUnit.equiv(b1, b2), true);
var c1 = new C(function () {});
var c2 = new C(function () {});
equals(QUnit.equiv(c1, c2), true);
equal(QUnit.equiv(c1, c2), true);
var d1 = new D(function () {});
var d2 = new D(function () {});
equals(QUnit.equiv(d1, d2), false);
equal(QUnit.equiv(d1, d2), false);
var e1 = new E(function () {});
var e2 = new E(function () {});
equals(QUnit.equiv(e1, e2), false);
equal(QUnit.equiv(e1, e2), false);

@@ -1404,11 +1415,11 @@ });

circularB.abc = circularB;
equals(QUnit.equiv(circularA, circularB), true, "Should not repeat test on object (ambigous test)");
equal(QUnit.equiv(circularA, circularB), true, "Should not repeat test on object (ambigous test)");
circularA.def = 1;
circularB.def = 1;
equals(QUnit.equiv(circularA, circularB), true, "Should not repeat test on object (ambigous test)");
equal(QUnit.equiv(circularA, circularB), true, "Should not repeat test on object (ambigous test)");
circularA.def = 1;
circularB.def = 0;
equals(QUnit.equiv(circularA, circularB), false, "Should not repeat test on object (unambigous test)");
equal(QUnit.equiv(circularA, circularB), false, "Should not repeat test on object (unambigous test)");
});

@@ -1421,11 +1432,11 @@

circularB.push(circularB);
equals(QUnit.equiv(circularA, circularB), true, "Should not repeat test on array (ambigous test)");
equal(QUnit.equiv(circularA, circularB), true, "Should not repeat test on array (ambigous test)");
circularA.push( 'abc' );
circularB.push( 'abc' );
equals(QUnit.equiv(circularA, circularB), true, "Should not repeat test on array (ambigous test)");
equal(QUnit.equiv(circularA, circularB), true, "Should not repeat test on array (ambigous test)");
circularA.push( 'hello' );
circularB.push( 'goodbye' );
equals(QUnit.equiv(circularA, circularB), false, "Should not repeat test on array (unambigous test)");
equal(QUnit.equiv(circularA, circularB), false, "Should not repeat test on array (unambigous test)");
});

@@ -1441,11 +1452,11 @@

circularB.push(circularB);
equals(QUnit.equiv(circularA, circularB), true, "Should not repeat test on object/array (ambigous test)");
equal(QUnit.equiv(circularA, circularB), true, "Should not repeat test on object/array (ambigous test)");
circularA[0].def = 1;
circularB[0].def = 1;
equals(QUnit.equiv(circularA, circularB), true, "Should not repeat test on object/array (ambigous test)");
equal(QUnit.equiv(circularA, circularB), true, "Should not repeat test on object/array (ambigous test)");
circularA[0].def = 1;
circularB[0].def = 0;
equals(QUnit.equiv(circularA, circularB), false, "Should not repeat test on object/array (unambigous test)");
equal(QUnit.equiv(circularA, circularB), false, "Should not repeat test on object/array (unambigous test)");
});

@@ -1461,6 +1472,6 @@

var re = /my regex/gm;
equals(QUnit.equiv(re, function () {}), false, "A function that looks that a regex isn't a regex");
equal(QUnit.equiv(re, function () {}), false, "A function that looks that a regex isn't a regex");
// This test will ensures it works in both ways, and ALSO especially that we can make differences
// between RegExp and Function constructor because typeof on a RegExpt instance is "function"
equals(QUnit.equiv(function () {}, re), false, "Same conversely, but ensures that function and regexp are distinct because their constructor are different");
equal(QUnit.equiv(function () {}, re), false, "Same conversely, but ensures that function and regexp are distinct because their constructor are different");
});

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

test("module with setup, expect in test call", 2, function() {

@@ -250,7 +251,7 @@ ok(true);

test("jsDump output", function() {
equals( QUnit.jsDump.parse([1, 2]), "[\n 1,\n 2\n]" );
equals( QUnit.jsDump.parse({top: 5, left: 0}), "{\n \"top\": 5,\n \"left\": 0\n}" );
equal( QUnit.jsDump.parse([1, 2]), "[\n 1,\n 2\n]" );
equal( QUnit.jsDump.parse({top: 5, left: 0}), "{\n \"top\": 5,\n \"left\": 0\n}" );
if (typeof document !== 'undefined' && document.getElementById("qunit-header")) {
equals( QUnit.jsDump.parse(document.getElementById("qunit-header")), "<h1 id=\"qunit-header\"></h1>" );
equals( QUnit.jsDump.parse(document.getElementsByTagName("h1")), "[\n <h1 id=\"qunit-header\"></h1>\n]" );
equal( QUnit.jsDump.parse(document.getElementById("qunit-header")), "<h1 id=\"qunit-header\"></h1>" );
equal( QUnit.jsDump.parse(document.getElementsByTagName("h1")), "[\n <h1 id=\"qunit-header\"></h1>\n]" );
}

@@ -348,10 +349,10 @@ });

first = first || last;
if (depth == 1) {
first.wrap = last;
}
}
if (depth > 1) {
last = chainwrap(depth-1, first, new Wrap(last));
}
return last;

@@ -374,3 +375,3 @@ }

equal(parentdump, '{\n "wrap": {\n "wrap": recursion(-2),\n "first": true\n }\n}');
var circref = chainwrap(10);

@@ -401,3 +402,3 @@ var circdump = QUnit.jsDump.parse(circref);

arr.push(arr);
var arrdump = QUnit.jsDump.parse(arr);

@@ -413,12 +414,12 @@

obj.childarr = childarr;
var objdump = QUnit.jsDump.parse(obj);
var childarrdump = QUnit.jsDump.parse(childarr);
equal(objdump, '{\n "childarr": [\n recursion(-2)\n ]\n}');
equal(childarrdump, '[\n {\n "childarr": recursion(-2)\n }\n]');
equal(obj.childarr, childarr, 'no endless stack when trying to dump array/object mix with circular ref');
equal(childarr[0], obj, 'no endless stack when trying to dump array/object mix with circular ref');
});

@@ -469,10 +470,62 @@

module("noglobals", {
teardown: function() {
delete window.badGlobalVariableIntroducedInTest;
if (typeof setTimeout !== 'undefined') {
function testAfterDone(){
var testName = "ensure has correct number of assertions";
function secondAfterDoneTest(){
QUnit.config.done = [];
//QUnit.done = function(){};
//because when this does happen, the assertion count parameter doesn't actually
//work we use this test to check the assertion count.
module("check previous test's assertion counts");
test('count previous two test\'s assertions', function(){
var spans = document.getElementsByTagName('span'),
tests = [],
countNodes;
//find these two tests
for (var i = 0; i < spans.length; i++) {
if (spans[i].innerHTML.indexOf(testName) !== -1) {
tests.push(spans[i]);
}
}
//walk dom to counts
countNodes = tests[0].nextSibling.nextSibling.getElementsByTagName('b');
equal(countNodes[1].innerHTML, "99");
countNodes = tests[1].nextSibling.nextSibling.getElementsByTagName('b');
equal(countNodes[1].innerHTML, "99");
});
}
});
test("let teardown clean up globals", function() {
// this test will always pass if run without ?noglobals=true
window.badGlobalVariableIntroducedInTest = true;
});
QUnit.config.done = [];
QUnit.done(secondAfterDoneTest);
module("Synchronous test after load of page");
asyncTest('Async test', function(){
start();
for (var i = 1; i < 100; i++) {
ok(i);
}
});
test(testName, 99, function(){
for (var i = 1; i < 100; i++) {
ok(i);
}
});
//we need two of these types of tests in order to ensure that assertions
//don't move between tests.
test(testName + ' 2', 99, function(){
for (var i = 1; i < 100; i++) {
ok(i);
}
});
}
QUnit.done(testAfterDone);
}
var path = require('path'),
fs = require('fs'),
vm = require('vm'),
vm = require('vm'),
_ = require('underscore'),
trace = require('tracejs').trace,
options = JSON.parse(process.argv[2]);
var currentModule = path.basename(options.code.path, '.js'),
currentTest;
trace = require('tracejs').trace;
var qunitPath = __dirname + '/../deps/qunit/qunit/qunit.js',
var options = JSON.parse(process.argv[2]),
currentModule = path.basename(options.code.path, '.js'),
currentTest,
doneTimeout,
qunitPath = __dirname + '/../deps/qunit/qunit/qunit.js',
qunitCode,
sandbox = {
require: require,
exports: {},
window: {setTimeout: setTimeout},
console: console,
clearTimeout: clearTimeout
};
sandbox;
// globals needed by qunit
sandbox = {
require: require,
exports: {},
window: {setTimeout: setTimeout},
console: console,
clearTimeout: clearTimeout
};
try {

@@ -32,6 +35,5 @@ qunitCode = fs.readFileSync(qunitPath, 'utf-8');

vm.runInNewContext('(function(){'+ qunitCode +'}.call(window))', sandbox, qunitPath);
_.extend(global, sandbox.exports);
// make qunit api global, like it is in the browser
//_.extend(global, require('../deps/qunit/qunit/qunit'));
_.extend(global, sandbox.exports);

@@ -57,3 +59,3 @@ /**

function calcCoverage() {
}

@@ -79,3 +81,3 @@

data.module = currentModule;
process.send({

@@ -94,3 +96,3 @@ event: 'assertionDone',

test.module = test.module || currentModule;
process.send({

@@ -106,24 +108,13 @@ event: 'testDone',

*/
QUnit.done(function done(res) {
clearTimeout(done.timeout);
done.timeout = setTimeout(function() {
if (options.coverage) {
res.coverage = calcCoverage();
}
process.send({
event: 'done',
data: res
});
}, 3000);
});
QUnit.done(_.debounce(function done(res) {
if (options.coverage) {
res.coverage = calcCoverage();
}
process.send({
event: 'done',
data: res
});
}, 1000));
// require deps
options.deps.forEach(load);
// require code
load(options.code);
// require tests
options.tests.forEach(load);
/**

@@ -141,2 +132,12 @@ * Provide better stack traces

// require deps
options.deps.forEach(load);
// require code
load(options.code);
// require tests
options.tests.forEach(load);
QUnit.begin();

@@ -5,13 +5,17 @@ var fs = require('fs'),

cp = require('child_process'),
_ = require('underscore'),
log = require('./log');
var options = exports.options = {
assertions: true,
tests: true,
summary: true,
globalSummary: true,
coverage: true,
deps: null
};
var options;
options = exports.options = {
assertions: true,
tests: true,
summary: true,
globalSummary: true,
coverage: false,
deps: null,
namespace: null
};
/**

@@ -24,6 +28,7 @@ * Run one spawned instance with tests

var child;
child = cp.fork(
__dirname + '/child.js',
[JSON.stringify(opts)],
{ env: process.env }
{env: process.env}
);

@@ -33,5 +38,5 @@

if (msg.event === 'assertionDone') {
log.assertion(msg.data);
log.assertion(msg.data);
} else if (msg.event === 'testDone') {
log.test(msg.data);
log.test(msg.data);
} else if (msg.event === 'done') {

@@ -41,7 +46,5 @@ msg.data.code = opts.code.path;

callback(msg.data);
child.kill();
if (typeof callback === 'function') {
callback(msg.data);
}
}

@@ -60,4 +63,4 @@ });

}
if(file.path.charAt(0) === '.') {
if (file.path.charAt(0) === '.') {
file.path = path.join(process.cwd(), file.path);

@@ -74,3 +77,3 @@ }

*/
function toArray(files) {
function absPaths(files) {
var ret = [];

@@ -102,18 +105,11 @@

files.forEach(function(file) {
var opts = {
deps: toArray(file.deps || options.deps),
code: absPath(file.code),
tests: toArray(file.tests),
paths: file.paths || options.paths,
coverage: file.coverage,
namespace: null
};
if (typeof opts.coverage === 'undefined') {
opts.coverage = options.coverage;
}
var opts = _.extend({}, options, file);
opts.deps = absPaths(opts.deps);
opts.code = absPath(opts.code);
opts.tests = absPaths(opts.tests);
function finished(stat) {
filesCount++;
if (filesCount >= files.length) {

@@ -123,3 +119,3 @@ if (options.assertions) {

}
if (options.tests) {

@@ -136,3 +132,3 @@ log.print('tests');

}
if (typeof callback === 'function') {

@@ -142,6 +138,6 @@ callback(log.stats());

}
}
if (opts.coverage) {
converage.instrument(opts.code);
} else {

@@ -148,0 +144,0 @@ runOne(opts, finished);

{
"name": "qunit",
"description": "A port of QUnit unit testing framework to nodejs",
"version": "0.2.6",
"version": "0.2.7",
"author": "Oleg Slobodskoi <oleg008@gmail.com>",

@@ -18,3 +18,3 @@ "contributors": [

"scripts": {
"test": "make test"
"test": "make test"
},

@@ -32,3 +32,3 @@ "dependencies": {

"licenses": [
{
{
"type": "MIT",

@@ -35,0 +35,0 @@ "url": "http: //www.opensource.org/licenses/mit-license.php"

test('a', 2, function(){
stop();
setTimeout(function() {
ok(true, 'test a1');
ok(true, 'test a2');
start();
}, 10);
ok(true, 'test a1');
ok(true, 'test a2');
start();
}, 10000);
})

@@ -13,8 +13,8 @@

stop();
setTimeout(function() {
ok(true, 'test b1');
ok(true, 'test b2');
start();
ok(true, 'test b1');
ok(true, 'test b2');
start();
}, 10);
})
var a = require('assert'),
chainer = require('chainer');
var tr = require('../lib/testrunner'),

@@ -18,3 +18,3 @@ log = require('../lib/log');

log.reset();
return chainer.prototype.next.apply(this, arguments);
return chainer.prototype.next.apply(this, arguments);
};

@@ -26,5 +26,4 @@

tests: fixtures + '/testrunner-tests.js',
coverage: false
}, function(res) {
var stat = {
var stat = {
files: 1,

@@ -34,3 +33,3 @@ tests: 2,

failed: 2,
passed: 3
passed: 3
};

@@ -47,5 +46,4 @@

tests: fixtures + '/child-tests-global.js',
coverage: false
}, function(res) {
var stat = {
var stat = {
files: 1,

@@ -55,9 +53,9 @@ tests: 1,

failed: 0,
passed: 2
passed: 2
};
a.deepEqual(stat, res, 'attaching code to global works');
chain.next();
});
});
});

@@ -71,5 +69,4 @@ chain.add('attach code to a namespace', function() {

tests: fixtures + '/child-tests-namespace.js',
coverage: false
}, function(res) {
var stat = {
var stat = {
files: 1,

@@ -79,5 +76,5 @@ tests: 1,

failed: 0,
passed: 3
passed: 3
};
a.deepEqual(stat, res, 'attaching code to specified namespace works');

@@ -92,5 +89,4 @@ chain.next();

tests: fixtures + '/async-test.js',
coverage: false
}, function(res) {
var stat = {
var stat = {
files: 1,

@@ -100,5 +96,5 @@ tests: 2,

failed: 0,
passed: 4
passed: 4
};
a.deepEqual(stat, res, 'async code testing works');

@@ -109,6 +105,4 @@ chain.next();

chain.add(function() {
console.log('All tests done');
console.log('All tests done');
});

@@ -115,0 +109,0 @@

Sorry, the diff of this file is not supported yet

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