qunitx-cli 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/flake.lock +64 -0
  2. package/flake.nix +26 -0
  3. package/package.json +4 -4
  4. package/.github/dependabot.yml +0 -7
  5. package/.github/workflows/push.yml +0 -36
  6. package/CHANGELOG.md +0 -25
  7. package/Dockerfile +0 -24
  8. package/TODO +0 -90
  9. package/build.js +0 -54
  10. package/test/commands/help-test.js +0 -72
  11. package/test/commands/index.js +0 -2
  12. package/test/commands/init-test.js +0 -44
  13. package/test/flags/after-test.js +0 -23
  14. package/test/flags/before-test.js +0 -23
  15. package/test/flags/coverage-test.js +0 -6
  16. package/test/flags/failfast-test.js +0 -5
  17. package/test/flags/index.js +0 -2
  18. package/test/flags/output-test.js +0 -6
  19. package/test/flags/reporter-test.js +0 -6
  20. package/test/flags/timeout-test.js +0 -6
  21. package/test/flags/watch-test.js +0 -6
  22. package/test/helpers/after-script-async.js +0 -13
  23. package/test/helpers/after-script-basic.js +0 -1
  24. package/test/helpers/assert-stdout.js +0 -112
  25. package/test/helpers/before-script-async.js +0 -35
  26. package/test/helpers/before-script-basic.js +0 -1
  27. package/test/helpers/before-script-web-server-tests.js +0 -28
  28. package/test/helpers/failing-tests.js +0 -49
  29. package/test/helpers/failing-tests.ts +0 -49
  30. package/test/helpers/fs-writers.js +0 -36
  31. package/test/helpers/index-with-content.html +0 -20
  32. package/test/helpers/index-without-content.html +0 -22
  33. package/test/helpers/passing-tests-dist.js +0 -4883
  34. package/test/helpers/passing-tests.js +0 -44
  35. package/test/helpers/passing-tests.ts +0 -44
  36. package/test/helpers/shell.js +0 -37
  37. package/test/index.js +0 -22
  38. package/test/inputs/advanced-htmls-test.js +0 -21
  39. package/test/inputs/error-edge-cases-test.js +0 -11
  40. package/test/inputs/file-and-folder-test.js +0 -11
  41. package/test/inputs/file-test.js +0 -169
  42. package/test/inputs/folder-test.js +0 -193
  43. package/test/inputs/index.js +0 -5
  44. package/test/setup/index.js +0 -1
  45. package/test/setup/test-file-paths-test.js +0 -33
  46. package/test/setup.js +0 -17
