-
Notifications
You must be signed in to change notification settings - Fork 187
/
qunit-2.1.1.js
4366 lines (3589 loc) · 121 KB
/
qunit-2.1.1.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.1.1
* https://qunitjs.com/
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license
* https://jquery.org/license
*
* Date: 2017-01-06T01:52Z
*/
(function (global$1) {
'use strict';
global$1 = 'default' in global$1 ? global$1['default'] : global$1;
var window = global$1.window;
var console = global$1.console;
var setTimeout = global$1.setTimeout;
var clearTimeout = global$1.clearTimeout;
var document = window && window.document;
var navigator = window && window.navigator;
var sessionStorage = window && window.sessionStorage;
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
return typeof obj;
} : function (obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
var classCallCheck = function (instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
};
var createClass = 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);
}
}
return function (Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps);
if (staticProps) defineProperties(Constructor, staticProps);
return Constructor;
};
}();
var toConsumableArray = function (arr) {
if (Array.isArray(arr)) {
for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
return arr2;
} else {
return Array.from(arr);
}
};
var toString = Object.prototype.toString;
var hasOwn = Object.prototype.hasOwnProperty;
var now = Date.now || function () {
return new Date().getTime();
};
var defined = {
document: window && window.document !== undefined,
setTimeout: setTimeout !== undefined
};
// Returns a new Array with the elements that are in a but not in b
function diff(a, b) {
var i,
j,
result = a.slice();
for (i = 0; i < result.length; i++) {
for (j = 0; j < b.length; j++) {
if (result[i] === b[j]) {
result.splice(i, 1);
i--;
break;
}
}
}
return result;
}
// From jquery.js
function inArray(elem, array) {
if (array.indexOf) {
return array.indexOf(elem);
}
for (var i = 0, length = array.length; i < length; i++) {
if (array[i] === elem) {
return i;
}
}
return -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 key,
val,
vals = is("array", obj) ? [] : {};
for (key in obj) {
if (hasOwn.call(obj, key)) {
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.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(.*)\]$/),
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();
}
if ((typeof obj === "undefined" ? "undefined" : _typeof(obj)) === "object") {
return "object";
}
}
// Safe object type checking
function is(type, obj) {
return objectType(obj) === type;
}
// Test for equality any JavaScript type.
// Author: Philippe Rathé <[email protected]>
var equiv = (function () {
// Stack to decide between skip/abort functions
var callers = [];
// Stack to avoiding loops from circular referencing
var parents = [];
var parentsB = [];
var getProto = Object.getPrototypeOf || function (obj) {
return obj.__proto__;
};
function useStrictEquality(b, a) {
// To catch short annotation VS 'new' annotation of a declaration. e.g.:
// `var i = 1;`
// `var j = new Number(1);`
if ((typeof a === "undefined" ? "undefined" : _typeof(a)) === "object") {
a = a.valueOf();
}
if ((typeof b === "undefined" ? "undefined" : _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];
}
var callbacks = {
"string": useStrictEquality,
"boolean": useStrictEquality,
"number": useStrictEquality,
"null": useStrictEquality,
"undefined": useStrictEquality,
"symbol": useStrictEquality,
"date": useStrictEquality,
"nan": function nan() {
return true;
},
"regexp": function regexp(b, a) {
return a.source === b.source &&
// Include flags in the comparison
getRegExpFlags(a) === getRegExpFlags(b);
},
// - skip when the property is a method of an instance (OOP)
// - abort otherwise,
// initial === would have catch identical references anyway
"function": function _function(b, a) {
var caller = callers[callers.length - 1];
return caller !== Object && typeof caller !== "undefined" && a.toString() === b.toString();
},
"array": function array(b, a) {
var i, j, len, loop, aCircular, bCircular;
len = a.length;
if (len !== b.length) {
// Safe and faster
return false;
}
// Track reference to avoid circular references
parents.push(a);
parentsB.push(b);
for (i = 0; i < len; i++) {
loop = false;
for (j = 0; j < parents.length; j++) {
aCircular = parents[j] === a[i];
bCircular = parentsB[j] === b[i];
if (aCircular || bCircular) {
if (a[i] === b[i] || aCircular && bCircular) {
loop = true;
} else {
parents.pop();
parentsB.pop();
return false;
}
}
}
if (!loop && !innerEquiv(a[i], b[i])) {
parents.pop();
parentsB.pop();
return false;
}
}
parents.pop();
parentsB.pop();
return true;
},
"set": function set$$1(b, a) {
var innerEq,
outerEq = true;
if (a.size !== b.size) {
return false;
}
a.forEach(function (aVal) {
innerEq = false;
b.forEach(function (bVal) {
if (innerEquiv(bVal, aVal)) {
innerEq = true;
}
});
if (!innerEq) {
outerEq = false;
}
});
return outerEq;
},
"map": function map(b, a) {
var innerEq,
outerEq = true;
if (a.size !== b.size) {
return false;
}
a.forEach(function (aVal, aKey) {
innerEq = false;
b.forEach(function (bVal, bKey) {
if (innerEquiv([bVal, bKey], [aVal, aKey])) {
innerEq = true;
}
});
if (!innerEq) {
outerEq = false;
}
});
return outerEq;
},
"object": function object(b, a) {
var i, j, loop, aCircular, bCircular;
// Default to true
var eq = true;
var aProperties = [];
var bProperties = [];
if (compareConstructors(a, b) === false) {
return false;
}
// Stack constructor before traversing properties
callers.push(a.constructor);
// Track reference to avoid circular references
parents.push(a);
parentsB.push(b);
// Be strict: don't ensure hasOwnProperty and go deep
for (i in a) {
loop = false;
for (j = 0; j < parents.length; j++) {
aCircular = parents[j] === a[i];
bCircular = parentsB[j] === b[i];
if (aCircular || bCircular) {
if (a[i] === b[i] || aCircular && bCircular) {
loop = true;
} else {
eq = false;
break;
}
}
}
aProperties.push(i);
if (!loop && !innerEquiv(a[i], b[i])) {
eq = false;
break;
}
}
parents.pop();
parentsB.pop();
// Unstack, we are done
callers.pop();
for (i in b) {
// Collect b's properties
bProperties.push(i);
}
// Ensures identical properties name
return eq && innerEquiv(aProperties.sort(), bProperties.sort());
}
};
function typeEquiv(a, b) {
var type = objectType(a);
return objectType(b) === type && callbacks[type](b, a);
}
// The real equiv function
function innerEquiv(a, b) {
// We're done when there's nothing more to compare
if (arguments.length < 2) {
return true;
}
// Require type-specific equality
return (a === b || typeEquiv(a, b)) && (
// ...across all consecutive argument pairs
arguments.length === 2 || innerEquiv.apply(this, [].slice.call(arguments, 1)));
}
return innerEquiv;
})();
/**
* 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: [],
// Block until document ready
blocking: 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: [],
// Stack of nested modules
moduleStack: [],
// The first unnamed module
currentModule: {
name: "",
tests: [],
childModules: [],
testsRun: 0
},
callbacks: {},
// The storage module to use for reordering tests
storage: sessionStorage
};
// take a predefined QUnit.config and extend the defaults
var globalConfig = window && window.QUnit && window.QUnit.config;
// only extend the global config if there is no QUnit overload
if (window && window.QUnit && !window.QUnit.version) {
extend(config, globalConfig);
}
// Push a loose unnamed module to the modules collection
config.modules.push(config.currentModule);
// Based on jsDump by Ariel Flesler
// http://flesler.blogspot.com/2008/05/jsdump-pretty-dump-of-any-javascript.html
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(),
base = dump.indent(),
inner = dump.indent(1);
if (arr.join) {
arr = arr.join("," + s + inner);
}
if (!arr) {
return pre + post;
}
return [pre, inner + arr, base + post].join(s);
}
function array(arr, stack) {
var i = arr.length,
ret = new Array(i);
if (dump.maxDepth && dump.depth > dump.maxDepth) {
return "[object Array]";
}
this.up();
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+)/,
dump = {
// The objType is used mostly internally, you can fix a (custom) type in advance
parse: function parse(obj, objType, stack) {
stack = stack || [];
var res,
parser,
parserType,
inStack = inArray(obj, stack);
if (inStack !== -1) {
return "recursion(" + (inStack - stack.length) + ")";
}
objType = objType || this.typeOf(obj);
parser = this.parsers[objType];
parserType = typeof parser === "undefined" ? "undefined" : _typeof(parser);
if (parserType === "function") {
stack.push(obj);
res = parser.call(this, obj, stack);
stack.pop();
return res;
}
return parserType === "string" ? parser : this.parsers.error;
},
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 === "undefined" ? "undefined" : _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 + "\")";
},
unknown: "[Unknown]",
"null": "null",
"undefined": "undefined",
"function": function _function(fn) {
var ret = "function",
// Functions never have name in IE
name = "name" in fn ? fn.name : (reName.exec(fn) || [])[1];
if (name) {
ret += " " + name;
}
ret += "(";
ret = [ret, dump.parse(fn, "functionArgs"), "){"].join("");
return join(ret, dump.parse(fn, "functionCode"), "}");
},
array: array,
nodelist: array,
"arguments": array,
object: function object(map, stack) {
var keys,
key,
val,
i,
nonEnumerableProperties,
ret = [];
if (dump.maxDepth && dump.depth > dump.maxDepth) {
return "[object Object]";
}
dump.up();
keys = [];
for (key in map) {
keys.push(key);
}
// Some properties are not always enumerable on Error objects.
nonEnumerableProperties = ["message", "name"];
for (i in nonEnumerableProperties) {
key = nonEnumerableProperties[i];
if (key in map && inArray(key, keys) < 0) {
keys.push(key);
}
}
keys.sort();
for (i = 0; i < keys.length; i++) {
key = keys[i];
val = map[key];
ret.push(dump.parse(key, "key") + ": " + dump.parse(val, undefined, stack));
}
dump.down();
return join("{", ret, "}");
},
node: function node(_node) {
var len,
i,
val,
open = dump.HTML ? "<" : "<",
close = dump.HTML ? ">" : ">",
tag = _node.nodeName.toLowerCase(),
ret = open + tag,
attrs = _node.attributes;
if (attrs) {
for (i = 0, len = attrs.length; i < len; i++) {
val = attrs[i].nodeValue;
// IE6 includes all attributes in .attributes, even ones not explicitly
// set. Those have values like undefined, null, 0, false, "" or
// "inherit".
if (val && val !== "inherit") {
ret += " " + attrs[i].nodeName + "=" + dump.parse(val, "attribute");
}
}
}
ret += close;
// Show content of TextNode or CDATASection
if (_node.nodeType === 3 || _node.nodeType === 4) {
ret += _node.nodeValue;
}
return ret + open + "/" + tag + close;
},
// Function calls it internally, it's the arguments part of the function
functionArgs: function functionArgs(fn) {
var args,
l = fn.length;
if (!l) {
return "";
}
args = new Array(l);
while (l--) {
// 97 is 'a'
args[l] = String.fromCharCode(97 + l);
}
return " " + args.join(", ") + " ";
},
// Object calls it internally, the key part of an item in a map
key: quote,
// Function calls it internally, it's the content of the function
functionCode: "[code]",
// Node calls it internally, it's a html attribute value
attribute: quote,
string: quote,
date: quote,
regexp: literal,
number: literal,
"boolean": literal,
symbol: function symbol(sym) {
return sym.toString();
}
},
// If true, entities are escaped ( <, >, \t, space and \n )
HTML: false,
// Indentation unit
indentChar: " ",
// If true, items in a collection, are separated by a \n, else just a space.
multiline: true
};
return dump;
})();
// Register logging callbacks
function registerLoggingCallbacks(obj) {
var i,
l,
key,
callbackNames = ["begin", "done", "log", "testStart", "testDone", "moduleStart", "moduleDone"];
function registerLoggingCallback(key) {
var loggingCallback = function loggingCallback(callback) {
if (objectType(callback) !== "function") {
throw new Error("QUnit logging methods require a callback function as their first parameters.");
}
config.callbacks[key].push(callback);
};
return loggingCallback;
}
for (i = 0, l = callbackNames.length; i < l; i++) {
key = callbackNames[i];
// Initialize key collection of logging callback
if (objectType(config.callbacks[key]) === "undefined") {
config.callbacks[key] = [];
}
obj[key] = registerLoggingCallback(key);
}
}
function runLoggingCallbacks(key, args) {
var i, l, callbacks;
callbacks = config.callbacks[key];
for (i = 0, l = callbacks.length; i < l; i++) {
callbacks[i](args);
}
}
// Doesn't support IE9, it will return undefined on these browsers
// See also https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error/Stack
var fileName = (sourceFromStacktrace(0) || "").replace(/(:\d+)+\)?/, "").replace(/.+\//, "");
function extractStacktrace(e, offset) {
offset = offset === undefined ? 4 : offset;
var stack, include, i;
if (e && e.stack) {
stack = e.stack.split("\n");
if (/^error$/i.test(stack[0])) {
stack.shift();
}
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];
}
}
function sourceFromStacktrace(offset) {
var error = new Error();
// Support: Safari <=7 only, IE <=10 - 11 only
// Not all browsers generate the `stack` property for `new Error()`, see also #636
if (!error.stack) {
try {
throw error;
} catch (err) {
error = err;
}
}
return extractStacktrace(error, offset);
}
var unitSampler;
var focused = false;
var priorityCount = 0;
function Test(settings) {
var i, l;
++Test.count;
this.expected = null;
extend(this, settings);
this.assertions = [];
this.semaphore = 0;
this.usedAsync = false;
this.module = config.currentModule;
this.stack = sourceFromStacktrace(3);
// Register unique strings
for (i = 0, l = this.module.tests; i < l.length; i++) {
if (this.module.tests[i].name === this.testName) {
this.testName += " ";
}
}
this.testId = generateHash(this.module.name, this.testName);
this.module.tests.push({
name: this.testName,
testId: this.testId
});
if (settings.skip) {
// Skipped tests will fully ignore any sent callback
this.callback = function () {};
this.async = false;
this.expected = 0;
} else {
this.assert = new Assert(this);
}
}
Test.count = 0;
function getNotStartedModules(startModule) {
var module = startModule,
modules = [];
while (module && module.testsRun === 0) {
modules.push(module);
module = module.parentModule;
}
return modules;
}
Test.prototype = {
before: function before() {
var i,
startModule,
module = this.module,
notStartedModules = getNotStartedModules(module);
for (i = notStartedModules.length - 1; i >= 0; i--) {
startModule = notStartedModules[i];
startModule.stats = { all: 0, bad: 0, started: now() };
runLoggingCallbacks("moduleStart", {
name: startModule.name,
tests: startModule.tests