-
Notifications
You must be signed in to change notification settings - Fork 0
/
qunit-2.17.2.js
7392 lines (6144 loc) · 242 KB
/
qunit-2.17.2.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*!
* QUnit 2.17.2
* https://qunitjs.com/
*
* Copyright OpenJS Foundation and other contributors
* Released under the MIT license
* https://jquery.org/license
*/
(function () {
'use strict';
// Support IE 9-10, Safari 7, PhantomJS: Partial Map fallback.
// Used by html.js (via fuzzysort.js), and test.js.
//
// FIXME: This check is broken. This file is embedded in the qunit.js closure,
// thus the Map var is hoisted in that scope, and starts undefined (not a function).
var Map = typeof Map === "function" ? Map : function StringMap() {
var store = Object.create( null );
var hasOwn = Object.prototype.hasOwnProperty;
this.get = function( strKey ) {
return store[ strKey ];
};
this.set = function( strKey, val ) {
if ( !hasOwn.call( store, strKey ) ) {
this.size++;
}
store[ strKey ] = val;
return this;
};
this.delete = function( strKey ) {
if ( hasOwn.call( store, strKey ) ) {
delete store[ strKey ];
this.size--;
}
};
this.forEach = function( callback ) {
for ( var strKey in store ) {
callback( store[ strKey ], strKey );
}
};
this.clear = function() {
store = Object.create( null );
this.size = 0;
};
this.size = 0;
};
function _typeof(obj) {
"@babel/helpers - typeof";
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
_typeof = function (obj) {
return typeof obj;
};
} else {
_typeof = function (obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
}
return _typeof(obj);
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
function _slicedToArray(arr, i) {
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
}
function _toConsumableArray(arr) {
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
}
function _arrayWithoutHoles(arr) {
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
}
function _arrayWithHoles(arr) {
if (Array.isArray(arr)) return arr;
}
function _iterableToArray(iter) {
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
}
function _iterableToArrayLimit(arr, i) {
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
if (_i == null) return;
var _arr = [];
var _n = true;
var _d = false;
var _s, _e;
try {
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
_arr.push(_s.value);
if (i && _arr.length === i) break;
}
} catch (err) {
_d = true;
_e = err;
} finally {
try {
if (!_n && _i["return"] != null) _i["return"]();
} finally {
if (_d) throw _e;
}
}
return _arr;
}
function _unsupportedIterableToArray(o, minLen) {
if (!o) return;
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
var n = Object.prototype.toString.call(o).slice(8, -1);
if (n === "Object" && o.constructor) n = o.constructor.name;
if (n === "Map" || n === "Set") return Array.from(o);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
}
function _arrayLikeToArray(arr, len) {
if (len == null || len > arr.length) len = arr.length;
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
return arr2;
}
function _nonIterableSpread() {
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _nonIterableRest() {
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _createForOfIteratorHelper(o, allowArrayLike) {
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
if (!it) {
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
if (it) o = it;
var i = 0;
var F = function () {};
return {
s: F,
n: function () {
if (i >= o.length) return {
done: true
};
return {
done: false,
value: o[i++]
};
},
e: function (e) {
throw e;
},
f: F
};
}
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
var normalCompletion = true,
didErr = false,
err;
return {
s: function () {
it = it.call(o);
},
n: function () {
var step = it.next();
normalCompletion = step.done;
return step;
},
e: function (e) {
didErr = true;
err = e;
},
f: function () {
try {
if (!normalCompletion && it.return != null) it.return();
} finally {
if (didErr) throw err;
}
}
};
}
/*
https://github.com/ungap/global-this/blob/v0.4.4/esm/index.js
Copyright (c) 2020, Andrea Giammarchi, @WebReflection
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
-------
Patches for use in QUnit:
- 2021-02-25: Export as module only, don't change global scope as QUnit must not
affect the host context (e.g. people may test their application intentionally
with different or no polyfills and we must not affect that).
*/
var foundGlobalThis;
(function (Object) {
if ((typeof globalThis === "undefined" ? "undefined" : _typeof(globalThis)) === "object") {
foundGlobalThis = globalThis;
} else {
var get = function get() {
foundGlobalThis = this || self;
delete Object.prototype._T_;
};
this ? get() : (Object.defineProperty(Object.prototype, "_T_", {
configurable: true,
get: get
}), _T_);
}
})(Object);
var globalThis$1 = foundGlobalThis;
var window$1 = globalThis$1.window;
var self$1 = globalThis$1.self;
var console$1 = globalThis$1.console;
var setTimeout$1 = globalThis$1.setTimeout;
var clearTimeout = globalThis$1.clearTimeout;
var document = window$1 && window$1.document;
var navigator = window$1 && window$1.navigator;
var localSessionStorage = function () {
var x = "qunit-test-string";
try {
globalThis$1.sessionStorage.setItem(x, x);
globalThis$1.sessionStorage.removeItem(x);
return globalThis$1.sessionStorage;
} catch (e) {
return undefined;
}
}();
// Detect if the console object exists and no-op otherwise.
// This allows support for IE 9, which doesn't have a console
// object if the developer tools are not open.
// Support: IE 9
// Function#bind is supported, but no console.log.bind().
// Support: SpiderMonkey (mozjs 68+)
// The console object has a log method, but no warn method.
var Logger = {
warn: console$1 ? Function.prototype.bind.call(console$1.warn || console$1.log, console$1) : function () {}
};
var toString = Object.prototype.toString;
var hasOwn$1 = Object.prototype.hasOwnProperty;
var now = Date.now || function () {
return new Date().getTime();
};
var nativePerf = getNativePerf();
function getNativePerf() {
if (window$1 && typeof window$1.performance !== "undefined" && typeof window$1.performance.mark === "function" && typeof window$1.performance.measure === "function") {
return window$1.performance;
} else {
return undefined;
}
}
var performance = {
now: nativePerf ? nativePerf.now.bind(nativePerf) : now,
measure: nativePerf ? function (comment, startMark, endMark) {
// `performance.measure` may fail if the mark could not be found.
// reasons a specific mark could not be found include: outside code invoking `performance.clearMarks()`
try {
nativePerf.measure(comment, startMark, endMark);
} catch (ex) {
Logger.warn("performance.measure could not be executed because of ", ex.message);
}
} : function () {},
mark: nativePerf ? nativePerf.mark.bind(nativePerf) : function () {}
}; // Returns a new Array with the elements that are in a but not in b
function diff(a, b) {
var result = a.slice();
for (var i = 0; i < result.length; i++) {
for (var j = 0; j < b.length; j++) {
if (result[i] === b[j]) {
result.splice(i, 1);
i--;
break;
}
}
}
return result;
}
/**
* Determines whether an element exists in a given array or not.
*
* @method inArray
* @param {any} elem
* @param {Array} array
* @return {boolean}
*/
function inArray(elem, array) {
return array.indexOf(elem) !== -1;
}
/**
* Makes a clone of an object using only Array or Object as base,
* and copies over the own enumerable properties.
*
* @param {Object} obj
* @return {Object} New object with only the own properties (recursively).
*/
function objectValues(obj) {
var vals = is("array", obj) ? [] : {};
for (var key in obj) {
if (hasOwn$1.call(obj, key)) {
var val = obj[key];
vals[key] = val === Object(val) ? objectValues(val) : val;
}
}
return vals;
}
function extend(a, b, undefOnly) {
for (var prop in b) {
if (hasOwn$1.call(b, prop)) {
if (b[prop] === undefined) {
delete a[prop];
} else if (!(undefOnly && typeof a[prop] !== "undefined")) {
a[prop] = b[prop];
}
}
}
return a;
}
function objectType(obj) {
if (typeof obj === "undefined") {
return "undefined";
} // Consider: typeof null === object
if (obj === null) {
return "null";
}
var match = toString.call(obj).match(/^\[object\s(.*)\]$/);
var type = match && match[1];
switch (type) {
case "Number":
if (isNaN(obj)) {
return "nan";
}
return "number";
case "String":
case "Boolean":
case "Array":
case "Set":
case "Map":
case "Date":
case "RegExp":
case "Function":
case "Symbol":
return type.toLowerCase();
default:
return _typeof(obj);
}
} // Safe object type checking
function is(type, obj) {
return objectType(obj) === type;
} // Based on Java's String.hashCode, a simple but not
// rigorously collision resistant hashing function
function generateHash(module, testName) {
var str = module + "\x1C" + testName;
var hash = 0;
for (var i = 0; i < str.length; i++) {
hash = (hash << 5) - hash + str.charCodeAt(i);
hash |= 0;
} // Convert the possibly negative integer hash code into an 8 character hex string, which isn't
// strictly necessary but increases user understanding that the id is a SHA-like hash
var hex = (0x100000000 + hash).toString(16);
if (hex.length < 8) {
hex = "0000000" + hex;
}
return hex.slice(-8);
}
/**
* Converts an error into a simple string for comparisons.
*
* @param {Error|any} error
* @return {string}
*/
function errorString(error) {
// Use String() instead of toString() to handle non-object values like undefined or null.
var resultErrorString = String(error); // If the error wasn't a subclass of Error but something like
// an object literal with name and message properties...
if (resultErrorString.slice(0, 7) === "[object") {
// Based on https://es5.github.io/#x15.11.4.4
return (error.name || "Error") + (error.message ? ": ".concat(error.message) : "");
} else {
return resultErrorString;
}
}
// Authors: Philippe Rathé <[email protected]>, David Chan <[email protected]>
var equiv = (function () {
// Value pairs queued for comparison. Used for breadth-first processing order, recursion
// detection and avoiding repeated comparison (see below for details).
// Elements are { a: val, b: val }.
var pairs = [];
var getProto = Object.getPrototypeOf || function (obj) {
return obj.__proto__;
};
function useStrictEquality(a, b) {
// This only gets called if a and b are not strict equal, and is used to compare on
// the primitive values inside object wrappers. For example:
// `var i = 1;`
// `var j = new Number(1);`
// Neither a nor b can be null, as a !== b and they have the same type.
if (_typeof(a) === "object") {
a = a.valueOf();
}
if (_typeof(b) === "object") {
b = b.valueOf();
}
return a === b;
}
function compareConstructors(a, b) {
var protoA = getProto(a);
var protoB = getProto(b); // Comparing constructors is more strict than using `instanceof`
if (a.constructor === b.constructor) {
return true;
} // Ref #851
// If the obj prototype descends from a null constructor, treat it
// as a null prototype.
if (protoA && protoA.constructor === null) {
protoA = null;
}
if (protoB && protoB.constructor === null) {
protoB = null;
} // Allow objects with no prototype to be equivalent to
// objects with Object as their constructor.
if (protoA === null && protoB === Object.prototype || protoB === null && protoA === Object.prototype) {
return true;
}
return false;
}
function getRegExpFlags(regexp) {
return "flags" in regexp ? regexp.flags : regexp.toString().match(/[gimuy]*$/)[0];
}
function isContainer(val) {
return ["object", "array", "map", "set"].indexOf(objectType(val)) !== -1;
}
function breadthFirstCompareChild(a, b) {
// If a is a container not reference-equal to b, postpone the comparison to the
// end of the pairs queue -- unless (a, b) has been seen before, in which case skip
// over the pair.
if (a === b) {
return true;
}
if (!isContainer(a)) {
return typeEquiv(a, b);
}
if (pairs.every(function (pair) {
return pair.a !== a || pair.b !== b;
})) {
// Not yet started comparing this pair
pairs.push({
a: a,
b: b
});
}
return true;
}
var callbacks = {
"string": useStrictEquality,
"boolean": useStrictEquality,
"number": useStrictEquality,
"null": useStrictEquality,
"undefined": useStrictEquality,
"symbol": useStrictEquality,
"date": useStrictEquality,
"nan": function nan() {
return true;
},
"regexp": function regexp(a, b) {
return a.source === b.source && // Include flags in the comparison
getRegExpFlags(a) === getRegExpFlags(b);
},
// abort (identical references / instance methods were skipped earlier)
"function": function _function() {
return false;
},
"array": function array(a, b) {
var len = a.length;
if (len !== b.length) {
// Safe and faster
return false;
}
for (var i = 0; i < len; i++) {
// Compare non-containers; queue non-reference-equal containers
if (!breadthFirstCompareChild(a[i], b[i])) {
return false;
}
}
return true;
},
// Define sets a and b to be equivalent if for each element aVal in a, there
// is some element bVal in b such that aVal and bVal are equivalent. Element
// repetitions are not counted, so these are equivalent:
// a = new Set( [ {}, [], [] ] );
// b = new Set( [ {}, {}, [] ] );
"set": function set(a, b) {
if (a.size !== b.size) {
// This optimization has certain quirks because of the lack of
// repetition counting. For instance, adding the same
// (reference-identical) element to two equivalent sets can
// make them non-equivalent.
return false;
}
var outerEq = true;
a.forEach(function (aVal) {
// Short-circuit if the result is already known. (Using for...of
// with a break clause would be cleaner here, but it would cause
// a syntax error on older JavaScript implementations even if
// Set is unused)
if (!outerEq) {
return;
}
var innerEq = false;
b.forEach(function (bVal) {
// Likewise, short-circuit if the result is already known
if (innerEq) {
return;
} // Swap out the global pairs list, as the nested call to
// innerEquiv will clobber its contents
var parentPairs = pairs;
if (innerEquiv(bVal, aVal)) {
innerEq = true;
} // Replace the global pairs list
pairs = parentPairs;
});
if (!innerEq) {
outerEq = false;
}
});
return outerEq;
},
// Define maps a and b to be equivalent if for each key-value pair (aKey, aVal)
// in a, there is some key-value pair (bKey, bVal) in b such that
// [ aKey, aVal ] and [ bKey, bVal ] are equivalent. Key repetitions are not
// counted, so these are equivalent:
// a = new Map( [ [ {}, 1 ], [ {}, 1 ], [ [], 1 ] ] );
// b = new Map( [ [ {}, 1 ], [ [], 1 ], [ [], 1 ] ] );
"map": function map(a, b) {
if (a.size !== b.size) {
// This optimization has certain quirks because of the lack of
// repetition counting. For instance, adding the same
// (reference-identical) key-value pair to two equivalent maps
// can make them non-equivalent.
return false;
}
var outerEq = true;
a.forEach(function (aVal, aKey) {
// Short-circuit if the result is already known. (Using for...of
// with a break clause would be cleaner here, but it would cause
// a syntax error on older JavaScript implementations even if
// Map is unused)
if (!outerEq) {
return;
}
var innerEq = false;
b.forEach(function (bVal, bKey) {
// Likewise, short-circuit if the result is already known
if (innerEq) {
return;
} // Swap out the global pairs list, as the nested call to
// innerEquiv will clobber its contents
var parentPairs = pairs;
if (innerEquiv([bVal, bKey], [aVal, aKey])) {
innerEq = true;
} // Replace the global pairs list
pairs = parentPairs;
});
if (!innerEq) {
outerEq = false;
}
});
return outerEq;
},
"object": function object(a, b) {
if (compareConstructors(a, b) === false) {
return false;
}
var aProperties = [];
var bProperties = []; // Be strict: don't ensure hasOwnProperty and go deep
for (var i in a) {
// Collect a's properties
aProperties.push(i); // Skip OOP methods that look the same
if (a.constructor !== Object && typeof a.constructor !== "undefined" && typeof a[i] === "function" && typeof b[i] === "function" && a[i].toString() === b[i].toString()) {
continue;
} // Compare non-containers; queue non-reference-equal containers
if (!breadthFirstCompareChild(a[i], b[i])) {
return false;
}
}
for (var _i in b) {
// Collect b's properties
bProperties.push(_i);
} // Ensures identical properties name
return typeEquiv(aProperties.sort(), bProperties.sort());
}
};
function typeEquiv(a, b) {
var type = objectType(a); // Callbacks for containers will append to the pairs queue to achieve breadth-first
// search order. The pairs queue is also used to avoid reprocessing any pair of
// containers that are reference-equal to a previously visited pair (a special case
// this being recursion detection).
//
// Because of this approach, once typeEquiv returns a false value, it should not be
// called again without clearing the pair queue else it may wrongly report a visited
// pair as being equivalent.
return objectType(b) === type && callbacks[type](a, b);
}
function innerEquiv(a, b) {
// We're done when there's nothing more to compare
if (arguments.length < 2) {
return true;
} // Clear the global pair queue and add the top-level values being compared
pairs = [{
a: a,
b: b
}];
for (var i = 0; i < pairs.length; i++) {
var pair = pairs[i]; // Perform type-specific comparison on any pairs that are not strictly
// equal. For container types, that comparison will postpone comparison
// of any sub-container pair to the end of the pair queue. This gives
// breadth-first search order. It also avoids the reprocessing of
// reference-equal siblings, cousins etc, which can have a significant speed
// impact when comparing a container of small objects each of which has a
// reference to the same (singleton) large object.
if (pair.a !== pair.b && !typeEquiv(pair.a, pair.b)) {
return false;
}
} // ...across all consecutive argument pairs
return arguments.length === 2 || innerEquiv.apply(this, [].slice.call(arguments, 1));
}
return function () {
var result = innerEquiv.apply(void 0, arguments); // Release any retained objects
pairs.length = 0;
return result;
};
})();
/**
* Config object: Maintain internal state
* Later exposed as QUnit.config
* `config` initialized at top of scope
*/
var config = {
// The queue of tests to run
queue: [],
stats: {
all: 0,
bad: 0,
testCount: 0
},
// Block until document ready
blocking: true,
// whether or not to fail when there are zero tests
// defaults to `true`
failOnZeroTests: true,
// By default, run previously failed tests first
// very useful in combination with "Hide passed tests" checked
reorder: true,
// By default, modify document.title when suite is done
altertitle: true,
// HTML Reporter: collapse every test except the first failing test
// If false, all failing tests will be expanded
collapse: true,
// By default, scroll to top of the page when suite is done
scrolltop: true,
// Depth up-to which object will be dumped
maxDepth: 5,
// When enabled, all tests must call expect()
requireExpects: false,
// Placeholder for user-configurable form-exposed URL parameters
urlConfig: [],
// Set of all modules.
modules: [],
// The first unnamed module
currentModule: {
name: "",
tests: [],
childModules: [],
testsRun: 0,
testsIgnored: 0,
hooks: {
before: [],
beforeEach: [],
afterEach: [],
after: []
}
},
callbacks: {},
// The storage module to use for reordering tests
storage: localSessionStorage
}; // take a predefined QUnit.config and extend the defaults
var globalConfig = window$1 && window$1.QUnit && window$1.QUnit.config; // only extend the global config if there is no QUnit overload
if (window$1 && window$1.QUnit && !window$1.QUnit.version) {
extend(config, globalConfig);
} // Push a loose unnamed module to the modules collection
config.modules.push(config.currentModule);
var dump = (function () {
function quote(str) {
return "\"" + str.toString().replace(/\\/g, "\\\\").replace(/"/g, "\\\"") + "\"";
}
function literal(o) {
return o + "";
}
function join(pre, arr, post) {
var s = dump.separator();
var inner = dump.indent(1);
if (arr.join) {
arr = arr.join("," + s + inner);
}
if (!arr) {
return pre + post;
}
var base = dump.indent();
return [pre, inner + arr, base + post].join(s);
}
function array(arr, stack) {
if (dump.maxDepth && dump.depth > dump.maxDepth) {
return "[object Array]";
}
this.up();
var i = arr.length;
var ret = new Array(i);
while (i--) {
ret[i] = this.parse(arr[i], undefined, stack);
}
this.down();
return join("[", ret, "]");
}
function isArray(obj) {
return (//Native Arrays
toString.call(obj) === "[object Array]" || // NodeList objects
typeof obj.length === "number" && obj.item !== undefined && (obj.length ? obj.item(0) === obj[0] : obj.item(0) === null && obj[0] === undefined)
);
}
var reName = /^function (\w+)/;
var dump = {
// The objType is used mostly internally, you can fix a (custom) type in advance
parse: function parse(obj, objType, stack) {
stack = stack || [];
var objIndex = stack.indexOf(obj);
if (objIndex !== -1) {
return "recursion(".concat(objIndex - stack.length, ")");
}
objType = objType || this.typeOf(obj);
var parser = this.parsers[objType];
var parserType = _typeof(parser);
if (parserType === "function") {
stack.push(obj);
var res = parser.call(this, obj, stack);
stack.pop();
return res;
}
if (parserType === "string") {
return parser;
}
return "[ERROR: Missing QUnit.dump formatter for type " + objType + "]";
},
typeOf: function typeOf(obj) {
var type;
if (obj === null) {
type = "null";
} else if (typeof obj === "undefined") {
type = "undefined";
} else if (is("regexp", obj)) {
type = "regexp";
} else if (is("date", obj)) {
type = "date";
} else if (is("function", obj)) {
type = "function";
} else if (obj.setInterval !== undefined && obj.document !== undefined && obj.nodeType === undefined) {
type = "window";
} else if (obj.nodeType === 9) {
type = "document";
} else if (obj.nodeType) {
type = "node";
} else if (isArray(obj)) {
type = "array";
} else if (obj.constructor === Error.prototype.constructor) {
type = "error";
} else {
type = _typeof(obj);
}
return type;
},
separator: function separator() {
if (this.multiline) {
return this.HTML ? "<br />" : "\n";
} else {
return this.HTML ? " " : " ";
}
},
// Extra can be a number, shortcut for increasing-calling-decreasing
indent: function indent(extra) {
if (!this.multiline) {
return "";
}
var chr = this.indentChar;
if (this.HTML) {
chr = chr.replace(/\t/g, " ").replace(/ /g, " ");
}
return new Array(this.depth + (extra || 0)).join(chr);
},
up: function up(a) {
this.depth += a || 1;
},
down: function down(a) {
this.depth -= a || 1;
},
setParser: function setParser(name, parser) {
this.parsers[name] = parser;
},
// The next 3 are exposed so you can use them
quote: quote,
literal: literal,
join: join,
depth: 1,
maxDepth: config.maxDepth,
// This is the list of parsers, to modify them, use dump.setParser
parsers: {
window: "[Window]",
document: "[Document]",
error: function error(_error) {
return "Error(\"" + _error.message + "\")";
},
// This has been unused since QUnit 1.0.0.
// @todo Deprecate and remove.
unknown: "[Unknown]",
"null": "null",
"undefined": "undefined",
"function": function _function(fn) {
var ret = "function"; // Functions never have name in IE
var name = "name" in fn ? fn.name : (reName.exec(fn) || [])[1];
if (name) {
ret += " " + name;
}