@@ -1,4883 +0,0 @@
1
- (() => {
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getProtoOf = Object.getPrototypeOf;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
8
- var __markAsModule = (target) => __defProp(target, "__esModule", {value: true});
9
- var __commonJS = (cb, mod) => () => (mod || cb((mod = {exports: {}}).exports, mod), mod.exports);
10
- var __reExport = (target, module2, desc) => {
11
- if (module2 && typeof module2 === "object" || typeof module2 === "function") {
12
- for (let key of __getOwnPropNames(module2))
13
- if (!__hasOwnProp.call(target, key) && key !== "default")
14
- __defProp(target, key, {get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable});
15
- }
16
- return target;
17
- };
18
- var __toModule = (module2) => {
19
- return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? {get: () => module2.default, enumerable: true} : {value: module2, enumerable: true})), module2);
20
- };
21
-
22
- // ../../vendor/qunit.js
23
- var require_qunit = __commonJS((exports, module2) => {
24
- /*!
25
- * QUnit 2.15.0
26
- * https://qunitjs.com/
27
- *
28
- * Copyright OpenJS Foundation and other contributors
29
- * Released under the MIT license
30
- * https://jquery.org/license
31
- */
32
- (function() {
33
- "use strict";
34
- var Map = typeof Map === "function" ? Map : function StringMap() {
35
- var store = Object.create(null);
36
- this.get = function(strKey) {
37
- return store[strKey];
38
- };
39
- this.set = function(strKey, val) {
40
- store[strKey] = val;
41
- return this;
42
- };
43
- this.clear = function() {
44
- store = Object.create(null);
45
- };
46
- };
47
- function _typeof(obj) {
48
- "@babel/helpers - typeof";
49
- if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
50
- _typeof = function(obj2) {
51
- return typeof obj2;
52
- };
53
- } else {
54
- _typeof = function(obj2) {
55
- return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
56
- };
57
- }
58
- return _typeof(obj);
59
- }
60
- function _classCallCheck(instance, Constructor) {
61
- if (!(instance instanceof Constructor)) {
62
- throw new TypeError("Cannot call a class as a function");
63
- }
64
- }
65
- function _defineProperties(target, props) {
66
- for (var i = 0; i < props.length; i++) {
67
- var descriptor = props[i];
68
- descriptor.enumerable = descriptor.enumerable || false;
69
- descriptor.configurable = true;
70
- if ("value" in descriptor)
71
- descriptor.writable = true;
72
- Object.defineProperty(target, descriptor.key, descriptor);
73
- }
74
- }
75
- function _createClass(Constructor, protoProps, staticProps) {
76
- if (protoProps)
77
- _defineProperties(Constructor.prototype, protoProps);
78
- if (staticProps)
79
- _defineProperties(Constructor, staticProps);
80
- return Constructor;
81
- }
82
- function _toConsumableArray(arr) {
83
- return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
84
- }
85
- function _arrayWithoutHoles(arr) {
86
- if (Array.isArray(arr))
87
- return _arrayLikeToArray(arr);
88
- }
89
- function _iterableToArray(iter) {
90
- if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter))
91
- return Array.from(iter);
92
- }
93
- function _unsupportedIterableToArray(o, minLen) {
94
- if (!o)
95
- return;
96
- if (typeof o === "string")
97
- return _arrayLikeToArray(o, minLen);
98
- var n = Object.prototype.toString.call(o).slice(8, -1);
99
- if (n === "Object" && o.constructor)
100
- n = o.constructor.name;
101
- if (n === "Map" || n === "Set")
102
- return Array.from(o);
103
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
104
- return _arrayLikeToArray(o, minLen);
105
- }
106
- function _arrayLikeToArray(arr, len) {
107
- if (len == null || len > arr.length)
108
- len = arr.length;
109
- for (var i = 0, arr2 = new Array(len); i < len; i++)
110
- arr2[i] = arr[i];
111
- return arr2;
112
- }
113
- function _nonIterableSpread() {
114
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
115
- }
116
- function _createForOfIteratorHelper(o, allowArrayLike) {
117
- var it;
118
- if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) {
119
- if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
120
- if (it)
121
- o = it;
122
- var i = 0;
123
- var F = function() {
124
- };
125
- return {
126
- s: F,
127
- n: function() {
128
- if (i >= o.length)
129
- return {
130
- done: true
131
- };
132
- return {
133
- done: false,
134
- value: o[i++]
135
- };
136
- },
137
- e: function(e) {
138
- throw e;
139
- },
140
- f: F
141
- };
142
- }
143
- throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
144
- }
145
- var normalCompletion = true, didErr = false, err;
146
- return {
147
- s: function() {
148
- it = o[Symbol.iterator]();
149
- },
150
- n: function() {
151
- var step = it.next();
152
- normalCompletion = step.done;
153
- return step;
154
- },
155
- e: function(e) {
156
- didErr = true;
157
- err = e;
158
- },
159
- f: function() {
160
- try {
161
- if (!normalCompletion && it.return != null)
162
- it.return();
163
- } finally {
164
- if (didErr)
165
- throw err;
166
- }
167
- }
168
- };
169
- }
170
- var foundGlobalThis;
171
- (function(Object2) {
172
- if ((typeof globalThis === "undefined" ? "undefined" : _typeof(globalThis)) === "object") {
173
- foundGlobalThis = globalThis;
174
- } else {
175
- var get = function get2() {
176
- foundGlobalThis = this || self;
177
- delete Object2.prototype._T_;
178
- };
179
- this ? get() : (Object2.defineProperty(Object2.prototype, "_T_", {
180
- configurable: true,
181
- get
182
- }), _T_);
183
- }
184
- })(Object);
185
- var globalThis$1 = foundGlobalThis;
186
- var window$1 = globalThis$1.window;
187
- var self$1 = globalThis$1.self;
188
- var console$1 = globalThis$1.console;
189
- var setTimeout$1 = globalThis$1.setTimeout;
190
- var clearTimeout = globalThis$1.clearTimeout;
191
- var document = window$1 && window$1.document;
192
- var navigator = window$1 && window$1.navigator;
193
- var localSessionStorage = function() {
194
- var x = "qunit-test-string";
195
- try {
196
- globalThis$1.sessionStorage.setItem(x, x);
197
- globalThis$1.sessionStorage.removeItem(x);
198
- return globalThis$1.sessionStorage;
199
- } catch (e) {
200
- return void 0;
201
- }
202
- }();
203
- var Logger = {
204
- warn: console$1 ? (console$1.warn || console$1.log).bind(console$1) : function() {
205
- }
206
- };
207
- var toString = Object.prototype.toString;
208
- var hasOwn = Object.prototype.hasOwnProperty;
209
- var now = Date.now || function() {
210
- return new Date().getTime();
211
- };
212
- var nativePerf = getNativePerf();
213
- function getNativePerf() {
214
- if (window$1 && typeof window$1.performance !== "undefined" && typeof window$1.performance.mark === "function" && typeof window$1.performance.measure === "function") {
215
- return window$1.performance;
216
- } else {
217
- return void 0;
218
- }
219
- }
220
- var performance = {
221
- now: nativePerf ? nativePerf.now.bind(nativePerf) : now,
222
- measure: nativePerf ? function(comment, startMark, endMark) {
223
- try {
224
- nativePerf.measure(comment, startMark, endMark);
225
- } catch (ex) {
226
- Logger.warn("performance.measure could not be executed because of ", ex.message);
227
- }
228
- } : function() {
229
- },
230
- mark: nativePerf ? nativePerf.mark.bind(nativePerf) : function() {
231
- }
232
- };
233
- function diff2(a, b) {
234
- var result = a.slice();
235
- for (var i = 0; i < result.length; i++) {
236
- for (var j = 0; j < b.length; j++) {
237
- if (result[i] === b[j]) {
238
- result.splice(i, 1);
239
- i--;
240
- break;
241
- }
242
- }
243
- }
244
- return result;
245
- }
246
- function inArray(elem, array) {
247
- return array.indexOf(elem) !== -1;
248
- }
249
- function objectValues(obj) {
250
- var vals = is2("array", obj) ? [] : {};
251
- for (var key in obj) {
252
- if (hasOwn.call(obj, key)) {
253
- var val = obj[key];
254
- vals[key] = val === Object(val) ? objectValues(val) : val;
255
- }
256
- }
257
- return vals;
258
- }
259
- function extend2(a, b, undefOnly) {
260
- for (var prop in b) {
261
- if (hasOwn.call(b, prop)) {
262
- if (b[prop] === void 0) {
263
- delete a[prop];
264
- } else if (!(undefOnly && typeof a[prop] !== "undefined")) {
265
- a[prop] = b[prop];
266
- }
267
- }
268
- }
269
- return a;
270
- }
271
- function objectType2(obj) {
272
- if (typeof obj === "undefined") {
273
- return "undefined";
274
- }
275
- if (obj === null) {
276
- return "null";
277
- }
278
- var match = toString.call(obj).match(/^\[object\s(.*)\]$/);
279
- var type = match && match[1];
280
- switch (type) {
281
- case "Number":
282
- if (isNaN(obj)) {
283
- return "nan";
284
- }
285
- return "number";
286
- case "String":
287
- case "Boolean":
288
- case "Array":
289
- case "Set":
290
- case "Map":
291
- case "Date":
292
- case "RegExp":
293
- case "Function":
294
- case "Symbol":
295
- return type.toLowerCase();
296
- default:
297
- return _typeof(obj);
298
- }
299
- }
300
- function is2(type, obj) {
301
- return objectType2(obj) === type;
302
- }
303
- function generateHash(module3, testName) {
304
- var str = module3 + "" + testName;
305
- var hash = 0;
306
- for (var i = 0; i < str.length; i++) {
307
- hash = (hash << 5) - hash + str.charCodeAt(i);
308
- hash |= 0;
309
- }
310
- var hex = (4294967296 + hash).toString(16);
311
- if (hex.length < 8) {
312
- hex = "0000000" + hex;
313
- }
314
- return hex.slice(-8);
315
- }
316
- var equiv2 = function() {
317
- var pairs = [];
318
- var getProto = Object.getPrototypeOf || function(obj) {
319
- return obj.__proto__;
320
- };
321
- function useStrictEquality(a, b) {
322
- if (_typeof(a) === "object") {
323
- a = a.valueOf();
324
- }
325
- if (_typeof(b) === "object") {
326
- b = b.valueOf();
327
- }
328
- return a === b;
329
- }
330
- function compareConstructors(a, b) {
331
- var protoA = getProto(a);
332
- var protoB = getProto(b);
333
- if (a.constructor === b.constructor) {
334
- return true;
335
- }
336
- if (protoA && protoA.constructor === null) {
337
- protoA = null;
338
- }
339
- if (protoB && protoB.constructor === null) {
340
- protoB = null;
341
- }
342
- if (protoA === null && protoB === Object.prototype || protoB === null && protoA === Object.prototype) {
343
- return true;
344
- }
345
- return false;
346
- }
347
- function getRegExpFlags(regexp) {
348
- return "flags" in regexp ? regexp.flags : regexp.toString().match(/[gimuy]*$/)[0];
349
- }
350
- function isContainer(val) {
351
- return ["object", "array", "map", "set"].indexOf(objectType2(val)) !== -1;
352
- }
353
- function breadthFirstCompareChild(a, b) {
354
- if (a === b) {
355
- return true;
356
- }
357
- if (!isContainer(a)) {
358
- return typeEquiv(a, b);
359
- }
360
- if (pairs.every(function(pair) {
361
- return pair.a !== a || pair.b !== b;
362
- })) {
363
- pairs.push({
364
- a,
365
- b
366
- });
367
- }
368
- return true;
369
- }
370
- var callbacks = {
371
- string: useStrictEquality,
372
- boolean: useStrictEquality,
373
- number: useStrictEquality,
374
- null: useStrictEquality,
375
- undefined: useStrictEquality,
376
- symbol: useStrictEquality,
377
- date: useStrictEquality,
378
- nan: function nan() {
379
- return true;
380
- },
381
- regexp: function regexp(a, b) {
382
- return a.source === b.source && getRegExpFlags(a) === getRegExpFlags(b);
383
- },
384
- function: function _function() {
385
- return false;
386
- },
387
- array: function array(a, b) {
388
- var len = a.length;
389
- if (len !== b.length) {
390
- return false;
391
- }
392
- for (var i = 0; i < len; i++) {
393
- if (!breadthFirstCompareChild(a[i], b[i])) {
394
- return false;
395
- }
396
- }
397
- return true;
398
- },
399
- set: function set(a, b) {
400
- if (a.size !== b.size) {
401
- return false;
402
- }
403
- var outerEq = true;
404
- a.forEach(function(aVal) {
405
- if (!outerEq) {
406
- return;
407
- }
408
- var innerEq = false;
409
- b.forEach(function(bVal) {
410
- if (innerEq) {
411
- return;
412
- }
413
- var parentPairs = pairs;
414
- if (innerEquiv(bVal, aVal)) {
415
- innerEq = true;
416
- }
417
- pairs = parentPairs;
418
- });
419
- if (!innerEq) {
420
- outerEq = false;
421
- }
422
- });
423
- return outerEq;
424
- },
425
- map: function map(a, b) {
426
- if (a.size !== b.size) {
427
- return false;
428
- }
429
- var outerEq = true;
430
- a.forEach(function(aVal, aKey) {
431
- if (!outerEq) {
432
- return;
433
- }
434
- var innerEq = false;
435
- b.forEach(function(bVal, bKey) {
436
- if (innerEq) {
437
- return;
438
- }
439
- var parentPairs = pairs;
440
- if (innerEquiv([bVal, bKey], [aVal, aKey])) {
441
- innerEq = true;
442
- }
443
- pairs = parentPairs;
444
- });
445
- if (!innerEq) {
446
- outerEq = false;
447
- }
448
- });
449
- return outerEq;
450
- },
451
- object: function object(a, b) {
452
- if (compareConstructors(a, b) === false) {
453
- return false;
454
- }
455
- var aProperties = [];
456
- var bProperties = [];
457
- for (var i in a) {
458
- aProperties.push(i);
459
- if (a.constructor !== Object && typeof a.constructor !== "undefined" && typeof a[i] === "function" && typeof b[i] === "function" && a[i].toString() === b[i].toString()) {
460
- continue;
461
- }
462
- if (!breadthFirstCompareChild(a[i], b[i])) {
463
- return false;
464
- }
465
- }
466
- for (var _i in b) {
467
- bProperties.push(_i);
468
- }
469
- return typeEquiv(aProperties.sort(), bProperties.sort());
470
- }
471
- };
472
- function typeEquiv(a, b) {
473
- var type = objectType2(a);
474
- return objectType2(b) === type && callbacks[type](a, b);
475
- }
476
- function innerEquiv(a, b) {
477
- if (arguments.length < 2) {
478
- return true;
479
- }
480
- pairs = [{
481
- a,
482
- b
483
- }];
484
- for (var i = 0; i < pairs.length; i++) {
485
- var pair = pairs[i];
486
- if (pair.a !== pair.b && !typeEquiv(pair.a, pair.b)) {
487
- return false;
488
- }
489
- }
490
- return arguments.length === 2 || innerEquiv.apply(this, [].slice.call(arguments, 1));
491
- }
492
- return function() {
493
- var result = innerEquiv.apply(void 0, arguments);
494
- pairs.length = 0;
495
- return result;
496
- };
497
- }();
498
- var config2 = {
499
- queue: [],
500
- blocking: true,
501
- reorder: true,
502
- altertitle: true,
503
- collapse: true,
504
- scrolltop: true,
505
- maxDepth: 5,
506
- requireExpects: false,
507
- urlConfig: [],
508
- modules: [],
509
- currentModule: {
510
- name: "",
511
- tests: [],
512
- childModules: [],
513
- testsRun: 0,
514
- testsIgnored: 0,
515
- hooks: {
516
- before: [],
517
- beforeEach: [],
518
- afterEach: [],
519
- after: []
520
- }
521
- },
522
- callbacks: {},
523
- storage: localSessionStorage
524
- };
525
- var globalConfig = window$1 && window$1.QUnit && window$1.QUnit.config;
526
- if (window$1 && window$1.QUnit && !window$1.QUnit.version) {
527
- extend2(config2, globalConfig);
528
- }
529
- config2.modules.push(config2.currentModule);
530
- var dump2 = function() {
531
- function quote(str) {
532
- return '"' + str.toString().replace(/\\/g, "\\\\").replace(/"/g, '\\"') + '"';
533
- }
534
- function literal(o) {
535
- return o + "";
536
- }
537
- function join(pre, arr, post) {
538
- var s = dump3.separator();
539
- var inner = dump3.indent(1);
540
- if (arr.join) {
541
- arr = arr.join("," + s + inner);
542
- }
543
- if (!arr) {
544
- return pre + post;
545
- }
546
- var base = dump3.indent();
547
- return [pre, inner + arr, base + post].join(s);
548
- }
549
- function array(arr, stack2) {
550
- if (dump3.maxDepth && dump3.depth > dump3.maxDepth) {
551
- return "[object Array]";
552
- }
553
- this.up();
554
- var i = arr.length;
555
- var ret = new Array(i);
556
- while (i--) {
557
- ret[i] = this.parse(arr[i], void 0, stack2);
558
- }
559
- this.down();
560
- return join("[", ret, "]");
561
- }
562
- function isArray(obj) {
563
- return toString.call(obj) === "[object Array]" || typeof obj.length === "number" && obj.item !== void 0 && (obj.length ? obj.item(0) === obj[0] : obj.item(0) === null && obj[0] === void 0);
564
- }
565
- var reName = /^function (\w+)/;
566
- var dump3 = {
567
- parse: function parse(obj, objType, stack2) {
568
- stack2 = stack2 || [];
569
- var objIndex = stack2.indexOf(obj);
570
- if (objIndex !== -1) {
571
- return "recursion(".concat(objIndex - stack2.length, ")");
572
- }
573
- objType = objType || this.typeOf(obj);
574
- var parser = this.parsers[objType];
575
- var parserType = _typeof(parser);
576
- if (parserType === "function") {
577
- stack2.push(obj);
578
- var res = parser.call(this, obj, stack2);
579
- stack2.pop();
580
- return res;
581
- }
582
- return parserType === "string" ? parser : this.parsers.error;
583
- },
584
- typeOf: function typeOf(obj) {
585
- var type;
586
- if (obj === null) {
587
- type = "null";
588
- } else if (typeof obj === "undefined") {
589
- type = "undefined";
590
- } else if (is2("regexp", obj)) {
591
- type = "regexp";
592
- } else if (is2("date", obj)) {
593
- type = "date";
594
- } else if (is2("function", obj)) {
595
- type = "function";
596
- } else if (obj.setInterval !== void 0 && obj.document !== void 0 && obj.nodeType === void 0) {
597
- type = "window";
598
- } else if (obj.nodeType === 9) {
599
- type = "document";
600
- } else if (obj.nodeType) {
601
- type = "node";
602
- } else if (isArray(obj)) {
603
- type = "array";
604
- } else if (obj.constructor === Error.prototype.constructor) {
605
- type = "error";
606
- } else {
607
- type = _typeof(obj);
608
- }
609
- return type;
610
- },
611
- separator: function separator() {
612
- if (this.multiline) {
613
- return this.HTML ? "<br />" : "\n";
614
- } else {
615
- return this.HTML ? "&#160;" : " ";
616
- }
617
- },
618
- indent: function indent(extra) {
619
- if (!this.multiline) {
620
- return "";
621
- }
622
- var chr = this.indentChar;
623
- if (this.HTML) {
624
- chr = chr.replace(/\t/g, " ").replace(/ /g, "&#160;");
625
- }
626
- return new Array(this.depth + (extra || 0)).join(chr);
627
- },
628
- up: function up(a) {
629
- this.depth += a || 1;
630
- },
631
- down: function down(a) {
632
- this.depth -= a || 1;
633
- },
634
- setParser: function setParser(name, parser) {
635
- this.parsers[name] = parser;
636
- },
637
- quote,
638
- literal,
639
- join,
640
- depth: 1,
641
- maxDepth: config2.maxDepth,
642
- parsers: {
643
- window: "[Window]",
644
- document: "[Document]",
645
- error: function error(_error) {
646
- return 'Error("' + _error.message + '")';
647
- },
648
- unknown: "[Unknown]",
649
- null: "null",
650
- undefined: "undefined",
651
- function: function _function(fn) {
652
- var ret = "function";
653
- var name = "name" in fn ? fn.name : (reName.exec(fn) || [])[1];
654
- if (name) {
655
- ret += " " + name;
656
- }
657
- ret += "(";
658
- ret = [ret, dump3.parse(fn, "functionArgs"), "){"].join("");
659
- return join(ret, dump3.parse(fn, "functionCode"), "}");
660
- },
661
- array,
662
- nodelist: array,
663
- arguments: array,
664
- object: function object(map, stack2) {
665
- var ret = [];
666
- if (dump3.maxDepth && dump3.depth > dump3.maxDepth) {
667
- return "[object Object]";
668
- }
669
- dump3.up();
670
- var keys = [];
671
- for (var key in map) {
672
- keys.push(key);
673
- }
674
- var nonEnumerableProperties = ["message", "name"];
675
- for (var i in nonEnumerableProperties) {
676
- var _key = nonEnumerableProperties[i];
677
- if (_key in map && !inArray(_key, keys)) {
678
- keys.push(_key);
679
- }
680
- }
681
- keys.sort();
682
- for (var _i = 0; _i < keys.length; _i++) {
683
- var _key2 = keys[_i];
684
- var val = map[_key2];
685
- ret.push(dump3.parse(_key2, "key") + ": " + dump3.parse(val, void 0, stack2));
686
- }
687
- dump3.down();
688
- return join("{", ret, "}");
689
- },
690
- node: function node(_node) {
691
- var open = dump3.HTML ? "&lt;" : "<";
692
- var close = dump3.HTML ? "&gt;" : ">";
693
- var tag = _node.nodeName.toLowerCase();
694
- var ret = open + tag;
695
- var attrs = _node.attributes;
696
- if (attrs) {
697
- for (var i = 0, len = attrs.length; i < len; i++) {
698
- var val = attrs[i].nodeValue;
699
- if (val && val !== "inherit") {
700
- ret += " " + attrs[i].nodeName + "=" + dump3.parse(val, "attribute");
701
- }
702
- }
703
- }
704
- ret += close;
705
- if (_node.nodeType === 3 || _node.nodeType === 4) {
706
- ret += _node.nodeValue;
707
- }
708
- return ret + open + "/" + tag + close;
709
- },
710
- functionArgs: function functionArgs(fn) {
711
- var l = fn.length;
712
- if (!l) {
713
- return "";
714
- }
715
- var args = new Array(l);
716
- while (l--) {
717
- args[l] = String.fromCharCode(97 + l);
718
- }
719
- return " " + args.join(", ") + " ";
720
- },
721
- key: quote,
722
- functionCode: "[code]",
723
- attribute: quote,
724
- string: quote,
725
- date: quote,
726
- regexp: literal,
727
- number: literal,
728
- boolean: literal,
729
- symbol: function symbol(sym) {
730
- return sym.toString();
731
- }
732
- },
733
- HTML: false,
734
- indentChar: " ",
735
- multiline: true
736
- };
737
- return dump3;
738
- }();
739
- var SuiteReport = /* @__PURE__ */ function() {
740
- function SuiteReport2(name, parentSuite) {
741
- _classCallCheck(this, SuiteReport2);
742
- this.name = name;
743
- this.fullName = parentSuite ? parentSuite.fullName.concat(name) : [];
744
- this.tests = [];
745
- this.childSuites = [];
746
- if (parentSuite) {
747
- parentSuite.pushChildSuite(this);
748
- }
749
- }
750
- _createClass(SuiteReport2, [{
751
- key: "start",
752
- value: function start2(recordTime) {
753
- if (recordTime) {
754
- this._startTime = performance.now();
755
- var suiteLevel = this.fullName.length;
756
- performance.mark("qunit_suite_".concat(suiteLevel, "_start"));
757
- }
758
- return {
759
- name: this.name,
760
- fullName: this.fullName.slice(),
761
- tests: this.tests.map(function(test3) {
762
- return test3.start();
763
- }),
764
- childSuites: this.childSuites.map(function(suite) {
765
- return suite.start();
766
- }),
767
- testCounts: {
768
- total: this.getTestCounts().total
769
- }
770
- };
771
- }
772
- }, {
773
- key: "end",
774
- value: function end(recordTime) {
775
- if (recordTime) {
776
- this._endTime = performance.now();
777
- var suiteLevel = this.fullName.length;
778
- var suiteName = this.fullName.join(" \u2013 ");
779
- performance.mark("qunit_suite_".concat(suiteLevel, "_end"));
780
- performance.measure(suiteLevel === 0 ? "QUnit Test Run" : "QUnit Test Suite: ".concat(suiteName), "qunit_suite_".concat(suiteLevel, "_start"), "qunit_suite_".concat(suiteLevel, "_end"));
781
- }
782
- return {
783
- name: this.name,
784
- fullName: this.fullName.slice(),
785
- tests: this.tests.map(function(test3) {
786
- return test3.end();
787
- }),
788
- childSuites: this.childSuites.map(function(suite) {
789
- return suite.end();
790
- }),
791
- testCounts: this.getTestCounts(),
792
- runtime: this.getRuntime(),
793
- status: this.getStatus()
794
- };
795
- }
796
- }, {
797
- key: "pushChildSuite",
798
- value: function pushChildSuite(suite) {
799
- this.childSuites.push(suite);
800
- }
801
- }, {
802
- key: "pushTest",
803
- value: function pushTest(test3) {
804
- this.tests.push(test3);
805
- }
806
- }, {
807
- key: "getRuntime",
808
- value: function getRuntime() {
809
- return this._endTime - this._startTime;
810
- }
811
- }, {
812
- key: "getTestCounts",
813
- value: function getTestCounts() {
814
- var counts = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {
815
- passed: 0,
816
- failed: 0,
817
- skipped: 0,
818
- todo: 0,
819
- total: 0
820
- };
821
- counts = this.tests.reduce(function(counts2, test3) {
822
- if (test3.valid) {
823
- counts2[test3.getStatus()]++;
824
- counts2.total++;
825
- }
826
- return counts2;
827
- }, counts);
828
- return this.childSuites.reduce(function(counts2, suite) {
829
- return suite.getTestCounts(counts2);
830
- }, counts);
831
- }
832
- }, {
833
- key: "getStatus",
834
- value: function getStatus() {
835
- var _this$getTestCounts = this.getTestCounts(), total = _this$getTestCounts.total, failed = _this$getTestCounts.failed, skipped = _this$getTestCounts.skipped, todo2 = _this$getTestCounts.todo;
836
- if (failed) {
837
- return "failed";
838
- } else {
839
- if (skipped === total) {
840
- return "skipped";
841
- } else if (todo2 === total) {
842
- return "todo";
843
- } else {
844
- return "passed";
845
- }
846
- }
847
- }
848
- }]);
849
- return SuiteReport2;
850
- }();
851
- var moduleStack = [];
852
- function isParentModuleInQueue() {
853
- var modulesInQueue = config2.modules.map(function(module3) {
854
- return module3.moduleId;
855
- });
856
- return moduleStack.some(function(module3) {
857
- return modulesInQueue.includes(module3.moduleId);
858
- });
859
- }
860
- function createModule(name, testEnvironment, modifiers) {
861
- var parentModule = moduleStack.length ? moduleStack.slice(-1)[0] : null;
862
- var moduleName = parentModule !== null ? [parentModule.name, name].join(" > ") : name;
863
- var parentSuite = parentModule ? parentModule.suiteReport : globalSuite;
864
- var skip2 = parentModule !== null && parentModule.skip || modifiers.skip;
865
- var todo2 = parentModule !== null && parentModule.todo || modifiers.todo;
866
- var module3 = {
867
- name: moduleName,
868
- parentModule,
869
- tests: [],
870
- moduleId: generateHash(moduleName),
871
- testsRun: 0,
872
- testsIgnored: 0,
873
- childModules: [],
874
- suiteReport: new SuiteReport(name, parentSuite),
875
- skip: skip2,
876
- todo: skip2 ? false : todo2,
877
- ignored: modifiers.ignored || false
878
- };
879
- var env = {};
880
- if (parentModule) {
881
- parentModule.childModules.push(module3);
882
- extend2(env, parentModule.testEnvironment);
883
- }
884
- extend2(env, testEnvironment);
885
- module3.testEnvironment = env;
886
- config2.modules.push(module3);
887
- return module3;
888
- }
889
- function processModule(name, options, executeNow) {
890
- var modifiers = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
891
- if (objectType2(options) === "function") {
892
- executeNow = options;
893
- options = void 0;
894
- }
895
- var module3 = createModule(name, options, modifiers);
896
- var testEnvironment = module3.testEnvironment;
897
- var hooks = module3.hooks = {};
898
- setHookFromEnvironment(hooks, testEnvironment, "before");
899
- setHookFromEnvironment(hooks, testEnvironment, "beforeEach");
900
- setHookFromEnvironment(hooks, testEnvironment, "afterEach");
901
- setHookFromEnvironment(hooks, testEnvironment, "after");
902
- var moduleFns = {
903
- before: setHookFunction(module3, "before"),
904
- beforeEach: setHookFunction(module3, "beforeEach"),
905
- afterEach: setHookFunction(module3, "afterEach"),
906
- after: setHookFunction(module3, "after")
907
- };
908
- var currentModule = config2.currentModule;
909
- if (objectType2(executeNow) === "function") {
910
- moduleStack.push(module3);
911
- config2.currentModule = module3;
912
- executeNow.call(module3.testEnvironment, moduleFns);
913
- moduleStack.pop();
914
- module3 = module3.parentModule || currentModule;
915
- }
916
- config2.currentModule = module3;
917
- function setHookFromEnvironment(hooks2, environment, name2) {
918
- var potentialHook = environment[name2];
919
- hooks2[name2] = typeof potentialHook === "function" ? [potentialHook] : [];
920
- delete environment[name2];
921
- }
922
- function setHookFunction(module4, hookName) {
923
- return function setHook(callback) {
924
- if (config2.currentModule !== module4) {
925
- Logger.warn("The `" + hookName + "` hook was called inside the wrong module. Instead, use hooks provided by the callback to the containing module.This will become an error in QUnit 3.0.");
926
- }
927
- module4.hooks[hookName].push(callback);
928
- };
929
- }
930
- }
931
- var focused$1 = false;
932
- function module$1(name, options, executeNow) {
933
- var ignored = focused$1 && !isParentModuleInQueue();
934
- processModule(name, options, executeNow, {
935
- ignored
936
- });
937
- }
938
- module$1.only = function() {
939
- if (!focused$1) {
940
- config2.modules.length = 0;
941
- config2.queue.length = 0;
942
- }
943
- processModule.apply(void 0, arguments);
944
- focused$1 = true;
945
- };
946
- module$1.skip = function(name, options, executeNow) {
947
- if (focused$1) {
948
- return;
949
- }
950
- processModule(name, options, executeNow, {
951
- skip: true
952
- });
953
- };
954
- module$1.todo = function(name, options, executeNow) {
955
- if (focused$1) {
956
- return;
957
- }
958
- processModule(name, options, executeNow, {
959
- todo: true
960
- });
961
- };
962
- var LISTENERS = Object.create(null);
963
- var SUPPORTED_EVENTS = ["runStart", "suiteStart", "testStart", "assertion", "testEnd", "suiteEnd", "runEnd"];
964
- function emit(eventName, data) {
965
- if (objectType2(eventName) !== "string") {
966
- throw new TypeError("eventName must be a string when emitting an event");
967
- }
968
- var originalCallbacks = LISTENERS[eventName];
969
- var callbacks = originalCallbacks ? _toConsumableArray(originalCallbacks) : [];
970
- for (var i = 0; i < callbacks.length; i++) {
971
- callbacks[i](data);
972
- }
973
- }
974
- function on2(eventName, callback) {
975
- if (objectType2(eventName) !== "string") {
976
- throw new TypeError("eventName must be a string when registering a listener");
977
- } else if (!inArray(eventName, SUPPORTED_EVENTS)) {
978
- var events = SUPPORTED_EVENTS.join(", ");
979
- throw new Error('"'.concat(eventName, '" is not a valid event; must be one of: ').concat(events, "."));
980
- } else if (objectType2(callback) !== "function") {
981
- throw new TypeError("callback must be a function when registering a listener");
982
- }
983
- if (!LISTENERS[eventName]) {
984
- LISTENERS[eventName] = [];
985
- }
986
- if (!inArray(callback, LISTENERS[eventName])) {
987
- LISTENERS[eventName].push(callback);
988
- }
989
- }
990
- var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
991
- function createCommonjsModule(fn) {
992
- var module3 = {exports: {}};
993
- return fn(module3, module3.exports), module3.exports;
994
- }
995
- function commonjsRequire(path) {
996
- throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
997
- }
998
- var promisePolyfill = createCommonjsModule(function(module3) {
999
- (function() {
1000
- var globalNS = function() {
1001
- if (typeof globalThis !== "undefined") {
1002
- return globalThis;
1003
- }
1004
- if (typeof self !== "undefined") {
1005
- return self;
1006
- }
1007
- if (typeof window !== "undefined") {
1008
- return window;
1009
- }
1010
- if (typeof commonjsGlobal !== "undefined") {
1011
- return commonjsGlobal;
1012
- }
1013
- throw new Error("unable to locate global object");
1014
- }();
1015
- if (typeof globalNS["Promise"] === "function") {
1016
- module3.exports = globalNS["Promise"];
1017
- return;
1018
- }
1019
- function finallyConstructor(callback) {
1020
- var constructor = this.constructor;
1021
- return this.then(function(value) {
1022
- return constructor.resolve(callback()).then(function() {
1023
- return value;
1024
- });
1025
- }, function(reason) {
1026
- return constructor.resolve(callback()).then(function() {
1027
- return constructor.reject(reason);
1028
- });
1029
- });
1030
- }
1031
- function allSettled(arr) {
1032
- var P = this;
1033
- return new P(function(resolve2, reject2) {
1034
- if (!(arr && typeof arr.length !== "undefined")) {
1035
- return reject2(new TypeError(_typeof(arr) + " " + arr + " is not iterable(cannot read property Symbol(Symbol.iterator))"));
1036
- }
1037
- var args = Array.prototype.slice.call(arr);
1038
- if (args.length === 0)
1039
- return resolve2([]);
1040
- var remaining = args.length;
1041
- function res(i2, val) {
1042
- if (val && (_typeof(val) === "object" || typeof val === "function")) {
1043
- var then = val.then;
1044
- if (typeof then === "function") {
1045
- then.call(val, function(val2) {
1046
- res(i2, val2);
1047
- }, function(e) {
1048
- args[i2] = {
1049
- status: "rejected",
1050
- reason: e
1051
- };
1052
- if (--remaining === 0) {
1053
- resolve2(args);
1054
- }
1055
- });
1056
- return;
1057
- }
1058
- }
1059
- args[i2] = {
1060
- status: "fulfilled",
1061
- value: val
1062
- };
1063
- if (--remaining === 0) {
1064
- resolve2(args);
1065
- }
1066
- }
1067
- for (var i = 0; i < args.length; i++) {
1068
- res(i, args[i]);
1069
- }
1070
- });
1071
- }
1072
- var setTimeoutFunc = setTimeout;
1073
- function isArray(x) {
1074
- return Boolean(x && typeof x.length !== "undefined");
1075
- }
1076
- function noop() {
1077
- }
1078
- function bind(fn, thisArg) {
1079
- return function() {
1080
- fn.apply(thisArg, arguments);
1081
- };
1082
- }
1083
- function Promise2(fn) {
1084
- if (!(this instanceof Promise2))
1085
- throw new TypeError("Promises must be constructed via new");
1086
- if (typeof fn !== "function")
1087
- throw new TypeError("not a function");
1088
- this._state = 0;
1089
- this._handled = false;
1090
- this._value = void 0;
1091
- this._deferreds = [];
1092
- doResolve(fn, this);
1093
- }
1094
- function handle(self2, deferred) {
1095
- while (self2._state === 3) {
1096
- self2 = self2._value;
1097
- }
1098
- if (self2._state === 0) {
1099
- self2._deferreds.push(deferred);
1100
- return;
1101
- }
1102
- self2._handled = true;
1103
- Promise2._immediateFn(function() {
1104
- var cb = self2._state === 1 ? deferred.onFulfilled : deferred.onRejected;
1105
- if (cb === null) {
1106
- (self2._state === 1 ? resolve : reject)(deferred.promise, self2._value);
1107
- return;
1108
- }
1109
- var ret;
1110
- try {
1111
- ret = cb(self2._value);
1112
- } catch (e) {
1113
- reject(deferred.promise, e);
1114
- return;
1115
- }
1116
- resolve(deferred.promise, ret);
1117
- });
1118
- }
1119
- function resolve(self2, newValue) {
1120
- try {
1121
- if (newValue === self2)
1122
- throw new TypeError("A promise cannot be resolved with itself.");
1123
- if (newValue && (_typeof(newValue) === "object" || typeof newValue === "function")) {
1124
- var then = newValue.then;
1125
- if (newValue instanceof Promise2) {
1126
- self2._state = 3;
1127
- self2._value = newValue;
1128
- finale(self2);
1129
- return;
1130
- } else if (typeof then === "function") {
1131
- doResolve(bind(then, newValue), self2);
1132
- return;
1133
- }
1134
- }
1135
- self2._state = 1;
1136
- self2._value = newValue;
1137
- finale(self2);
1138
- } catch (e) {
1139
- reject(self2, e);
1140
- }
1141
- }
1142
- function reject(self2, newValue) {
1143
- self2._state = 2;
1144
- self2._value = newValue;
1145
- finale(self2);
1146
- }
1147
- function finale(self2) {
1148
- if (self2._state === 2 && self2._deferreds.length === 0) {
1149
- Promise2._immediateFn(function() {
1150
- if (!self2._handled) {
1151
- Promise2._unhandledRejectionFn(self2._value);
1152
- }
1153
- });
1154
- }
1155
- for (var i = 0, len = self2._deferreds.length; i < len; i++) {
1156
- handle(self2, self2._deferreds[i]);
1157
- }
1158
- self2._deferreds = null;
1159
- }
1160
- function Handler(onFulfilled, onRejected, promise) {
1161
- this.onFulfilled = typeof onFulfilled === "function" ? onFulfilled : null;
1162
- this.onRejected = typeof onRejected === "function" ? onRejected : null;
1163
- this.promise = promise;
1164
- }
1165
- function doResolve(fn, self2) {
1166
- var done3 = false;
1167
- try {
1168
- fn(function(value) {
1169
- if (done3)
1170
- return;
1171
- done3 = true;
1172
- resolve(self2, value);
1173
- }, function(reason) {
1174
- if (done3)
1175
- return;
1176
- done3 = true;
1177
- reject(self2, reason);
1178
- });
1179
- } catch (ex) {
1180
- if (done3)
1181
- return;
1182
- done3 = true;
1183
- reject(self2, ex);
1184
- }
1185
- }
1186
- Promise2.prototype["catch"] = function(onRejected) {
1187
- return this.then(null, onRejected);
1188
- };
1189
- Promise2.prototype.then = function(onFulfilled, onRejected) {
1190
- var prom = new this.constructor(noop);
1191
- handle(this, new Handler(onFulfilled, onRejected, prom));
1192
- return prom;
1193
- };
1194
- Promise2.prototype["finally"] = finallyConstructor;
1195
- Promise2.all = function(arr) {
1196
- return new Promise2(function(resolve2, reject2) {
1197
- if (!isArray(arr)) {
1198
- return reject2(new TypeError("Promise.all accepts an array"));
1199
- }
1200
- var args = Array.prototype.slice.call(arr);
1201
- if (args.length === 0)
1202
- return resolve2([]);
1203
- var remaining = args.length;
1204
- function res(i2, val) {
1205
- try {
1206
- if (val && (_typeof(val) === "object" || typeof val === "function")) {
1207
- var then = val.then;
1208
- if (typeof then === "function") {
1209
- then.call(val, function(val2) {
1210
- res(i2, val2);
1211
- }, reject2);
1212
- return;
1213
- }
1214
- }
1215
- args[i2] = val;
1216
- if (--remaining === 0) {
1217
- resolve2(args);
1218
- }
1219
- } catch (ex) {
1220
- reject2(ex);
1221
- }
1222
- }
1223
- for (var i = 0; i < args.length; i++) {
1224
- res(i, args[i]);
1225
- }
1226
- });
1227
- };
1228
- Promise2.allSettled = allSettled;
1229
- Promise2.resolve = function(value) {
1230
- if (value && _typeof(value) === "object" && value.constructor === Promise2) {
1231
- return value;
1232
- }
1233
- return new Promise2(function(resolve2) {
1234
- resolve2(value);
1235
- });
1236
- };
1237
- Promise2.reject = function(value) {
1238
- return new Promise2(function(resolve2, reject2) {
1239
- reject2(value);
1240
- });
1241
- };
1242
- Promise2.race = function(arr) {
1243
- return new Promise2(function(resolve2, reject2) {
1244
- if (!isArray(arr)) {
1245
- return reject2(new TypeError("Promise.race accepts an array"));
1246
- }
1247
- for (var i = 0, len = arr.length; i < len; i++) {
1248
- Promise2.resolve(arr[i]).then(resolve2, reject2);
1249
- }
1250
- });
1251
- };
1252
- Promise2._immediateFn = typeof setImmediate === "function" && function(fn) {
1253
- setImmediate(fn);
1254
- } || function(fn) {
1255
- setTimeoutFunc(fn, 0);
1256
- };
1257
- Promise2._unhandledRejectionFn = function _unhandledRejectionFn(err) {
1258
- if (typeof console !== "undefined" && console) {
1259
- console.warn("Possible Unhandled Promise Rejection:", err);
1260
- }
1261
- };
1262
- module3.exports = Promise2;
1263
- })();
1264
- });
1265
- function registerLoggingCallbacks(obj) {
1266
- var callbackNames = ["begin", "done", "log", "testStart", "testDone", "moduleStart", "moduleDone"];
1267
- function registerLoggingCallback(key2) {
1268
- var loggingCallback = function loggingCallback2(callback) {
1269
- if (objectType2(callback) !== "function") {
1270
- throw new Error("QUnit logging methods require a callback function as their first parameters.");
1271
- }
1272
- config2.callbacks[key2].push(callback);
1273
- };
1274
- return loggingCallback;
1275
- }
1276
- for (var i = 0, l = callbackNames.length; i < l; i++) {
1277
- var key = callbackNames[i];
1278
- if (objectType2(config2.callbacks[key]) === "undefined") {
1279
- config2.callbacks[key] = [];
1280
- }
1281
- obj[key] = registerLoggingCallback(key);
1282
- }
1283
- }
1284
- function runLoggingCallbacks(key, args) {
1285
- var callbacks = config2.callbacks[key];
1286
- if (key === "log") {
1287
- callbacks.map(function(callback) {
1288
- return callback(args);
1289
- });
1290
- return;
1291
- }
1292
- return callbacks.reduce(function(promiseChain, callback) {
1293
- return promiseChain.then(function() {
1294
- return promisePolyfill.resolve(callback(args));
1295
- });
1296
- }, promisePolyfill.resolve([]));
1297
- }
1298
- var fileName = (sourceFromStacktrace(0) || "").replace(/(:\d+)+\)?/, "").replace(/.+\//, "");
1299
- function extractStacktrace(e, offset) {
1300
- offset = offset === void 0 ? 4 : offset;
1301
- if (e && e.stack) {
1302
- var stack2 = e.stack.split("\n");
1303
- if (/^error$/i.test(stack2[0])) {
1304
- stack2.shift();
1305
- }
1306
- if (fileName) {
1307
- var include = [];
1308
- for (var i = offset; i < stack2.length; i++) {
1309
- if (stack2[i].indexOf(fileName) !== -1) {
1310
- break;
1311
- }
1312
- include.push(stack2[i]);
1313
- }
1314
- if (include.length) {
1315
- return include.join("\n");
1316
- }
1317
- }
1318
- return stack2[offset];
1319
- }
1320
- }
1321
- function sourceFromStacktrace(offset) {
1322
- var error = new Error();
1323
- if (!error.stack) {
1324
- try {
1325
- throw error;
1326
- } catch (err) {
1327
- error = err;
1328
- }
1329
- }
1330
- return extractStacktrace(error, offset);
1331
- }
1332
- var priorityCount = 0;
1333
- var unitSampler;
1334
- var taskQueue = [];
1335
- function advance() {
1336
- advanceTaskQueue();
1337
- if (!taskQueue.length && !config2.blocking && !config2.current) {
1338
- advanceTestQueue();
1339
- }
1340
- }
1341
- function advanceTaskQueue() {
1342
- var start2 = now();
1343
- config2.depth = (config2.depth || 0) + 1;
1344
- processTaskQueue(start2);
1345
- config2.depth--;
1346
- }
1347
- function processTaskQueue(start2) {
1348
- if (taskQueue.length && !config2.blocking) {
1349
- var elapsedTime = now() - start2;
1350
- if (!setTimeout$1 || config2.updateRate <= 0 || elapsedTime < config2.updateRate) {
1351
- var task = taskQueue.shift();
1352
- promisePolyfill.resolve(task()).then(function() {
1353
- if (!taskQueue.length) {
1354
- advance();
1355
- } else {
1356
- processTaskQueue(start2);
1357
- }
1358
- });
1359
- } else {
1360
- setTimeout$1(advance);
1361
- }
1362
- }
1363
- }
1364
- function advanceTestQueue() {
1365
- if (!config2.blocking && !config2.queue.length && config2.depth === 0) {
1366
- done2();
1367
- return;
1368
- }
1369
- var testTasks = config2.queue.shift();
1370
- addToTaskQueue(testTasks());
1371
- if (priorityCount > 0) {
1372
- priorityCount--;
1373
- }
1374
- advance();
1375
- }
1376
- function addToTaskQueue(tasksArray) {
1377
- taskQueue.push.apply(taskQueue, _toConsumableArray(tasksArray));
1378
- }
1379
- function taskQueueLength() {
1380
- return taskQueue.length;
1381
- }
1382
- function addToTestQueue(testTasksFunc, prioritize, seed) {
1383
- if (prioritize) {
1384
- config2.queue.splice(priorityCount++, 0, testTasksFunc);
1385
- } else if (seed) {
1386
- if (!unitSampler) {
1387
- unitSampler = unitSamplerGenerator(seed);
1388
- }
1389
- var index = Math.floor(unitSampler() * (config2.queue.length - priorityCount + 1));
1390
- config2.queue.splice(priorityCount + index, 0, testTasksFunc);
1391
- } else {
1392
- config2.queue.push(testTasksFunc);
1393
- }
1394
- }
1395
- function unitSamplerGenerator(seed) {
1396
- var sample = parseInt(generateHash(seed), 16) || -1;
1397
- return function() {
1398
- sample ^= sample << 13;
1399
- sample ^= sample >>> 17;
1400
- sample ^= sample << 5;
1401
- if (sample < 0) {
1402
- sample += 4294967296;
1403
- }
1404
- return sample / 4294967296;
1405
- };
1406
- }
1407
- function done2() {
1408
- var storage = config2.storage;
1409
- ProcessingQueue.finished = true;
1410
- var runtime = now() - config2.started;
1411
- var passed = config2.stats.all - config2.stats.bad;
1412
- if (config2.stats.testCount === 0) {
1413
- if (config2.filter && config2.filter.length) {
1414
- throw new Error('No tests matched the filter "'.concat(config2.filter, '".'));
1415
- }
1416
- if (config2.module && config2.module.length) {
1417
- throw new Error('No tests matched the module "'.concat(config2.module, '".'));
1418
- }
1419
- if (config2.moduleId && config2.moduleId.length) {
1420
- throw new Error('No tests matched the moduleId "'.concat(config2.moduleId, '".'));
1421
- }
1422
- if (config2.testId && config2.testId.length) {
1423
- throw new Error('No tests matched the testId "'.concat(config2.testId, '".'));
1424
- }
1425
- throw new Error("No tests were run.");
1426
- }
1427
- emit("runEnd", globalSuite.end(true));
1428
- runLoggingCallbacks("done", {
1429
- passed,
1430
- failed: config2.stats.bad,
1431
- total: config2.stats.all,
1432
- runtime
1433
- }).then(function() {
1434
- if (storage && config2.stats.bad === 0) {
1435
- for (var i = storage.length - 1; i >= 0; i--) {
1436
- var key = storage.key(i);
1437
- if (key.indexOf("qunit-test-") === 0) {
1438
- storage.removeItem(key);
1439
- }
1440
- }
1441
- }
1442
- });
1443
- }
1444
- var ProcessingQueue = {
1445
- finished: false,
1446
- add: addToTestQueue,
1447
- advance,
1448
- taskCount: taskQueueLength
1449
- };
1450
- var TestReport = /* @__PURE__ */ function() {
1451
- function TestReport2(name, suite, options) {
1452
- _classCallCheck(this, TestReport2);
1453
- this.name = name;
1454
- this.suiteName = suite.name;
1455
- this.fullName = suite.fullName.concat(name);
1456
- this.runtime = 0;
1457
- this.assertions = [];
1458
- this.skipped = !!options.skip;
1459
- this.todo = !!options.todo;
1460
- this.valid = options.valid;
1461
- this._startTime = 0;
1462
- this._endTime = 0;
1463
- suite.pushTest(this);
1464
- }
1465
- _createClass(TestReport2, [{
1466
- key: "start",
1467
- value: function start2(recordTime) {
1468
- if (recordTime) {
1469
- this._startTime = performance.now();
1470
- performance.mark("qunit_test_start");
1471
- }
1472
- return {
1473
- name: this.name,
1474
- suiteName: this.suiteName,
1475
- fullName: this.fullName.slice()
1476
- };
1477
- }
1478
- }, {
1479
- key: "end",
1480
- value: function end(recordTime) {
1481
- if (recordTime) {
1482
- this._endTime = performance.now();
1483
- if (performance) {
1484
- performance.mark("qunit_test_end");
1485
- var testName = this.fullName.join(" \u2013 ");
1486
- performance.measure("QUnit Test: ".concat(testName), "qunit_test_start", "qunit_test_end");
1487
- }
1488
- }
1489
- return extend2(this.start(), {
1490
- runtime: this.getRuntime(),
1491
- status: this.getStatus(),
1492
- errors: this.getFailedAssertions(),
1493
- assertions: this.getAssertions()
1494
- });
1495
- }
1496
- }, {
1497
- key: "pushAssertion",
1498
- value: function pushAssertion(assertion) {
1499
- this.assertions.push(assertion);
1500
- }
1501
- }, {
1502
- key: "getRuntime",
1503
- value: function getRuntime() {
1504
- return this._endTime - this._startTime;
1505
- }
1506
- }, {
1507
- key: "getStatus",
1508
- value: function getStatus() {
1509
- if (this.skipped) {
1510
- return "skipped";
1511
- }
1512
- var testPassed = this.getFailedAssertions().length > 0 ? this.todo : !this.todo;
1513
- if (!testPassed) {
1514
- return "failed";
1515
- } else if (this.todo) {
1516
- return "todo";
1517
- } else {
1518
- return "passed";
1519
- }
1520
- }
1521
- }, {
1522
- key: "getFailedAssertions",
1523
- value: function getFailedAssertions() {
1524
- return this.assertions.filter(function(assertion) {
1525
- return !assertion.passed;
1526
- });
1527
- }
1528
- }, {
1529
- key: "getAssertions",
1530
- value: function getAssertions() {
1531
- return this.assertions.slice();
1532
- }
1533
- }, {
1534
- key: "slimAssertions",
1535
- value: function slimAssertions() {
1536
- this.assertions = this.assertions.map(function(assertion) {
1537
- delete assertion.actual;
1538
- delete assertion.expected;
1539
- return assertion;
1540
- });
1541
- }
1542
- }]);
1543
- return TestReport2;
1544
- }();
1545
- function Test(settings) {
1546
- this.expected = null;
1547
- this.assertions = [];
1548
- this.semaphore = 0;
1549
- this.module = config2.currentModule;
1550
- this.steps = [];
1551
- this.timeout = void 0;
1552
- extend2(this, settings);
1553
- if (this.module.skip) {
1554
- this.skip = true;
1555
- this.todo = false;
1556
- } else if (this.module.todo && !this.skip) {
1557
- this.todo = true;
1558
- }
1559
- if (!this.skip && typeof this.callback !== "function") {
1560
- var method = this.todo ? "QUnit.todo" : "QUnit.test";
1561
- throw new TypeError("You must provide a callback to ".concat(method, '("').concat(this.testName, '")'));
1562
- }
1563
- ++Test.count;
1564
- this.errorForStack = new Error();
1565
- this.testReport = new TestReport(this.testName, this.module.suiteReport, {
1566
- todo: this.todo,
1567
- skip: this.skip,
1568
- valid: this.valid()
1569
- });
1570
- for (var i = 0, l = this.module.tests; i < l.length; i++) {
1571
- if (this.module.tests[i].name === this.testName) {
1572
- this.testName += " ";
1573
- }
1574
- }
1575
- this.testId = generateHash(this.module.name, this.testName);
1576
- this.module.tests.push({
1577
- name: this.testName,
1578
- testId: this.testId,
1579
- skip: !!this.skip
1580
- });
1581
- if (this.skip) {
1582
- this.callback = function() {
1583
- };
1584
- this.async = false;
1585
- this.expected = 0;
1586
- } else {
1587
- this.assert = new Assert(this);
1588
- }
1589
- }
1590
- Test.count = 0;
1591
- function getNotStartedModules(startModule) {
1592
- var module3 = startModule;
1593
- var modules = [];
1594
- while (module3 && module3.testsRun === 0) {
1595
- modules.push(module3);
1596
- module3 = module3.parentModule;
1597
- }
1598
- return modules.reverse();
1599
- }
1600
- Test.prototype = {
1601
- get stack() {
1602
- return extractStacktrace(this.errorForStack, 2);
1603
- },
1604
- before: function before() {
1605
- var _this = this;
1606
- var module3 = this.module;
1607
- var notStartedModules = getNotStartedModules(module3);
1608
- var callbackPromises = notStartedModules.reduce(function(promiseChain, startModule) {
1609
- return promiseChain.then(function() {
1610
- startModule.stats = {
1611
- all: 0,
1612
- bad: 0,
1613
- started: now()
1614
- };
1615
- emit("suiteStart", startModule.suiteReport.start(true));
1616
- return runLoggingCallbacks("moduleStart", {
1617
- name: startModule.name,
1618
- tests: startModule.tests
1619
- });
1620
- });
1621
- }, promisePolyfill.resolve([]));
1622
- return callbackPromises.then(function() {
1623
- config2.current = _this;
1624
- _this.testEnvironment = extend2({}, module3.testEnvironment);
1625
- _this.started = now();
1626
- emit("testStart", _this.testReport.start(true));
1627
- return runLoggingCallbacks("testStart", {
1628
- name: _this.testName,
1629
- module: module3.name,
1630
- testId: _this.testId,
1631
- previousFailure: _this.previousFailure
1632
- }).then(function() {
1633
- if (!config2.pollution) {
1634
- saveGlobal();
1635
- }
1636
- });
1637
- });
1638
- },
1639
- run: function run() {
1640
- config2.current = this;
1641
- this.callbackStarted = now();
1642
- if (config2.notrycatch) {
1643
- runTest(this);
1644
- return;
1645
- }
1646
- try {
1647
- runTest(this);
1648
- } catch (e) {
1649
- this.pushFailure("Died on test #" + (this.assertions.length + 1) + " " + this.stack + ": " + (e.message || e), extractStacktrace(e, 0));
1650
- saveGlobal();
1651
- if (config2.blocking) {
1652
- internalRecover(this);
1653
- }
1654
- }
1655
- function runTest(test3) {
1656
- var promise = test3.callback.call(test3.testEnvironment, test3.assert);
1657
- test3.resolvePromise(promise);
1658
- if (test3.timeout === 0 && test3.semaphore !== 0) {
1659
- pushFailure2("Test did not finish synchronously even though assert.timeout( 0 ) was used.", sourceFromStacktrace(2));
1660
- }
1661
- }
1662
- },
1663
- after: function after() {
1664
- checkPollution();
1665
- },
1666
- queueHook: function queueHook(hook, hookName, hookOwner) {
1667
- var _this2 = this;
1668
- var callHook = function callHook2() {
1669
- var promise = hook.call(_this2.testEnvironment, _this2.assert);
1670
- _this2.resolvePromise(promise, hookName);
1671
- };
1672
- var runHook = function runHook2() {
1673
- if (hookName === "before") {
1674
- if (hookOwner.testsRun !== 0) {
1675
- return;
1676
- }
1677
- _this2.preserveEnvironment = true;
1678
- }
1679
- if (hookName === "after" && !lastTestWithinModuleExecuted(hookOwner) && (config2.queue.length > 0 || ProcessingQueue.taskCount() > 2)) {
1680
- return;
1681
- }
1682
- config2.current = _this2;
1683
- if (config2.notrycatch) {
1684
- callHook();
1685
- return;
1686
- }
1687
- try {
1688
- callHook();
1689
- } catch (error) {
1690
- _this2.pushFailure(hookName + " failed on " + _this2.testName + ": " + (error.message || error), extractStacktrace(error, 0));
1691
- }
1692
- };
1693
- return runHook;
1694
- },
1695
- hooks: function hooks(handler) {
1696
- var hooks2 = [];
1697
- function processHooks(test3, module3) {
1698
- if (module3.parentModule) {
1699
- processHooks(test3, module3.parentModule);
1700
- }
1701
- if (module3.hooks[handler].length) {
1702
- for (var i = 0; i < module3.hooks[handler].length; i++) {
1703
- hooks2.push(test3.queueHook(module3.hooks[handler][i], handler, module3));
1704
- }
1705
- }
1706
- }
1707
- if (!this.skip) {
1708
- processHooks(this, this.module);
1709
- }
1710
- return hooks2;
1711
- },
1712
- finish: function finish() {
1713
- config2.current = this;
1714
- this.callback = void 0;
1715
- if (this.steps.length) {
1716
- var stepsList = this.steps.join(", ");
1717
- this.pushFailure("Expected assert.verifySteps() to be called before end of test " + "after using assert.step(). Unverified steps: ".concat(stepsList), this.stack);
1718
- }
1719
- if (config2.requireExpects && this.expected === null) {
1720
- this.pushFailure("Expected number of assertions to be defined, but expect() was not called.", this.stack);
1721
- } else if (this.expected !== null && this.expected !== this.assertions.length) {
1722
- this.pushFailure("Expected " + this.expected + " assertions, but " + this.assertions.length + " were run", this.stack);
1723
- } else if (this.expected === null && !this.assertions.length) {
1724
- this.pushFailure("Expected at least one assertion, but none were run - call expect(0) to accept zero assertions.", this.stack);
1725
- }
1726
- var module3 = this.module;
1727
- var moduleName = module3.name;
1728
- var testName = this.testName;
1729
- var skipped = !!this.skip;
1730
- var todo2 = !!this.todo;
1731
- var bad = 0;
1732
- var storage = config2.storage;
1733
- this.runtime = now() - this.started;
1734
- config2.stats.all += this.assertions.length;
1735
- config2.stats.testCount += 1;
1736
- module3.stats.all += this.assertions.length;
1737
- for (var i = 0; i < this.assertions.length; i++) {
1738
- if (!this.assertions[i].result) {
1739
- bad++;
1740
- config2.stats.bad++;
1741
- module3.stats.bad++;
1742
- }
1743
- }
1744
- if (skipped) {
1745
- incrementTestsIgnored(module3);
1746
- } else {
1747
- incrementTestsRun(module3);
1748
- }
1749
- if (storage) {
1750
- if (bad) {
1751
- storage.setItem("qunit-test-" + moduleName + "-" + testName, bad);
1752
- } else {
1753
- storage.removeItem("qunit-test-" + moduleName + "-" + testName);
1754
- }
1755
- }
1756
- emit("testEnd", this.testReport.end(true));
1757
- this.testReport.slimAssertions();
1758
- var test3 = this;
1759
- return runLoggingCallbacks("testDone", {
1760
- name: testName,
1761
- module: moduleName,
1762
- skipped,
1763
- todo: todo2,
1764
- failed: bad,
1765
- passed: this.assertions.length - bad,
1766
- total: this.assertions.length,
1767
- runtime: skipped ? 0 : this.runtime,
1768
- assertions: this.assertions,
1769
- testId: this.testId,
1770
- get source() {
1771
- return test3.stack;
1772
- }
1773
- }).then(function() {
1774
- if (allTestsExecuted(module3)) {
1775
- var completedModules = [module3];
1776
- var parent = module3.parentModule;
1777
- while (parent && allTestsExecuted(parent)) {
1778
- completedModules.push(parent);
1779
- parent = parent.parentModule;
1780
- }
1781
- return completedModules.reduce(function(promiseChain, completedModule) {
1782
- return promiseChain.then(function() {
1783
- return logSuiteEnd(completedModule);
1784
- });
1785
- }, promisePolyfill.resolve([]));
1786
- }
1787
- }).then(function() {
1788
- config2.current = void 0;
1789
- });
1790
- function logSuiteEnd(module4) {
1791
- module4.hooks = {};
1792
- emit("suiteEnd", module4.suiteReport.end(true));
1793
- return runLoggingCallbacks("moduleDone", {
1794
- name: module4.name,
1795
- tests: module4.tests,
1796
- failed: module4.stats.bad,
1797
- passed: module4.stats.all - module4.stats.bad,
1798
- total: module4.stats.all,
1799
- runtime: now() - module4.stats.started
1800
- });
1801
- }
1802
- },
1803
- preserveTestEnvironment: function preserveTestEnvironment() {
1804
- if (this.preserveEnvironment) {
1805
- this.module.testEnvironment = this.testEnvironment;
1806
- this.testEnvironment = extend2({}, this.module.testEnvironment);
1807
- }
1808
- },
1809
- queue: function queue() {
1810
- var test3 = this;
1811
- if (!this.valid()) {
1812
- incrementTestsIgnored(this.module);
1813
- return;
1814
- }
1815
- function runTest() {
1816
- return [function() {
1817
- return test3.before();
1818
- }].concat(_toConsumableArray(test3.hooks("before")), [function() {
1819
- test3.preserveTestEnvironment();
1820
- }], _toConsumableArray(test3.hooks("beforeEach")), [function() {
1821
- test3.run();
1822
- }], _toConsumableArray(test3.hooks("afterEach").reverse()), _toConsumableArray(test3.hooks("after").reverse()), [function() {
1823
- test3.after();
1824
- }, function() {
1825
- return test3.finish();
1826
- }]);
1827
- }
1828
- var previousFailCount = config2.storage && +config2.storage.getItem("qunit-test-" + this.module.name + "-" + this.testName);
1829
- var prioritize = config2.reorder && !!previousFailCount;
1830
- this.previousFailure = !!previousFailCount;
1831
- ProcessingQueue.add(runTest, prioritize, config2.seed);
1832
- if (ProcessingQueue.finished) {
1833
- ProcessingQueue.advance();
1834
- }
1835
- },
1836
- pushResult: function pushResult(resultInfo) {
1837
- if (this !== config2.current) {
1838
- var message = resultInfo && resultInfo.message || "";
1839
- var testName = this && this.testName || "";
1840
- var error = "Assertion occurred after test finished.\n> Test: " + testName + "\n> Message: " + message + "\n";
1841
- throw new Error(error);
1842
- }
1843
- var details = {
1844
- module: this.module.name,
1845
- name: this.testName,
1846
- result: resultInfo.result,
1847
- message: resultInfo.message,
1848
- actual: resultInfo.actual,
1849
- testId: this.testId,
1850
- negative: resultInfo.negative || false,
1851
- runtime: now() - this.started,
1852
- todo: !!this.todo
1853
- };
1854
- if (hasOwn.call(resultInfo, "expected")) {
1855
- details.expected = resultInfo.expected;
1856
- }
1857
- if (!resultInfo.result) {
1858
- var source = resultInfo.source || sourceFromStacktrace();
1859
- if (source) {
1860
- details.source = source;
1861
- }
1862
- }
1863
- this.logAssertion(details);
1864
- this.assertions.push({
1865
- result: !!resultInfo.result,
1866
- message: resultInfo.message
1867
- });
1868
- },
1869
- pushFailure: function pushFailure3(message, source, actual) {
1870
- if (!(this instanceof Test)) {
1871
- throw new Error("pushFailure() assertion outside test context, was " + sourceFromStacktrace(2));
1872
- }
1873
- this.pushResult({
1874
- result: false,
1875
- message: message || "error",
1876
- actual: actual || null,
1877
- source
1878
- });
1879
- },
1880
- logAssertion: function logAssertion(details) {
1881
- runLoggingCallbacks("log", details);
1882
- var assertion = {
1883
- passed: details.result,
1884
- actual: details.actual,
1885
- expected: details.expected,
1886
- message: details.message,
1887
- stack: details.source,
1888
- todo: details.todo
1889
- };
1890
- this.testReport.pushAssertion(assertion);
1891
- emit("assertion", assertion);
1892
- },
1893
- resolvePromise: function resolvePromise(promise, phase) {
1894
- if (promise != null) {
1895
- var _test = this;
1896
- var then = promise.then;
1897
- if (objectType2(then) === "function") {
1898
- var resume = internalStop(_test);
1899
- if (config2.notrycatch) {
1900
- then.call(promise, function() {
1901
- resume();
1902
- });
1903
- } else {
1904
- then.call(promise, function() {
1905
- resume();
1906
- }, function(error) {
1907
- var message = "Promise rejected " + (!phase ? "during" : phase.replace(/Each$/, "")) + ' "' + _test.testName + '": ' + (error && error.message || error);
1908
- _test.pushFailure(message, extractStacktrace(error, 0));
1909
- saveGlobal();
1910
- internalRecover(_test);
1911
- });
1912
- }
1913
- }
1914
- }
1915
- },
1916
- valid: function valid() {
1917
- var filter = config2.filter;
1918
- var regexFilter = /^(!?)\/([\w\W]*)\/(i?$)/.exec(filter);
1919
- var module3 = config2.module && config2.module.toLowerCase();
1920
- var fullName = this.module.name + ": " + this.testName;
1921
- function moduleChainNameMatch(testModule) {
1922
- var testModuleName = testModule.name ? testModule.name.toLowerCase() : null;
1923
- if (testModuleName === module3) {
1924
- return true;
1925
- } else if (testModule.parentModule) {
1926
- return moduleChainNameMatch(testModule.parentModule);
1927
- } else {
1928
- return false;
1929
- }
1930
- }
1931
- function moduleChainIdMatch(testModule) {
1932
- return inArray(testModule.moduleId, config2.moduleId) || testModule.parentModule && moduleChainIdMatch(testModule.parentModule);
1933
- }
1934
- if (this.callback && this.callback.validTest) {
1935
- return true;
1936
- }
1937
- if (config2.moduleId && config2.moduleId.length > 0 && !moduleChainIdMatch(this.module)) {
1938
- return false;
1939
- }
1940
- if (config2.testId && config2.testId.length > 0 && !inArray(this.testId, config2.testId)) {
1941
- return false;
1942
- }
1943
- if (module3 && !moduleChainNameMatch(this.module)) {
1944
- return false;
1945
- }
1946
- if (!filter) {
1947
- return true;
1948
- }
1949
- return regexFilter ? this.regexFilter(!!regexFilter[1], regexFilter[2], regexFilter[3], fullName) : this.stringFilter(filter, fullName);
1950
- },
1951
- regexFilter: function regexFilter(exclude, pattern, flags, fullName) {
1952
- var regex = new RegExp(pattern, flags);
1953
- var match = regex.test(fullName);
1954
- return match !== exclude;
1955
- },
1956
- stringFilter: function stringFilter(filter, fullName) {
1957
- filter = filter.toLowerCase();
1958
- fullName = fullName.toLowerCase();
1959
- var include = filter.charAt(0) !== "!";
1960
- if (!include) {
1961
- filter = filter.slice(1);
1962
- }
1963
- if (fullName.indexOf(filter) !== -1) {
1964
- return include;
1965
- }
1966
- return !include;
1967
- }
1968
- };
1969
- function pushFailure2() {
1970
- if (!config2.current) {
1971
- throw new Error("pushFailure() assertion outside test context, in " + sourceFromStacktrace(2));
1972
- }
1973
- var currentTest = config2.current;
1974
- return currentTest.pushFailure.apply(currentTest, arguments);
1975
- }
1976
- function saveGlobal() {
1977
- config2.pollution = [];
1978
- if (config2.noglobals) {
1979
- for (var key in globalThis$1) {
1980
- if (hasOwn.call(globalThis$1, key)) {
1981
- if (/^qunit-test-output/.test(key)) {
1982
- continue;
1983
- }
1984
- config2.pollution.push(key);
1985
- }
1986
- }
1987
- }
1988
- }
1989
- function checkPollution() {
1990
- var old = config2.pollution;
1991
- saveGlobal();
1992
- var newGlobals = diff2(config2.pollution, old);
1993
- if (newGlobals.length > 0) {
1994
- pushFailure2("Introduced global variable(s): " + newGlobals.join(", "));
1995
- }
1996
- var deletedGlobals = diff2(old, config2.pollution);
1997
- if (deletedGlobals.length > 0) {
1998
- pushFailure2("Deleted global variable(s): " + deletedGlobals.join(", "));
1999
- }
2000
- }
2001
- var focused = false;
2002
- function test2(testName, callback) {
2003
- if (focused || config2.currentModule.ignored) {
2004
- return;
2005
- }
2006
- var newTest = new Test({
2007
- testName,
2008
- callback
2009
- });
2010
- newTest.queue();
2011
- }
2012
- extend2(test2, {
2013
- todo: function todo2(testName, callback) {
2014
- if (focused || config2.currentModule.ignored) {
2015
- return;
2016
- }
2017
- var newTest = new Test({
2018
- testName,
2019
- callback,
2020
- todo: true
2021
- });
2022
- newTest.queue();
2023
- },
2024
- skip: function skip2(testName) {
2025
- if (focused || config2.currentModule.ignored) {
2026
- return;
2027
- }
2028
- var test3 = new Test({
2029
- testName,
2030
- skip: true
2031
- });
2032
- test3.queue();
2033
- },
2034
- only: function only2(testName, callback) {
2035
- if (config2.currentModule.ignored) {
2036
- return;
2037
- }
2038
- if (!focused) {
2039
- config2.queue.length = 0;
2040
- focused = true;
2041
- }
2042
- var newTest = new Test({
2043
- testName,
2044
- callback
2045
- });
2046
- newTest.queue();
2047
- }
2048
- });
2049
- function resetTestTimeout(timeoutDuration) {
2050
- clearTimeout(config2.timeout);
2051
- config2.timeout = setTimeout$1(config2.timeoutHandler(timeoutDuration), timeoutDuration);
2052
- }
2053
- function internalStop(test3) {
2054
- var released = false;
2055
- test3.semaphore += 1;
2056
- config2.blocking = true;
2057
- if (setTimeout$1) {
2058
- var timeoutDuration;
2059
- if (typeof test3.timeout === "number") {
2060
- timeoutDuration = test3.timeout;
2061
- } else if (typeof config2.testTimeout === "number") {
2062
- timeoutDuration = config2.testTimeout;
2063
- }
2064
- if (typeof timeoutDuration === "number" && timeoutDuration > 0) {
2065
- config2.timeoutHandler = function(timeout) {
2066
- return function() {
2067
- config2.timeout = null;
2068
- pushFailure2("Test took longer than ".concat(timeout, "ms; test timed out."), sourceFromStacktrace(2));
2069
- released = true;
2070
- internalRecover(test3);
2071
- };
2072
- };
2073
- clearTimeout(config2.timeout);
2074
- config2.timeout = setTimeout$1(config2.timeoutHandler(timeoutDuration), timeoutDuration);
2075
- }
2076
- }
2077
- return function resume() {
2078
- if (released) {
2079
- return;
2080
- }
2081
- released = true;
2082
- test3.semaphore -= 1;
2083
- internalStart(test3);
2084
- };
2085
- }
2086
- function internalRecover(test3) {
2087
- test3.semaphore = 0;
2088
- internalStart(test3);
2089
- }
2090
- function internalStart(test3) {
2091
- if (isNaN(test3.semaphore)) {
2092
- test3.semaphore = 0;
2093
- pushFailure2("Invalid value on test.semaphore", sourceFromStacktrace(2));
2094
- return;
2095
- }
2096
- if (test3.semaphore > 0) {
2097
- return;
2098
- }
2099
- if (test3.semaphore < 0) {
2100
- test3.semaphore = 0;
2101
- pushFailure2("Tried to restart test while already started (test's semaphore was 0 already)", sourceFromStacktrace(2));
2102
- return;
2103
- }
2104
- if (setTimeout$1) {
2105
- clearTimeout(config2.timeout);
2106
- config2.timeout = setTimeout$1(function() {
2107
- if (test3.semaphore > 0) {
2108
- return;
2109
- }
2110
- clearTimeout(config2.timeout);
2111
- config2.timeout = null;
2112
- begin2();
2113
- });
2114
- } else {
2115
- begin2();
2116
- }
2117
- }
2118
- function collectTests(module3) {
2119
- var tests = [].concat(module3.tests);
2120
- var modules = _toConsumableArray(module3.childModules);
2121
- while (modules.length) {
2122
- var nextModule = modules.shift();
2123
- tests.push.apply(tests, nextModule.tests);
2124
- modules.push.apply(modules, _toConsumableArray(nextModule.childModules));
2125
- }
2126
- return tests;
2127
- }
2128
- function allTestsExecuted(module3) {
2129
- return module3.testsRun + module3.testsIgnored === collectTests(module3).length;
2130
- }
2131
- function lastTestWithinModuleExecuted(module3) {
2132
- return module3.testsRun === collectTests(module3).filter(function(test3) {
2133
- return !test3.skip;
2134
- }).length - 1;
2135
- }
2136
- function incrementTestsRun(module3) {
2137
- module3.testsRun++;
2138
- while (module3 = module3.parentModule) {
2139
- module3.testsRun++;
2140
- }
2141
- }
2142
- function incrementTestsIgnored(module3) {
2143
- module3.testsIgnored++;
2144
- while (module3 = module3.parentModule) {
2145
- module3.testsIgnored++;
2146
- }
2147
- }
2148
- var Assert = /* @__PURE__ */ function() {
2149
- function Assert2(testContext) {
2150
- _classCallCheck(this, Assert2);
2151
- this.test = testContext;
2152
- }
2153
- _createClass(Assert2, [{
2154
- key: "timeout",
2155
- value: function timeout(duration) {
2156
- if (typeof duration !== "number") {
2157
- throw new Error("You must pass a number as the duration to assert.timeout");
2158
- }
2159
- this.test.timeout = duration;
2160
- if (config2.timeout) {
2161
- clearTimeout(config2.timeout);
2162
- config2.timeout = null;
2163
- if (config2.timeoutHandler && this.test.timeout > 0) {
2164
- resetTestTimeout(this.test.timeout);
2165
- }
2166
- }
2167
- }
2168
- }, {
2169
- key: "step",
2170
- value: function step(message) {
2171
- var assertionMessage = message;
2172
- var result = !!message;
2173
- this.test.steps.push(message);
2174
- if (objectType2(message) === "undefined" || message === "") {
2175
- assertionMessage = "You must provide a message to assert.step";
2176
- } else if (objectType2(message) !== "string") {
2177
- assertionMessage = "You must provide a string value to assert.step";
2178
- result = false;
2179
- }
2180
- this.pushResult({
2181
- result,
2182
- message: assertionMessage
2183
- });
2184
- }
2185
- }, {
2186
- key: "verifySteps",
2187
- value: function verifySteps(steps, message) {
2188
- var actualStepsClone = this.test.steps.slice();
2189
- this.deepEqual(actualStepsClone, steps, message);
2190
- this.test.steps.length = 0;
2191
- }
2192
- }, {
2193
- key: "expect",
2194
- value: function expect(asserts) {
2195
- if (arguments.length === 1) {
2196
- this.test.expected = asserts;
2197
- } else {
2198
- return this.test.expected;
2199
- }
2200
- }
2201
- }, {
2202
- key: "async",
2203
- value: function async(count) {
2204
- var test3 = this.test;
2205
- var popped = false, acceptCallCount = count;
2206
- if (typeof acceptCallCount === "undefined") {
2207
- acceptCallCount = 1;
2208
- }
2209
- var resume = internalStop(test3);
2210
- return function done3() {
2211
- if (config2.current !== test3) {
2212
- throw Error("assert.async callback called after test finished.");
2213
- }
2214
- if (popped) {
2215
- test3.pushFailure("Too many calls to the `assert.async` callback", sourceFromStacktrace(2));
2216
- return;
2217
- }
2218
- acceptCallCount -= 1;
2219
- if (acceptCallCount > 0) {
2220
- return;
2221
- }
2222
- popped = true;
2223
- resume();
2224
- };
2225
- }
2226
- }, {
2227
- key: "push",
2228
- value: function push(result, actual, expected, message, negative) {
2229
- Logger.warn("assert.push is deprecated and will be removed in QUnit 3.0. Please use assert.pushResult instead (https://api.qunitjs.com/assert/pushResult).");
2230
- var currentAssert = this instanceof Assert2 ? this : config2.current.assert;
2231
- return currentAssert.pushResult({
2232
- result,
2233
- actual,
2234
- expected,
2235
- message,
2236
- negative
2237
- });
2238
- }
2239
- }, {
2240
- key: "pushResult",
2241
- value: function pushResult(resultInfo) {
2242
- var assert2 = this;
2243
- var currentTest = assert2 instanceof Assert2 && assert2.test || config2.current;
2244
- if (!currentTest) {
2245
- throw new Error("assertion outside test context, in " + sourceFromStacktrace(2));
2246
- }
2247
- if (!(assert2 instanceof Assert2)) {
2248
- assert2 = currentTest.assert;
2249
- }
2250
- return assert2.test.pushResult(resultInfo);
2251
- }
2252
- }, {
2253
- key: "ok",
2254
- value: function ok(result, message) {
2255
- if (!message) {
2256
- message = result ? "okay" : "failed, expected argument to be truthy, was: ".concat(dump2.parse(result));
2257
- }
2258
- this.pushResult({
2259
- result: !!result,
2260
- actual: result,
2261
- expected: true,
2262
- message
2263
- });
2264
- }
2265
- }, {
2266
- key: "notOk",
2267
- value: function notOk(result, message) {
2268
- if (!message) {
2269
- message = !result ? "okay" : "failed, expected argument to be falsy, was: ".concat(dump2.parse(result));
2270
- }
2271
- this.pushResult({
2272
- result: !result,
2273
- actual: result,
2274
- expected: false,
2275
- message
2276
- });
2277
- }
2278
- }, {
2279
- key: "true",
2280
- value: function _true(result, message) {
2281
- this.pushResult({
2282
- result: result === true,
2283
- actual: result,
2284
- expected: true,
2285
- message
2286
- });
2287
- }
2288
- }, {
2289
- key: "false",
2290
- value: function _false(result, message) {
2291
- this.pushResult({
2292
- result: result === false,
2293
- actual: result,
2294
- expected: false,
2295
- message
2296
- });
2297
- }
2298
- }, {
2299
- key: "equal",
2300
- value: function equal(actual, expected, message) {
2301
- var result = expected == actual;
2302
- this.pushResult({
2303
- result,
2304
- actual,
2305
- expected,
2306
- message
2307
- });
2308
- }
2309
- }, {
2310
- key: "notEqual",
2311
- value: function notEqual(actual, expected, message) {
2312
- var result = expected != actual;
2313
- this.pushResult({
2314
- result,
2315
- actual,
2316
- expected,
2317
- message,
2318
- negative: true
2319
- });
2320
- }
2321
- }, {
2322
- key: "propEqual",
2323
- value: function propEqual(actual, expected, message) {
2324
- actual = objectValues(actual);
2325
- expected = objectValues(expected);
2326
- this.pushResult({
2327
- result: equiv2(actual, expected),
2328
- actual,
2329
- expected,
2330
- message
2331
- });
2332
- }
2333
- }, {
2334
- key: "notPropEqual",
2335
- value: function notPropEqual(actual, expected, message) {
2336
- actual = objectValues(actual);
2337
- expected = objectValues(expected);
2338
- this.pushResult({
2339
- result: !equiv2(actual, expected),
2340
- actual,
2341
- expected,
2342
- message,
2343
- negative: true
2344
- });
2345
- }
2346
- }, {
2347
- key: "deepEqual",
2348
- value: function deepEqual(actual, expected, message) {
2349
- this.pushResult({
2350
- result: equiv2(actual, expected),
2351
- actual,
2352
- expected,
2353
- message
2354
- });
2355
- }
2356
- }, {
2357
- key: "notDeepEqual",
2358
- value: function notDeepEqual(actual, expected, message) {
2359
- this.pushResult({
2360
- result: !equiv2(actual, expected),
2361
- actual,
2362
- expected,
2363
- message,
2364
- negative: true
2365
- });
2366
- }
2367
- }, {
2368
- key: "strictEqual",
2369
- value: function strictEqual(actual, expected, message) {
2370
- this.pushResult({
2371
- result: expected === actual,
2372
- actual,
2373
- expected,
2374
- message
2375
- });
2376
- }
2377
- }, {
2378
- key: "notStrictEqual",
2379
- value: function notStrictEqual(actual, expected, message) {
2380
- this.pushResult({
2381
- result: expected !== actual,
2382
- actual,
2383
- expected,
2384
- message,
2385
- negative: true
2386
- });
2387
- }
2388
- }, {
2389
- key: "throws",
2390
- value: function throws(block, expected, message) {
2391
- var actual, result = false;
2392
- var currentTest = this instanceof Assert2 && this.test || config2.current;
2393
- if (objectType2(expected) === "string") {
2394
- if (message == null) {
2395
- message = expected;
2396
- expected = null;
2397
- } else {
2398
- throw new Error("throws/raises does not accept a string value for the expected argument.\nUse a non-string object value (e.g. regExp) instead if it's necessary.");
2399
- }
2400
- }
2401
- currentTest.ignoreGlobalErrors = true;
2402
- try {
2403
- block.call(currentTest.testEnvironment);
2404
- } catch (e) {
2405
- actual = e;
2406
- }
2407
- currentTest.ignoreGlobalErrors = false;
2408
- if (actual) {
2409
- var expectedType = objectType2(expected);
2410
- if (!expected) {
2411
- result = true;
2412
- } else if (expectedType === "regexp") {
2413
- result = expected.test(errorString(actual));
2414
- expected = String(expected);
2415
- } else if (expectedType === "function" && expected.prototype !== void 0 && actual instanceof expected) {
2416
- result = true;
2417
- } else if (expectedType === "object") {
2418
- result = actual instanceof expected.constructor && actual.name === expected.name && actual.message === expected.message;
2419
- expected = errorString(expected);
2420
- } else if (expectedType === "function") {
2421
- try {
2422
- result = expected.call({}, actual) === true;
2423
- expected = null;
2424
- } catch (e) {
2425
- expected = errorString(e);
2426
- }
2427
- }
2428
- }
2429
- currentTest.assert.pushResult({
2430
- result,
2431
- actual: actual && errorString(actual),
2432
- expected,
2433
- message
2434
- });
2435
- }
2436
- }, {
2437
- key: "rejects",
2438
- value: function rejects(promise, expected, message) {
2439
- var result = false;
2440
- var currentTest = this instanceof Assert2 && this.test || config2.current;
2441
- if (objectType2(expected) === "string") {
2442
- if (message === void 0) {
2443
- message = expected;
2444
- expected = void 0;
2445
- } else {
2446
- message = "assert.rejects does not accept a string value for the expected argument.\nUse a non-string object value (e.g. validator function) instead if necessary.";
2447
- currentTest.assert.pushResult({
2448
- result: false,
2449
- message
2450
- });
2451
- return;
2452
- }
2453
- }
2454
- var then = promise && promise.then;
2455
- if (objectType2(then) !== "function") {
2456
- var _message = 'The value provided to `assert.rejects` in "' + currentTest.testName + '" was not a promise.';
2457
- currentTest.assert.pushResult({
2458
- result: false,
2459
- message: _message,
2460
- actual: promise
2461
- });
2462
- return;
2463
- }
2464
- var done3 = this.async();
2465
- return then.call(promise, function handleFulfillment() {
2466
- var message2 = 'The promise returned by the `assert.rejects` callback in "' + currentTest.testName + '" did not reject.';
2467
- currentTest.assert.pushResult({
2468
- result: false,
2469
- message: message2,
2470
- actual: promise
2471
- });
2472
- done3();
2473
- }, function handleRejection(actual) {
2474
- var expectedType = objectType2(expected);
2475
- if (expected === void 0) {
2476
- result = true;
2477
- } else if (expectedType === "regexp") {
2478
- result = expected.test(errorString(actual));
2479
- expected = String(expected);
2480
- } else if (expectedType === "function" && actual instanceof expected) {
2481
- result = true;
2482
- } else if (expectedType === "object") {
2483
- result = actual instanceof expected.constructor && actual.name === expected.name && actual.message === expected.message;
2484
- expected = errorString(expected);
2485
- } else {
2486
- if (expectedType === "function") {
2487
- result = expected.call({}, actual) === true;
2488
- expected = null;
2489
- } else {
2490
- result = false;
2491
- message = 'invalid expected value provided to `assert.rejects` callback in "' + currentTest.testName + '": ' + expectedType + ".";
2492
- }
2493
- }
2494
- currentTest.assert.pushResult({
2495
- result,
2496
- actual: actual && errorString(actual),
2497
- expected,
2498
- message
2499
- });
2500
- done3();
2501
- });
2502
- }
2503
- }]);
2504
- return Assert2;
2505
- }();
2506
- Assert.prototype.raises = Assert.prototype["throws"];
2507
- function errorString(error) {
2508
- var resultErrorString = error.toString();
2509
- if (resultErrorString.slice(0, 7) === "[object") {
2510
- var name = error.name ? String(error.name) : "Error";
2511
- return error.message ? "".concat(name, ": ").concat(error.message) : name;
2512
- } else {
2513
- return resultErrorString;
2514
- }
2515
- }
2516
- function exportQUnit(QUnit3) {
2517
- var exportedModule = false;
2518
- if (window$1 && document) {
2519
- if (window$1.QUnit && window$1.QUnit.version) {
2520
- throw new Error("QUnit has already been defined.");
2521
- }
2522
- window$1.QUnit = QUnit3;
2523
- exportedModule = true;
2524
- }
2525
- if (typeof module2 !== "undefined" && module2 && module2.exports) {
2526
- module2.exports = QUnit3;
2527
- module2.exports.QUnit = QUnit3;
2528
- exportedModule = true;
2529
- }
2530
- if (typeof exports !== "undefined" && exports) {
2531
- exports.QUnit = QUnit3;
2532
- exportedModule = true;
2533
- }
2534
- if (typeof define === "function" && define.amd) {
2535
- define(function() {
2536
- return QUnit3;
2537
- });
2538
- QUnit3.config.autostart = false;
2539
- exportedModule = true;
2540
- }
2541
- if (self$1 && self$1.WorkerGlobalScope && self$1 instanceof self$1.WorkerGlobalScope) {
2542
- self$1.QUnit = QUnit3;
2543
- exportedModule = true;
2544
- }
2545
- if (!exportedModule) {
2546
- globalThis$1.QUnit = QUnit3;
2547
- }
2548
- }
2549
- function onError2(error) {
2550
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
2551
- args[_key - 1] = arguments[_key];
2552
- }
2553
- if (config2.current) {
2554
- if (config2.current.ignoreGlobalErrors) {
2555
- return true;
2556
- }
2557
- pushFailure2.apply(void 0, [error.message, error.stacktrace || error.fileName + ":" + error.lineNumber].concat(args));
2558
- } else {
2559
- test2("global failure", extend2(function() {
2560
- pushFailure2.apply(void 0, [error.message, error.stacktrace || error.fileName + ":" + error.lineNumber].concat(args));
2561
- }, {
2562
- validTest: true
2563
- }));
2564
- }
2565
- return false;
2566
- }
2567
- function onUnhandledRejection2(reason) {
2568
- var resultInfo = {
2569
- result: false,
2570
- message: reason.message || "error",
2571
- actual: reason,
2572
- source: reason.stack || sourceFromStacktrace(3)
2573
- };
2574
- var currentTest = config2.current;
2575
- if (currentTest) {
2576
- currentTest.assert.pushResult(resultInfo);
2577
- } else {
2578
- test2("global failure", extend2(function(assert2) {
2579
- assert2.pushResult(resultInfo);
2580
- }, {
2581
- validTest: true
2582
- }));
2583
- }
2584
- }
2585
- var QUnit2 = {};
2586
- var globalSuite = new SuiteReport();
2587
- config2.currentModule.suiteReport = globalSuite;
2588
- var globalStartCalled = false;
2589
- var runStarted = false;
2590
- QUnit2.isLocal = window$1 && window$1.location && window$1.location.protocol === "file:";
2591
- QUnit2.version = "2.15.0";
2592
- extend2(QUnit2, {
2593
- config: config2,
2594
- dump: dump2,
2595
- equiv: equiv2,
2596
- is: is2,
2597
- objectType: objectType2,
2598
- on: on2,
2599
- onError: onError2,
2600
- onUnhandledRejection: onUnhandledRejection2,
2601
- pushFailure: pushFailure2,
2602
- assert: Assert.prototype,
2603
- module: module$1,
2604
- test: test2,
2605
- todo: test2.todo,
2606
- skip: test2.skip,
2607
- only: test2.only,
2608
- reset: function() {
2609
- ProcessingQueue.finished = false;
2610
- globalStartCalled = false;
2611
- runStarted = false;
2612
- config2.queue.length = 0;
2613
- config2.modules.length = 0;
2614
- config2.autostart = false;
2615
- [
2616
- "stats",
2617
- "started",
2618
- "updateRate",
2619
- "filter",
2620
- "depth",
2621
- "current",
2622
- "pageLoaded",
2623
- "timeoutHandler",
2624
- "timeout",
2625
- "pollution"
2626
- ].forEach((key) => delete config2[key]);
2627
- const suiteReport = config2.currentModule.suiteReport;
2628
- suiteReport.childSuites.length = 0;
2629
- delete suiteReport._startTime;
2630
- delete suiteReport._endTime;
2631
- config2.modules.push(config2.currentModule);
2632
- },
2633
- start: function start2(count) {
2634
- if (config2.current) {
2635
- throw new Error("QUnit.start cannot be called inside a test context.");
2636
- }
2637
- var globalStartAlreadyCalled = globalStartCalled;
2638
- globalStartCalled = true;
2639
- if (runStarted) {
2640
- throw new Error("Called start() while test already started running");
2641
- }
2642
- if (globalStartAlreadyCalled || count > 1) {
2643
- throw new Error("Called start() outside of a test context too many times");
2644
- }
2645
- if (config2.autostart) {
2646
- throw new Error("Called start() outside of a test context when QUnit.config.autostart was true");
2647
- }
2648
- if (!config2.pageLoaded) {
2649
- config2.autostart = true;
2650
- if (!document) {
2651
- QUnit2.load();
2652
- }
2653
- return;
2654
- }
2655
- scheduleBegin();
2656
- },
2657
- extend: function extend$1() {
2658
- Logger.warn("QUnit.extend is deprecated and will be removed in QUnit 3.0. Please use Object.assign instead.");
2659
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2660
- args[_key] = arguments[_key];
2661
- }
2662
- return extend2.apply(this, args);
2663
- },
2664
- load: function load2() {
2665
- config2.pageLoaded = true;
2666
- extend2(config2, {
2667
- stats: {
2668
- all: 0,
2669
- bad: 0,
2670
- testCount: 0
2671
- },
2672
- started: 0,
2673
- updateRate: 1e3,
2674
- autostart: true,
2675
- filter: ""
2676
- }, true);
2677
- if (!runStarted) {
2678
- config2.blocking = false;
2679
- if (config2.autostart) {
2680
- scheduleBegin();
2681
- }
2682
- }
2683
- },
2684
- stack: function stack2(offset) {
2685
- offset = (offset || 0) + 2;
2686
- return sourceFromStacktrace(offset);
2687
- }
2688
- });
2689
- registerLoggingCallbacks(QUnit2);
2690
- function scheduleBegin() {
2691
- runStarted = true;
2692
- if (setTimeout$1) {
2693
- setTimeout$1(function() {
2694
- begin2();
2695
- });
2696
- } else {
2697
- begin2();
2698
- }
2699
- }
2700
- function unblockAndAdvanceQueue() {
2701
- config2.blocking = false;
2702
- ProcessingQueue.advance();
2703
- }
2704
- function begin2() {
2705
- if (config2.started) {
2706
- unblockAndAdvanceQueue();
2707
- return;
2708
- }
2709
- config2.started = now();
2710
- if (config2.modules[0].name === "" && config2.modules[0].tests.length === 0) {
2711
- config2.modules.shift();
2712
- }
2713
- var l = config2.modules.length;
2714
- var modulesLog = [];
2715
- for (var i = 0; i < l; i++) {
2716
- modulesLog.push({
2717
- name: config2.modules[i].name,
2718
- tests: config2.modules[i].tests
2719
- });
2720
- }
2721
- emit("runStart", globalSuite.start(true));
2722
- runLoggingCallbacks("begin", {
2723
- totalTests: Test.count,
2724
- modules: modulesLog
2725
- }).then(unblockAndAdvanceQueue);
2726
- }
2727
- exportQUnit(QUnit2);
2728
- (function() {
2729
- if (!window$1 || !document) {
2730
- return;
2731
- }
2732
- var config3 = QUnit2.config, hasOwn2 = Object.prototype.hasOwnProperty;
2733
- function storeFixture() {
2734
- if (hasOwn2.call(config3, "fixture")) {
2735
- return;
2736
- }
2737
- var fixture = document.getElementById("qunit-fixture");
2738
- if (fixture) {
2739
- config3.fixture = fixture.cloneNode(true);
2740
- }
2741
- }
2742
- QUnit2.begin(storeFixture);
2743
- function resetFixture() {
2744
- if (config3.fixture == null) {
2745
- return;
2746
- }
2747
- var fixture = document.getElementById("qunit-fixture");
2748
- var resetFixtureType = _typeof(config3.fixture);
2749
- if (resetFixtureType === "string") {
2750
- var newFixture = document.createElement("div");
2751
- newFixture.setAttribute("id", "qunit-fixture");
2752
- newFixture.innerHTML = config3.fixture;
2753
- fixture.parentNode.replaceChild(newFixture, fixture);
2754
- } else {
2755
- var clonedFixture = config3.fixture.cloneNode(true);
2756
- fixture.parentNode.replaceChild(clonedFixture, fixture);
2757
- }
2758
- }
2759
- QUnit2.testStart(resetFixture);
2760
- })();
2761
- (function() {
2762
- var location = typeof window$1 !== "undefined" && window$1.location;
2763
- if (!location) {
2764
- return;
2765
- }
2766
- var urlParams = getUrlParams();
2767
- QUnit2.urlParams = urlParams;
2768
- QUnit2.config.moduleId = [].concat(urlParams.moduleId || []);
2769
- QUnit2.config.testId = [].concat(urlParams.testId || []);
2770
- QUnit2.config.module = urlParams.module;
2771
- QUnit2.config.filter = urlParams.filter;
2772
- if (urlParams.seed === true) {
2773
- QUnit2.config.seed = Math.random().toString(36).slice(2);
2774
- } else if (urlParams.seed) {
2775
- QUnit2.config.seed = urlParams.seed;
2776
- }
2777
- QUnit2.config.urlConfig.push({
2778
- id: "hidepassed",
2779
- label: "Hide passed tests",
2780
- tooltip: "Only show tests and assertions that fail. Stored as query-strings."
2781
- }, {
2782
- id: "noglobals",
2783
- label: "Check for Globals",
2784
- tooltip: "Enabling this will test if any test introduces new properties on the global object (`window` in Browsers). Stored as query-strings."
2785
- }, {
2786
- id: "notrycatch",
2787
- label: "No try-catch",
2788
- tooltip: "Enabling this will run tests outside of a try-catch block. Makes debugging exceptions in IE reasonable. Stored as query-strings."
2789
- });
2790
- QUnit2.begin(function() {
2791
- var i, option, urlConfig = QUnit2.config.urlConfig;
2792
- for (i = 0; i < urlConfig.length; i++) {
2793
- option = QUnit2.config.urlConfig[i];
2794
- if (typeof option !== "string") {
2795
- option = option.id;
2796
- }
2797
- if (QUnit2.config[option] === void 0) {
2798
- QUnit2.config[option] = urlParams[option];
2799
- }
2800
- }
2801
- });
2802
- function getUrlParams() {
2803
- var i, param, name, value;
2804
- var urlParams2 = Object.create(null);
2805
- var params = location.search.slice(1).split("&");
2806
- var length = params.length;
2807
- for (i = 0; i < length; i++) {
2808
- if (params[i]) {
2809
- param = params[i].split("=");
2810
- name = decodeQueryParam(param[0]);
2811
- value = param.length === 1 || decodeQueryParam(param.slice(1).join("="));
2812
- if (name in urlParams2) {
2813
- urlParams2[name] = [].concat(urlParams2[name], value);
2814
- } else {
2815
- urlParams2[name] = value;
2816
- }
2817
- }
2818
- }
2819
- return urlParams2;
2820
- }
2821
- function decodeQueryParam(param) {
2822
- return decodeURIComponent(param.replace(/\+/g, "%20"));
2823
- }
2824
- })();
2825
- var fuzzysort = createCommonjsModule(function(module3) {
2826
- (function(root, UMD) {
2827
- if (module3.exports)
2828
- module3.exports = UMD();
2829
- else
2830
- root.fuzzysort = UMD();
2831
- })(commonjsGlobal, function UMD() {
2832
- function fuzzysortNew(instanceOptions) {
2833
- var fuzzysort2 = {
2834
- single: function(search, target, options) {
2835
- if (!search)
2836
- return null;
2837
- if (!isObj(search))
2838
- search = fuzzysort2.getPreparedSearch(search);
2839
- if (!target)
2840
- return null;
2841
- if (!isObj(target))
2842
- target = fuzzysort2.getPrepared(target);
2843
- var allowTypo = options && options.allowTypo !== void 0 ? options.allowTypo : instanceOptions && instanceOptions.allowTypo !== void 0 ? instanceOptions.allowTypo : true;
2844
- var algorithm = allowTypo ? fuzzysort2.algorithm : fuzzysort2.algorithmNoTypo;
2845
- return algorithm(search, target, search[0]);
2846
- },
2847
- go: function(search, targets, options) {
2848
- if (!search)
2849
- return noResults;
2850
- search = fuzzysort2.prepareSearch(search);
2851
- var searchLowerCode = search[0];
2852
- var threshold = options && options.threshold || instanceOptions && instanceOptions.threshold || -9007199254740991;
2853
- var limit = options && options.limit || instanceOptions && instanceOptions.limit || 9007199254740991;
2854
- var allowTypo = options && options.allowTypo !== void 0 ? options.allowTypo : instanceOptions && instanceOptions.allowTypo !== void 0 ? instanceOptions.allowTypo : true;
2855
- var algorithm = allowTypo ? fuzzysort2.algorithm : fuzzysort2.algorithmNoTypo;
2856
- var resultsLen = 0;
2857
- var limitedCount = 0;
2858
- var targetsLen = targets.length;
2859
- if (options && options.keys) {
2860
- var scoreFn = options.scoreFn || defaultScoreFn;
2861
- var keys = options.keys;
2862
- var keysLen = keys.length;
2863
- for (var i = targetsLen - 1; i >= 0; --i) {
2864
- var obj = targets[i];
2865
- var objResults = new Array(keysLen);
2866
- for (var keyI = keysLen - 1; keyI >= 0; --keyI) {
2867
- var key = keys[keyI];
2868
- var target = getValue(obj, key);
2869
- if (!target) {
2870
- objResults[keyI] = null;
2871
- continue;
2872
- }
2873
- if (!isObj(target))
2874
- target = fuzzysort2.getPrepared(target);
2875
- objResults[keyI] = algorithm(search, target, searchLowerCode);
2876
- }
2877
- objResults.obj = obj;
2878
- var score = scoreFn(objResults);
2879
- if (score === null)
2880
- continue;
2881
- if (score < threshold)
2882
- continue;
2883
- objResults.score = score;
2884
- if (resultsLen < limit) {
2885
- q.add(objResults);
2886
- ++resultsLen;
2887
- } else {
2888
- ++limitedCount;
2889
- if (score > q.peek().score)
2890
- q.replaceTop(objResults);
2891
- }
2892
- }
2893
- } else if (options && options.key) {
2894
- var key = options.key;
2895
- for (var i = targetsLen - 1; i >= 0; --i) {
2896
- var obj = targets[i];
2897
- var target = getValue(obj, key);
2898
- if (!target)
2899
- continue;
2900
- if (!isObj(target))
2901
- target = fuzzysort2.getPrepared(target);
2902
- var result = algorithm(search, target, searchLowerCode);
2903
- if (result === null)
2904
- continue;
2905
- if (result.score < threshold)
2906
- continue;
2907
- result = {
2908
- target: result.target,
2909
- _targetLowerCodes: null,
2910
- _nextBeginningIndexes: null,
2911
- score: result.score,
2912
- indexes: result.indexes,
2913
- obj
2914
- };
2915
- if (resultsLen < limit) {
2916
- q.add(result);
2917
- ++resultsLen;
2918
- } else {
2919
- ++limitedCount;
2920
- if (result.score > q.peek().score)
2921
- q.replaceTop(result);
2922
- }
2923
- }
2924
- } else {
2925
- for (var i = targetsLen - 1; i >= 0; --i) {
2926
- var target = targets[i];
2927
- if (!target)
2928
- continue;
2929
- if (!isObj(target))
2930
- target = fuzzysort2.getPrepared(target);
2931
- var result = algorithm(search, target, searchLowerCode);
2932
- if (result === null)
2933
- continue;
2934
- if (result.score < threshold)
2935
- continue;
2936
- if (resultsLen < limit) {
2937
- q.add(result);
2938
- ++resultsLen;
2939
- } else {
2940
- ++limitedCount;
2941
- if (result.score > q.peek().score)
2942
- q.replaceTop(result);
2943
- }
2944
- }
2945
- }
2946
- if (resultsLen === 0)
2947
- return noResults;
2948
- var results = new Array(resultsLen);
2949
- for (var i = resultsLen - 1; i >= 0; --i)
2950
- results[i] = q.poll();
2951
- results.total = resultsLen + limitedCount;
2952
- return results;
2953
- },
2954
- goAsync: function(search, targets, options) {
2955
- var canceled = false;
2956
- var p = new Promise(function(resolve, reject) {
2957
- if (!search)
2958
- return resolve(noResults);
2959
- search = fuzzysort2.prepareSearch(search);
2960
- var searchLowerCode = search[0];
2961
- var q2 = fastpriorityqueue();
2962
- var iCurrent = targets.length - 1;
2963
- var threshold = options && options.threshold || instanceOptions && instanceOptions.threshold || -9007199254740991;
2964
- var limit = options && options.limit || instanceOptions && instanceOptions.limit || 9007199254740991;
2965
- var allowTypo = options && options.allowTypo !== void 0 ? options.allowTypo : instanceOptions && instanceOptions.allowTypo !== void 0 ? instanceOptions.allowTypo : true;
2966
- var algorithm = allowTypo ? fuzzysort2.algorithm : fuzzysort2.algorithmNoTypo;
2967
- var resultsLen = 0;
2968
- var limitedCount = 0;
2969
- function step() {
2970
- if (canceled)
2971
- return reject("canceled");
2972
- var startMs = Date.now();
2973
- if (options && options.keys) {
2974
- var scoreFn = options.scoreFn || defaultScoreFn;
2975
- var keys = options.keys;
2976
- var keysLen = keys.length;
2977
- for (; iCurrent >= 0; --iCurrent) {
2978
- var obj = targets[iCurrent];
2979
- var objResults = new Array(keysLen);
2980
- for (var keyI = keysLen - 1; keyI >= 0; --keyI) {
2981
- var key = keys[keyI];
2982
- var target = getValue(obj, key);
2983
- if (!target) {
2984
- objResults[keyI] = null;
2985
- continue;
2986
- }
2987
- if (!isObj(target))
2988
- target = fuzzysort2.getPrepared(target);
2989
- objResults[keyI] = algorithm(search, target, searchLowerCode);
2990
- }
2991
- objResults.obj = obj;
2992
- var score = scoreFn(objResults);
2993
- if (score === null)
2994
- continue;
2995
- if (score < threshold)
2996
- continue;
2997
- objResults.score = score;
2998
- if (resultsLen < limit) {
2999
- q2.add(objResults);
3000
- ++resultsLen;
3001
- } else {
3002
- ++limitedCount;
3003
- if (score > q2.peek().score)
3004
- q2.replaceTop(objResults);
3005
- }
3006
- if (iCurrent % 1e3 === 0) {
3007
- if (Date.now() - startMs >= 10) {
3008
- isNode ? setImmediate(step) : setTimeout(step);
3009
- return;
3010
- }
3011
- }
3012
- }
3013
- } else if (options && options.key) {
3014
- var key = options.key;
3015
- for (; iCurrent >= 0; --iCurrent) {
3016
- var obj = targets[iCurrent];
3017
- var target = getValue(obj, key);
3018
- if (!target)
3019
- continue;
3020
- if (!isObj(target))
3021
- target = fuzzysort2.getPrepared(target);
3022
- var result = algorithm(search, target, searchLowerCode);
3023
- if (result === null)
3024
- continue;
3025
- if (result.score < threshold)
3026
- continue;
3027
- result = {
3028
- target: result.target,
3029
- _targetLowerCodes: null,
3030
- _nextBeginningIndexes: null,
3031
- score: result.score,
3032
- indexes: result.indexes,
3033
- obj
3034
- };
3035
- if (resultsLen < limit) {
3036
- q2.add(result);
3037
- ++resultsLen;
3038
- } else {
3039
- ++limitedCount;
3040
- if (result.score > q2.peek().score)
3041
- q2.replaceTop(result);
3042
- }
3043
- if (iCurrent % 1e3 === 0) {
3044
- if (Date.now() - startMs >= 10) {
3045
- isNode ? setImmediate(step) : setTimeout(step);
3046
- return;
3047
- }
3048
- }
3049
- }
3050
- } else {
3051
- for (; iCurrent >= 0; --iCurrent) {
3052
- var target = targets[iCurrent];
3053
- if (!target)
3054
- continue;
3055
- if (!isObj(target))
3056
- target = fuzzysort2.getPrepared(target);
3057
- var result = algorithm(search, target, searchLowerCode);
3058
- if (result === null)
3059
- continue;
3060
- if (result.score < threshold)
3061
- continue;
3062
- if (resultsLen < limit) {
3063
- q2.add(result);
3064
- ++resultsLen;
3065
- } else {
3066
- ++limitedCount;
3067
- if (result.score > q2.peek().score)
3068
- q2.replaceTop(result);
3069
- }
3070
- if (iCurrent % 1e3 === 0) {
3071
- if (Date.now() - startMs >= 10) {
3072
- isNode ? setImmediate(step) : setTimeout(step);
3073
- return;
3074
- }
3075
- }
3076
- }
3077
- }
3078
- if (resultsLen === 0)
3079
- return resolve(noResults);
3080
- var results = new Array(resultsLen);
3081
- for (var i = resultsLen - 1; i >= 0; --i)
3082
- results[i] = q2.poll();
3083
- results.total = resultsLen + limitedCount;
3084
- resolve(results);
3085
- }
3086
- isNode ? setImmediate(step) : step();
3087
- });
3088
- p.cancel = function() {
3089
- canceled = true;
3090
- };
3091
- return p;
3092
- },
3093
- highlight: function(result, hOpen, hClose) {
3094
- if (result === null)
3095
- return null;
3096
- if (hOpen === void 0)
3097
- hOpen = "<b>";
3098
- if (hClose === void 0)
3099
- hClose = "</b>";
3100
- var highlighted = "";
3101
- var matchesIndex = 0;
3102
- var opened = false;
3103
- var target = result.target;
3104
- var targetLen = target.length;
3105
- var matchesBest = result.indexes;
3106
- for (var i = 0; i < targetLen; ++i) {
3107
- var char = target[i];
3108
- if (matchesBest[matchesIndex] === i) {
3109
- ++matchesIndex;
3110
- if (!opened) {
3111
- opened = true;
3112
- highlighted += hOpen;
3113
- }
3114
- if (matchesIndex === matchesBest.length) {
3115
- highlighted += char + hClose + target.substr(i + 1);
3116
- break;
3117
- }
3118
- } else {
3119
- if (opened) {
3120
- opened = false;
3121
- highlighted += hClose;
3122
- }
3123
- }
3124
- highlighted += char;
3125
- }
3126
- return highlighted;
3127
- },
3128
- prepare: function(target) {
3129
- if (!target)
3130
- return;
3131
- return {
3132
- target,
3133
- _targetLowerCodes: fuzzysort2.prepareLowerCodes(target),
3134
- _nextBeginningIndexes: null,
3135
- score: null,
3136
- indexes: null,
3137
- obj: null
3138
- };
3139
- },
3140
- prepareSlow: function(target) {
3141
- if (!target)
3142
- return;
3143
- return {
3144
- target,
3145
- _targetLowerCodes: fuzzysort2.prepareLowerCodes(target),
3146
- _nextBeginningIndexes: fuzzysort2.prepareNextBeginningIndexes(target),
3147
- score: null,
3148
- indexes: null,
3149
- obj: null
3150
- };
3151
- },
3152
- prepareSearch: function(search) {
3153
- if (!search)
3154
- return;
3155
- return fuzzysort2.prepareLowerCodes(search);
3156
- },
3157
- getPrepared: function(target) {
3158
- if (target.length > 999)
3159
- return fuzzysort2.prepare(target);
3160
- var targetPrepared = preparedCache.get(target);
3161
- if (targetPrepared !== void 0)
3162
- return targetPrepared;
3163
- targetPrepared = fuzzysort2.prepare(target);
3164
- preparedCache.set(target, targetPrepared);
3165
- return targetPrepared;
3166
- },
3167
- getPreparedSearch: function(search) {
3168
- if (search.length > 999)
3169
- return fuzzysort2.prepareSearch(search);
3170
- var searchPrepared = preparedSearchCache.get(search);
3171
- if (searchPrepared !== void 0)
3172
- return searchPrepared;
3173
- searchPrepared = fuzzysort2.prepareSearch(search);
3174
- preparedSearchCache.set(search, searchPrepared);
3175
- return searchPrepared;
3176
- },
3177
- algorithm: function(searchLowerCodes, prepared, searchLowerCode) {
3178
- var targetLowerCodes = prepared._targetLowerCodes;
3179
- var searchLen = searchLowerCodes.length;
3180
- var targetLen = targetLowerCodes.length;
3181
- var searchI = 0;
3182
- var targetI = 0;
3183
- var typoSimpleI = 0;
3184
- var matchesSimpleLen = 0;
3185
- for (; ; ) {
3186
- var isMatch = searchLowerCode === targetLowerCodes[targetI];
3187
- if (isMatch) {
3188
- matchesSimple[matchesSimpleLen++] = targetI;
3189
- ++searchI;
3190
- if (searchI === searchLen)
3191
- break;
3192
- searchLowerCode = searchLowerCodes[typoSimpleI === 0 ? searchI : typoSimpleI === searchI ? searchI + 1 : typoSimpleI === searchI - 1 ? searchI - 1 : searchI];
3193
- }
3194
- ++targetI;
3195
- if (targetI >= targetLen) {
3196
- for (; ; ) {
3197
- if (searchI <= 1)
3198
- return null;
3199
- if (typoSimpleI === 0) {
3200
- --searchI;
3201
- var searchLowerCodeNew = searchLowerCodes[searchI];
3202
- if (searchLowerCode === searchLowerCodeNew)
3203
- continue;
3204
- typoSimpleI = searchI;
3205
- } else {
3206
- if (typoSimpleI === 1)
3207
- return null;
3208
- --typoSimpleI;
3209
- searchI = typoSimpleI;
3210
- searchLowerCode = searchLowerCodes[searchI + 1];
3211
- var searchLowerCodeNew = searchLowerCodes[searchI];
3212
- if (searchLowerCode === searchLowerCodeNew)
3213
- continue;
3214
- }
3215
- matchesSimpleLen = searchI;
3216
- targetI = matchesSimple[matchesSimpleLen - 1] + 1;
3217
- break;
3218
- }
3219
- }
3220
- }
3221
- var searchI = 0;
3222
- var typoStrictI = 0;
3223
- var successStrict = false;
3224
- var matchesStrictLen = 0;
3225
- var nextBeginningIndexes = prepared._nextBeginningIndexes;
3226
- if (nextBeginningIndexes === null)
3227
- nextBeginningIndexes = prepared._nextBeginningIndexes = fuzzysort2.prepareNextBeginningIndexes(prepared.target);
3228
- var firstPossibleI = targetI = matchesSimple[0] === 0 ? 0 : nextBeginningIndexes[matchesSimple[0] - 1];
3229
- if (targetI !== targetLen)
3230
- for (; ; ) {
3231
- if (targetI >= targetLen) {
3232
- if (searchI <= 0) {
3233
- ++typoStrictI;
3234
- if (typoStrictI > searchLen - 2)
3235
- break;
3236
- if (searchLowerCodes[typoStrictI] === searchLowerCodes[typoStrictI + 1])
3237
- continue;
3238
- targetI = firstPossibleI;
3239
- continue;
3240
- }
3241
- --searchI;
3242
- var lastMatch = matchesStrict[--matchesStrictLen];
3243
- targetI = nextBeginningIndexes[lastMatch];
3244
- } else {
3245
- var isMatch = searchLowerCodes[typoStrictI === 0 ? searchI : typoStrictI === searchI ? searchI + 1 : typoStrictI === searchI - 1 ? searchI - 1 : searchI] === targetLowerCodes[targetI];
3246
- if (isMatch) {
3247
- matchesStrict[matchesStrictLen++] = targetI;
3248
- ++searchI;
3249
- if (searchI === searchLen) {
3250
- successStrict = true;
3251
- break;
3252
- }
3253
- ++targetI;
3254
- } else {
3255
- targetI = nextBeginningIndexes[targetI];
3256
- }
3257
- }
3258
- }
3259
- {
3260
- if (successStrict) {
3261
- var matchesBest = matchesStrict;
3262
- var matchesBestLen = matchesStrictLen;
3263
- } else {
3264
- var matchesBest = matchesSimple;
3265
- var matchesBestLen = matchesSimpleLen;
3266
- }
3267
- var score = 0;
3268
- var lastTargetI = -1;
3269
- for (var i = 0; i < searchLen; ++i) {
3270
- var targetI = matchesBest[i];
3271
- if (lastTargetI !== targetI - 1)
3272
- score -= targetI;
3273
- lastTargetI = targetI;
3274
- }
3275
- if (!successStrict) {
3276
- score *= 1e3;
3277
- if (typoSimpleI !== 0)
3278
- score += -20;
3279
- } else {
3280
- if (typoStrictI !== 0)
3281
- score += -20;
3282
- }
3283
- score -= targetLen - searchLen;
3284
- prepared.score = score;
3285
- prepared.indexes = new Array(matchesBestLen);
3286
- for (var i = matchesBestLen - 1; i >= 0; --i)
3287
- prepared.indexes[i] = matchesBest[i];
3288
- return prepared;
3289
- }
3290
- },
3291
- algorithmNoTypo: function(searchLowerCodes, prepared, searchLowerCode) {
3292
- var targetLowerCodes = prepared._targetLowerCodes;
3293
- var searchLen = searchLowerCodes.length;
3294
- var targetLen = targetLowerCodes.length;
3295
- var searchI = 0;
3296
- var targetI = 0;
3297
- var matchesSimpleLen = 0;
3298
- for (; ; ) {
3299
- var isMatch = searchLowerCode === targetLowerCodes[targetI];
3300
- if (isMatch) {
3301
- matchesSimple[matchesSimpleLen++] = targetI;
3302
- ++searchI;
3303
- if (searchI === searchLen)
3304
- break;
3305
- searchLowerCode = searchLowerCodes[searchI];
3306
- }
3307
- ++targetI;
3308
- if (targetI >= targetLen)
3309
- return null;
3310
- }
3311
- var searchI = 0;
3312
- var successStrict = false;
3313
- var matchesStrictLen = 0;
3314
- var nextBeginningIndexes = prepared._nextBeginningIndexes;
3315
- if (nextBeginningIndexes === null)
3316
- nextBeginningIndexes = prepared._nextBeginningIndexes = fuzzysort2.prepareNextBeginningIndexes(prepared.target);
3317
- targetI = matchesSimple[0] === 0 ? 0 : nextBeginningIndexes[matchesSimple[0] - 1];
3318
- if (targetI !== targetLen)
3319
- for (; ; ) {
3320
- if (targetI >= targetLen) {
3321
- if (searchI <= 0)
3322
- break;
3323
- --searchI;
3324
- var lastMatch = matchesStrict[--matchesStrictLen];
3325
- targetI = nextBeginningIndexes[lastMatch];
3326
- } else {
3327
- var isMatch = searchLowerCodes[searchI] === targetLowerCodes[targetI];
3328
- if (isMatch) {
3329
- matchesStrict[matchesStrictLen++] = targetI;
3330
- ++searchI;
3331
- if (searchI === searchLen) {
3332
- successStrict = true;
3333
- break;
3334
- }
3335
- ++targetI;
3336
- } else {
3337
- targetI = nextBeginningIndexes[targetI];
3338
- }
3339
- }
3340
- }
3341
- {
3342
- if (successStrict) {
3343
- var matchesBest = matchesStrict;
3344
- var matchesBestLen = matchesStrictLen;
3345
- } else {
3346
- var matchesBest = matchesSimple;
3347
- var matchesBestLen = matchesSimpleLen;
3348
- }
3349
- var score = 0;
3350
- var lastTargetI = -1;
3351
- for (var i = 0; i < searchLen; ++i) {
3352
- var targetI = matchesBest[i];
3353
- if (lastTargetI !== targetI - 1)
3354
- score -= targetI;
3355
- lastTargetI = targetI;
3356
- }
3357
- if (!successStrict)
3358
- score *= 1e3;
3359
- score -= targetLen - searchLen;
3360
- prepared.score = score;
3361
- prepared.indexes = new Array(matchesBestLen);
3362
- for (var i = matchesBestLen - 1; i >= 0; --i)
3363
- prepared.indexes[i] = matchesBest[i];
3364
- return prepared;
3365
- }
3366
- },
3367
- prepareLowerCodes: function(str) {
3368
- var strLen = str.length;
3369
- var lowerCodes = [];
3370
- var lower = str.toLowerCase();
3371
- for (var i = 0; i < strLen; ++i)
3372
- lowerCodes[i] = lower.charCodeAt(i);
3373
- return lowerCodes;
3374
- },
3375
- prepareBeginningIndexes: function(target) {
3376
- var targetLen = target.length;
3377
- var beginningIndexes = [];
3378
- var beginningIndexesLen = 0;
3379
- var wasUpper = false;
3380
- var wasAlphanum = false;
3381
- for (var i = 0; i < targetLen; ++i) {
3382
- var targetCode = target.charCodeAt(i);
3383
- var isUpper = targetCode >= 65 && targetCode <= 90;
3384
- var isAlphanum = isUpper || targetCode >= 97 && targetCode <= 122 || targetCode >= 48 && targetCode <= 57;
3385
- var isBeginning = isUpper && !wasUpper || !wasAlphanum || !isAlphanum;
3386
- wasUpper = isUpper;
3387
- wasAlphanum = isAlphanum;
3388
- if (isBeginning)
3389
- beginningIndexes[beginningIndexesLen++] = i;
3390
- }
3391
- return beginningIndexes;
3392
- },
3393
- prepareNextBeginningIndexes: function(target) {
3394
- var targetLen = target.length;
3395
- var beginningIndexes = fuzzysort2.prepareBeginningIndexes(target);
3396
- var nextBeginningIndexes = [];
3397
- var lastIsBeginning = beginningIndexes[0];
3398
- var lastIsBeginningI = 0;
3399
- for (var i = 0; i < targetLen; ++i) {
3400
- if (lastIsBeginning > i) {
3401
- nextBeginningIndexes[i] = lastIsBeginning;
3402
- } else {
3403
- lastIsBeginning = beginningIndexes[++lastIsBeginningI];
3404
- nextBeginningIndexes[i] = lastIsBeginning === void 0 ? targetLen : lastIsBeginning;
3405
- }
3406
- }
3407
- return nextBeginningIndexes;
3408
- },
3409
- cleanup,
3410
- new: fuzzysortNew
3411
- };
3412
- return fuzzysort2;
3413
- }
3414
- var isNode = typeof commonjsRequire !== "undefined" && typeof window === "undefined";
3415
- var preparedCache = new Map();
3416
- var preparedSearchCache = new Map();
3417
- var noResults = [];
3418
- noResults.total = 0;
3419
- var matchesSimple = [];
3420
- var matchesStrict = [];
3421
- function cleanup() {
3422
- preparedCache.clear();
3423
- preparedSearchCache.clear();
3424
- matchesSimple = [];
3425
- matchesStrict = [];
3426
- }
3427
- function defaultScoreFn(a) {
3428
- var max = -9007199254740991;
3429
- for (var i = a.length - 1; i >= 0; --i) {
3430
- var result = a[i];
3431
- if (result === null)
3432
- continue;
3433
- var score = result.score;
3434
- if (score > max)
3435
- max = score;
3436
- }
3437
- if (max === -9007199254740991)
3438
- return null;
3439
- return max;
3440
- }
3441
- function getValue(obj, prop) {
3442
- var tmp = obj[prop];
3443
- if (tmp !== void 0)
3444
- return tmp;
3445
- var segs = prop;
3446
- if (!Array.isArray(prop))
3447
- segs = prop.split(".");
3448
- var len = segs.length;
3449
- var i = -1;
3450
- while (obj && ++i < len)
3451
- obj = obj[segs[i]];
3452
- return obj;
3453
- }
3454
- function isObj(x) {
3455
- return typeof x === "object";
3456
- }
3457
- var fastpriorityqueue = function() {
3458
- var r = [], o = 0, e = {};
3459
- function n() {
3460
- for (var e2 = 0, n2 = r[e2], c = 1; c < o; ) {
3461
- var f = c + 1;
3462
- e2 = c, f < o && r[f].score < r[c].score && (e2 = f), r[e2 - 1 >> 1] = r[e2], c = 1 + (e2 << 1);
3463
- }
3464
- for (var a = e2 - 1 >> 1; e2 > 0 && n2.score < r[a].score; a = (e2 = a) - 1 >> 1)
3465
- r[e2] = r[a];
3466
- r[e2] = n2;
3467
- }
3468
- return e.add = function(e2) {
3469
- var n2 = o;
3470
- r[o++] = e2;
3471
- for (var c = n2 - 1 >> 1; n2 > 0 && e2.score < r[c].score; c = (n2 = c) - 1 >> 1)
3472
- r[n2] = r[c];
3473
- r[n2] = e2;
3474
- }, e.poll = function() {
3475
- if (o !== 0) {
3476
- var e2 = r[0];
3477
- return r[0] = r[--o], n(), e2;
3478
- }
3479
- }, e.peek = function(e2) {
3480
- if (o !== 0)
3481
- return r[0];
3482
- }, e.replaceTop = function(o2) {
3483
- r[0] = o2, n();
3484
- }, e;
3485
- };
3486
- var q = fastpriorityqueue();
3487
- return fuzzysortNew();
3488
- });
3489
- });
3490
- var stats = {
3491
- passedTests: 0,
3492
- failedTests: 0,
3493
- skippedTests: 0,
3494
- todoTests: 0
3495
- };
3496
- function escapeText(s) {
3497
- if (!s) {
3498
- return "";
3499
- }
3500
- s = s + "";
3501
- return s.replace(/['"<>&]/g, function(s2) {
3502
- switch (s2) {
3503
- case "'":
3504
- return "&#039;";
3505
- case '"':
3506
- return "&quot;";
3507
- case "<":
3508
- return "&lt;";
3509
- case ">":
3510
- return "&gt;";
3511
- case "&":
3512
- return "&amp;";
3513
- }
3514
- });
3515
- }
3516
- (function() {
3517
- if (!window$1 || !document) {
3518
- return;
3519
- }
3520
- var config3 = QUnit2.config, hiddenTests = [], collapseNext = false, hasOwn2 = Object.prototype.hasOwnProperty, unfilteredUrl = setUrl({
3521
- filter: void 0,
3522
- module: void 0,
3523
- moduleId: void 0,
3524
- testId: void 0
3525
- });
3526
- function trim(string) {
3527
- if (typeof string.trim === "function") {
3528
- return string.trim();
3529
- } else {
3530
- return string.replace(/^\s+|\s+$/g, "");
3531
- }
3532
- }
3533
- function addEvent(elem, type, fn) {
3534
- elem.addEventListener(type, fn, false);
3535
- }
3536
- function removeEvent(elem, type, fn) {
3537
- elem.removeEventListener(type, fn, false);
3538
- }
3539
- function addEvents(elems, type, fn) {
3540
- var i = elems.length;
3541
- while (i--) {
3542
- addEvent(elems[i], type, fn);
3543
- }
3544
- }
3545
- function hasClass(elem, name) {
3546
- return (" " + elem.className + " ").indexOf(" " + name + " ") >= 0;
3547
- }
3548
- function addClass(elem, name) {
3549
- if (!hasClass(elem, name)) {
3550
- elem.className += (elem.className ? " " : "") + name;
3551
- }
3552
- }
3553
- function toggleClass(elem, name, force) {
3554
- if (force || typeof force === "undefined" && !hasClass(elem, name)) {
3555
- addClass(elem, name);
3556
- } else {
3557
- removeClass(elem, name);
3558
- }
3559
- }
3560
- function removeClass(elem, name) {
3561
- var set = " " + elem.className + " ";
3562
- while (set.indexOf(" " + name + " ") >= 0) {
3563
- set = set.replace(" " + name + " ", " ");
3564
- }
3565
- elem.className = trim(set);
3566
- }
3567
- function id(name) {
3568
- return document.getElementById && document.getElementById(name);
3569
- }
3570
- function abortTests() {
3571
- var abortButton = id("qunit-abort-tests-button");
3572
- if (abortButton) {
3573
- abortButton.disabled = true;
3574
- abortButton.innerHTML = "Aborting...";
3575
- }
3576
- QUnit2.config.queue.length = 0;
3577
- return false;
3578
- }
3579
- function interceptNavigation(ev) {
3580
- var filterInputElem = id("qunit-filter-input");
3581
- filterInputElem.value = trim(filterInputElem.value);
3582
- applyUrlParams();
3583
- if (ev && ev.preventDefault) {
3584
- ev.preventDefault();
3585
- }
3586
- return false;
3587
- }
3588
- function getUrlConfigHtml() {
3589
- var i, j, val, escaped, escapedTooltip, selection = false, urlConfig = config3.urlConfig, urlConfigHtml = "";
3590
- for (i = 0; i < urlConfig.length; i++) {
3591
- val = config3.urlConfig[i];
3592
- if (typeof val === "string") {
3593
- val = {
3594
- id: val,
3595
- label: val
3596
- };
3597
- }
3598
- escaped = escapeText(val.id);
3599
- escapedTooltip = escapeText(val.tooltip);
3600
- if (!val.value || typeof val.value === "string") {
3601
- urlConfigHtml += "<label for='qunit-urlconfig-" + escaped + "' title='" + escapedTooltip + "'><input id='qunit-urlconfig-" + escaped + "' name='" + escaped + "' type='checkbox'" + (val.value ? " value='" + escapeText(val.value) + "'" : "") + (config3[val.id] ? " checked='checked'" : "") + " title='" + escapedTooltip + "' />" + escapeText(val.label) + "</label>";
3602
- } else {
3603
- urlConfigHtml += "<label for='qunit-urlconfig-" + escaped + "' title='" + escapedTooltip + "'>" + val.label + ": </label><select id='qunit-urlconfig-" + escaped + "' name='" + escaped + "' title='" + escapedTooltip + "'><option></option>";
3604
- if (QUnit2.is("array", val.value)) {
3605
- for (j = 0; j < val.value.length; j++) {
3606
- escaped = escapeText(val.value[j]);
3607
- urlConfigHtml += "<option value='" + escaped + "'" + (config3[val.id] === val.value[j] ? (selection = true) && " selected='selected'" : "") + ">" + escaped + "</option>";
3608
- }
3609
- } else {
3610
- for (j in val.value) {
3611
- if (hasOwn2.call(val.value, j)) {
3612
- urlConfigHtml += "<option value='" + escapeText(j) + "'" + (config3[val.id] === j ? (selection = true) && " selected='selected'" : "") + ">" + escapeText(val.value[j]) + "</option>";
3613
- }
3614
- }
3615
- }
3616
- if (config3[val.id] && !selection) {
3617
- escaped = escapeText(config3[val.id]);
3618
- urlConfigHtml += "<option value='" + escaped + "' selected='selected' disabled='disabled'>" + escaped + "</option>";
3619
- }
3620
- urlConfigHtml += "</select>";
3621
- }
3622
- }
3623
- return urlConfigHtml;
3624
- }
3625
- function toolbarChanged() {
3626
- var updatedUrl, value, tests, field = this, params = {};
3627
- if ("selectedIndex" in field) {
3628
- value = field.options[field.selectedIndex].value || void 0;
3629
- } else {
3630
- value = field.checked ? field.defaultValue || true : void 0;
3631
- }
3632
- params[field.name] = value;
3633
- updatedUrl = setUrl(params);
3634
- if (field.name === "hidepassed" && "replaceState" in window$1.history) {
3635
- QUnit2.urlParams[field.name] = value;
3636
- config3[field.name] = value || false;
3637
- tests = id("qunit-tests");
3638
- if (tests) {
3639
- var length = tests.children.length;
3640
- var children = tests.children;
3641
- if (field.checked) {
3642
- for (var i = 0; i < length; i++) {
3643
- var test3 = children[i];
3644
- var className = test3 ? test3.className : "";
3645
- var classNameHasPass = className.indexOf("pass") > -1;
3646
- var classNameHasSkipped = className.indexOf("skipped") > -1;
3647
- if (classNameHasPass || classNameHasSkipped) {
3648
- hiddenTests.push(test3);
3649
- }
3650
- }
3651
- var _iterator = _createForOfIteratorHelper(hiddenTests), _step;
3652
- try {
3653
- for (_iterator.s(); !(_step = _iterator.n()).done; ) {
3654
- var hiddenTest = _step.value;
3655
- tests.removeChild(hiddenTest);
3656
- }
3657
- } catch (err) {
3658
- _iterator.e(err);
3659
- } finally {
3660
- _iterator.f();
3661
- }
3662
- } else {
3663
- while ((test3 = hiddenTests.pop()) != null) {
3664
- tests.appendChild(test3);
3665
- }
3666
- }
3667
- }
3668
- window$1.history.replaceState(null, "", updatedUrl);
3669
- } else {
3670
- window$1.location = updatedUrl;
3671
- }
3672
- }
3673
- function setUrl(params) {
3674
- var key, arrValue, i, querystring = "?", location = window$1.location;
3675
- params = extend2(extend2({}, QUnit2.urlParams), params);
3676
- for (key in params) {
3677
- if (hasOwn2.call(params, key) && params[key] !== void 0) {
3678
- arrValue = [].concat(params[key]);
3679
- for (i = 0; i < arrValue.length; i++) {
3680
- querystring += encodeURIComponent(key);
3681
- if (arrValue[i] !== true) {
3682
- querystring += "=" + encodeURIComponent(arrValue[i]);
3683
- }
3684
- querystring += "&";
3685
- }
3686
- }
3687
- }
3688
- return location.protocol + "//" + location.host + location.pathname + querystring.slice(0, -1);
3689
- }
3690
- function applyUrlParams() {
3691
- var i, selectedModules = [], modulesList = id("qunit-modulefilter-dropdown-list").getElementsByTagName("input"), filter = id("qunit-filter-input").value;
3692
- for (i = 0; i < modulesList.length; i++) {
3693
- if (modulesList[i].checked) {
3694
- selectedModules.push(modulesList[i].value);
3695
- }
3696
- }
3697
- window$1.location = setUrl({
3698
- filter: filter === "" ? void 0 : filter,
3699
- moduleId: selectedModules.length === 0 ? void 0 : selectedModules,
3700
- module: void 0,
3701
- testId: void 0
3702
- });
3703
- }
3704
- function toolbarUrlConfigContainer() {
3705
- var urlConfigContainer = document.createElement("span");
3706
- urlConfigContainer.innerHTML = getUrlConfigHtml();
3707
- addClass(urlConfigContainer, "qunit-url-config");
3708
- addEvents(urlConfigContainer.getElementsByTagName("input"), "change", toolbarChanged);
3709
- addEvents(urlConfigContainer.getElementsByTagName("select"), "change", toolbarChanged);
3710
- return urlConfigContainer;
3711
- }
3712
- function abortTestsButton() {
3713
- var button = document.createElement("button");
3714
- button.id = "qunit-abort-tests-button";
3715
- button.innerHTML = "Abort";
3716
- addEvent(button, "click", abortTests);
3717
- return button;
3718
- }
3719
- function toolbarLooseFilter() {
3720
- var filter = document.createElement("form"), label = document.createElement("label"), input = document.createElement("input"), button = document.createElement("button");
3721
- addClass(filter, "qunit-filter");
3722
- label.innerHTML = "Filter: ";
3723
- input.type = "text";
3724
- input.value = config3.filter || "";
3725
- input.name = "filter";
3726
- input.id = "qunit-filter-input";
3727
- button.innerHTML = "Go";
3728
- label.appendChild(input);
3729
- filter.appendChild(label);
3730
- filter.appendChild(document.createTextNode(" "));
3731
- filter.appendChild(button);
3732
- addEvent(filter, "submit", interceptNavigation);
3733
- return filter;
3734
- }
3735
- function moduleListHtml(modules) {
3736
- var i, checked, html = "";
3737
- for (i = 0; i < modules.length; i++) {
3738
- if (modules[i].name !== "") {
3739
- checked = config3.moduleId.indexOf(modules[i].moduleId) > -1;
3740
- html += "<li><label class='clickable" + (checked ? " checked" : "") + "'><input type='checkbox' value='" + modules[i].moduleId + "'" + (checked ? " checked='checked'" : "") + " />" + escapeText(modules[i].name) + "</label></li>";
3741
- }
3742
- }
3743
- return html;
3744
- }
3745
- function toolbarModuleFilter() {
3746
- var commit, reset, moduleFilter = document.createElement("form"), label = document.createElement("label"), moduleSearch = document.createElement("input"), dropDown = document.createElement("div"), actions = document.createElement("span"), applyButton = document.createElement("button"), resetButton = document.createElement("button"), allModulesLabel = document.createElement("label"), allCheckbox = document.createElement("input"), dropDownList = document.createElement("ul"), dirty = false;
3747
- moduleSearch.id = "qunit-modulefilter-search";
3748
- moduleSearch.autocomplete = "off";
3749
- addEvent(moduleSearch, "input", searchInput);
3750
- addEvent(moduleSearch, "input", searchFocus);
3751
- addEvent(moduleSearch, "focus", searchFocus);
3752
- addEvent(moduleSearch, "click", searchFocus);
3753
- config3.modules.forEach(function(module3) {
3754
- return module3.namePrepared = fuzzysort.prepare(module3.name);
3755
- });
3756
- label.id = "qunit-modulefilter-search-container";
3757
- label.innerHTML = "Module: ";
3758
- label.appendChild(moduleSearch);
3759
- applyButton.textContent = "Apply";
3760
- applyButton.style.display = "none";
3761
- resetButton.textContent = "Reset";
3762
- resetButton.type = "reset";
3763
- resetButton.style.display = "none";
3764
- allCheckbox.type = "checkbox";
3765
- allCheckbox.checked = config3.moduleId.length === 0;
3766
- allModulesLabel.className = "clickable";
3767
- if (config3.moduleId.length) {
3768
- allModulesLabel.className = "checked";
3769
- }
3770
- allModulesLabel.appendChild(allCheckbox);
3771
- allModulesLabel.appendChild(document.createTextNode("All modules"));
3772
- actions.id = "qunit-modulefilter-actions";
3773
- actions.appendChild(applyButton);
3774
- actions.appendChild(resetButton);
3775
- actions.appendChild(allModulesLabel);
3776
- commit = actions.firstChild;
3777
- reset = commit.nextSibling;
3778
- addEvent(commit, "click", applyUrlParams);
3779
- dropDownList.id = "qunit-modulefilter-dropdown-list";
3780
- dropDownList.innerHTML = moduleListHtml(config3.modules);
3781
- dropDown.id = "qunit-modulefilter-dropdown";
3782
- dropDown.style.display = "none";
3783
- dropDown.appendChild(actions);
3784
- dropDown.appendChild(dropDownList);
3785
- addEvent(dropDown, "change", selectionChange);
3786
- selectionChange();
3787
- moduleFilter.id = "qunit-modulefilter";
3788
- moduleFilter.appendChild(label);
3789
- moduleFilter.appendChild(dropDown);
3790
- addEvent(moduleFilter, "submit", interceptNavigation);
3791
- addEvent(moduleFilter, "reset", function() {
3792
- window$1.setTimeout(selectionChange);
3793
- });
3794
- function searchFocus() {
3795
- if (dropDown.style.display !== "none") {
3796
- return;
3797
- }
3798
- dropDown.style.display = "block";
3799
- addEvent(document, "click", hideHandler);
3800
- addEvent(document, "keydown", hideHandler);
3801
- function hideHandler(e) {
3802
- var inContainer = moduleFilter.contains(e.target);
3803
- if (e.keyCode === 27 || !inContainer) {
3804
- if (e.keyCode === 27 && inContainer) {
3805
- moduleSearch.focus();
3806
- }
3807
- dropDown.style.display = "none";
3808
- removeEvent(document, "click", hideHandler);
3809
- removeEvent(document, "keydown", hideHandler);
3810
- moduleSearch.value = "";
3811
- searchInput();
3812
- }
3813
- }
3814
- }
3815
- function filterModules(searchText) {
3816
- if (searchText === "") {
3817
- return config3.modules;
3818
- }
3819
- return fuzzysort.go(searchText, config3.modules, {
3820
- key: "namePrepared",
3821
- threshold: -1e4
3822
- }).map(function(module3) {
3823
- return module3.obj;
3824
- });
3825
- }
3826
- var searchInputTimeout;
3827
- function searchInput() {
3828
- window$1.clearTimeout(searchInputTimeout);
3829
- searchInputTimeout = window$1.setTimeout(function() {
3830
- var searchText = moduleSearch.value.toLowerCase(), filteredModules = filterModules(searchText);
3831
- dropDownList.innerHTML = moduleListHtml(filteredModules);
3832
- }, 200);
3833
- }
3834
- function selectionChange(evt) {
3835
- var i, item, checkbox = evt && evt.target || allCheckbox, modulesList = dropDownList.getElementsByTagName("input"), selectedNames = [];
3836
- toggleClass(checkbox.parentNode, "checked", checkbox.checked);
3837
- dirty = false;
3838
- if (checkbox.checked && checkbox !== allCheckbox) {
3839
- allCheckbox.checked = false;
3840
- removeClass(allCheckbox.parentNode, "checked");
3841
- }
3842
- for (i = 0; i < modulesList.length; i++) {
3843
- item = modulesList[i];
3844
- if (!evt) {
3845
- toggleClass(item.parentNode, "checked", item.checked);
3846
- } else if (checkbox === allCheckbox && checkbox.checked) {
3847
- item.checked = false;
3848
- removeClass(item.parentNode, "checked");
3849
- }
3850
- dirty = dirty || item.checked !== item.defaultChecked;
3851
- if (item.checked) {
3852
- selectedNames.push(item.parentNode.textContent);
3853
- }
3854
- }
3855
- commit.style.display = reset.style.display = dirty ? "" : "none";
3856
- moduleSearch.placeholder = selectedNames.join(", ") || allCheckbox.parentNode.textContent;
3857
- moduleSearch.title = "Type to filter list. Current selection:\n" + (selectedNames.join("\n") || allCheckbox.parentNode.textContent);
3858
- }
3859
- return moduleFilter;
3860
- }
3861
- function toolbarFilters() {
3862
- var toolbarFilters2 = document.createElement("span");
3863
- toolbarFilters2.id = "qunit-toolbar-filters";
3864
- toolbarFilters2.appendChild(toolbarLooseFilter());
3865
- toolbarFilters2.appendChild(toolbarModuleFilter());
3866
- return toolbarFilters2;
3867
- }
3868
- function appendToolbar() {
3869
- var toolbar = id("qunit-testrunner-toolbar");
3870
- if (toolbar) {
3871
- toolbar.appendChild(toolbarUrlConfigContainer());
3872
- toolbar.appendChild(toolbarFilters());
3873
- toolbar.appendChild(document.createElement("div")).className = "clearfix";
3874
- }
3875
- }
3876
- function appendHeader() {
3877
- var header = id("qunit-header");
3878
- if (header) {
3879
- header.innerHTML = "<a href='" + escapeText(unfilteredUrl) + "'>" + header.innerHTML + "</a> ";
3880
- }
3881
- }
3882
- function appendBanner() {
3883
- var banner = id("qunit-banner");
3884
- if (banner) {
3885
- banner.className = "";
3886
- }
3887
- }
3888
- function appendTestResults() {
3889
- var tests = id("qunit-tests"), result = id("qunit-testresult"), controls;
3890
- if (result) {
3891
- result.parentNode.removeChild(result);
3892
- }
3893
- if (tests) {
3894
- tests.innerHTML = "";
3895
- result = document.createElement("p");
3896
- result.id = "qunit-testresult";
3897
- result.className = "result";
3898
- tests.parentNode.insertBefore(result, tests);
3899
- result.innerHTML = '<div id="qunit-testresult-display">Running...<br />&#160;</div><div id="qunit-testresult-controls"></div><div class="clearfix"></div>';
3900
- controls = id("qunit-testresult-controls");
3901
- }
3902
- if (controls) {
3903
- controls.appendChild(abortTestsButton());
3904
- }
3905
- }
3906
- function appendFilteredTest() {
3907
- var testId = QUnit2.config.testId;
3908
- if (!testId || testId.length <= 0) {
3909
- return "";
3910
- }
3911
- return "<div id='qunit-filteredTest'>Rerunning selected tests: " + escapeText(testId.join(", ")) + " <a id='qunit-clearFilter' href='" + escapeText(unfilteredUrl) + "'>Run all tests</a></div>";
3912
- }
3913
- function appendUserAgent() {
3914
- var userAgent = id("qunit-userAgent");
3915
- if (userAgent) {
3916
- userAgent.innerHTML = "";
3917
- userAgent.appendChild(document.createTextNode("QUnit " + QUnit2.version + "; " + navigator.userAgent));
3918
- }
3919
- }
3920
- function appendInterface() {
3921
- var qunit = id("qunit");
3922
- if (qunit) {
3923
- qunit.setAttribute("role", "main");
3924
- qunit.innerHTML = "<h1 id='qunit-header'>" + escapeText(document.title) + "</h1><h2 id='qunit-banner'></h2><div id='qunit-testrunner-toolbar' role='navigation'></div>" + appendFilteredTest() + "<h2 id='qunit-userAgent'></h2><ol id='qunit-tests'></ol>";
3925
- }
3926
- appendHeader();
3927
- appendBanner();
3928
- appendTestResults();
3929
- appendUserAgent();
3930
- appendToolbar();
3931
- }
3932
- function appendTest(name, testId, moduleName) {
3933
- var title, rerunTrigger, testBlock, assertList, tests = id("qunit-tests");
3934
- if (!tests) {
3935
- return;
3936
- }
3937
- title = document.createElement("strong");
3938
- title.innerHTML = getNameHtml(name, moduleName);
3939
- rerunTrigger = document.createElement("a");
3940
- rerunTrigger.innerHTML = "Rerun";
3941
- rerunTrigger.href = setUrl({
3942
- testId
3943
- });
3944
- testBlock = document.createElement("li");
3945
- testBlock.appendChild(title);
3946
- testBlock.appendChild(rerunTrigger);
3947
- testBlock.id = "qunit-test-output-" + testId;
3948
- assertList = document.createElement("ol");
3949
- assertList.className = "qunit-assert-list";
3950
- testBlock.appendChild(assertList);
3951
- tests.appendChild(testBlock);
3952
- }
3953
- QUnit2.begin(function() {
3954
- appendInterface();
3955
- });
3956
- QUnit2.done(function(details) {
3957
- var banner = id("qunit-banner"), tests = id("qunit-tests"), abortButton = id("qunit-abort-tests-button"), totalTests = stats.passedTests + stats.skippedTests + stats.todoTests + stats.failedTests, html = [totalTests, " tests completed in ", details.runtime, " milliseconds, with ", stats.failedTests, " failed, ", stats.skippedTests, " skipped, and ", stats.todoTests, " todo.<br />", "<span class='passed'>", details.passed, "</span> assertions of <span class='total'>", details.total, "</span> passed, <span class='failed'>", details.failed, "</span> failed."].join(""), test3, assertLi, assertList;
3958
- if (abortButton && abortButton.disabled) {
3959
- html = "Tests aborted after " + details.runtime + " milliseconds.";
3960
- for (var i = 0; i < tests.children.length; i++) {
3961
- test3 = tests.children[i];
3962
- if (test3.className === "" || test3.className === "running") {
3963
- test3.className = "aborted";
3964
- assertList = test3.getElementsByTagName("ol")[0];
3965
- assertLi = document.createElement("li");
3966
- assertLi.className = "fail";
3967
- assertLi.innerHTML = "Test aborted.";
3968
- assertList.appendChild(assertLi);
3969
- }
3970
- }
3971
- }
3972
- if (banner && (!abortButton || abortButton.disabled === false)) {
3973
- banner.className = stats.failedTests ? "qunit-fail" : "qunit-pass";
3974
- }
3975
- if (abortButton) {
3976
- abortButton.parentNode.removeChild(abortButton);
3977
- }
3978
- if (tests) {
3979
- id("qunit-testresult-display").innerHTML = html;
3980
- }
3981
- if (config3.altertitle && document.title) {
3982
- document.title = [stats.failedTests ? "\u2716" : "\u2714", document.title.replace(/^[\u2714\u2716] /i, "")].join(" ");
3983
- }
3984
- if (config3.scrolltop && window$1.scrollTo) {
3985
- window$1.scrollTo(0, 0);
3986
- }
3987
- });
3988
- function getNameHtml(name, module3) {
3989
- var nameHtml = "";
3990
- if (module3) {
3991
- nameHtml = "<span class='module-name'>" + escapeText(module3) + "</span>: ";
3992
- }
3993
- nameHtml += "<span class='test-name'>" + escapeText(name) + "</span>";
3994
- return nameHtml;
3995
- }
3996
- function getProgressHtml(runtime, stats2, total) {
3997
- var completed = stats2.passedTests + stats2.skippedTests + stats2.todoTests + stats2.failedTests;
3998
- return ["<br />", completed, " / ", total, " tests completed in ", runtime, " milliseconds, with ", stats2.failedTests, " failed, ", stats2.skippedTests, " skipped, and ", stats2.todoTests, " todo."].join("");
3999
- }
4000
- QUnit2.testStart(function(details) {
4001
- var running, bad;
4002
- appendTest(details.name, details.testId, details.module);
4003
- running = id("qunit-testresult-display");
4004
- if (running) {
4005
- addClass(running, "running");
4006
- bad = QUnit2.config.reorder && details.previousFailure;
4007
- running.innerHTML = [bad ? "Rerunning previously failed test: <br />" : "Running: <br />", getNameHtml(details.name, details.module), getProgressHtml(now() - config3.started, stats, Test.count)].join("");
4008
- }
4009
- });
4010
- function stripHtml(string) {
4011
- return string.replace(/<\/?[^>]+(>|$)/g, "").replace(/&quot;/g, "").replace(/\s+/g, "");
4012
- }
4013
- QUnit2.log(function(details) {
4014
- var assertList, assertLi, message, expected, actual, diff3, showDiff = false, testItem = id("qunit-test-output-" + details.testId);
4015
- if (!testItem) {
4016
- return;
4017
- }
4018
- message = escapeText(details.message) || (details.result ? "okay" : "failed");
4019
- message = "<span class='test-message'>" + message + "</span>";
4020
- message += "<span class='runtime'>@ " + details.runtime + " ms</span>";
4021
- if (!details.result && hasOwn2.call(details, "expected")) {
4022
- if (details.negative) {
4023
- expected = "NOT " + QUnit2.dump.parse(details.expected);
4024
- } else {
4025
- expected = QUnit2.dump.parse(details.expected);
4026
- }
4027
- actual = QUnit2.dump.parse(details.actual);
4028
- message += "<table><tr class='test-expected'><th>Expected: </th><td><pre>" + escapeText(expected) + "</pre></td></tr>";
4029
- if (actual !== expected) {
4030
- message += "<tr class='test-actual'><th>Result: </th><td><pre>" + escapeText(actual) + "</pre></td></tr>";
4031
- if (typeof details.actual === "number" && typeof details.expected === "number") {
4032
- if (!isNaN(details.actual) && !isNaN(details.expected)) {
4033
- showDiff = true;
4034
- diff3 = details.actual - details.expected;
4035
- diff3 = (diff3 > 0 ? "+" : "") + diff3;
4036
- }
4037
- } else if (typeof details.actual !== "boolean" && typeof details.expected !== "boolean") {
4038
- diff3 = QUnit2.diff(expected, actual);
4039
- showDiff = stripHtml(diff3).length !== stripHtml(expected).length + stripHtml(actual).length;
4040
- }
4041
- if (showDiff) {
4042
- message += "<tr class='test-diff'><th>Diff: </th><td><pre>" + diff3 + "</pre></td></tr>";
4043
- }
4044
- } else if (expected.indexOf("[object Array]") !== -1 || expected.indexOf("[object Object]") !== -1) {
4045
- message += "<tr class='test-message'><th>Message: </th><td>Diff suppressed as the depth of object is more than current max depth (" + QUnit2.config.maxDepth + ").<p>Hint: Use <code>QUnit.dump.maxDepth</code> to run with a higher max depth or <a href='" + escapeText(setUrl({
4046
- maxDepth: -1
4047
- })) + "'>Rerun</a> without max depth.</p></td></tr>";
4048
- } else {
4049
- message += "<tr class='test-message'><th>Message: </th><td>Diff suppressed as the expected and actual results have an equivalent serialization</td></tr>";
4050
- }
4051
- if (details.source) {
4052
- message += "<tr class='test-source'><th>Source: </th><td><pre>" + escapeText(details.source) + "</pre></td></tr>";
4053
- }
4054
- message += "</table>";
4055
- } else if (!details.result && details.source) {
4056
- message += "<table><tr class='test-source'><th>Source: </th><td><pre>" + escapeText(details.source) + "</pre></td></tr></table>";
4057
- }
4058
- assertList = testItem.getElementsByTagName("ol")[0];
4059
- assertLi = document.createElement("li");
4060
- assertLi.className = details.result ? "pass" : "fail";
4061
- assertLi.innerHTML = message;
4062
- assertList.appendChild(assertLi);
4063
- });
4064
- QUnit2.testDone(function(details) {
4065
- var testTitle, time, assertList, status, good, bad, testCounts, skipped, sourceName, tests = id("qunit-tests"), testItem = id("qunit-test-output-" + details.testId);
4066
- if (!tests || !testItem) {
4067
- return;
4068
- }
4069
- removeClass(testItem, "running");
4070
- if (details.failed > 0) {
4071
- status = "failed";
4072
- } else if (details.todo) {
4073
- status = "todo";
4074
- } else {
4075
- status = details.skipped ? "skipped" : "passed";
4076
- }
4077
- assertList = testItem.getElementsByTagName("ol")[0];
4078
- good = details.passed;
4079
- bad = details.failed;
4080
- var testPassed = details.failed > 0 ? details.todo : !details.todo;
4081
- if (testPassed) {
4082
- addClass(assertList, "qunit-collapsed");
4083
- } else if (config3.collapse) {
4084
- if (!collapseNext) {
4085
- collapseNext = true;
4086
- } else {
4087
- addClass(assertList, "qunit-collapsed");
4088
- }
4089
- }
4090
- testTitle = testItem.firstChild;
4091
- testCounts = bad ? "<b class='failed'>" + bad + "</b>, <b class='passed'>" + good + "</b>, " : "";
4092
- testTitle.innerHTML += " <b class='counts'>(" + testCounts + details.assertions.length + ")</b>";
4093
- if (details.skipped) {
4094
- stats.skippedTests++;
4095
- testItem.className = "skipped";
4096
- skipped = document.createElement("em");
4097
- skipped.className = "qunit-skipped-label";
4098
- skipped.innerHTML = "skipped";
4099
- testItem.insertBefore(skipped, testTitle);
4100
- } else {
4101
- addEvent(testTitle, "click", function() {
4102
- toggleClass(assertList, "qunit-collapsed");
4103
- });
4104
- testItem.className = testPassed ? "pass" : "fail";
4105
- if (details.todo) {
4106
- var todoLabel = document.createElement("em");
4107
- todoLabel.className = "qunit-todo-label";
4108
- todoLabel.innerHTML = "todo";
4109
- testItem.className += " todo";
4110
- testItem.insertBefore(todoLabel, testTitle);
4111
- }
4112
- time = document.createElement("span");
4113
- time.className = "runtime";
4114
- time.innerHTML = details.runtime + " ms";
4115
- testItem.insertBefore(time, assertList);
4116
- if (!testPassed) {
4117
- stats.failedTests++;
4118
- } else if (details.todo) {
4119
- stats.todoTests++;
4120
- } else {
4121
- stats.passedTests++;
4122
- }
4123
- }
4124
- if (details.source) {
4125
- sourceName = document.createElement("p");
4126
- sourceName.innerHTML = "<strong>Source: </strong>" + escapeText(details.source);
4127
- addClass(sourceName, "qunit-source");
4128
- if (testPassed) {
4129
- addClass(sourceName, "qunit-collapsed");
4130
- }
4131
- addEvent(testTitle, "click", function() {
4132
- toggleClass(sourceName, "qunit-collapsed");
4133
- });
4134
- testItem.appendChild(sourceName);
4135
- }
4136
- if (config3.hidepassed && (status === "passed" || details.skipped)) {
4137
- hiddenTests.push(testItem);
4138
- tests.removeChild(testItem);
4139
- }
4140
- });
4141
- var usingPhantom = function(p) {
4142
- return p && p.version && p.version.major > 0;
4143
- }(window$1.phantom);
4144
- if (usingPhantom) {
4145
- console$1.warn("Support for PhantomJS is deprecated and will be removed in QUnit 3.0.");
4146
- }
4147
- if (!usingPhantom && document.readyState === "complete") {
4148
- QUnit2.load();
4149
- } else {
4150
- addEvent(window$1, "load", QUnit2.load);
4151
- }
4152
- var originalWindowOnError = window$1.onerror;
4153
- window$1.onerror = function(message, fileName2, lineNumber, columnNumber, errorObj) {
4154
- var ret = false;
4155
- if (originalWindowOnError) {
4156
- for (var _len = arguments.length, args = new Array(_len > 5 ? _len - 5 : 0), _key = 5; _key < _len; _key++) {
4157
- args[_key - 5] = arguments[_key];
4158
- }
4159
- ret = originalWindowOnError.call.apply(originalWindowOnError, [this, message, fileName2, lineNumber, columnNumber, errorObj].concat(args));
4160
- }
4161
- if (ret !== true) {
4162
- var error = {
4163
- message,
4164
- fileName: fileName2,
4165
- lineNumber
4166
- };
4167
- if (errorObj && errorObj.stack) {
4168
- error.stacktrace = extractStacktrace(errorObj, 0);
4169
- }
4170
- ret = QUnit2.onError(error);
4171
- }
4172
- return ret;
4173
- };
4174
- window$1.addEventListener("unhandledrejection", function(event) {
4175
- QUnit2.onUnhandledRejection(event.reason);
4176
- });
4177
- })();
4178
- QUnit2.diff = function() {
4179
- function DiffMatchPatch() {
4180
- }
4181
- var DIFF_DELETE = -1, DIFF_INSERT = 1, DIFF_EQUAL = 0, hasOwn2 = Object.prototype.hasOwnProperty;
4182
- DiffMatchPatch.prototype.DiffMain = function(text1, text2, optChecklines) {
4183
- var deadline, checklines, commonlength, commonprefix, commonsuffix, diffs;
4184
- deadline = new Date().getTime() + 1e3;
4185
- if (text1 === null || text2 === null) {
4186
- throw new Error("Null input. (DiffMain)");
4187
- }
4188
- if (text1 === text2) {
4189
- if (text1) {
4190
- return [[DIFF_EQUAL, text1]];
4191
- }
4192
- return [];
4193
- }
4194
- if (typeof optChecklines === "undefined") {
4195
- optChecklines = true;
4196
- }
4197
- checklines = optChecklines;
4198
- commonlength = this.diffCommonPrefix(text1, text2);
4199
- commonprefix = text1.substring(0, commonlength);
4200
- text1 = text1.substring(commonlength);
4201
- text2 = text2.substring(commonlength);
4202
- commonlength = this.diffCommonSuffix(text1, text2);
4203
- commonsuffix = text1.substring(text1.length - commonlength);
4204
- text1 = text1.substring(0, text1.length - commonlength);
4205
- text2 = text2.substring(0, text2.length - commonlength);
4206
- diffs = this.diffCompute(text1, text2, checklines, deadline);
4207
- if (commonprefix) {
4208
- diffs.unshift([DIFF_EQUAL, commonprefix]);
4209
- }
4210
- if (commonsuffix) {
4211
- diffs.push([DIFF_EQUAL, commonsuffix]);
4212
- }
4213
- this.diffCleanupMerge(diffs);
4214
- return diffs;
4215
- };
4216
- DiffMatchPatch.prototype.diffCleanupEfficiency = function(diffs) {
4217
- var changes, equalities, equalitiesLength, lastequality, pointer, preIns, preDel, postIns, postDel;
4218
- changes = false;
4219
- equalities = [];
4220
- equalitiesLength = 0;
4221
- lastequality = null;
4222
- pointer = 0;
4223
- preIns = false;
4224
- preDel = false;
4225
- postIns = false;
4226
- postDel = false;
4227
- while (pointer < diffs.length) {
4228
- if (diffs[pointer][0] === DIFF_EQUAL) {
4229
- if (diffs[pointer][1].length < 4 && (postIns || postDel)) {
4230
- equalities[equalitiesLength++] = pointer;
4231
- preIns = postIns;
4232
- preDel = postDel;
4233
- lastequality = diffs[pointer][1];
4234
- } else {
4235
- equalitiesLength = 0;
4236
- lastequality = null;
4237
- }
4238
- postIns = postDel = false;
4239
- } else {
4240
- if (diffs[pointer][0] === DIFF_DELETE) {
4241
- postDel = true;
4242
- } else {
4243
- postIns = true;
4244
- }
4245
- if (lastequality && (preIns && preDel && postIns && postDel || lastequality.length < 2 && preIns + preDel + postIns + postDel === 3)) {
4246
- diffs.splice(equalities[equalitiesLength - 1], 0, [DIFF_DELETE, lastequality]);
4247
- diffs[equalities[equalitiesLength - 1] + 1][0] = DIFF_INSERT;
4248
- equalitiesLength--;
4249
- lastequality = null;
4250
- if (preIns && preDel) {
4251
- postIns = postDel = true;
4252
- equalitiesLength = 0;
4253
- } else {
4254
- equalitiesLength--;
4255
- pointer = equalitiesLength > 0 ? equalities[equalitiesLength - 1] : -1;
4256
- postIns = postDel = false;
4257
- }
4258
- changes = true;
4259
- }
4260
- }
4261
- pointer++;
4262
- }
4263
- if (changes) {
4264
- this.diffCleanupMerge(diffs);
4265
- }
4266
- };
4267
- DiffMatchPatch.prototype.diffPrettyHtml = function(diffs) {
4268
- var op, data, x, html = [];
4269
- for (x = 0; x < diffs.length; x++) {
4270
- op = diffs[x][0];
4271
- data = diffs[x][1];
4272
- switch (op) {
4273
- case DIFF_INSERT:
4274
- html[x] = "<ins>" + escapeText(data) + "</ins>";
4275
- break;
4276
- case DIFF_DELETE:
4277
- html[x] = "<del>" + escapeText(data) + "</del>";
4278
- break;
4279
- case DIFF_EQUAL:
4280
- html[x] = "<span>" + escapeText(data) + "</span>";
4281
- break;
4282
- }
4283
- }
4284
- return html.join("");
4285
- };
4286
- DiffMatchPatch.prototype.diffCommonPrefix = function(text1, text2) {
4287
- var pointermid, pointermax, pointermin, pointerstart;
4288
- if (!text1 || !text2 || text1.charAt(0) !== text2.charAt(0)) {
4289
- return 0;
4290
- }
4291
- pointermin = 0;
4292
- pointermax = Math.min(text1.length, text2.length);
4293
- pointermid = pointermax;
4294
- pointerstart = 0;
4295
- while (pointermin < pointermid) {
4296
- if (text1.substring(pointerstart, pointermid) === text2.substring(pointerstart, pointermid)) {
4297
- pointermin = pointermid;
4298
- pointerstart = pointermin;
4299
- } else {
4300
- pointermax = pointermid;
4301
- }
4302
- pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);
4303
- }
4304
- return pointermid;
4305
- };
4306
- DiffMatchPatch.prototype.diffCommonSuffix = function(text1, text2) {
4307
- var pointermid, pointermax, pointermin, pointerend;
4308
- if (!text1 || !text2 || text1.charAt(text1.length - 1) !== text2.charAt(text2.length - 1)) {
4309
- return 0;
4310
- }
4311
- pointermin = 0;
4312
- pointermax = Math.min(text1.length, text2.length);
4313
- pointermid = pointermax;
4314
- pointerend = 0;
4315
- while (pointermin < pointermid) {
4316
- if (text1.substring(text1.length - pointermid, text1.length - pointerend) === text2.substring(text2.length - pointermid, text2.length - pointerend)) {
4317
- pointermin = pointermid;
4318
- pointerend = pointermin;
4319
- } else {
4320
- pointermax = pointermid;
4321
- }
4322
- pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);
4323
- }
4324
- return pointermid;
4325
- };
4326
- DiffMatchPatch.prototype.diffCompute = function(text1, text2, checklines, deadline) {
4327
- var diffs, longtext, shorttext, i, hm, text1A, text2A, text1B, text2B, midCommon, diffsA, diffsB;
4328
- if (!text1) {
4329
- return [[DIFF_INSERT, text2]];
4330
- }
4331
- if (!text2) {
4332
- return [[DIFF_DELETE, text1]];
4333
- }
4334
- longtext = text1.length > text2.length ? text1 : text2;
4335
- shorttext = text1.length > text2.length ? text2 : text1;
4336
- i = longtext.indexOf(shorttext);
4337
- if (i !== -1) {
4338
- diffs = [[DIFF_INSERT, longtext.substring(0, i)], [DIFF_EQUAL, shorttext], [DIFF_INSERT, longtext.substring(i + shorttext.length)]];
4339
- if (text1.length > text2.length) {
4340
- diffs[0][0] = diffs[2][0] = DIFF_DELETE;
4341
- }
4342
- return diffs;
4343
- }
4344
- if (shorttext.length === 1) {
4345
- return [[DIFF_DELETE, text1], [DIFF_INSERT, text2]];
4346
- }
4347
- hm = this.diffHalfMatch(text1, text2);
4348
- if (hm) {
4349
- text1A = hm[0];
4350
- text1B = hm[1];
4351
- text2A = hm[2];
4352
- text2B = hm[3];
4353
- midCommon = hm[4];
4354
- diffsA = this.DiffMain(text1A, text2A, checklines, deadline);
4355
- diffsB = this.DiffMain(text1B, text2B, checklines, deadline);
4356
- return diffsA.concat([[DIFF_EQUAL, midCommon]], diffsB);
4357
- }
4358
- if (checklines && text1.length > 100 && text2.length > 100) {
4359
- return this.diffLineMode(text1, text2, deadline);
4360
- }
4361
- return this.diffBisect(text1, text2, deadline);
4362
- };
4363
- DiffMatchPatch.prototype.diffHalfMatch = function(text1, text2) {
4364
- var longtext, shorttext, dmp, text1A, text2B, text2A, text1B, midCommon, hm1, hm2, hm;
4365
- longtext = text1.length > text2.length ? text1 : text2;
4366
- shorttext = text1.length > text2.length ? text2 : text1;
4367
- if (longtext.length < 4 || shorttext.length * 2 < longtext.length) {
4368
- return null;
4369
- }
4370
- dmp = this;
4371
- function diffHalfMatchI(longtext2, shorttext2, i) {
4372
- var seed, j, bestCommon, prefixLength, suffixLength, bestLongtextA, bestLongtextB, bestShorttextA, bestShorttextB;
4373
- seed = longtext2.substring(i, i + Math.floor(longtext2.length / 4));
4374
- j = -1;
4375
- bestCommon = "";
4376
- while ((j = shorttext2.indexOf(seed, j + 1)) !== -1) {
4377
- prefixLength = dmp.diffCommonPrefix(longtext2.substring(i), shorttext2.substring(j));
4378
- suffixLength = dmp.diffCommonSuffix(longtext2.substring(0, i), shorttext2.substring(0, j));
4379
- if (bestCommon.length < suffixLength + prefixLength) {
4380
- bestCommon = shorttext2.substring(j - suffixLength, j) + shorttext2.substring(j, j + prefixLength);
4381
- bestLongtextA = longtext2.substring(0, i - suffixLength);
4382
- bestLongtextB = longtext2.substring(i + prefixLength);
4383
- bestShorttextA = shorttext2.substring(0, j - suffixLength);
4384
- bestShorttextB = shorttext2.substring(j + prefixLength);
4385
- }
4386
- }
4387
- if (bestCommon.length * 2 >= longtext2.length) {
4388
- return [bestLongtextA, bestLongtextB, bestShorttextA, bestShorttextB, bestCommon];
4389
- } else {
4390
- return null;
4391
- }
4392
- }
4393
- hm1 = diffHalfMatchI(longtext, shorttext, Math.ceil(longtext.length / 4));
4394
- hm2 = diffHalfMatchI(longtext, shorttext, Math.ceil(longtext.length / 2));
4395
- if (!hm1 && !hm2) {
4396
- return null;
4397
- } else if (!hm2) {
4398
- hm = hm1;
4399
- } else if (!hm1) {
4400
- hm = hm2;
4401
- } else {
4402
- hm = hm1[4].length > hm2[4].length ? hm1 : hm2;
4403
- }
4404
- if (text1.length > text2.length) {
4405
- text1A = hm[0];
4406
- text1B = hm[1];
4407
- text2A = hm[2];
4408
- text2B = hm[3];
4409
- } else {
4410
- text2A = hm[0];
4411
- text2B = hm[1];
4412
- text1A = hm[2];
4413
- text1B = hm[3];
4414
- }
4415
- midCommon = hm[4];
4416
- return [text1A, text1B, text2A, text2B, midCommon];
4417
- };
4418
- DiffMatchPatch.prototype.diffLineMode = function(text1, text2, deadline) {
4419
- var a, diffs, linearray, pointer, countInsert, countDelete, textInsert, textDelete, j;
4420
- a = this.diffLinesToChars(text1, text2);
4421
- text1 = a.chars1;
4422
- text2 = a.chars2;
4423
- linearray = a.lineArray;
4424
- diffs = this.DiffMain(text1, text2, false, deadline);
4425
- this.diffCharsToLines(diffs, linearray);
4426
- this.diffCleanupSemantic(diffs);
4427
- diffs.push([DIFF_EQUAL, ""]);
4428
- pointer = 0;
4429
- countDelete = 0;
4430
- countInsert = 0;
4431
- textDelete = "";
4432
- textInsert = "";
4433
- while (pointer < diffs.length) {
4434
- switch (diffs[pointer][0]) {
4435
- case DIFF_INSERT:
4436
- countInsert++;
4437
- textInsert += diffs[pointer][1];
4438
- break;
4439
- case DIFF_DELETE:
4440
- countDelete++;
4441
- textDelete += diffs[pointer][1];
4442
- break;
4443
- case DIFF_EQUAL:
4444
- if (countDelete >= 1 && countInsert >= 1) {
4445
- diffs.splice(pointer - countDelete - countInsert, countDelete + countInsert);
4446
- pointer = pointer - countDelete - countInsert;
4447
- a = this.DiffMain(textDelete, textInsert, false, deadline);
4448
- for (j = a.length - 1; j >= 0; j--) {
4449
- diffs.splice(pointer, 0, a[j]);
4450
- }
4451
- pointer = pointer + a.length;
4452
- }
4453
- countInsert = 0;
4454
- countDelete = 0;
4455
- textDelete = "";
4456
- textInsert = "";
4457
- break;
4458
- }
4459
- pointer++;
4460
- }
4461
- diffs.pop();
4462
- return diffs;
4463
- };
4464
- DiffMatchPatch.prototype.diffBisect = function(text1, text2, deadline) {
4465
- var text1Length, text2Length, maxD, vOffset, vLength, v1, v2, x, delta, front, k1start, k1end, k2start, k2end, k2Offset, k1Offset, x1, x2, y1, y2, d, k1, k2;
4466
- text1Length = text1.length;
4467
- text2Length = text2.length;
4468
- maxD = Math.ceil((text1Length + text2Length) / 2);
4469
- vOffset = maxD;
4470
- vLength = 2 * maxD;
4471
- v1 = new Array(vLength);
4472
- v2 = new Array(vLength);
4473
- for (x = 0; x < vLength; x++) {
4474
- v1[x] = -1;
4475
- v2[x] = -1;
4476
- }
4477
- v1[vOffset + 1] = 0;
4478
- v2[vOffset + 1] = 0;
4479
- delta = text1Length - text2Length;
4480
- front = delta % 2 !== 0;
4481
- k1start = 0;
4482
- k1end = 0;
4483
- k2start = 0;
4484
- k2end = 0;
4485
- for (d = 0; d < maxD; d++) {
4486
- if (new Date().getTime() > deadline) {
4487
- break;
4488
- }
4489
- for (k1 = -d + k1start; k1 <= d - k1end; k1 += 2) {
4490
- k1Offset = vOffset + k1;
4491
- if (k1 === -d || k1 !== d && v1[k1Offset - 1] < v1[k1Offset + 1]) {
4492
- x1 = v1[k1Offset + 1];
4493
- } else {
4494
- x1 = v1[k1Offset - 1] + 1;
4495
- }
4496
- y1 = x1 - k1;
4497
- while (x1 < text1Length && y1 < text2Length && text1.charAt(x1) === text2.charAt(y1)) {
4498
- x1++;
4499
- y1++;
4500
- }
4501
- v1[k1Offset] = x1;
4502
- if (x1 > text1Length) {
4503
- k1end += 2;
4504
- } else if (y1 > text2Length) {
4505
- k1start += 2;
4506
- } else if (front) {
4507
- k2Offset = vOffset + delta - k1;
4508
- if (k2Offset >= 0 && k2Offset < vLength && v2[k2Offset] !== -1) {
4509
- x2 = text1Length - v2[k2Offset];
4510
- if (x1 >= x2) {
4511
- return this.diffBisectSplit(text1, text2, x1, y1, deadline);
4512
- }
4513
- }
4514
- }
4515
- }
4516
- for (k2 = -d + k2start; k2 <= d - k2end; k2 += 2) {
4517
- k2Offset = vOffset + k2;
4518
- if (k2 === -d || k2 !== d && v2[k2Offset - 1] < v2[k2Offset + 1]) {
4519
- x2 = v2[k2Offset + 1];
4520
- } else {
4521
- x2 = v2[k2Offset - 1] + 1;
4522
- }
4523
- y2 = x2 - k2;
4524
- while (x2 < text1Length && y2 < text2Length && text1.charAt(text1Length - x2 - 1) === text2.charAt(text2Length - y2 - 1)) {
4525
- x2++;
4526
- y2++;
4527
- }
4528
- v2[k2Offset] = x2;
4529
- if (x2 > text1Length) {
4530
- k2end += 2;
4531
- } else if (y2 > text2Length) {
4532
- k2start += 2;
4533
- } else if (!front) {
4534
- k1Offset = vOffset + delta - k2;
4535
- if (k1Offset >= 0 && k1Offset < vLength && v1[k1Offset] !== -1) {
4536
- x1 = v1[k1Offset];
4537
- y1 = vOffset + x1 - k1Offset;
4538
- x2 = text1Length - x2;
4539
- if (x1 >= x2) {
4540
- return this.diffBisectSplit(text1, text2, x1, y1, deadline);
4541
- }
4542
- }
4543
- }
4544
- }
4545
- }
4546
- return [[DIFF_DELETE, text1], [DIFF_INSERT, text2]];
4547
- };
4548
- DiffMatchPatch.prototype.diffBisectSplit = function(text1, text2, x, y, deadline) {
4549
- var text1a, text1b, text2a, text2b, diffs, diffsb;
4550
- text1a = text1.substring(0, x);
4551
- text2a = text2.substring(0, y);
4552
- text1b = text1.substring(x);
4553
- text2b = text2.substring(y);
4554
- diffs = this.DiffMain(text1a, text2a, false, deadline);
4555
- diffsb = this.DiffMain(text1b, text2b, false, deadline);
4556
- return diffs.concat(diffsb);
4557
- };
4558
- DiffMatchPatch.prototype.diffCleanupSemantic = function(diffs) {
4559
- var changes, equalities, equalitiesLength, lastequality, pointer, lengthInsertions2, lengthDeletions2, lengthInsertions1, lengthDeletions1, deletion, insertion, overlapLength1, overlapLength2;
4560
- changes = false;
4561
- equalities = [];
4562
- equalitiesLength = 0;
4563
- lastequality = null;
4564
- pointer = 0;
4565
- lengthInsertions1 = 0;
4566
- lengthDeletions1 = 0;
4567
- lengthInsertions2 = 0;
4568
- lengthDeletions2 = 0;
4569
- while (pointer < diffs.length) {
4570
- if (diffs[pointer][0] === DIFF_EQUAL) {
4571
- equalities[equalitiesLength++] = pointer;
4572
- lengthInsertions1 = lengthInsertions2;
4573
- lengthDeletions1 = lengthDeletions2;
4574
- lengthInsertions2 = 0;
4575
- lengthDeletions2 = 0;
4576
- lastequality = diffs[pointer][1];
4577
- } else {
4578
- if (diffs[pointer][0] === DIFF_INSERT) {
4579
- lengthInsertions2 += diffs[pointer][1].length;
4580
- } else {
4581
- lengthDeletions2 += diffs[pointer][1].length;
4582
- }
4583
- if (lastequality && lastequality.length <= Math.max(lengthInsertions1, lengthDeletions1) && lastequality.length <= Math.max(lengthInsertions2, lengthDeletions2)) {
4584
- diffs.splice(equalities[equalitiesLength - 1], 0, [DIFF_DELETE, lastequality]);
4585
- diffs[equalities[equalitiesLength - 1] + 1][0] = DIFF_INSERT;
4586
- equalitiesLength--;
4587
- equalitiesLength--;
4588
- pointer = equalitiesLength > 0 ? equalities[equalitiesLength - 1] : -1;
4589
- lengthInsertions1 = 0;
4590
- lengthDeletions1 = 0;
4591
- lengthInsertions2 = 0;
4592
- lengthDeletions2 = 0;
4593
- lastequality = null;
4594
- changes = true;
4595
- }
4596
- }
4597
- pointer++;
4598
- }
4599
- if (changes) {
4600
- this.diffCleanupMerge(diffs);
4601
- }
4602
- pointer = 1;
4603
- while (pointer < diffs.length) {
4604
- if (diffs[pointer - 1][0] === DIFF_DELETE && diffs[pointer][0] === DIFF_INSERT) {
4605
- deletion = diffs[pointer - 1][1];
4606
- insertion = diffs[pointer][1];
4607
- overlapLength1 = this.diffCommonOverlap(deletion, insertion);
4608
- overlapLength2 = this.diffCommonOverlap(insertion, deletion);
4609
- if (overlapLength1 >= overlapLength2) {
4610
- if (overlapLength1 >= deletion.length / 2 || overlapLength1 >= insertion.length / 2) {
4611
- diffs.splice(pointer, 0, [DIFF_EQUAL, insertion.substring(0, overlapLength1)]);
4612
- diffs[pointer - 1][1] = deletion.substring(0, deletion.length - overlapLength1);
4613
- diffs[pointer + 1][1] = insertion.substring(overlapLength1);
4614
- pointer++;
4615
- }
4616
- } else {
4617
- if (overlapLength2 >= deletion.length / 2 || overlapLength2 >= insertion.length / 2) {
4618
- diffs.splice(pointer, 0, [DIFF_EQUAL, deletion.substring(0, overlapLength2)]);
4619
- diffs[pointer - 1][0] = DIFF_INSERT;
4620
- diffs[pointer - 1][1] = insertion.substring(0, insertion.length - overlapLength2);
4621
- diffs[pointer + 1][0] = DIFF_DELETE;
4622
- diffs[pointer + 1][1] = deletion.substring(overlapLength2);
4623
- pointer++;
4624
- }
4625
- }
4626
- pointer++;
4627
- }
4628
- pointer++;
4629
- }
4630
- };
4631
- DiffMatchPatch.prototype.diffCommonOverlap = function(text1, text2) {
4632
- var text1Length, text2Length, textLength, best, length, pattern, found;
4633
- text1Length = text1.length;
4634
- text2Length = text2.length;
4635
- if (text1Length === 0 || text2Length === 0) {
4636
- return 0;
4637
- }
4638
- if (text1Length > text2Length) {
4639
- text1 = text1.substring(text1Length - text2Length);
4640
- } else if (text1Length < text2Length) {
4641
- text2 = text2.substring(0, text1Length);
4642
- }
4643
- textLength = Math.min(text1Length, text2Length);
4644
- if (text1 === text2) {
4645
- return textLength;
4646
- }
4647
- best = 0;
4648
- length = 1;
4649
- while (true) {
4650
- pattern = text1.substring(textLength - length);
4651
- found = text2.indexOf(pattern);
4652
- if (found === -1) {
4653
- return best;
4654
- }
4655
- length += found;
4656
- if (found === 0 || text1.substring(textLength - length) === text2.substring(0, length)) {
4657
- best = length;
4658
- length++;
4659
- }
4660
- }
4661
- };
4662
- DiffMatchPatch.prototype.diffLinesToChars = function(text1, text2) {
4663
- var lineArray, lineHash, chars1, chars2;
4664
- lineArray = [];
4665
- lineHash = {};
4666
- lineArray[0] = "";
4667
- function diffLinesToCharsMunge(text) {
4668
- var chars, lineStart, lineEnd, lineArrayLength, line;
4669
- chars = "";
4670
- lineStart = 0;
4671
- lineEnd = -1;
4672
- lineArrayLength = lineArray.length;
4673
- while (lineEnd < text.length - 1) {
4674
- lineEnd = text.indexOf("\n", lineStart);
4675
- if (lineEnd === -1) {
4676
- lineEnd = text.length - 1;
4677
- }
4678
- line = text.substring(lineStart, lineEnd + 1);
4679
- lineStart = lineEnd + 1;
4680
- if (hasOwn2.call(lineHash, line)) {
4681
- chars += String.fromCharCode(lineHash[line]);
4682
- } else {
4683
- chars += String.fromCharCode(lineArrayLength);
4684
- lineHash[line] = lineArrayLength;
4685
- lineArray[lineArrayLength++] = line;
4686
- }
4687
- }
4688
- return chars;
4689
- }
4690
- chars1 = diffLinesToCharsMunge(text1);
4691
- chars2 = diffLinesToCharsMunge(text2);
4692
- return {
4693
- chars1,
4694
- chars2,
4695
- lineArray
4696
- };
4697
- };
4698
- DiffMatchPatch.prototype.diffCharsToLines = function(diffs, lineArray) {
4699
- var x, chars, text, y;
4700
- for (x = 0; x < diffs.length; x++) {
4701
- chars = diffs[x][1];
4702
- text = [];
4703
- for (y = 0; y < chars.length; y++) {
4704
- text[y] = lineArray[chars.charCodeAt(y)];
4705
- }
4706
- diffs[x][1] = text.join("");
4707
- }
4708
- };
4709
- DiffMatchPatch.prototype.diffCleanupMerge = function(diffs) {
4710
- var pointer, countDelete, countInsert, textInsert, textDelete, commonlength, changes, diffPointer, position;
4711
- diffs.push([DIFF_EQUAL, ""]);
4712
- pointer = 0;
4713
- countDelete = 0;
4714
- countInsert = 0;
4715
- textDelete = "";
4716
- textInsert = "";
4717
- while (pointer < diffs.length) {
4718
- switch (diffs[pointer][0]) {
4719
- case DIFF_INSERT:
4720
- countInsert++;
4721
- textInsert += diffs[pointer][1];
4722
- pointer++;
4723
- break;
4724
- case DIFF_DELETE:
4725
- countDelete++;
4726
- textDelete += diffs[pointer][1];
4727
- pointer++;
4728
- break;
4729
- case DIFF_EQUAL:
4730
- if (countDelete + countInsert > 1) {
4731
- if (countDelete !== 0 && countInsert !== 0) {
4732
- commonlength = this.diffCommonPrefix(textInsert, textDelete);
4733
- if (commonlength !== 0) {
4734
- if (pointer - countDelete - countInsert > 0 && diffs[pointer - countDelete - countInsert - 1][0] === DIFF_EQUAL) {
4735
- diffs[pointer - countDelete - countInsert - 1][1] += textInsert.substring(0, commonlength);
4736
- } else {
4737
- diffs.splice(0, 0, [DIFF_EQUAL, textInsert.substring(0, commonlength)]);
4738
- pointer++;
4739
- }
4740
- textInsert = textInsert.substring(commonlength);
4741
- textDelete = textDelete.substring(commonlength);
4742
- }
4743
- commonlength = this.diffCommonSuffix(textInsert, textDelete);
4744
- if (commonlength !== 0) {
4745
- diffs[pointer][1] = textInsert.substring(textInsert.length - commonlength) + diffs[pointer][1];
4746
- textInsert = textInsert.substring(0, textInsert.length - commonlength);
4747
- textDelete = textDelete.substring(0, textDelete.length - commonlength);
4748
- }
4749
- }
4750
- if (countDelete === 0) {
4751
- diffs.splice(pointer - countInsert, countDelete + countInsert, [DIFF_INSERT, textInsert]);
4752
- } else if (countInsert === 0) {
4753
- diffs.splice(pointer - countDelete, countDelete + countInsert, [DIFF_DELETE, textDelete]);
4754
- } else {
4755
- diffs.splice(pointer - countDelete - countInsert, countDelete + countInsert, [DIFF_DELETE, textDelete], [DIFF_INSERT, textInsert]);
4756
- }
4757
- pointer = pointer - countDelete - countInsert + (countDelete ? 1 : 0) + (countInsert ? 1 : 0) + 1;
4758
- } else if (pointer !== 0 && diffs[pointer - 1][0] === DIFF_EQUAL) {
4759
- diffs[pointer - 1][1] += diffs[pointer][1];
4760
- diffs.splice(pointer, 1);
4761
- } else {
4762
- pointer++;
4763
- }
4764
- countInsert = 0;
4765
- countDelete = 0;
4766
- textDelete = "";
4767
- textInsert = "";
4768
- break;
4769
- }
4770
- }
4771
- if (diffs[diffs.length - 1][1] === "") {
4772
- diffs.pop();
4773
- }
4774
- changes = false;
4775
- pointer = 1;
4776
- while (pointer < diffs.length - 1) {
4777
- if (diffs[pointer - 1][0] === DIFF_EQUAL && diffs[pointer + 1][0] === DIFF_EQUAL) {
4778
- diffPointer = diffs[pointer][1];
4779
- position = diffPointer.substring(diffPointer.length - diffs[pointer - 1][1].length);
4780
- if (position === diffs[pointer - 1][1]) {
4781
- diffs[pointer][1] = diffs[pointer - 1][1] + diffs[pointer][1].substring(0, diffs[pointer][1].length - diffs[pointer - 1][1].length);
4782
- diffs[pointer + 1][1] = diffs[pointer - 1][1] + diffs[pointer + 1][1];
4783
- diffs.splice(pointer - 1, 1);
4784
- changes = true;
4785
- } else if (diffPointer.substring(0, diffs[pointer + 1][1].length) === diffs[pointer + 1][1]) {
4786
- diffs[pointer - 1][1] += diffs[pointer + 1][1];
4787
- diffs[pointer][1] = diffs[pointer][1].substring(diffs[pointer + 1][1].length) + diffs[pointer + 1][1];
4788
- diffs.splice(pointer + 1, 1);
4789
- changes = true;
4790
- }
4791
- }
4792
- pointer++;
4793
- }
4794
- if (changes) {
4795
- this.diffCleanupMerge(diffs);
4796
- }
4797
- };
4798
- return function(o, n) {
4799
- var diff3, output, text;
4800
- diff3 = new DiffMatchPatch();
4801
- output = diff3.DiffMain(o, n);
4802
- diff3.diffCleanupEfficiency(output);
4803
- text = diff3.diffPrettyHtml(output);
4804
- return text;
4805
- };
4806
- }();
4807
- })();
4808
- });
4809
-
4810
- // ../../index.js
4811
- var import_qunit = __toModule(require_qunit());
4812
- import_qunit.default.config.autostart = false;
4813
- var isLocal = import_qunit.default.isLocal;
4814
- var on = import_qunit.default.on;
4815
- var test = import_qunit.default.test;
4816
- var skip = import_qunit.default.skip;
4817
- var start = import_qunit.default.start;
4818
- var is = import_qunit.default.is;
4819
- var extend = import_qunit.default.extend;
4820
- var stack = import_qunit.default.stack;
4821
- var onUnhandledRejection = import_qunit.default.onUnhandledRejection;
4822
- var assert = import_qunit.default.assert;
4823
- var dump = import_qunit.default.dump;
4824
- var done = import_qunit.default.done;
4825
- var testStart = import_qunit.default.testStart;
4826
- var moduleStart = import_qunit.default.moduleStart;
4827
- var version = import_qunit.default.version;
4828
- var module = import_qunit.default.module;
4829
- var todo = import_qunit.default.todo;
4830
- var only = import_qunit.default.only;
4831
- var config = import_qunit.default.config;
4832
- var objectType = import_qunit.default.objectType;
4833
- var load = import_qunit.default.load;
4834
- var onError = import_qunit.default.onError;
4835
- var pushFailure = import_qunit.default.pushFailure;
4836
- var equiv = import_qunit.default.equiv;
4837
- var begin = import_qunit.default.begin;
4838
- var log = import_qunit.default.log;
4839
- var testDone = import_qunit.default.testDone;
4840
- var moduleDone = import_qunit.default.moduleDone;
4841
- var diff = import_qunit.default.diff;
4842
- var qunitx_default = Object.assign(import_qunit.default, {
4843
- QUnitxVersion: "0.0.1"
4844
- });
4845
-
4846
- // passing-tests.js
4847
- module("{{moduleName}}", function(hooks) {
4848
- test("assert true works", function(assert2) {
4849
- assert2.expect(3);
4850
- assert2.ok(true);
4851
- console.log("calling assert true test case");
4852
- assert2.equal(true, true);
4853
- assert2.equal(null, null);
4854
- });
4855
- test("async test finishes", async function(assert2) {
4856
- assert2.expect(3);
4857
- const wait = new Promise((resolve, reject) => {
4858
- window.setTimeout(() => {
4859
- console.log("resolving async test");
4860
- console.log({
4861
- moduleName: "called resolved async test with object",
4862
- placeholder: 1e3,
4863
- anotherObject: {
4864
- firstName: "Izel",
4865
- createdAt: new Date("2021-03-06")
4866
- }
4867
- });
4868
- resolve(true);
4869
- }, 50);
4870
- });
4871
- const result = await wait;
4872
- assert2.ok(true);
4873
- assert2.equal(true, result);
4874
- assert2.equal(null, null);
4875
- result;
4876
- });
4877
- test("deepEqual true works", function(assert2) {
4878
- const me = {firstName: "Izel", lastName: "Nakri"};
4879
- console.log("calling deepEqual test case");
4880
- assert2.deepEqual(me, {firstName: "Izel", lastName: "Nakri"});
4881
- });
4882
- });
4883
- })();