-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.bundle.js
7625 lines (6549 loc) · 354 KB
/
test.bundle.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ function(module, exports, __webpack_require__) {
__webpack_require__(1);
mocha.setup("bdd");
__webpack_require__(9)
__webpack_require__(49);
if(false) {
module.hot.accept();
module.hot.dispose(function() {
mocha.suite.suites.length = 0;
var stats = document.getElementById('mocha-stats');
var report = document.getElementById('mocha-report');
stats.parentNode.removeChild(stats);
report.parentNode.removeChild(report);
});
}
/***/ },
/* 1 */
/***/ function(module, exports, __webpack_require__) {
if (! document.getElementById("mocha")) { document.write("<div id=\"mocha\"></div>"); }
__webpack_require__(2);
__webpack_require__(6);
/***/ },
/* 2 */
/***/ function(module, exports, __webpack_require__) {
// style-loader: Adds some css to the DOM by adding a <style> tag
// load the styles
var content = __webpack_require__(3);
if(typeof content === 'string') content = [[module.id, content, '']];
// add the styles to the DOM
var update = __webpack_require__(5)(content, {});
// Hot Module Replacement
if(false) {
// When the styles change, update the <style> tags
module.hot.accept("!!/Users/stevekinney/Projects/game-time-starter-kit/node_modules/mocha-loader/node_modules/css-loader/index.js!/Users/stevekinney/Projects/game-time-starter-kit/node_modules/mocha/mocha.css", function() {
var newContent = require("!!/Users/stevekinney/Projects/game-time-starter-kit/node_modules/mocha-loader/node_modules/css-loader/index.js!/Users/stevekinney/Projects/game-time-starter-kit/node_modules/mocha/mocha.css");
if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
update(newContent);
});
// When the module is disposed, remove the <style> tags
module.hot.dispose(function() { update(); });
}
/***/ },
/* 3 */
/***/ function(module, exports, __webpack_require__) {
exports = module.exports = __webpack_require__(4)();
exports.push([module.id, "@charset \"utf-8\";\n\nbody {\n margin:0;\n}\n\n#mocha {\n font: 20px/1.5 \"Helvetica Neue\", Helvetica, Arial, sans-serif;\n margin: 60px 50px;\n}\n\n#mocha ul,\n#mocha li {\n margin: 0;\n padding: 0;\n}\n\n#mocha ul {\n list-style: none;\n}\n\n#mocha h1,\n#mocha h2 {\n margin: 0;\n}\n\n#mocha h1 {\n margin-top: 15px;\n font-size: 1em;\n font-weight: 200;\n}\n\n#mocha h1 a {\n text-decoration: none;\n color: inherit;\n}\n\n#mocha h1 a:hover {\n text-decoration: underline;\n}\n\n#mocha .suite .suite h1 {\n margin-top: 0;\n font-size: .8em;\n}\n\n#mocha .hidden {\n display: none;\n}\n\n#mocha h2 {\n font-size: 12px;\n font-weight: normal;\n cursor: pointer;\n}\n\n#mocha .suite {\n margin-left: 15px;\n}\n\n#mocha .test {\n margin-left: 15px;\n overflow: hidden;\n}\n\n#mocha .test.pending:hover h2::after {\n content: '(pending)';\n font-family: arial, sans-serif;\n}\n\n#mocha .test.pass.medium .duration {\n background: #c09853;\n}\n\n#mocha .test.pass.slow .duration {\n background: #b94a48;\n}\n\n#mocha .test.pass::before {\n content: '✓';\n font-size: 12px;\n display: block;\n float: left;\n margin-right: 5px;\n color: #00d6b2;\n}\n\n#mocha .test.pass .duration {\n font-size: 9px;\n margin-left: 5px;\n padding: 2px 5px;\n color: #fff;\n -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.2);\n -moz-box-shadow: inset 0 1px 1px rgba(0,0,0,.2);\n box-shadow: inset 0 1px 1px rgba(0,0,0,.2);\n -webkit-border-radius: 5px;\n -moz-border-radius: 5px;\n -ms-border-radius: 5px;\n -o-border-radius: 5px;\n border-radius: 5px;\n}\n\n#mocha .test.pass.fast .duration {\n display: none;\n}\n\n#mocha .test.pending {\n color: #0b97c4;\n}\n\n#mocha .test.pending::before {\n content: '◦';\n color: #0b97c4;\n}\n\n#mocha .test.fail {\n color: #c00;\n}\n\n#mocha .test.fail pre {\n color: black;\n}\n\n#mocha .test.fail::before {\n content: '✖';\n font-size: 12px;\n display: block;\n float: left;\n margin-right: 5px;\n color: #c00;\n}\n\n#mocha .test pre.error {\n color: #c00;\n max-height: 300px;\n overflow: auto;\n}\n\n/**\n * (1): approximate for browsers not supporting calc\n * (2): 42 = 2*15 + 2*10 + 2*1 (padding + margin + border)\n * ^^ seriously\n */\n#mocha .test pre {\n display: block;\n float: left;\n clear: left;\n font: 12px/1.5 monaco, monospace;\n margin: 5px;\n padding: 15px;\n border: 1px solid #eee;\n max-width: 85%; /*(1)*/\n max-width: calc(100% - 42px); /*(2)*/\n word-wrap: break-word;\n border-bottom-color: #ddd;\n -webkit-border-radius: 3px;\n -webkit-box-shadow: 0 1px 3px #eee;\n -moz-border-radius: 3px;\n -moz-box-shadow: 0 1px 3px #eee;\n border-radius: 3px;\n}\n\n#mocha .test h2 {\n position: relative;\n}\n\n#mocha .test a.replay {\n position: absolute;\n top: 3px;\n right: 0;\n text-decoration: none;\n vertical-align: middle;\n display: block;\n width: 15px;\n height: 15px;\n line-height: 15px;\n text-align: center;\n background: #eee;\n font-size: 15px;\n -moz-border-radius: 15px;\n border-radius: 15px;\n -webkit-transition: opacity 200ms;\n -moz-transition: opacity 200ms;\n transition: opacity 200ms;\n opacity: 0.3;\n color: #888;\n}\n\n#mocha .test:hover a.replay {\n opacity: 1;\n}\n\n#mocha-report.pass .test.fail {\n display: none;\n}\n\n#mocha-report.fail .test.pass {\n display: none;\n}\n\n#mocha-report.pending .test.pass,\n#mocha-report.pending .test.fail {\n display: none;\n}\n#mocha-report.pending .test.pass.pending {\n display: block;\n}\n\n#mocha-error {\n color: #c00;\n font-size: 1.5em;\n font-weight: 100;\n letter-spacing: 1px;\n}\n\n#mocha-stats {\n position: fixed;\n top: 15px;\n right: 10px;\n font-size: 12px;\n margin: 0;\n color: #888;\n z-index: 1;\n}\n\n#mocha-stats .progress {\n float: right;\n padding-top: 0;\n}\n\n#mocha-stats em {\n color: black;\n}\n\n#mocha-stats a {\n text-decoration: none;\n color: inherit;\n}\n\n#mocha-stats a:hover {\n border-bottom: 1px solid #eee;\n}\n\n#mocha-stats li {\n display: inline-block;\n margin: 0 5px;\n list-style: none;\n padding-top: 11px;\n}\n\n#mocha-stats canvas {\n width: 40px;\n height: 40px;\n}\n\n#mocha code .comment { color: #ddd; }\n#mocha code .init { color: #2f6fad; }\n#mocha code .string { color: #5890ad; }\n#mocha code .keyword { color: #8a6343; }\n#mocha code .number { color: #2f6fad; }\n\n@media screen and (max-device-width: 480px) {\n #mocha {\n margin: 60px 0px;\n }\n\n #mocha #stats {\n position: absolute;\n }\n}\n", ""]);
/***/ },
/* 4 */
/***/ function(module, exports) {
"use strict";
module.exports = function () {
var list = [];
list.toString = function toString() {
var result = [];
for (var i = 0; i < this.length; i++) {
var item = this[i];
if (item[2]) {
result.push("@media " + item[2] + "{" + item[1] + "}");
} else {
result.push(item[1]);
}
}
return result.join("");
};
return list;
};
/***/ },
/* 5 */
/***/ function(module, exports, __webpack_require__) {
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
var stylesInDom = {},
memoize = function(fn) {
var memo;
return function () {
if (typeof memo === "undefined") memo = fn.apply(this, arguments);
return memo;
};
},
isIE9 = memoize(function() {
return /msie 9\b/.test(window.navigator.userAgent.toLowerCase());
}),
getHeadElement = memoize(function () {
return document.head || document.getElementsByTagName("head")[0];
}),
singletonElement = null,
singletonCounter = 0;
module.exports = function(list, options) {
if(false) {
if(typeof document !== "object") throw new Error("The style-loader cannot be used in a non-browser environment");
}
options = options || {};
// Force single-tag solution on IE9, which has a hard limit on the # of <style>
// tags it will allow on a page
if (typeof options.singleton === "undefined") options.singleton = isIE9();
var styles = listToStyles(list);
addStylesToDom(styles, options);
return function update(newList) {
var mayRemove = [];
for(var i = 0; i < styles.length; i++) {
var item = styles[i];
var domStyle = stylesInDom[item.id];
domStyle.refs--;
mayRemove.push(domStyle);
}
if(newList) {
var newStyles = listToStyles(newList);
addStylesToDom(newStyles, options);
}
for(var i = 0; i < mayRemove.length; i++) {
var domStyle = mayRemove[i];
if(domStyle.refs === 0) {
for(var j = 0; j < domStyle.parts.length; j++)
domStyle.parts[j]();
delete stylesInDom[domStyle.id];
}
}
};
}
function addStylesToDom(styles, options) {
for(var i = 0; i < styles.length; i++) {
var item = styles[i];
var domStyle = stylesInDom[item.id];
if(domStyle) {
domStyle.refs++;
for(var j = 0; j < domStyle.parts.length; j++) {
domStyle.parts[j](item.parts[j]);
}
for(; j < item.parts.length; j++) {
domStyle.parts.push(addStyle(item.parts[j], options));
}
} else {
var parts = [];
for(var j = 0; j < item.parts.length; j++) {
parts.push(addStyle(item.parts[j], options));
}
stylesInDom[item.id] = {id: item.id, refs: 1, parts: parts};
}
}
}
function listToStyles(list) {
var styles = [];
var newStyles = {};
for(var i = 0; i < list.length; i++) {
var item = list[i];
var id = item[0];
var css = item[1];
var media = item[2];
var sourceMap = item[3];
var part = {css: css, media: media, sourceMap: sourceMap};
if(!newStyles[id])
styles.push(newStyles[id] = {id: id, parts: [part]});
else
newStyles[id].parts.push(part);
}
return styles;
}
function createStyleElement() {
var styleElement = document.createElement("style");
var head = getHeadElement();
styleElement.type = "text/css";
head.appendChild(styleElement);
return styleElement;
}
function addStyle(obj, options) {
var styleElement, update, remove;
if (options.singleton) {
var styleIndex = singletonCounter++;
styleElement = singletonElement || (singletonElement = createStyleElement());
update = applyToSingletonTag.bind(null, styleElement, styleIndex, false);
remove = applyToSingletonTag.bind(null, styleElement, styleIndex, true);
} else {
styleElement = createStyleElement();
update = applyToTag.bind(null, styleElement);
remove = function () {
styleElement.parentNode.removeChild(styleElement);
};
}
update(obj);
return function updateStyle(newObj) {
if(newObj) {
if(newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap)
return;
update(obj = newObj);
} else {
remove();
}
};
}
function replaceText(source, id, replacement) {
var boundaries = ["/** >>" + id + " **/", "/** " + id + "<< **/"];
var start = source.lastIndexOf(boundaries[0]);
var wrappedReplacement = replacement
? (boundaries[0] + replacement + boundaries[1])
: "";
if (source.lastIndexOf(boundaries[0]) >= 0) {
var end = source.lastIndexOf(boundaries[1]) + boundaries[1].length;
return source.slice(0, start) + wrappedReplacement + source.slice(end);
} else {
return source + wrappedReplacement;
}
}
function applyToSingletonTag(styleElement, index, remove, obj) {
var css = remove ? "" : obj.css;
if(styleElement.styleSheet) {
styleElement.styleSheet.cssText = replaceText(styleElement.styleSheet.cssText, index, css);
} else {
var cssNode = document.createTextNode(css);
var childNodes = styleElement.childNodes;
if (childNodes[index]) styleElement.removeChild(childNodes[index]);
if (childNodes.length) {
styleElement.insertBefore(cssNode, childNodes[index]);
} else {
styleElement.appendChild(cssNode);
}
}
}
function applyToTag(styleElement, obj) {
var css = obj.css;
var media = obj.media;
var sourceMap = obj.sourceMap;
if(sourceMap && typeof btoa === "function") {
try {
css += "\n/*# sourceMappingURL=data:application/json;base64," + btoa(JSON.stringify(sourceMap)) + " */";
css = "@import url(\"data:text/css;base64," + btoa(css) + "\")";
} catch(e) {}
}
if(media) {
styleElement.setAttribute("media", media)
}
if(styleElement.styleSheet) {
styleElement.styleSheet.cssText = css;
} else {
while(styleElement.firstChild) {
styleElement.removeChild(styleElement.firstChild);
}
styleElement.appendChild(document.createTextNode(css));
}
}
/***/ },
/* 6 */
/***/ function(module, exports, __webpack_require__) {
__webpack_require__(7)(__webpack_require__(8))
/***/ },
/* 7 */
/***/ function(module, exports) {
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
module.exports = function(src) {
if (typeof execScript === "function")
execScript(src);
else
eval.call(null, src);
}
/***/ },
/* 8 */
/***/ function(module, exports) {
module.exports = ";(function(){\n\n// CommonJS require()\n\nfunction require(p){\n var path = require.resolve(p)\n , mod = require.modules[path];\n if (!mod) throw new Error('failed to require \"' + p + '\"');\n if (!mod.exports) {\n mod.exports = {};\n mod.call(mod.exports, mod, mod.exports, require.relative(path));\n }\n return mod.exports;\n }\n\nrequire.modules = {};\n\nrequire.resolve = function (path){\n var orig = path\n , reg = path + '.js'\n , index = path + '/index.js';\n return require.modules[reg] && reg\n || require.modules[index] && index\n || orig;\n };\n\nrequire.register = function (path, fn){\n require.modules[path] = fn;\n };\n\nrequire.relative = function (parent) {\n return function(p){\n if ('.' != p.charAt(0)) return require(p);\n\n var path = parent.split('/')\n , segs = p.split('/');\n path.pop();\n\n for (var i = 0; i < segs.length; i++) {\n var seg = segs[i];\n if ('..' == seg) path.pop();\n else if ('.' != seg) path.push(seg);\n }\n\n return require(path.join('/'));\n };\n };\n\n\nrequire.register(\"browser/debug.js\", function(module, exports, require){\nmodule.exports = function(type){\n return function(){\n }\n};\n\n}); // module: browser/debug.js\n\nrequire.register(\"browser/diff.js\", function(module, exports, require){\n/* See LICENSE file for terms of use */\n\n/*\n * Text diff implementation.\n *\n * This library supports the following APIS:\n * JsDiff.diffChars: Character by character diff\n * JsDiff.diffWords: Word (as defined by \\b regex) diff which ignores whitespace\n * JsDiff.diffLines: Line based diff\n *\n * JsDiff.diffCss: Diff targeted at CSS content\n *\n * These methods are based on the implementation proposed in\n * \"An O(ND) Difference Algorithm and its Variations\" (Myers, 1986).\n * http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.4.6927\n */\nvar JsDiff = (function() {\n /*jshint maxparams: 5*/\n function clonePath(path) {\n return { newPos: path.newPos, components: path.components.slice(0) };\n }\n function removeEmpty(array) {\n var ret = [];\n for (var i = 0; i < array.length; i++) {\n if (array[i]) {\n ret.push(array[i]);\n }\n }\n return ret;\n }\n function escapeHTML(s) {\n var n = s;\n n = n.replace(/&/g, '&');\n n = n.replace(/</g, '<');\n n = n.replace(/>/g, '>');\n n = n.replace(/\"/g, '"');\n\n return n;\n }\n\n var Diff = function(ignoreWhitespace) {\n this.ignoreWhitespace = ignoreWhitespace;\n };\n Diff.prototype = {\n diff: function(oldString, newString) {\n // Handle the identity case (this is due to unrolling editLength == 0\n if (newString === oldString) {\n return [{ value: newString }];\n }\n if (!newString) {\n return [{ value: oldString, removed: true }];\n }\n if (!oldString) {\n return [{ value: newString, added: true }];\n }\n\n newString = this.tokenize(newString);\n oldString = this.tokenize(oldString);\n\n var newLen = newString.length, oldLen = oldString.length;\n var maxEditLength = newLen + oldLen;\n var bestPath = [{ newPos: -1, components: [] }];\n\n // Seed editLength = 0\n var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0);\n if (bestPath[0].newPos+1 >= newLen && oldPos+1 >= oldLen) {\n return bestPath[0].components;\n }\n\n for (var editLength = 1; editLength <= maxEditLength; editLength++) {\n for (var diagonalPath = -1*editLength; diagonalPath <= editLength; diagonalPath+=2) {\n var basePath;\n var addPath = bestPath[diagonalPath-1],\n removePath = bestPath[diagonalPath+1];\n oldPos = (removePath ? removePath.newPos : 0) - diagonalPath;\n if (addPath) {\n // No one else is going to attempt to use this value, clear it\n bestPath[diagonalPath-1] = undefined;\n }\n\n var canAdd = addPath && addPath.newPos+1 < newLen;\n var canRemove = removePath && 0 <= oldPos && oldPos < oldLen;\n if (!canAdd && !canRemove) {\n bestPath[diagonalPath] = undefined;\n continue;\n }\n\n // Select the diagonal that we want to branch from. We select the prior\n // path whose position in the new string is the farthest from the origin\n // and does not pass the bounds of the diff graph\n if (!canAdd || (canRemove && addPath.newPos < removePath.newPos)) {\n basePath = clonePath(removePath);\n this.pushComponent(basePath.components, oldString[oldPos], undefined, true);\n } else {\n basePath = clonePath(addPath);\n basePath.newPos++;\n this.pushComponent(basePath.components, newString[basePath.newPos], true, undefined);\n }\n\n var oldPos = this.extractCommon(basePath, newString, oldString, diagonalPath);\n\n if (basePath.newPos+1 >= newLen && oldPos+1 >= oldLen) {\n return basePath.components;\n } else {\n bestPath[diagonalPath] = basePath;\n }\n }\n }\n },\n\n pushComponent: function(components, value, added, removed) {\n var last = components[components.length-1];\n if (last && last.added === added && last.removed === removed) {\n // We need to clone here as the component clone operation is just\n // as shallow array clone\n components[components.length-1] =\n {value: this.join(last.value, value), added: added, removed: removed };\n } else {\n components.push({value: value, added: added, removed: removed });\n }\n },\n extractCommon: function(basePath, newString, oldString, diagonalPath) {\n var newLen = newString.length,\n oldLen = oldString.length,\n newPos = basePath.newPos,\n oldPos = newPos - diagonalPath;\n while (newPos+1 < newLen && oldPos+1 < oldLen && this.equals(newString[newPos+1], oldString[oldPos+1])) {\n newPos++;\n oldPos++;\n\n this.pushComponent(basePath.components, newString[newPos], undefined, undefined);\n }\n basePath.newPos = newPos;\n return oldPos;\n },\n\n equals: function(left, right) {\n var reWhitespace = /\\S/;\n if (this.ignoreWhitespace && !reWhitespace.test(left) && !reWhitespace.test(right)) {\n return true;\n } else {\n return left === right;\n }\n },\n join: function(left, right) {\n return left + right;\n },\n tokenize: function(value) {\n return value;\n }\n };\n\n var CharDiff = new Diff();\n\n var WordDiff = new Diff(true);\n var WordWithSpaceDiff = new Diff();\n WordDiff.tokenize = WordWithSpaceDiff.tokenize = function(value) {\n return removeEmpty(value.split(/(\\s+|\\b)/));\n };\n\n var CssDiff = new Diff(true);\n CssDiff.tokenize = function(value) {\n return removeEmpty(value.split(/([{}:;,]|\\s+)/));\n };\n\n var LineDiff = new Diff();\n LineDiff.tokenize = function(value) {\n var retLines = [],\n lines = value.split(/^/m);\n\n for(var i = 0; i < lines.length; i++) {\n var line = lines[i],\n lastLine = lines[i - 1];\n\n // Merge lines that may contain windows new lines\n if (line == '\\n' && lastLine && lastLine[lastLine.length - 1] === '\\r') {\n retLines[retLines.length - 1] += '\\n';\n } else if (line) {\n retLines.push(line);\n }\n }\n\n return retLines;\n };\n\n return {\n Diff: Diff,\n\n diffChars: function(oldStr, newStr) { return CharDiff.diff(oldStr, newStr); },\n diffWords: function(oldStr, newStr) { return WordDiff.diff(oldStr, newStr); },\n diffWordsWithSpace: function(oldStr, newStr) { return WordWithSpaceDiff.diff(oldStr, newStr); },\n diffLines: function(oldStr, newStr) { return LineDiff.diff(oldStr, newStr); },\n\n diffCss: function(oldStr, newStr) { return CssDiff.diff(oldStr, newStr); },\n\n createPatch: function(fileName, oldStr, newStr, oldHeader, newHeader) {\n var ret = [];\n\n ret.push('Index: ' + fileName);\n ret.push('===================================================================');\n ret.push('--- ' + fileName + (typeof oldHeader === 'undefined' ? '' : '\\t' + oldHeader));\n ret.push('+++ ' + fileName + (typeof newHeader === 'undefined' ? '' : '\\t' + newHeader));\n\n var diff = LineDiff.diff(oldStr, newStr);\n if (!diff[diff.length-1].value) {\n diff.pop(); // Remove trailing newline add\n }\n diff.push({value: '', lines: []}); // Append an empty value to make cleanup easier\n\n function contextLines(lines) {\n return lines.map(function(entry) { return ' ' + entry; });\n }\n function eofNL(curRange, i, current) {\n var last = diff[diff.length-2],\n isLast = i === diff.length-2,\n isLastOfType = i === diff.length-3 && (current.added !== last.added || current.removed !== last.removed);\n\n // Figure out if this is the last line for the given file and missing NL\n if (!/\\n$/.test(current.value) && (isLast || isLastOfType)) {\n curRange.push('\\\\ No newline at end of file');\n }\n }\n\n var oldRangeStart = 0, newRangeStart = 0, curRange = [],\n oldLine = 1, newLine = 1;\n for (var i = 0; i < diff.length; i++) {\n var current = diff[i],\n lines = current.lines || current.value.replace(/\\n$/, '').split('\\n');\n current.lines = lines;\n\n if (current.added || current.removed) {\n if (!oldRangeStart) {\n var prev = diff[i-1];\n oldRangeStart = oldLine;\n newRangeStart = newLine;\n\n if (prev) {\n curRange = contextLines(prev.lines.slice(-4));\n oldRangeStart -= curRange.length;\n newRangeStart -= curRange.length;\n }\n }\n curRange.push.apply(curRange, lines.map(function(entry) { return (current.added?'+':'-') + entry; }));\n eofNL(curRange, i, current);\n\n if (current.added) {\n newLine += lines.length;\n } else {\n oldLine += lines.length;\n }\n } else {\n if (oldRangeStart) {\n // Close out any changes that have been output (or join overlapping)\n if (lines.length <= 8 && i < diff.length-2) {\n // Overlapping\n curRange.push.apply(curRange, contextLines(lines));\n } else {\n // end the range and output\n var contextSize = Math.min(lines.length, 4);\n ret.push(\n '@@ -' + oldRangeStart + ',' + (oldLine-oldRangeStart+contextSize)\n + ' +' + newRangeStart + ',' + (newLine-newRangeStart+contextSize)\n + ' @@');\n ret.push.apply(ret, curRange);\n ret.push.apply(ret, contextLines(lines.slice(0, contextSize)));\n if (lines.length <= 4) {\n eofNL(ret, i, current);\n }\n\n oldRangeStart = 0; newRangeStart = 0; curRange = [];\n }\n }\n oldLine += lines.length;\n newLine += lines.length;\n }\n }\n\n return ret.join('\\n') + '\\n';\n },\n\n applyPatch: function(oldStr, uniDiff) {\n var diffstr = uniDiff.split('\\n');\n var diff = [];\n var remEOFNL = false,\n addEOFNL = false;\n\n for (var i = (diffstr[0][0]==='I'?4:0); i < diffstr.length; i++) {\n if(diffstr[i][0] === '@') {\n var meh = diffstr[i].split(/@@ -(\\d+),(\\d+) \\+(\\d+),(\\d+) @@/);\n diff.unshift({\n start:meh[3],\n oldlength:meh[2],\n oldlines:[],\n newlength:meh[4],\n newlines:[]\n });\n } else if(diffstr[i][0] === '+') {\n diff[0].newlines.push(diffstr[i].substr(1));\n } else if(diffstr[i][0] === '-') {\n diff[0].oldlines.push(diffstr[i].substr(1));\n } else if(diffstr[i][0] === ' ') {\n diff[0].newlines.push(diffstr[i].substr(1));\n diff[0].oldlines.push(diffstr[i].substr(1));\n } else if(diffstr[i][0] === '\\\\') {\n if (diffstr[i-1][0] === '+') {\n remEOFNL = true;\n } else if(diffstr[i-1][0] === '-') {\n addEOFNL = true;\n }\n }\n }\n\n var str = oldStr.split('\\n');\n for (var i = diff.length - 1; i >= 0; i--) {\n var d = diff[i];\n for (var j = 0; j < d.oldlength; j++) {\n if(str[d.start-1+j] !== d.oldlines[j]) {\n return false;\n }\n }\n Array.prototype.splice.apply(str,[d.start-1,+d.oldlength].concat(d.newlines));\n }\n\n if (remEOFNL) {\n while (!str[str.length-1]) {\n str.pop();\n }\n } else if (addEOFNL) {\n str.push('');\n }\n return str.join('\\n');\n },\n\n convertChangesToXML: function(changes){\n var ret = [];\n for ( var i = 0; i < changes.length; i++) {\n var change = changes[i];\n if (change.added) {\n ret.push('<ins>');\n } else if (change.removed) {\n ret.push('<del>');\n }\n\n ret.push(escapeHTML(change.value));\n\n if (change.added) {\n ret.push('</ins>');\n } else if (change.removed) {\n ret.push('</del>');\n }\n }\n return ret.join('');\n },\n\n // See: http://code.google.com/p/google-diff-match-patch/wiki/API\n convertChangesToDMP: function(changes){\n var ret = [], change;\n for ( var i = 0; i < changes.length; i++) {\n change = changes[i];\n ret.push([(change.added ? 1 : change.removed ? -1 : 0), change.value]);\n }\n return ret;\n }\n };\n})();\n\nif (typeof module !== 'undefined') {\n module.exports = JsDiff;\n}\n\n}); // module: browser/diff.js\n\nrequire.register(\"browser/escape-string-regexp.js\", function(module, exports, require){\n'use strict';\n\nvar matchOperatorsRe = /[|\\\\{}()[\\]^$+*?.]/g;\n\nmodule.exports = function (str) {\n if (typeof str !== 'string') {\n throw new TypeError('Expected a string');\n }\n\n return str.replace(matchOperatorsRe, '\\\\$&');\n};\n\n}); // module: browser/escape-string-regexp.js\n\nrequire.register(\"browser/events.js\", function(module, exports, require){\n/**\n * Module exports.\n */\n\nexports.EventEmitter = EventEmitter;\n\n/**\n * Check if `obj` is an array.\n */\n\nfunction isArray(obj) {\n return '[object Array]' == {}.toString.call(obj);\n}\n\n/**\n * Event emitter constructor.\n *\n * @api public\n */\n\nfunction EventEmitter(){};\n\n/**\n * Adds a listener.\n *\n * @api public\n */\n\nEventEmitter.prototype.on = function (name, fn) {\n if (!this.$events) {\n this.$events = {};\n }\n\n if (!this.$events[name]) {\n this.$events[name] = fn;\n } else if (isArray(this.$events[name])) {\n this.$events[name].push(fn);\n } else {\n this.$events[name] = [this.$events[name], fn];\n }\n\n return this;\n};\n\nEventEmitter.prototype.addListener = EventEmitter.prototype.on;\n\n/**\n * Adds a volatile listener.\n *\n * @api public\n */\n\nEventEmitter.prototype.once = function (name, fn) {\n var self = this;\n\n function on () {\n self.removeListener(name, on);\n fn.apply(this, arguments);\n };\n\n on.listener = fn;\n this.on(name, on);\n\n return this;\n};\n\n/**\n * Removes a listener.\n *\n * @api public\n */\n\nEventEmitter.prototype.removeListener = function (name, fn) {\n if (this.$events && this.$events[name]) {\n var list = this.$events[name];\n\n if (isArray(list)) {\n var pos = -1;\n\n for (var i = 0, l = list.length; i < l; i++) {\n if (list[i] === fn || (list[i].listener && list[i].listener === fn)) {\n pos = i;\n break;\n }\n }\n\n if (pos < 0) {\n return this;\n }\n\n list.splice(pos, 1);\n\n if (!list.length) {\n delete this.$events[name];\n }\n } else if (list === fn || (list.listener && list.listener === fn)) {\n delete this.$events[name];\n }\n }\n\n return this;\n};\n\n/**\n * Removes all listeners for an event.\n *\n * @api public\n */\n\nEventEmitter.prototype.removeAllListeners = function (name) {\n if (name === undefined) {\n this.$events = {};\n return this;\n }\n\n if (this.$events && this.$events[name]) {\n this.$events[name] = null;\n }\n\n return this;\n};\n\n/**\n * Gets all listeners for a certain event.\n *\n * @api public\n */\n\nEventEmitter.prototype.listeners = function (name) {\n if (!this.$events) {\n this.$events = {};\n }\n\n if (!this.$events[name]) {\n this.$events[name] = [];\n }\n\n if (!isArray(this.$events[name])) {\n this.$events[name] = [this.$events[name]];\n }\n\n return this.$events[name];\n};\n\n/**\n * Emits an event.\n *\n * @api public\n */\n\nEventEmitter.prototype.emit = function (name) {\n if (!this.$events) {\n return false;\n }\n\n var handler = this.$events[name];\n\n if (!handler) {\n return false;\n }\n\n var args = [].slice.call(arguments, 1);\n\n if ('function' == typeof handler) {\n handler.apply(this, args);\n } else if (isArray(handler)) {\n var listeners = handler.slice();\n\n for (var i = 0, l = listeners.length; i < l; i++) {\n listeners[i].apply(this, args);\n }\n } else {\n return false;\n }\n\n return true;\n};\n\n}); // module: browser/events.js\n\nrequire.register(\"browser/fs.js\", function(module, exports, require){\n\n}); // module: browser/fs.js\n\nrequire.register(\"browser/glob.js\", function(module, exports, require){\n\n}); // module: browser/glob.js\n\nrequire.register(\"browser/path.js\", function(module, exports, require){\n\n}); // module: browser/path.js\n\nrequire.register(\"browser/progress.js\", function(module, exports, require){\n/**\n * Expose `Progress`.\n */\n\nmodule.exports = Progress;\n\n/**\n * Initialize a new `Progress` indicator.\n */\n\nfunction Progress() {\n this.percent = 0;\n this.size(0);\n this.fontSize(11);\n this.font('helvetica, arial, sans-serif');\n}\n\n/**\n * Set progress size to `n`.\n *\n * @param {Number} n\n * @return {Progress} for chaining\n * @api public\n */\n\nProgress.prototype.size = function(n){\n this._size = n;\n return this;\n};\n\n/**\n * Set text to `str`.\n *\n * @param {String} str\n * @return {Progress} for chaining\n * @api public\n */\n\nProgress.prototype.text = function(str){\n this._text = str;\n return this;\n};\n\n/**\n * Set font size to `n`.\n *\n * @param {Number} n\n * @return {Progress} for chaining\n * @api public\n */\n\nProgress.prototype.fontSize = function(n){\n this._fontSize = n;\n return this;\n};\n\n/**\n * Set font `family`.\n *\n * @param {String} family\n * @return {Progress} for chaining\n */\n\nProgress.prototype.font = function(family){\n this._font = family;\n return this;\n};\n\n/**\n * Update percentage to `n`.\n *\n * @param {Number} n\n * @return {Progress} for chaining\n */\n\nProgress.prototype.update = function(n){\n this.percent = n;\n return this;\n};\n\n/**\n * Draw on `ctx`.\n *\n * @param {CanvasRenderingContext2d} ctx\n * @return {Progress} for chaining\n */\n\nProgress.prototype.draw = function(ctx){\n try {\n var percent = Math.min(this.percent, 100)\n , size = this._size\n , half = size / 2\n , x = half\n , y = half\n , rad = half - 1\n , fontSize = this._fontSize;\n\n ctx.font = fontSize + 'px ' + this._font;\n\n var angle = Math.PI * 2 * (percent / 100);\n ctx.clearRect(0, 0, size, size);\n\n // outer circle\n ctx.strokeStyle = '#9f9f9f';\n ctx.beginPath();\n ctx.arc(x, y, rad, 0, angle, false);\n ctx.stroke();\n\n // inner circle\n ctx.strokeStyle = '#eee';\n ctx.beginPath();\n ctx.arc(x, y, rad - 1, 0, angle, true);\n ctx.stroke();\n\n // text\n var text = this._text || (percent | 0) + '%'\n , w = ctx.measureText(text).width;\n\n ctx.fillText(\n text\n , x - w / 2 + 1\n , y + fontSize / 2 - 1);\n } catch (ex) {} //don't fail if we can't render progress\n return this;\n};\n\n}); // module: browser/progress.js\n\nrequire.register(\"browser/tty.js\", function(module, exports, require){\nexports.isatty = function(){\n return true;\n};\n\nexports.getWindowSize = function(){\n if ('innerHeight' in global) {\n return [global.innerHeight, global.innerWidth];\n } else {\n // In a Web Worker, the DOM Window is not available.\n return [640, 480];\n }\n};\n\n}); // module: browser/tty.js\n\nrequire.register(\"context.js\", function(module, exports, require){\n/**\n * Expose `Context`.\n */\n\nmodule.exports = Context;\n\n/**\n * Initialize a new `Context`.\n *\n * @api private\n */\n\nfunction Context(){}\n\n/**\n * Set or get the context `Runnable` to `runnable`.\n *\n * @param {Runnable} runnable\n * @return {Context}\n * @api private\n */\n\nContext.prototype.runnable = function(runnable){\n if (0 == arguments.length) return this._runnable;\n this.test = this._runnable = runnable;\n return this;\n};\n\n/**\n * Set test timeout `ms`.\n *\n * @param {Number} ms\n * @return {Context} self\n * @api private\n */\n\nContext.prototype.timeout = function(ms){\n if (arguments.length === 0) return this.runnable().timeout();\n this.runnable().timeout(ms);\n return this;\n};\n\n/**\n * Set test timeout `enabled`.\n *\n * @param {Boolean} enabled\n * @return {Context} self\n * @api private\n */\n\nContext.prototype.enableTimeouts = function (enabled) {\n this.runnable().enableTimeouts(enabled);\n return this;\n};\n\n\n/**\n * Set test slowness threshold `ms`.\n *\n * @param {Number} ms\n * @return {Context} self\n * @api private\n */\n\nContext.prototype.slow = function(ms){\n this.runnable().slow(ms);\n return this;\n};\n\n/**\n * Mark a test as skipped.\n *\n * @return {Context} self\n * @api private\n */\n\nContext.prototype.skip = function(){\n this.runnable().skip();\n return this;\n};\n\n/**\n * Inspect the context void of `._runnable`.\n *\n * @return {String}\n * @api private\n */\n\nContext.prototype.inspect = function(){\n return JSON.stringify(this, function(key, val){\n if ('_runnable' == key) return;\n if ('test' == key) return;\n return val;\n }, 2);\n};\n\n}); // module: context.js\n\nrequire.register(\"hook.js\", function(module, exports, require){\n/**\n * Module dependencies.\n */\n\nvar Runnable = require('./runnable');\n\n/**\n * Expose `Hook`.\n */\n\nmodule.exports = Hook;\n\n/**\n * Initialize a new `Hook` with the given `title` and callback `fn`.\n *\n * @param {String} title\n * @param {Function} fn\n * @api private\n */\n\nfunction Hook(title, fn) {\n Runnable.call(this, title, fn);\n this.type = 'hook';\n}\n\n/**\n * Inherit from `Runnable.prototype`.\n */\n\nfunction F(){};\nF.prototype = Runnable.prototype;\nHook.prototype = new F;\nHook.prototype.constructor = Hook;\n\n\n/**\n * Get or set the test `err`.\n *\n * @param {Error} err\n * @return {Error}\n * @api public\n */\n\nHook.prototype.error = function(err){\n if (0 == arguments.length) {\n var err = this._error;\n this._error = null;\n return err;\n }\n\n this._error = err;\n};\n\n}); // module: hook.js\n\nrequire.register(\"interfaces/bdd.js\", function(module, exports, require){\n/**\n * Module dependencies.\n */\n\nvar Suite = require('../suite')\n , Test = require('../test')\n , utils = require('../utils')\n , escapeRe = require('browser/escape-string-regexp');\n\n/**\n * BDD-style interface:\n *\n * describe('Array', function(){\n * describe('#indexOf()', function(){\n * it('should return -1 when not present', function(){\n *\n * });\n *\n * it('should return the index when present', function(){\n *\n * });\n * });\n * });\n *\n */\n\nmodule.exports = function(suite){\n var suites = [suite];\n\n suite.on('pre-require', function(context, file, mocha){\n\n var common = require('./common')(suites, context);\n\n context.before = common.before;\n context.after = common.after;\n context.beforeEach = common.beforeEach;\n context.afterEach = common.afterEach;\n context.run = mocha.options.delay && common.runWithSuite(suite);\n /**\n * Describe a \"suite\" with the given `title`\n * and callback `fn` containing nested suites\n * and/or tests.\n */\n\n context.describe = context.context = function(title, fn){\n var suite = Suite.create(suites[0], title);\n suite.file = file;\n suites.unshift(suite);\n fn.call(suite);\n suites.shift();\n return suite;\n };\n\n /**\n * Pending describe.\n */\n\n context.xdescribe =\n context.xcontext =\n context.describe.skip = function(title, fn){\n var suite = Suite.create(suites[0], title);\n suite.pending = true;\n suites.unshift(suite);\n fn.call(suite);\n suites.shift();\n };\n\n /**\n * Exclusive suite.\n */\n\n context.describe.only = function(title, fn){\n var suite = context.describe(title, fn);\n mocha.grep(suite.fullTitle());\n return suite;\n };\n\n /**\n * Describe a specification or test-case\n * with the given `title` and callback `fn`\n * acting as a thunk.\n */\n\n context.it = context.specify = function(title, fn){\n var suite = suites[0];\n if (suite.pending) fn = null;\n var test = new Test(title, fn);\n test.file = file;\n suite.addTest(test);\n return test;\n };\n\n /**\n * Exclusive test-case.\n */\n\n context.it.only = function(title, fn){\n var test = context.it(title, fn);\n var reString = '^' + escapeRe(test.fullTitle()) + '$';\n mocha.grep(new RegExp(reString));\n return test;\n };\n\n /**\n * Pending test case.\n */\n\n context.xit =\n context.xspecify =\n context.it.skip = function(title){\n context.it(title);\n };\n\n });\n};\n\n}); // module: interfaces/bdd.js\n\nrequire.register(\"interfaces/common.js\", function(module, exports, require){\n/**\n * Functions common to more than one interface\n * @module lib/interfaces/common\n */\n\n'use strict';\n\nmodule.exports = function (suites, context) {\n\n return {\n /**\n * This is only present if flag --delay is passed into Mocha. It triggers\n * root suite execution. Returns a function which runs the root suite.\n */\n runWithSuite: function runWithSuite(suite) {\n return function run() {\n suite.run();\n };\n },\n\n /**\n * Execute before running tests.\n */\n before: function (name, fn) {\n suites[0].beforeAll(name, fn);\n },\n\n /**\n * Execute after running tests.\n */\n after: function (name, fn) {\n suites[0].afterAll(name, fn);\n },\n\n /**\n * Execute before each test case.\n */\n beforeEach: function (name, fn) {\n suites[0].beforeEach(name, fn);\n },\n\n /**\n * Execute after each test case.\n */\n afterEach: function (name, fn) {\n suites[0].afterEach(name, fn);\n },\n\n test: {\n /**\n * Pending test case.\n */\n skip: function (title) {\n context.test(title);\n }\n }\n }\n};\n\n}); // module: interfaces/common.js\n\nrequire.register(\"interfaces/exports.js\", function(module, exports, require){\n/**\n * Module dependencies.\n */\n\nvar Suite = require('../suite')\n , Test = require('../test');\n\n/**\n * TDD-style interface:\n *\n * exports.Array = {\n * '#indexOf()': {\n * 'should return -1 when the value is not present': function(){\n *\n * },\n *\n * 'should return the correct index when the value is present': function(){\n *\n * }\n * }\n * };\n *\n */\n\nmodule.exports = function(suite){\n var suites = [suite];\n\n suite.on('require', visit);\n\n function visit(obj, file) {\n var suite;\n for (var key in obj) {\n if ('function' == typeof obj[key]) {\n var fn = obj[key];\n switch (key) {\n case 'before':\n suites[0].beforeAll(fn);\n break;\n case 'after':\n suites[0].afterAll(fn);\n break;\n case 'beforeEach':\n suites[0].beforeEach(fn);\n break;\n case 'afterEach':\n suites[0].afterEach(fn);\n break;\n default:\n var test = new Test(key, fn);\n test.file = file;\n suites[0].addTest(test);\n }\n } else {\n suite = Suite.create(suites[0], key);\n suites.unshift(suite);\n visit(obj[key]);\n suites.shift();\n }\n }\n }\n};\n\n}); // module: interfaces/exports.js\n\nrequire.register(\"interfaces/index.js\", function(module, exports, require){\nexports.bdd = require('./bdd');\nexports.tdd = require('./tdd');\nexports.qunit = require('./qunit');\nexports.exports = require('./exports');\n\n}); // module: interfaces/index.js\n\nrequire.register(\"interfaces/qunit.js\", function(module, exports, require){\n/**\n * Module dependencies.\n */\n\nvar Suite = require('../suite')\n , Test = require('../test')\n , escapeRe = require('browser/escape-string-regexp')\n , utils = require('../utils');\n\n/**\n * QUnit-style interface:\n *\n * suite('Array');\n *\n * test('#length', function(){\n * var arr = [1,2,3];\n * ok(arr.length == 3);\n * });\n *\n * test('#indexOf()', function(){\n * var arr = [1,2,3];\n * ok(arr.indexOf(1) == 0);\n * ok(arr.indexOf(2) == 1);\n * ok(arr.indexOf(3) == 2);\n * });\n *\n * suite('String');\n *\n * test('#length', function(){\n * ok('foo'.length == 3);\n * });\n *\n */\n\nmodule.exports = function(suite){\n var suites = [suite];\n\n suite.on('pre-require', function(context, file, mocha){\n\n var common = require('./common')(suites, context);\n\n context.before = common.before;\n context.after = common.after;\n context.beforeEach = common.beforeEach;\n context.afterEach = common.afterEach;\n context.run = mocha.options.delay && common.runWithSuite(suite);\n /**\n * Describe a \"suite\" with the given `title`.\n */\n\n context.suite = function(title){\n if (suites.length > 1) suites.shift();\n var suite = Suite.create(suites[0], title);\n suite.file = file;\n suites.unshift(suite);\n return suite;\n };\n\n /**\n * Exclusive test-case.\n */\n\n context.suite.only = function(title, fn){\n var suite = context.suite(title, fn);\n mocha.grep(suite.fullTitle());\n };\n\n /**\n * Describe a specification or test-case\n * with the given `title` and callback `fn`\n * acting as a thunk.\n */\n\n context.test = function(title, fn){\n var test = new Test(title, fn);\n test.file = file;\n suites[0].addTest(test);\n return test;\n };\n\n /**\n * Exclusive test-case.\n */\n\n context.test.only = function(title, fn){\n var test = context.test(title, fn);\n var reString = '^' + escapeRe(test.fullTitle()) + '$';\n mocha.grep(new RegExp(reString));\n };\n\n context.test.skip = common.test.skip;\n\n });\n};\n\n}); // module: interfaces/qunit.js\n\nrequire.register(\"interfaces/tdd.js\", function(module, exports, require){\n/**\n * Module dependencies.\n */\n\nvar Suite = require('../suite')\n , Test = require('../test')\n , escapeRe = require('browser/escape-string-regexp')\n , utils = require('../utils');\n\n/**\n * TDD-style interface:\n *\n * suite('Array', function(){\n * suite('#indexOf()', function(){\n * suiteSetup(function(){\n *\n * });\n *\n * test('should return -1 when not present', function(){\n *\n * });\n *\n * test('should return the index when present', function(){\n *\n * });\n *\n * suiteTeardown(function(){\n *\n * });\n * });\n * });\n *\n */\n\nmodule.exports = function(suite){\n var suites = [suite];\n\n suite.on('pre-require', function(context, file, mocha){\n\n var common = require('./common')(suites, context);\n\n context.setup = common.beforeEach;\n context.teardown = common.afterEach;\n context.suiteSetup = common.before;\n context.suiteTeardown = common.after;\n context.run = mocha.options.delay && common.runWithSuite(suite);\n /**\n * Describe a \"suite\" with the given `title`\n * and callback `fn` containing nested suites\n * and/or tests.\n */\n\n context.suite = function(title, fn){\n var suite = Suite.create(suites[0], title);\n suite.file = file;\n suites.unshift(suite);\n fn.call(suite);\n suites.shift();\n return suite;\n };\n\n /**\n * Pending suite.\n */\n context.suite.skip = function(title, fn) {\n var suite = Suite.create(suites[0], title);\n suite.pending = true;\n suites.unshift(suite);\n fn.call(suite);\n suites.shift();\n };\n\n /**\n * Exclusive test-case.\n */\n\n context.suite.only = function(title, fn){\n var suite = context.suite(title, fn);\n mocha.grep(suite.fullTitle());\n };\n\n /**\n * Describe a specification or test-case\n * with the given `title` and callback `fn`\n * acting as a thunk.\n */\n\n context.test = function(title, fn){\n var suite = suites[0];\n if (suite.pending) fn = null;\n var test = new Test(title, fn);\n test.file = file;\n suite.addTest(test);\n return test;\n };\n\n /**\n * Exclusive test-case.\n */\n\n context.test.only = function(title, fn){\n var test = context.test(title, fn);\n var reString = '^' + escapeRe(test.fullTitle()) + '$';\n mocha.grep(new RegExp(reString));\n };\n\n context.test.skip = common.test.skip;\n });\n};\n\n}); // module: interfaces/tdd.js\n\nrequire.register(\"mocha.js\", function(module, exports, require){\n/*!\n * mocha\n * Copyright(c) 2011 TJ Holowaychuk <[email protected]>\n * MIT Licensed\n */\n\n/**\n * Module dependencies.\n */\n\nvar path = require('browser/path')\n , escapeRe = require('browser/escape-string-regexp')\n , utils = require('./utils');\n\n/**\n * Expose `Mocha`.\n */\n\nexports = module.exports = Mocha;\n\n/**\n * To require local UIs and reporters when running in node.\n */\n\nif (typeof process !== 'undefined' && typeof process.cwd === 'function') {\n var join = path.join\n , cwd = process.cwd();\n module.paths.push(cwd, join(cwd, 'node_modules'));\n}\n\n/**\n * Expose internals.\n */\n\nexports.utils = utils;\nexports.interfaces = require('./interfaces');\nexports.reporters = require('./reporters');\nexports.Runnable = require('./runnable');\nexports.Context = require('./context');\nexports.Runner = require('./runner');\nexports.Suite = require('./suite');\nexports.Hook = require('./hook');\nexports.Test = require('./test');\n\n/**\n * Return image `name` path.\n *\n * @param {String} name\n * @return {String}\n * @api private\n */\n\nfunction image(name) {\n return __dirname + '/../images/' + name + '.png';\n}\n\n/**\n * Setup mocha with `options`.\n *\n * Options:\n *\n * - `ui` name \"bdd\", \"tdd\", \"exports\" etc\n * - `reporter` reporter instance, defaults to `mocha.reporters.spec`\n * - `globals` array of accepted globals\n * - `timeout` timeout in milliseconds\n * - `bail` bail on the first test failure\n * - `slow` milliseconds to wait before considering a test slow\n * - `ignoreLeaks` ignore global leaks\n * - `fullTrace` display the full stack-trace on failing\n * - `grep` string or regexp to filter tests with\n *\n * @param {Object} options\n * @api public\n */\n\nfunction Mocha(options) {\n options = options || {};\n this.files = [];\n this.options = options;\n if (options.grep) this.grep(new RegExp(options.grep));\n if (options.fgrep) this.grep(options.fgrep);\n this.suite = new exports.Suite('', new exports.Context);\n this.ui(options.ui);\n this.bail(options.bail);\n this.reporter(options.reporter, options.reporterOptions);\n if (null != options.timeout) this.timeout(options.timeout);\n this.useColors(options.useColors);\n if (options.enableTimeouts !== null) this.enableTimeouts(options.enableTimeouts);\n if (options.slow) this.slow(options.slow);\n\n this.suite.on('pre-require', function (context) {\n exports.afterEach = context.afterEach || context.teardown;\n exports.after = context.after || context.suiteTeardown;\n exports.beforeEach = context.beforeEach || context.setup;\n exports.before = context.before || context.suiteSetup;\n exports.describe = context.describe || context.suite;\n exports.it = context.it || context.test;\n exports.setup = context.setup || context.beforeEach;\n exports.suiteSetup = context.suiteSetup || context.before;\n exports.suiteTeardown = context.suiteTeardown || context.after;\n exports.suite = context.suite || context.describe;\n exports.teardown = context.teardown || context.afterEach;\n exports.test = context.test || context.it;\n exports.run = context.run;\n });\n}\n\n/**\n * Enable or disable bailing on the first failure.\n *\n * @param {Boolean} [bail]\n * @api public\n */\n\nMocha.prototype.bail = function(bail){\n if (0 == arguments.length) bail = true;\n this.suite.bail(bail);\n return this;\n};\n\n/**\n * Add test `file`.\n *\n * @param {String} file\n * @api public\n */\n\nMocha.prototype.addFile = function(file){\n this.files.push(file);\n return this;\n};\n\n/**\n * Set reporter to `reporter`, defaults to \"spec\".\n *\n * @param {String|Function} reporter name or constructor\n * @param {Object} reporterOptions optional options\n * @api public\n */\nMocha.prototype.reporter = function(reporter, reporterOptions){\n if ('function' == typeof reporter) {\n this._reporter = reporter;\n } else {\n reporter = reporter || 'spec';\n var _reporter;\n try { _reporter = require('./reporters/' + reporter); } catch (err) {}\n if (!_reporter) try { _reporter = require(reporter); } catch (err) {\n err.message.indexOf('Cannot find module') !== -1\n ? console.warn('\"' + reporter + '\" reporter not found')\n : console.warn('\"' + reporter + '\" reporter blew up with error:\\n' + err.stack);\n }\n if (!_reporter && reporter === 'teamcity')\n console.warn('The Teamcity reporter was moved to a package named ' +\n 'mocha-teamcity-reporter ' +\n '(https://npmjs.org/package/mocha-teamcity-reporter).');\n if (!_reporter) throw new Error('invalid reporter \"' + reporter + '\"');\n this._reporter = _reporter;\n }\n this.options.reporterOptions = reporterOptions;\n return this;\n};\n\n/**\n * Set test UI `name`, defaults to \"bdd\".\n *\n * @param {String} bdd\n * @api public\n */\n\nMocha.prototype.ui = function(name){\n name = name || 'bdd';\n this._ui = exports.interfaces[name];\n if (!this._ui) try { this._ui = require(name); } catch (err) {}\n if (!this._ui) throw new Error('invalid interface \"' + name + '\"');\n this._ui = this._ui(this.suite);\n return this;\n};\n\n/**\n * Load registered files.\n *\n * @api private\n */\n\nMocha.prototype.loadFiles = function(fn){\n var self = this;\n var suite = this.suite;\n var pending = this.files.length;\n this.files.forEach(function(file){\n file = path.resolve(file);\n suite.emit('pre-require', global, file, self);\n suite.emit('require', require(file), file, self);\n suite.emit('post-require', global, file, self);\n --pending || (fn && fn());\n });\n};\n\n/**\n * Enable growl support.\n *\n * @api private\n */\n\nMocha.prototype._growl = function(runner, reporter) {\n var notify = require('growl');\n\n runner.on('end', function(){\n var stats = reporter.stats;\n if (stats.failures) {\n var msg = stats.failures + ' of ' + runner.total + ' tests failed';\n notify(msg, { name: 'mocha', title: 'Failed', image: image('error') });\n } else {\n notify(stats.passes + ' tests passed in ' + stats.duration + 'ms', {\n name: 'mocha'\n , title: 'Passed'\n , image: image('ok')\n });\n }\n });\n};\n\n/**\n * Add regexp to grep, if `re` is a string it is escaped.\n *\n * @param {RegExp|String} re\n * @return {Mocha}\n * @api public\n */\n\nMocha.prototype.grep = function(re){\n this.options.grep = 'string' == typeof re\n ? new RegExp(escapeRe(re))\n : re;\n return this;\n};\n\n/**\n * Invert `.grep()` matches.\n *\n * @return {Mocha}\n * @api public\n */\n\nMocha.prototype.invert = function(){\n this.options.invert = true;\n return this;\n};\n\n/**\n * Ignore global leaks.\n *\n * @param {Boolean} ignore\n * @return {Mocha}\n * @api public\n */\n\nMocha.prototype.ignoreLeaks = function(ignore){\n this.options.ignoreLeaks = !!ignore;\n return this;\n};\n\n/**\n * Enable global leak checking.\n *\n * @return {Mocha}\n * @api public\n */\n\nMocha.prototype.checkLeaks = function(){\n this.options.ignoreLeaks = false;\n return this;\n};\n\n/**\n * Display long stack-trace on failing\n *\n * @return {Mocha}\n * @api public\n */\n\nMocha.prototype.fullTrace = function() {\n this.options.fullStackTrace = true;\n return this;\n};\n\n/**\n * Enable growl support.\n *\n * @return {Mocha}\n * @api public\n */\n\nMocha.prototype.growl = function(){\n this.options.growl = true;\n return this;\n};\n\n/**\n * Ignore `globals` array or string.\n *\n * @param {Array|String} globals\n * @return {Mocha}\n * @api public\n */\n\nMocha.prototype.globals = function(globals){\n this.options.globals = (this.options.globals || []).concat(globals);\n return this;\n};\n\n/**\n * Emit color output.\n *\n * @param {Boolean} colors\n * @return {Mocha}\n * @api public\n */\n\nMocha.prototype.useColors = function(colors){\n if (colors !== undefined) {\n this.options.useColors = colors;\n }\n return this;\n};\n\n/**\n * Use inline diffs rather than +/-.\n *\n * @param {Boolean} inlineDiffs\n * @return {Mocha}\n * @api public\n */\n\nMocha.prototype.useInlineDiffs = function(inlineDiffs) {\n this.options.useInlineDiffs = arguments.length && inlineDiffs != undefined\n ? inlineDiffs\n : false;\n return this;\n};\n\n/**\n * Set the timeout in milliseconds.\n *\n * @param {Number} timeout\n * @return {Mocha}\n * @api public\n */\n\nMocha.prototype.timeout = function(timeout){\n this.suite.timeout(timeout);\n return this;\n};\n\n/**\n * Set slowness threshold in milliseconds.\n *\n * @param {Number} slow\n * @return {Mocha}\n * @api public\n */\n\nMocha.prototype.slow = function(slow){\n this.suite.slow(slow);\n return this;\n};\n\n/**\n * Enable timeouts.\n *\n * @param {Boolean} enabled\n * @return {Mocha}\n * @api public\n */\n\nMocha.prototype.enableTimeouts = function(enabled) {\n this.suite.enableTimeouts(arguments.length && enabled !== undefined\n ? enabled\n : true);\n return this\n};\n\n/**\n * Makes all tests async (accepting a callback)\n *\n * @return {Mocha}\n * @api public\n */\n\nMocha.prototype.asyncOnly = function(){\n this.options.asyncOnly = true;\n return this;\n};\n\n/**\n * Disable syntax highlighting (in browser).\n * @returns {Mocha}\n * @api public\n */\nMocha.prototype.noHighlighting = function() {\n this.options.noHighlighting = true;\n return this;\n};\n\n/**\n * Delay root suite execution.\n * @returns {Mocha}\n * @api public\n */\nMocha.prototype.delay = function delay() {\n this.options.delay = true;\n return this;\n};\n\n/**\n * Run tests and invoke `fn()` when complete.\n *\n * @param {Function} fn\n * @return {Runner}\n * @api public\n */\nMocha.prototype.run = function(fn){\n if (this.files.length) this.loadFiles();\n var suite = this.suite;\n var options = this.options;\n options.files = this.files;\n var runner = new exports.Runner(suite, options.delay);\n var reporter = new this._reporter(runner, options);\n runner.ignoreLeaks = false !== options.ignoreLeaks;\n runner.fullStackTrace = options.fullStackTrace;\n runner.asyncOnly = options.asyncOnly;\n if (options.grep) runner.grep(options.grep, options.invert);\n if (options.globals) runner.globals(options.globals);\n if (options.growl) this._growl(runner, reporter);\n if (options.useColors !== undefined) {\n exports.reporters.Base.useColors = options.useColors;\n }\n exports.reporters.Base.inlineDiffs = options.useInlineDiffs;\n\n function done(failures) {\n if (reporter.done) {\n reporter.done(failures, fn);\n } else fn && fn(failures);\n }\n\n return runner.run(done);\n};\n\n}); // module: mocha.js\n\nrequire.register(\"ms.js\", function(module, exports, require){\n/**\n * Helpers.\n */\n\nvar s = 1000;\nvar m = s * 60;\nvar h = m * 60;\nvar d = h * 24;\nvar y = d * 365.25;\n\n/**\n * Parse or format the given `val`.\n *\n * Options:\n *\n * - `long` verbose formatting [false]\n *\n * @param {String|Number} val\n * @param {Object} options\n * @return {String|Number}\n * @api public\n */\n\nmodule.exports = function(val, options){\n options = options || {};\n if ('string' == typeof val) return parse(val);\n return options['long'] ? longFormat(val) : shortFormat(val);\n};\n\n/**\n * Parse the given `str` and return milliseconds.\n *\n * @param {String} str\n * @return {Number}\n * @api private\n */\n\nfunction parse(str) {\n var match = /^((?:\\d+)?\\.?\\d+) *(ms|seconds?|s|minutes?|m|hours?|h|days?|d|years?|y)?$/i.exec(str);\n if (!match) return;\n var n = parseFloat(match[1]);\n var type = (match[2] || 'ms').toLowerCase();\n switch (type) {\n case 'years':\n case 'year':\n case 'y':\n return n * y;\n case 'days':\n case 'day':\n case 'd':\n return n * d;\n case 'hours':\n case 'hour':\n case 'h':\n return n * h;\n case 'minutes':\n case 'minute':\n case 'm':\n return n * m;\n case 'seconds':\n case 'second':\n case 's':\n return n * s;\n case 'ms':\n return n;\n }\n}\n\n/**\n * Short format for `ms`.\n *\n * @param {Number} ms\n * @return {String}\n * @api private\n */\n\nfunction shortFormat(ms) {\n if (ms >= d) return Math.round(ms / d) + 'd';\n if (ms >= h) return Math.round(ms / h) + 'h';\n if (ms >= m) return Math.round(ms / m) + 'm';\n if (ms >= s) return Math.round(ms / s) + 's';\n return ms + 'ms';\n}\n\n/**\n * Long format for `ms`.\n *\n * @param {Number} ms\n * @return {String}\n * @api private\n */\n\nfunction longFormat(ms) {\n return plural(ms, d, 'day')\n || plural(ms, h, 'hour')\n || plural(ms, m, 'minute')\n || plural(ms, s, 'second')\n || ms + ' ms';\n}\n\n/**\n * Pluralization helper.\n */\n\nfunction plural(ms, n, name) {\n if (ms < n) return;\n if (ms < n * 1.5) return Math.floor(ms / n) + ' ' + name;\n return Math.ceil(ms / n) + ' ' + name + 's';\n}\n\n}); // module: ms.js\n\nrequire.register(\"pending.js\", function(module, exports, require){\n\n/**\n * Expose `Pending`.\n */\n\nmodule.exports = Pending;\n\n/**\n * Initialize a new `Pending` error with the given message.\n *\n * @param {String} message\n */\n\nfunction Pending(message) {\n this.message = message;\n}\n\n}); // module: pending.js\n\nrequire.register(\"reporters/base.js\", function(module, exports, require){\n/**\n * Module dependencies.\n */\n\nvar tty = require('browser/tty')\n , diff = require('browser/diff')\n , ms = require('../ms')\n , utils = require('../utils')\n , supportsColor = process.env ? require('supports-color') : null;\n\n/**\n * Save timer references to avoid Sinon interfering (see GH-237).\n */\n\nvar Date = global.Date\n , setTimeout = global.setTimeout\n , setInterval = global.setInterval\n , clearTimeout = global.clearTimeout\n , clearInterval = global.clearInterval;\n\n/**\n * Check if both stdio streams are associated with a tty.\n */\n\nvar isatty = tty.isatty(1) && tty.isatty(2);\n\n/**\n * Expose `Base`.\n */\n\nexports = module.exports = Base;\n\n/**\n * Enable coloring by default, except in the browser interface.\n */\n\nexports.useColors = process.env\n ? (supportsColor || (process.env.MOCHA_COLORS !== undefined))\n : false;\n\n/**\n * Inline diffs instead of +/-\n */\n\nexports.inlineDiffs = false;\n\n/**\n * Default color map.\n */\n\nexports.colors = {\n 'pass': 90\n , 'fail': 31\n , 'bright pass': 92\n , 'bright fail': 91\n , 'bright yellow': 93\n , 'pending': 36\n , 'suite': 0\n , 'error title': 0\n , 'error message': 31\n , 'error stack': 90\n , 'checkmark': 32\n , 'fast': 90\n , 'medium': 33\n , 'slow': 31\n , 'green': 32\n , 'light': 90\n , 'diff gutter': 90\n , 'diff added': 42\n , 'diff removed': 41\n};\n\n/**\n * Default symbol map.\n */\n\nexports.symbols = {\n ok: '✓',\n err: '✖',\n dot: '․'\n};\n\n// With node.js on Windows: use symbols available in terminal default fonts\nif ('win32' == process.platform) {\n exports.symbols.ok = '\\u221A';\n exports.symbols.err = '\\u00D7';\n exports.symbols.dot = '.';\n}\n\n/**\n * Color `str` with the given `type`,\n * allowing colors to be disabled,\n * as well as user-defined color\n * schemes.\n *\n * @param {String} type\n * @param {String} str\n * @return {String}\n * @api private\n */\n\nvar color = exports.color = function(type, str) {\n if (!exports.useColors) return String(str);\n return '\\u001b[' + exports.colors[type] + 'm' + str + '\\u001b[0m';\n};\n\n/**\n * Expose term window size, with some\n * defaults for when stderr is not a tty.\n */\n\nexports.window = {\n width: isatty\n ? process.stdout.getWindowSize\n ? process.stdout.getWindowSize(1)[0]\n : tty.getWindowSize()[1]\n : 75\n};\n\n/**\n * Expose some basic cursor interactions\n * that are common among reporters.\n */\n\nexports.cursor = {\n hide: function(){\n isatty && process.stdout.write('\\u001b[?25l');\n },\n\n show: function(){\n isatty && process.stdout.write('\\u001b[?25h');\n },\n\n deleteLine: function(){\n isatty && process.stdout.write('\\u001b[2K');\n },\n\n beginningOfLine: function(){\n isatty && process.stdout.write('\\u001b[0G');\n },\n\n CR: function(){\n if (isatty) {\n exports.cursor.deleteLine();\n exports.cursor.beginningOfLine();\n } else {\n process.stdout.write('\\r');\n }\n }\n};\n\n/**\n * Outut the given `failures` as a list.\n *\n * @param {Array} failures\n * @api public\n */\n\nexports.list = function(failures){\n console.log();\n failures.forEach(function(test, i){\n // format\n var fmt = color('error title', ' %s) %s:\\n')\n + color('error message', ' %s')\n + color('error stack', '\\n%s\\n');\n\n // msg\n var err = test.err\n , message = err.message || ''\n , stack = err.stack || message\n , index = stack.indexOf(message)\n , actual = err.actual\n , expected = err.expected\n , escape = true;\n if (index === -1) {\n msg = message;\n } else {\n index += message.length;\n msg = stack.slice(0, index);\n // remove msg from stack\n stack = stack.slice(index + 1);\n }\n\n // uncaught\n if (err.uncaught) {\n msg = 'Uncaught ' + msg;\n }\n // explicitly show diff\n if (err.showDiff !== false && sameType(actual, expected)\n && expected !== undefined) {\n\n if ('string' !== typeof actual) {\n escape = false;\n err.actual = actual = utils.stringify(actual);\n err.expected = expected = utils.stringify(expected);\n }\n\n fmt = color('error title', ' %s) %s:\\n%s') + color('error stack', '\\n%s\\n');\n var match = message.match(/^([^:]+): expected/);\n msg = '\\n ' + color('error message', match ? match[1] : msg);\n\n if (exports.inlineDiffs) {\n msg += inlineDiff(err, escape);\n } else {\n msg += unifiedDiff(err, escape);\n }\n }\n\n // indent stack trace\n stack = stack.replace(/^/gm, ' ');\n\n console.log(fmt, (i + 1), test.fullTitle(), msg, stack);\n });\n};\n\n/**\n * Initialize a new `Base` reporter.\n *\n * All other reporters generally\n * inherit from this reporter, providing\n * stats such as test duration, number\n * of tests passed / failed etc.\n *\n * @param {Runner} runner\n * @api public\n */\n\nfunction Base(runner) {\n var self = this\n , stats = this.stats = { suites: 0, tests: 0, passes: 0, pending: 0, failures: 0 }\n , failures = this.failures = [];\n\n if (!runner) return;\n this.runner = runner;\n\n runner.stats = stats;\n\n runner.on('start', function(){\n stats.start = new Date;\n });\n\n runner.on('suite', function(suite){\n stats.suites = stats.suites || 0;\n suite.root || stats.suites++;\n });\n\n runner.on('test end', function(test){\n stats.tests = stats.tests || 0;\n stats.tests++;\n });\n\n runner.on('pass', function(test){\n stats.passes = stats.passes || 0;\n\n var medium = test.slow() / 2;\n test.speed = test.duration > test.slow()\n ? 'slow'\n : test.duration > medium\n ? 'medium'\n : 'fast';\n\n stats.passes++;\n });\n\n runner.on('fail', function(test, err){\n stats.failures = stats.failures || 0;\n stats.failures++;\n test.err = err;\n failures.push(test);\n });\n\n runner.on('end', function(){\n stats.end = new Date;\n stats.duration = new Date - stats.start;\n });\n\n runner.on('pending', function(){\n stats.pending++;\n });\n}\n\n/**\n * Output common epilogue used by many of\n * the bundled reporters.\n *\n * @api public\n */\n\nBase.prototype.epilogue = function(){\n var stats = this.stats;\n var tests;\n var fmt;\n\n console.log();\n\n // passes\n fmt = color('bright pass', ' ')\n + color('green', ' %d passing')\n + color('light', ' (%s)');\n\n console.log(fmt,\n stats.passes || 0,\n ms(stats.duration));\n\n // pending\n if (stats.pending) {\n fmt = color('pending', ' ')\n + color('pending', ' %d pending');\n\n console.log(fmt, stats.pending);\n }\n\n // failures\n if (stats.failures) {\n fmt = color('fail', ' %d failing');\n\n console.log(fmt, stats.failures);\n\n Base.list(this.failures);\n console.log();\n }\n\n console.log();\n};\n\n/**\n * Pad the given `str` to `len`.\n *\n * @param {String} str\n * @param {String} len\n * @return {String}\n * @api private\n */\n\nfunction pad(str, len) {\n str = String(str);\n return Array(len - str.length + 1).join(' ') + str;\n}\n\n\n/**\n * Returns an inline diff between 2 strings with coloured ANSI output\n *\n * @param {Error} Error with actual/expected\n * @return {String} Diff\n * @api private\n */\n\nfunction inlineDiff(err, escape) {\n var msg = errorDiff(err, 'WordsWithSpace', escape);\n\n // linenos\n var lines = msg.split('\\n');\n if (lines.length > 4) {\n var width = String(lines.length).length;\n msg = lines.map(function(str, i){\n return pad(++i, width) + ' |' + ' ' + str;\n }).join('\\n');\n }\n\n // legend\n msg = '\\n'\n + color('diff removed', 'actual')\n + ' '\n + color('diff added', 'expected')\n + '\\n\\n'\n + msg\n + '\\n';\n\n // indent\n msg = msg.replace(/^/gm, ' ');\n return msg;\n}\n\n/**\n * Returns a unified diff between 2 strings\n *\n * @param {Error} Error with actual/expected\n * @return {String} Diff\n * @api private\n */\n\nfunction unifiedDiff(err, escape) {\n var indent = ' ';\n function cleanUp(line) {\n if (escape) {\n line = escapeInvisibles(line);\n }\n if (line[0] === '+') return indent + colorLines('diff added', line);\n if (line[0] === '-') return indent + colorLines('diff removed', line);\n if (line.match(/\\@\\@/)) return null;\n if (line.match(/\\\\ No newline/)) return null;\n else return indent + line;\n }\n function notBlank(line) {\n return line != null;\n }\n var msg = diff.createPatch('string', err.actual, err.expected);\n var lines = msg.split('\\n').splice(4);\n return '\\n '\n + colorLines('diff added', '+ expected') + ' '\n + colorLines('diff removed', '- actual')\n + '\\n\\n'\n + lines.map(cleanUp).filter(notBlank).join('\\n');\n}\n\n/**\n * Return a character diff for `err`.\n *\n * @param {Error} err\n * @return {String}\n * @api private\n */\n\nfunction errorDiff(err, type, escape) {\n var actual = escape ? escapeInvisibles(err.actual) : err.actual;\n var expected = escape ? escapeInvisibles(err.expected) : err.expected;\n return diff['diff' + type](actual, expected).map(function(str){\n if (str.added) return colorLines('diff added', str.value);\n if (str.removed) return colorLines('diff removed', str.value);\n return str.value;\n }).join('');\n}\n\n/**\n * Returns a string with all invisible characters in plain text\n *\n * @param {String} line\n * @return {String}\n * @api private\n */\nfunction escapeInvisibles(line) {\n return line.replace(/\\t/g, '<tab>')\n .replace(/\\r/g, '<CR>')\n .replace(/\\n/g, '<LF>\\n');\n}\n\n/**\n * Color lines for `str`, using the color `name`.\n *\n * @param {String} name\n * @param {String} str\n * @return {String}\n * @api private\n */\n\nfunction colorLines(name, str) {\n return str.split('\\n').map(function(str){\n return color(name, str);\n }).join('\\n');\n}\n\n/**\n * Check that a / b have the same type.\n *\n * @param {Object} a\n * @param {Object} b\n * @return {Boolean}\n * @api private\n */\n\nfunction sameType(a, b) {\n a = Object.prototype.toString.call(a);\n b = Object.prototype.toString.call(b);\n return a == b;\n}\n\n}); // module: reporters/base.js\n\nrequire.register(\"reporters/doc.js\", function(module, exports, require){\n/**\n * Module dependencies.\n */\n\nvar Base = require('./base')\n , utils = require('../utils');\n\n/**\n * Expose `Doc`.\n */\n\nexports = module.exports = Doc;\n\n/**\n * Initialize a new `Doc` reporter.\n *\n * @param {Runner} runner\n * @api public\n */\n\nfunction Doc(runner) {\n Base.call(this, runner);\n\n var self = this\n , stats = this.stats\n , total = runner.total\n , indents = 2;\n\n function indent() {\n return Array(indents).join(' ');\n }\n\n runner.on('suite', function(suite){\n if (suite.root) return;\n ++indents;\n console.log('%s<section class=\"suite\">', indent());\n ++indents;\n console.log('%s<h1>%s</h1>', indent(), utils.escape(suite.title));\n console.log('%s<dl>', indent());\n });\n\n runner.on('suite end', function(suite){\n if (suite.root) return;\n console.log('%s</dl>', indent());\n --indents;\n console.log('%s</section>', indent());\n --indents;\n });\n\n runner.on('pass', function(test){\n console.log('%s <dt>%s</dt>', indent(), utils.escape(test.title));\n var code = utils.escape(utils.clean(test.fn.toString()));\n console.log('%s <dd><pre><code>%s</code></pre></dd>', indent(), code);\n });\n\n runner.on('fail', function(test, err){\n console.log('%s <dt class=\"error\">%s</dt>', indent(), utils.escape(test.title));\n var code = utils.escape(utils.clean(test.fn.toString()));\n console.log('%s <dd class=\"error\"><pre><code>%s</code></pre></dd>', indent(), code);\n console.log('%s <dd class=\"error\">%s</dd>', indent(), utils.escape(err));\n });\n}\n\n}); // module: reporters/doc.js\n\nrequire.register(\"reporters/dot.js\", function(module, exports, require){\n/**\n * Module dependencies.\n */\n\nvar Base = require('./base')\n , color = Base.color;\n\n/**\n * Expose `Dot`.\n */\n\nexports = module.exports = Dot;\n\n/**\n * Initialize a new `Dot` matrix test reporter.\n *\n * @param {Runner} runner\n * @api public\n */\n\nfunction Dot(runner) {\n Base.call(this, runner);\n\n var self = this\n , stats = this.stats\n , width = Base.window.width * .75 | 0\n , n = -1;\n\n runner.on('start', function(){\n process.stdout.write('\\n');\n });\n\n runner.on('pending', function(test){\n if (++n % width == 0) process.stdout.write('\\n ');\n process.stdout.write(color('pending', Base.symbols.dot));\n });\n\n runner.on('pass', function(test){\n if (++n % width == 0) process.stdout.write('\\n ');\n if ('slow' == test.speed) {\n process.stdout.write(color('bright yellow', Base.symbols.dot));\n } else {\n process.stdout.write(color(test.speed, Base.symbols.dot));\n }\n });\n\n runner.on('fail', function(test, err){\n if (++n % width == 0) process.stdout.write('\\n ');\n process.stdout.write(color('fail', Base.symbols.dot));\n });\n\n runner.on('end', function(){\n console.log();\n self.epilogue();\n });\n}\n\n/**\n * Inherit from `Base.prototype`.\n */\n\nfunction F(){};\nF.prototype = Base.prototype;\nDot.prototype = new F;\nDot.prototype.constructor = Dot;\n\n\n}); // module: reporters/dot.js\n\nrequire.register(\"reporters/html-cov.js\", function(module, exports, require){\n/**\n * Module dependencies.\n */\n\nvar JSONCov = require('./json-cov')\n , fs = require('browser/fs');\n\n/**\n * Expose `HTMLCov`.\n */\n\nexports = module.exports = HTMLCov;\n\n/**\n * Initialize a new `JsCoverage` reporter.\n *\n * @param {Runner} runner\n * @api public\n */\n\nfunction HTMLCov(runner) {\n var jade = require('jade')\n , file = __dirname + '/templates/coverage.jade'\n , str = fs.readFileSync(file, 'utf8')\n , fn = jade.compile(str, { filename: file })\n , self = this;\n\n JSONCov.call(this, runner, false);\n\n runner.on('end', function(){\n process.stdout.write(fn({\n cov: self.cov\n , coverageClass: coverageClass\n }));\n });\n}\n\n/**\n * Return coverage class for `n`.\n *\n * @return {String}\n * @api private\n */\n\nfunction coverageClass(n) {\n if (n >= 75) return 'high';\n if (n >= 50) return 'medium';\n if (n >= 25) return 'low';\n return 'terrible';\n}\n\n}); // module: reporters/html-cov.js\n\nrequire.register(\"reporters/html.js\", function(module, exports, require){\n/**\n * Module dependencies.\n */\n\nvar Base = require('./base')\n , utils = require('../utils')\n , Progress = require('../browser/progress')\n , escape = utils.escape;\n\n/**\n * Save timer references to avoid Sinon interfering (see GH-237).\n */\n\nvar Date = global.Date\n , setTimeout = global.setTimeout\n , setInterval = global.setInterval\n , clearTimeout = global.clearTimeout\n , clearInterval = global.clearInterval;\n\n/**\n * Expose `HTML`.\n */\n\nexports = module.exports = HTML;\n\n/**\n * Stats template.\n */\n\nvar statsTemplate = '<ul id=\"mocha-stats\">'\n + '<li class=\"progress\"><canvas width=\"40\" height=\"40\"></canvas></li>'\n + '<li class=\"passes\"><a href=\"#\">passes:</a> <em>0</em></li>'\n + '<li class=\"failures\"><a href=\"#\">failures:</a> <em>0</em></li>'\n + '<li class=\"duration\">duration: <em>0</em>s</li>'\n + '</ul>';\n\n/**\n * Initialize a new `HTML` reporter.\n *\n * @param {Runner} runner\n * @api public\n */\n\nfunction HTML(runner) {\n Base.call(this, runner);\n\n var self = this\n , stats = this.stats\n , total = runner.total\n , stat = fragment(statsTemplate)\n , items = stat.getElementsByTagName('li')\n , passes = items[1].getElementsByTagName('em')[0]\n , passesLink = items[1].getElementsByTagName('a')[0]\n , failures = items[2].getElementsByTagName('em')[0]\n , failuresLink = items[2].getElementsByTagName('a')[0]\n , duration = items[3].getElementsByTagName('em')[0]\n , canvas = stat.getElementsByTagName('canvas')[0]\n , report = fragment('<ul id=\"mocha-report\"></ul>')\n , stack = [report]\n , progress\n , ctx\n , root = document.getElementById('mocha');\n\n if (canvas.getContext) {\n var ratio = window.devicePixelRatio || 1;\n canvas.style.width = canvas.width;\n canvas.style.height = canvas.height;\n canvas.width *= ratio;\n canvas.height *= ratio;\n ctx = canvas.getContext('2d');\n ctx.scale(ratio, ratio);\n progress = new Progress;\n }\n\n if (!root) return error('#mocha div missing, add it to your document');\n\n // pass toggle\n on(passesLink, 'click', function(){\n unhide();\n var name = /pass/.test(report.className) ? '' : ' pass';\n report.className = report.className.replace(/fail|pass/g, '') + name;\n if (report.className.trim()) hideSuitesWithout('test pass');\n });\n\n // failure toggle\n on(failuresLink, 'click', function(){\n unhide();\n var name = /fail/.test(report.className) ? '' : ' fail';\n report.className = report.className.replace(/fail|pass/g, '') + name;\n if (report.className.trim()) hideSuitesWithout('test fail');\n });\n\n root.appendChild(stat);\n root.appendChild(report);\n\n if (progress) progress.size(40);\n\n runner.on('suite', function(suite){\n if (suite.root) return;\n\n // suite\n var url = self.suiteURL(suite);\n var el = fragment('<li class=\"suite\"><h1><a href=\"%s\">%s</a></h1></li>', url, escape(suite.title));\n\n // container\n stack[0].appendChild(el);\n stack.unshift(document.createElement('ul'));\n el.appendChild(stack[0]);\n });\n\n runner.on('suite end', function(suite){\n if (suite.root) return;\n stack.shift();\n });\n\n runner.on('fail', function(test, err){\n if ('hook' == test.type) runner.emit('test end', test);\n });\n\n runner.on('test end', function(test){\n // TODO: add to stats\n var percent = stats.tests / this.total * 100 | 0;\n if (progress) progress.update(percent).draw(ctx);\n\n // update stats\n var ms = new Date - stats.start;\n text(passes, stats.passes);\n text(failures, stats.failures);\n text(duration, (ms / 1000).toFixed(2));\n\n // test\n if ('passed' == test.state) {\n var url = self.testURL(test);\n var el = fragment('<li class=\"test pass %e\"><h2>%e<span class=\"duration\">%ems</span> <a href=\"%s\" class=\"replay\">‣</a></h2></li>', test.speed, test.title, test.duration, url);\n } else if (test.pending) {\n var el = fragment('<li class=\"test pass pending\"><h2>%e</h2></li>', test.title);\n } else {\n var el = fragment('<li class=\"test fail\"><h2>%e <a href=\"%e\" class=\"replay\">‣</a></h2></li>', test.title, self.testURL(test));\n var str = test.err.stack || test.err.toString();\n\n // FF / Opera do not add the message\n if (!~str.indexOf(test.err.message)) {\n str = test.err.message + '\\n' + str;\n }\n\n // <=IE7 stringifies to [Object Error]. Since it can be overloaded, we\n // check for the result of the stringifying.\n if ('[object Error]' == str) str = test.err.message;\n\n // Safari doesn't give you a stack. Let's at least provide a source line.\n if (!test.err.stack && test.err.sourceURL && test.err.line !== undefined) {\n str += \"\\n(\" + test.err.sourceURL + \":\" + test.err.line + \")\";\n }\n\n el.appendChild(fragment('<pre class=\"error\">%e</pre>', str));\n }\n\n // toggle code\n // TODO: defer\n if (!test.pending) {\n var h2 = el.getElementsByTagName('h2')[0];\n\n on(h2, 'click', function(){\n pre.style.display = 'none' == pre.style.display\n ? 'block'\n : 'none';\n });\n\n var pre = fragment('<pre><code>%e</code></pre>', utils.clean(test.fn.toString()));\n el.appendChild(pre);\n pre.style.display = 'none';\n }\n\n // Don't call .appendChild if #mocha-report was already .shift()'ed off the stack.\n if (stack[0]) stack[0].appendChild(el);\n });\n}\n\n/**\n * Makes a URL, preserving querystring (\"search\") parameters.\n * @param {string} s\n * @returns {string} your new URL\n */\nvar makeUrl = function makeUrl(s) {\n var search = window.location.search;\n\n // Remove previous grep query parameter if present\n if (search) {\n search = search.replace(/[?&]grep=[^&\\s]*/g, '').replace(/^&/, '?');\n }\n\n return window.location.pathname + (search ? search + '&' : '?' ) + 'grep=' + encodeURIComponent(s);\n};\n\n/**\n * Provide suite URL\n *\n * @param {Object} [suite]\n */\nHTML.prototype.suiteURL = function(suite){\n return makeUrl(suite.fullTitle());\n};\n\n/**\n * Provide test URL\n *\n * @param {Object} [test]\n */\n\nHTML.prototype.testURL = function(test){\n return makeUrl(test.fullTitle());\n};\n\n/**\n * Display error `msg`.\n */\n\nfunction error(msg) {\n document.body.appendChild(fragment('<div id=\"mocha-error\">%s</div>', msg));\n}\n\n/**\n * Return a DOM fragment from `html`.\n */\n\nfunction fragment(html) {\n var args = arguments\n , div = document.createElement('div')\n , i = 1;\n\n div.innerHTML = html.replace(/%([se])/g, function(_, type){\n switch (type) {\n case 's': return String(args[i++]);\n case 'e': return escape(args[i++]);\n }\n });\n\n return div.firstChild;\n}\n\n/**\n * Check for suites that do not have elements\n * with `classname`, and hide them.\n */\n\nfunction hideSuitesWithout(classname) {\n var suites = document.getElementsByClassName('suite');\n for (var i = 0; i < suites.length; i++) {\n var els = suites[i].getElementsByClassName(classname);\n if (0 == els.length) suites[i].className += ' hidden';\n }\n}\n\n/**\n * Unhide .hidden suites.\n */\n\nfunction unhide() {\n var els = document.getElementsByClassName('suite hidden');\n for (var i = 0; i < els.length; ++i) {\n els[i].className = els[i].className.replace('suite hidden', 'suite');\n }\n}\n\n/**\n * Set `el` text to `str`.\n */\n\nfunction text(el, str) {\n if (el.textContent) {\n el.textContent = str;\n } else {\n el.innerText = str;\n }\n}\n\n/**\n * Listen on `event` with callback `fn`.\n */\n\nfunction on(el, event, fn) {\n if (el.addEventListener) {\n el.addEventListener(event, fn, false);\n } else {\n el.attachEvent('on' + event, fn);\n }\n}\n\n}); // module: reporters/html.js\n\nrequire.register(\"reporters/index.js\", function(module, exports, require){\nexports.Base = require('./base');\nexports.Dot = require('./dot');\nexports.Doc = require('./doc');\nexports.TAP = require('./tap');\nexports.JSON = require('./json');\nexports.HTML = require('./html');\nexports.List = require('./list');\nexports.Min = require('./min');\nexports.Spec = require('./spec');\nexports.Nyan = require('./nyan');\nexports.XUnit = require('./xunit');\nexports.Markdown = require('./markdown');\nexports.Progress = require('./progress');\nexports.Landing = require('./landing');\nexports.JSONCov = require('./json-cov');\nexports.HTMLCov = require('./html-cov');\nexports.JSONStream = require('./json-stream');\n\n}); // module: reporters/index.js\n\nrequire.register(\"reporters/json-cov.js\", function(module, exports, require){\n/**\n * Module dependencies.\n */\n\nvar Base = require('./base');\n\n/**\n * Expose `JSONCov`.\n */\n\nexports = module.exports = JSONCov;\n\n/**\n * Initialize a new `JsCoverage` reporter.\n *\n * @param {Runner} runner\n * @param {Boolean} output\n * @api public\n */\n\nfunction JSONCov(runner, output) {\n var self = this\n , output = 1 == arguments.length ? true : output;\n\n Base.call(this, runner);\n\n var tests = []\n , failures = []\n , passes = [];\n\n runner.on('test end', function(test){\n tests.push(test);\n });\n\n runner.on('pass', function(test){\n passes.push(test);\n });\n\n runner.on('fail', function(test){\n failures.push(test);\n });\n\n runner.on('end', function(){\n var cov = global._$jscoverage || {};\n var result = self.cov = map(cov);\n result.stats = self.stats;\n result.tests = tests.map(clean);\n result.failures = failures.map(clean);\n result.passes = passes.map(clean);\n if (!output) return;\n process.stdout.write(JSON.stringify(result, null, 2 ));\n });\n}\n\n/**\n * Map jscoverage data to a JSON structure\n * suitable for reporting.\n *\n * @param {Object} cov\n * @return {Object}\n * @api private\n */\n\nfunction map(cov) {\n var ret = {\n instrumentation: 'node-jscoverage'\n , sloc: 0\n , hits: 0\n , misses: 0\n , coverage: 0\n , files: []\n };\n\n for (var filename in cov) {\n var data = coverage(filename, cov[filename]);\n ret.files.push(data);\n ret.hits += data.hits;\n ret.misses += data.misses;\n ret.sloc += data.sloc;\n }\n\n ret.files.sort(function(a, b) {\n return a.filename.localeCompare(b.filename);\n });\n\n if (ret.sloc > 0) {\n ret.coverage = (ret.hits / ret.sloc) * 100;\n }\n\n return ret;\n}\n\n/**\n * Map jscoverage data for a single source file\n * to a JSON structure suitable for reporting.\n *\n * @param {String} filename name of the source file\n * @param {Object} data jscoverage coverage data\n * @return {Object}\n * @api private\n */\n\nfunction coverage(filename, data) {\n var ret = {\n filename: filename,\n coverage: 0,\n hits: 0,\n misses: 0,\n sloc: 0,\n source: {}\n };\n\n data.source.forEach(function(line, num){\n num++;\n\n if (data[num] === 0) {\n ret.misses++;\n ret.sloc++;\n } else if (data[num] !== undefined) {\n ret.hits++;\n ret.sloc++;\n }\n\n ret.source[num] = {\n source: line\n , coverage: data[num] === undefined\n ? ''\n : data[num]\n };\n });\n\n ret.coverage = ret.hits / ret.sloc * 100;\n\n return ret;\n}\n\n/**\n * Return a plain-object representation of `test`\n * free of cyclic properties etc.\n *\n * @param {Object} test\n * @return {Object}\n * @api private\n */\n\nfunction clean(test) {\n return {\n title: test.title\n , fullTitle: test.fullTitle()\n , duration: test.duration\n }\n}\n\n}); // module: reporters/json-cov.js\n\nrequire.register(\"reporters/json-stream.js\", function(module, exports, require){\n/**\n * Module dependencies.\n */\n\nvar Base = require('./base')\n , color = Base.color;\n\n/**\n * Expose `List`.\n */\n\nexports = module.exports = List;\n\n/**\n * Initialize a new `List` test reporter.\n *\n * @param {Runner} runner\n * @api public\n */\n\nfunction List(runner) {\n Base.call(this, runner);\n\n var self = this\n , stats = this.stats\n , total = runner.total;\n\n runner.on('start', function(){\n console.log(JSON.stringify(['start', { total: total }]));\n });\n\n runner.on('pass', function(test){\n console.log(JSON.stringify(['pass', clean(test)]));\n });\n\n runner.on('fail', function(test, err){\n test = clean(test);\n test.err = err.message;\n console.log(JSON.stringify(['fail', test]));\n });\n\n runner.on('end', function(){\n process.stdout.write(JSON.stringify(['end', self.stats]));\n });\n}\n\n/**\n * Return a plain-object representation of `test`\n * free of cyclic properties etc.\n *\n * @param {Object} test\n * @return {Object}\n * @api private\n */\n\nfunction clean(test) {\n return {\n title: test.title\n , fullTitle: test.fullTitle()\n , duration: test.duration\n }\n}\n\n}); // module: reporters/json-stream.js\n\nrequire.register(\"reporters/json.js\", function(module, exports, require){\n/**\n * Module dependencies.\n */\n\nvar Base = require('./base')\n , cursor = Base.cursor\n , color = Base.color;\n\n/**\n * Expose `JSON`.\n */\n\nexports = module.exports = JSONReporter;\n\n/**\n * Initialize a new `JSON` reporter.\n *\n * @param {Runner} runner\n * @api public\n */\n\nfunction JSONReporter(runner) {\n var self = this;\n Base.call(this, runner);\n\n var tests = []\n , pending = []\n , failures = []\n , passes = [];\n\n runner.on('test end', function(test){\n tests.push(test);\n });\n\n runner.on('pass', function(test){\n passes.push(test);\n });\n\n runner.on('fail', function(test){\n failures.push(test);\n });\n\n runner.on('pending', function(test){\n pending.push(test);\n });\n\n runner.on('end', function(){\n var obj = {\n stats: self.stats,\n tests: tests.map(clean),\n pending: pending.map(clean),\n failures: failures.map(clean),\n passes: passes.map(clean)\n };\n\n runner.testResults = obj;\n\n process.stdout.write(JSON.stringify(obj, null, 2));\n });\n}\n\n/**\n * Return a plain-object representation of `test`\n * free of cyclic properties etc.\n *\n * @param {Object} test\n * @return {Object}\n * @api private\n */\n\nfunction clean(test) {\n return {\n title: test.title,\n fullTitle: test.fullTitle(),\n duration: test.duration,\n err: errorJSON(test.err || {})\n }\n}\n\n/**\n * Transform `error` into a JSON object.\n * @param {Error} err\n * @return {Object}\n */\n\nfunction errorJSON(err) {\n var res = {};\n Object.getOwnPropertyNames(err).forEach(function(key) {\n res[key] = err[key];\n }, err);\n return res;\n}\n\n}); // module: reporters/json.js\n\nrequire.register(\"reporters/landing.js\", function(module, exports, require){\n/**\n * Module dependencies.\n */\n\nvar Base = require('./base')\n , cursor = Base.cursor\n , color = Base.color;\n\n/**\n * Expose `Landing`.\n */\n\nexports = module.exports = Landing;\n\n/**\n * Airplane color.\n */\n\nBase.colors.plane = 0;\n\n/**\n * Airplane crash color.\n */\n\nBase.colors['plane crash'] = 31;\n\n/**\n * Runway color.\n */\n\nBase.colors.runway = 90;\n\n/**\n * Initialize a new `Landing` reporter.\n *\n * @param {Runner} runner\n * @api public\n */\n\nfunction Landing(runner) {\n Base.call(this, runner);\n\n var self = this\n , stats = this.stats\n , width = Base.window.width * .75 | 0\n , total = runner.total\n , stream = process.stdout\n , plane = color('plane', '✈')\n , crashed = -1\n , n = 0;\n\n function runway() {\n var buf = Array(width).join('-');\n return ' ' + color('runway', buf);\n }\n\n runner.on('start', function(){\n stream.write('\\n\\n\\n ');\n cursor.hide();\n });\n\n runner.on('test end', function(test){\n // check if the plane crashed\n var col = -1 == crashed\n ? width * ++n / total | 0\n : crashed;\n\n // show the crash\n if ('failed' == test.state) {\n plane = color('plane crash', '✈');\n crashed = col;\n }\n\n // render landing strip\n stream.write('\\u001b['+(width+1)+'D\\u001b[2A');\n stream.write(runway());\n stream.write('\\n ');\n stream.write(color('runway', Array(col).join('⋅')));\n stream.write(plane)\n stream.write(color('runway', Array(width - col).join('⋅') + '\\n'));\n stream.write(runway());\n stream.write('\\u001b[0m');\n });\n\n runner.on('end', function(){\n cursor.show();\n console.log();\n self.epilogue();\n });\n}\n\n/**\n * Inherit from `Base.prototype`.\n */\n\nfunction F(){};\nF.prototype = Base.prototype;\nLanding.prototype = new F;\nLanding.prototype.constructor = Landing;\n\n\n}); // module: reporters/landing.js\n\nrequire.register(\"reporters/list.js\", function(module, exports, require){\n/**\n * Module dependencies.\n */\n\nvar Base = require('./base')\n , cursor = Base.cursor\n , color = Base.color;\n\n/**\n * Expose `List`.\n */\n\nexports = module.exports = List;\n\n/**\n * Initialize a new `List` test reporter.\n *\n * @param {Runner} runner\n * @api public\n */\n\nfunction List(runner) {\n Base.call(this, runner);\n\n var self = this\n , stats = this.stats\n , n = 0;\n\n runner.on('start', function(){\n console.log();\n });\n\n runner.on('test', function(test){\n process.stdout.write(color('pass', ' ' + test.fullTitle() + ': '));\n });\n\n runner.on('pending', function(test){\n var fmt = color('checkmark', ' -')\n + color('pending', ' %s');\n console.log(fmt, test.fullTitle());\n });\n\n runner.on('pass', function(test){\n var fmt = color('checkmark', ' '+Base.symbols.dot)\n + color('pass', ' %s: ')\n + color(test.speed, '%dms');\n cursor.CR();\n console.log(fmt, test.fullTitle(), test.duration);\n });\n\n runner.on('fail', function(test, err){\n cursor.CR();\n console.log(color('fail', ' %d) %s'), ++n, test.fullTitle());\n });\n\n runner.on('end', self.epilogue.bind(self));\n}\n\n/**\n * Inherit from `Base.prototype`.\n */\n\nfunction F(){};\nF.prototype = Base.prototype;\nList.prototype = new F;\nList.prototype.constructor = List;\n\n\n}); // module: reporters/list.js\n\nrequire.register(\"reporters/markdown.js\", function(module, exports, require){\n/**\n * Module dependencies.\n */\n\nvar Base = require('./base')\n , utils = require('../utils');\n\n/**\n * Constants\n */\n\nvar SUITE_PREFIX = '$';\n\n/**\n * Expose `Markdown`.\n */\n\nexports = module.exports = Markdown;\n\n/**\n * Initialize a new `Markdown` reporter.\n *\n * @param {Runner} runner\n * @api public\n */\n\nfunction Markdown(runner) {\n Base.call(this, runner);\n\n var self = this\n , stats = this.stats\n , level = 0\n , buf = '';\n\n function title(str) {\n return Array(level).join('#') + ' ' + str;\n }\n\n function indent() {\n return Array(level).join(' ');\n }\n\n function mapTOC(suite, obj) {\n var ret = obj,\n key = SUITE_PREFIX + suite.title;\n obj = obj[key] = obj[key] || { suite: suite };\n suite.suites.forEach(function(suite){\n mapTOC(suite, obj);\n });\n return ret;\n }\n\n function stringifyTOC(obj, level) {\n ++level;\n var buf = '';\n var link;\n for (var key in obj) {\n if ('suite' == key) continue;\n if (key !== SUITE_PREFIX) {\n link = ' - [' + key.substring(1) + ']';\n link += '(#' + utils.slug(obj[key].suite.fullTitle()) + ')\\n';\n buf += Array(level).join(' ') + link;\n }\n buf += stringifyTOC(obj[key], level);\n }\n return buf;\n }\n\n function generateTOC(suite) {\n var obj = mapTOC(suite, {});\n return stringifyTOC(obj, 0);\n }\n\n generateTOC(runner.suite);\n\n runner.on('suite', function(suite){\n ++level;\n var slug = utils.slug(suite.fullTitle());\n buf += '<a name=\"' + slug + '\"></a>' + '\\n';\n buf += title(suite.title) + '\\n';\n });\n\n runner.on('suite end', function(suite){\n --level;\n });\n\n runner.on('pass', function(test){\n var code = utils.clean(test.fn.toString());\n buf += test.title + '.\\n';\n buf += '\\n```js\\n';\n buf += code + '\\n';\n buf += '```\\n\\n';\n });\n\n runner.on('end', function(){\n process.stdout.write('# TOC\\n');\n process.stdout.write(generateTOC(runner.suite));\n process.stdout.write(buf);\n });\n}\n\n}); // module: reporters/markdown.js\n\nrequire.register(\"reporters/min.js\", function(module, exports, require){\n/**\n * Module dependencies.\n */\n\nvar Base = require('./base');\n\n/**\n * Expose `Min`.\n */\n\nexports = module.exports = Min;\n\n/**\n * Initialize a new `Min` minimal test reporter (best used with --watch).\n *\n * @param {Runner} runner\n * @api public\n */\n\nfunction Min(runner) {\n Base.call(this, runner);\n\n runner.on('start', function(){\n // clear screen\n process.stdout.write('\\u001b[2J');\n // set cursor position\n process.stdout.write('\\u001b[1;3H');\n });\n\n runner.on('end', this.epilogue.bind(this));\n}\n\n/**\n * Inherit from `Base.prototype`.\n */\n\nfunction F(){};\nF.prototype = Base.prototype;\nMin.prototype = new F;\nMin.prototype.constructor = Min;\n\n\n}); // module: reporters/min.js\n\nrequire.register(\"reporters/nyan.js\", function(module, exports, require){\n/**\n * Module dependencies.\n */\n\nvar Base = require('./base');\n\n/**\n * Expose `Dot`.\n */\n\nexports = module.exports = NyanCat;\n\n/**\n * Initialize a new `Dot` matrix test reporter.\n *\n * @param {Runner} runner\n * @api public\n */\n\nfunction NyanCat(runner) {\n Base.call(this, runner);\n var self = this\n , stats = this.stats\n , width = Base.window.width * .75 | 0\n , rainbowColors = this.rainbowColors = self.generateColors()\n , colorIndex = this.colorIndex = 0\n , numerOfLines = this.numberOfLines = 4\n , trajectories = this.trajectories = [[], [], [], []]\n , nyanCatWidth = this.nyanCatWidth = 11\n , trajectoryWidthMax = this.trajectoryWidthMax = (width - nyanCatWidth)\n , scoreboardWidth = this.scoreboardWidth = 5\n , tick = this.tick = 0\n , n = 0;\n\n runner.on('start', function(){\n Base.cursor.hide();\n self.draw();\n });\n\n runner.on('pending', function(test){\n self.draw();\n });\n\n runner.on('pass', function(test){\n self.draw();\n });\n\n runner.on('fail', function(test, err){\n self.draw();\n });\n\n runner.on('end', function(){\n Base.cursor.show();\n for (var i = 0; i < self.numberOfLines; i++) write('\\n');\n self.epilogue();\n });\n}\n\n/**\n * Draw the nyan cat\n *\n * @api private\n */\n\nNyanCat.prototype.draw = function(){\n this.appendRainbow();\n this.drawScoreboard();\n this.drawRainbow();\n this.drawNyanCat();\n this.tick = !this.tick;\n};\n\n/**\n * Draw the \"scoreboard\" showing the number\n * of passes, failures and pending tests.\n *\n * @api private\n */\n\nNyanCat.prototype.drawScoreboard = function(){\n var stats = this.stats;\n\n function draw(type, n) {\n write(' ');\n write(Base.color(type, n));\n write('\\n');\n }\n\n draw('green', stats.passes);\n draw('fail', stats.failures);\n draw('pending', stats.pending);\n write('\\n');\n\n this.cursorUp(this.numberOfLines);\n};\n\n/**\n * Append the rainbow.\n *\n * @api private\n */\n\nNyanCat.prototype.appendRainbow = function(){\n var segment = this.tick ? '_' : '-';\n var rainbowified = this.rainbowify(segment);\n\n for (var index = 0; index < this.numberOfLines; index++) {\n var trajectory = this.trajectories[index];\n if (trajectory.length >= this.trajectoryWidthMax) trajectory.shift();\n trajectory.push(rainbowified);\n }\n};\n\n/**\n * Draw the rainbow.\n *\n * @api private\n */\n\nNyanCat.prototype.drawRainbow = function(){\n var self = this;\n\n this.trajectories.forEach(function(line, index) {\n write('\\u001b[' + self.scoreboardWidth + 'C');\n write(line.join(''));\n write('\\n');\n });\n\n this.cursorUp(this.numberOfLines);\n};\n\n/**\n * Draw the nyan cat\n *\n * @api private\n */\n\nNyanCat.prototype.drawNyanCat = function() {\n var self = this;\n var startWidth = this.scoreboardWidth + this.trajectories[0].length;\n var dist = '\\u001b[' + startWidth + 'C';\n var padding = '';\n\n write(dist);\n write('_,------,');\n write('\\n');\n\n write(dist);\n padding = self.tick ? ' ' : ' ';\n write('_|' + padding + '/\\\\_/\\\\ ');\n write('\\n');\n\n write(dist);\n padding = self.tick ? '_' : '__';\n var tail = self.tick ? '~' : '^';\n var face;\n write(tail + '|' + padding + this.face() + ' ');\n write('\\n');\n\n write(dist);\n padding = self.tick ? ' ' : ' ';\n write(padding + '\"\" \"\" ');\n write('\\n');\n\n this.cursorUp(this.numberOfLines);\n};\n\n/**\n * Draw nyan cat face.\n *\n * @return {String}\n * @api private\n */\n\nNyanCat.prototype.face = function() {\n var stats = this.stats;\n if (stats.failures) {\n return '( x .x)';\n } else if (stats.pending) {\n return '( o .o)';\n } else if(stats.passes) {\n return '( ^ .^)';\n } else {\n return '( - .-)';\n }\n};\n\n/**\n * Move cursor up `n`.\n *\n * @param {Number} n\n * @api private\n */\n\nNyanCat.prototype.cursorUp = function(n) {\n write('\\u001b[' + n + 'A');\n};\n\n/**\n * Move cursor down `n`.\n *\n * @param {Number} n\n * @api private\n */\n\nNyanCat.prototype.cursorDown = function(n) {\n write('\\u001b[' + n + 'B');\n};\n\n/**\n * Generate rainbow colors.\n *\n * @return {Array}\n * @api private\n */\n\nNyanCat.prototype.generateColors = function(){\n var colors = [];\n\n for (var i = 0; i < (6 * 7); i++) {\n var pi3 = Math.floor(Math.PI / 3);\n var n = (i * (1.0 / 6));\n var r = Math.floor(3 * Math.sin(n) + 3);\n var g = Math.floor(3 * Math.sin(n + 2 * pi3) + 3);\n var b = Math.floor(3 * Math.sin(n + 4 * pi3) + 3);\n colors.push(36 * r + 6 * g + b + 16);\n }\n\n return colors;\n};\n\n/**\n * Apply rainbow to the given `str`.\n *\n * @param {String} str\n * @return {String}\n * @api private\n */\n\nNyanCat.prototype.rainbowify = function(str){\n if (!Base.useColors)\n return str;\n var color = this.rainbowColors[this.colorIndex % this.rainbowColors.length];\n this.colorIndex += 1;\n return '\\u001b[38;5;' + color + 'm' + str + '\\u001b[0m';\n};\n\n/**\n * Stdout helper.\n */\n\nfunction write(string) {\n process.stdout.write(string);\n}\n\n/**\n * Inherit from `Base.prototype`.\n */\n\nfunction F(){};\nF.prototype = Base.prototype;\nNyanCat.prototype = new F;\nNyanCat.prototype.constructor = NyanCat;\n\n\n}); // module: reporters/nyan.js\n\nrequire.register(\"reporters/progress.js\", function(module, exports, require){\n/**\n * Module dependencies.\n */\n\nvar Base = require('./base')\n , cursor = Base.cursor\n , color = Base.color;\n\n/**\n * Expose `Progress`.\n */\n\nexports = module.exports = Progress;\n\n/**\n * General progress bar color.\n */\n\nBase.colors.progress = 90;\n\n/**\n * Initialize a new `Progress` bar test reporter.\n *\n * @param {Runner} runner\n * @param {Object} options\n * @api public\n */\n\nfunction Progress(runner, options) {\n Base.call(this, runner);\n\n var self = this\n , options = options || {}\n , stats = this.stats\n , width = Base.window.width * .50 | 0\n , total = runner.total\n , complete = 0\n , max = Math.max\n , lastN = -1;\n\n // default chars\n options.open = options.open || '[';\n options.complete = options.complete || '▬';\n options.incomplete = options.incomplete || Base.symbols.dot;\n options.close = options.close || ']';\n options.verbose = false;\n\n // tests started\n runner.on('start', function(){\n console.log();\n cursor.hide();\n });\n\n // tests complete\n runner.on('test end', function(){\n complete++;\n var incomplete = total - complete\n , percent = complete / total\n , n = width * percent | 0\n , i = width - n;\n\n if (lastN === n && !options.verbose) {\n // Don't re-render the line if it hasn't changed\n return;\n }\n lastN = n;\n\n cursor.CR();\n process.stdout.write('\\u001b[J');\n process.stdout.write(color('progress', ' ' + options.open));\n process.stdout.write(Array(n).join(options.complete));\n process.stdout.write(Array(i).join(options.incomplete));\n process.stdout.write(color('progress', options.close));\n if (options.verbose) {\n process.stdout.write(color('progress', ' ' + complete + ' of ' + total));\n }\n });\n\n // tests are complete, output some stats\n // and the failures if any\n runner.on('end', function(){\n cursor.show();\n console.log();\n self.epilogue();\n });\n}\n\n/**\n * Inherit from `Base.prototype`.\n */\n\nfunction F(){};\nF.prototype = Base.prototype;\nProgress.prototype = new F;\nProgress.prototype.constructor = Progress;\n\n\n}); // module: reporters/progress.js\n\nrequire.register(\"reporters/spec.js\", function(module, exports, require){\n/**\n * Module dependencies.\n */\n\nvar Base = require('./base')\n , cursor = Base.cursor\n , color = Base.color;\n\n/**\n * Expose `Spec`.\n */\n\nexports = module.exports = Spec;\n\n/**\n * Initialize a new `Spec` test reporter.\n *\n * @param {Runner} runner\n * @api public\n */\n\nfunction Spec(runner) {\n Base.call(this, runner);\n\n var self = this\n , stats = this.stats\n , indents = 0\n , n = 0;\n\n function indent() {\n return Array(indents).join(' ')\n }\n\n runner.on('start', function(){\n console.log();\n });\n\n runner.on('suite', function(suite){\n ++indents;\n console.log(color('suite', '%s%s'), indent(), suite.title);\n });\n\n runner.on('suite end', function(suite){\n --indents;\n if (1 == indents) console.log();\n });\n\n runner.on('pending', function(test){\n var fmt = indent() + color('pending', ' - %s');\n console.log(fmt, test.title);\n });\n\n runner.on('pass', function(test){\n if ('fast' == test.speed) {\n var fmt = indent()\n + color('checkmark', ' ' + Base.symbols.ok)\n + color('pass', ' %s');\n cursor.CR();\n console.log(fmt, test.title);\n } else {\n var fmt = indent()\n + color('checkmark', ' ' + Base.symbols.ok)\n + color('pass', ' %s')\n + color(test.speed, ' (%dms)');\n cursor.CR();\n console.log(fmt, test.title, test.duration);\n }\n });\n\n runner.on('fail', function(test, err){\n cursor.CR();\n console.log(indent() + color('fail', ' %d) %s'), ++n, test.title);\n });\n\n runner.on('end', self.epilogue.bind(self));\n}\n\n/**\n * Inherit from `Base.prototype`.\n */\n\nfunction F(){};\nF.prototype = Base.prototype;\nSpec.prototype = new F;\nSpec.prototype.constructor = Spec;\n\n\n}); // module: reporters/spec.js\n\nrequire.register(\"reporters/tap.js\", function(module, exports, require){\n/**\n * Module dependencies.\n */\n\nvar Base = require('./base')\n , cursor = Base.cursor\n , color = Base.color;\n\n/**\n * Expose `TAP`.\n */\n\nexports = module.exports = TAP;\n\n/**\n * Initialize a new `TAP` reporter.\n *\n * @param {Runner} runner\n * @api public\n */\n\nfunction TAP(runner) {\n Base.call(this, runner);\n\n var self = this\n , stats = this.stats\n , n = 1\n , passes = 0\n , failures = 0;\n\n runner.on('start', function(){\n var total = runner.grepTotal(runner.suite);\n console.log('%d..%d', 1, total);\n });\n\n runner.on('test end', function(){\n ++n;\n });\n\n runner.on('pending', function(test){\n console.log('ok %d %s # SKIP -', n, title(test));\n });\n\n runner.on('pass', function(test){\n passes++;\n console.log('ok %d %s', n, title(test));\n });\n\n runner.on('fail', function(test, err){\n failures++;\n console.log('not ok %d %s', n, title(test));\n if (err.stack) console.log(err.stack.replace(/^/gm, ' '));\n });\n\n runner.on('end', function(){\n console.log('# tests ' + (passes + failures));\n console.log('# pass ' + passes);\n console.log('# fail ' + failures);\n });\n}\n\n/**\n * Return a TAP-safe title of `test`\n *\n * @param {Object} test\n * @return {String}\n * @api private\n */\n\nfunction title(test) {\n return test.fullTitle().replace(/#/g, '');\n}\n\n}); // module: reporters/tap.js\n\nrequire.register(\"reporters/xunit.js\", function(module, exports, require){\n/**\n * Module dependencies.\n */\n\nvar Base = require('./base')\n , utils = require('../utils')\n , fs = require('browser/fs')\n , escape = utils.escape;\n\n/**\n * Save timer references to avoid Sinon interfering (see GH-237).\n */\n\nvar Date = global.Date\n , setTimeout = global.setTimeout\n , setInterval = global.setInterval\n , clearTimeout = global.clearTimeout\n , clearInterval = global.clearInterval;\n\n/**\n * Expose `XUnit`.\n */\n\nexports = module.exports = XUnit;\n\n/**\n * Initialize a new `XUnit` reporter.\n *\n * @param {Runner} runner\n * @api public\n */\n\nfunction XUnit(runner, options) {\n Base.call(this, runner);\n var stats = this.stats\n , tests = []\n , self = this;\n\n if (options.reporterOptions && options.reporterOptions.output) {\n if (! fs.createWriteStream) {\n throw new Error('file output not supported in browser');\n }\n self.fileStream = fs.createWriteStream(options.reporterOptions.output);\n }\n\n runner.on('pending', function(test){\n tests.push(test);\n });\n\n runner.on('pass', function(test){\n tests.push(test);\n });\n\n runner.on('fail', function(test){\n tests.push(test);\n });\n\n runner.on('end', function(){\n self.write(tag('testsuite', {\n name: 'Mocha Tests'\n , tests: stats.tests\n , failures: stats.failures\n , errors: stats.failures\n , skipped: stats.tests - stats.failures - stats.passes\n , timestamp: (new Date).toUTCString()\n , time: (stats.duration / 1000) || 0\n }, false));\n\n tests.forEach(function(t) { self.test(t); });\n self.write('</testsuite>');\n });\n}\n\n/**\n * Override done to close the stream (if it's a file).\n */\nXUnit.prototype.done = function(failures, fn) {\n if (this.fileStream) {\n this.fileStream.end(function() {\n fn(failures);\n });\n } else {\n fn(failures);\n }\n};\n\n/**\n * Inherit from `Base.prototype`.\n */\n\nfunction F(){};\nF.prototype = Base.prototype;\nXUnit.prototype = new F;\nXUnit.prototype.constructor = XUnit;\n\n\n/**\n * Write out the given line\n */\nXUnit.prototype.write = function(line) {\n if (this.fileStream) {\n this.fileStream.write(line + '\\n');\n } else {\n console.log(line);\n }\n};\n\n/**\n * Output tag for the given `test.`\n */\n\nXUnit.prototype.test = function(test, ostream) {\n var attrs = {\n classname: test.parent.fullTitle()\n , name: test.title\n , time: (test.duration / 1000) || 0\n };\n\n if ('failed' == test.state) {\n var err = test.err;\n this.write(tag('testcase', attrs, false, tag('failure', {}, false, cdata(escape(err.message) + \"\\n\" + err.stack))));\n } else if (test.pending) {\n this.write(tag('testcase', attrs, false, tag('skipped', {}, true)));\n } else {\n this.write(tag('testcase', attrs, true) );\n }\n};\n\n/**\n * HTML tag helper.\n */\n\nfunction tag(name, attrs, close, content) {\n var end = close ? '/>' : '>'\n , pairs = []\n , tag;\n\n for (var key in attrs) {\n pairs.push(key + '=\"' + escape(attrs[key]) + '\"');\n }\n\n tag = '<' + name + (pairs.length ? ' ' + pairs.join(' ') : '') + end;\n if (content) tag += content + '</' + name + end;\n return tag;\n}\n\n/**\n * Return cdata escaped CDATA `str`.\n */\n\nfunction cdata(str) {\n return '<![CDATA[' + escape(str) + ']]>';\n}\n\n}); // module: reporters/xunit.js\n\nrequire.register(\"runnable.js\", function(module, exports, require){\n/**\n * Module dependencies.\n */\n\nvar EventEmitter = require('browser/events').EventEmitter\n , debug = require('browser/debug')('mocha:runnable')\n , Pending = require('./pending')\n , milliseconds = require('./ms')\n , utils = require('./utils');\n\n/**\n * Save timer references to avoid Sinon interfering (see GH-237).\n */\n\nvar Date = global.Date\n , setTimeout = global.setTimeout\n , setInterval = global.setInterval\n , clearTimeout = global.clearTimeout\n , clearInterval = global.clearInterval;\n\n/**\n * Object#toString().\n */\n\nvar toString = Object.prototype.toString;\n\n/**\n * Expose `Runnable`.\n */\n\nmodule.exports = Runnable;\n\n/**\n * Initialize a new `Runnable` with the given `title` and callback `fn`.\n *\n * @param {String} title\n * @param {Function} fn\n * @api private\n */\n\nfunction Runnable(title, fn) {\n this.title = title;\n this.fn = fn;\n this.async = fn && fn.length;\n this.sync = ! this.async;\n this._timeout = 2000;\n this._slow = 75;\n this._enableTimeouts = true;\n this.timedOut = false;\n this._trace = new Error('done() called multiple times')\n}\n\n/**\n * Inherit from `EventEmitter.prototype`.\n */\n\nfunction F(){};\nF.prototype = EventEmitter.prototype;\nRunnable.prototype = new F;\nRunnable.prototype.constructor = Runnable;\n\n\n/**\n * Set & get timeout `ms`.\n *\n * @param {Number|String} ms\n * @return {Runnable|Number} ms or self\n * @api private\n */\n\nRunnable.prototype.timeout = function(ms){\n if (0 == arguments.length) return this._timeout;\n if (ms === 0) this._enableTimeouts = false;\n if ('string' == typeof ms) ms = milliseconds(ms);\n debug('timeout %d', ms);\n this._timeout = ms;\n if (this.timer) this.resetTimeout();\n return this;\n};\n\n/**\n * Set & get slow `ms`.\n *\n * @param {Number|String} ms\n * @return {Runnable|Number} ms or self\n * @api private\n */\n\nRunnable.prototype.slow = function(ms){\n if (0 === arguments.length) return this._slow;\n if ('string' == typeof ms) ms = milliseconds(ms);\n debug('timeout %d', ms);\n this._slow = ms;\n return this;\n};\n\n/**\n * Set and & get timeout `enabled`.\n *\n * @param {Boolean} enabled\n * @return {Runnable|Boolean} enabled or self\n * @api private\n */\n\nRunnable.prototype.enableTimeouts = function(enabled){\n if (arguments.length === 0) return this._enableTimeouts;\n debug('enableTimeouts %s', enabled);\n this._enableTimeouts = enabled;\n return this;\n};\n\n/**\n * Halt and mark as pending.\n *\n * @api private\n */\n\nRunnable.prototype.skip = function(){\n throw new Pending();\n};\n\n/**\n * Return the full title generated by recursively\n * concatenating the parent's full title.\n *\n * @return {String}\n * @api public\n */\n\nRunnable.prototype.fullTitle = function(){\n return this.parent.fullTitle() + ' ' + this.title;\n};\n\n/**\n * Clear the timeout.\n *\n * @api private\n */\n\nRunnable.prototype.clearTimeout = function(){\n clearTimeout(this.timer);\n};\n\n/**\n * Inspect the runnable void of private properties.\n *\n * @return {String}\n * @api private\n */\n\nRunnable.prototype.inspect = function(){\n return JSON.stringify(this, function(key, val){\n if ('_' == key[0]) return;\n if ('parent' == key) return '#<Suite>';\n if ('ctx' == key) return '#<Context>';\n return val;\n }, 2);\n};\n\n/**\n * Reset the timeout.\n *\n * @api private\n */\n\nRunnable.prototype.resetTimeout = function(){\n var self = this;\n var ms = this.timeout() || 1e9;\n\n if (!this._enableTimeouts) return;\n this.clearTimeout();\n this.timer = setTimeout(function(){\n if (!self._enableTimeouts) return;\n self.callback(new Error('timeout of ' + ms + 'ms exceeded. Ensure the done() callback is being called in this test.'));\n self.timedOut = true;\n }, ms);\n};\n\n/**\n * Whitelist these globals for this test run\n *\n * @api private\n */\nRunnable.prototype.globals = function(arr){\n var self = this;\n this._allowedGlobals = arr;\n};\n\n/**\n * Run the test and invoke `fn(err)`.\n *\n * @param {Function} fn\n * @api private\n */\n\nRunnable.prototype.run = function(fn){\n var self = this\n , start = new Date\n , ctx = this.ctx\n , finished\n , emitted;\n\n // Some times the ctx exists but it is not runnable\n if (ctx && ctx.runnable) ctx.runnable(this);\n\n // called multiple times\n function multiple(err) {\n if (emitted) return;\n emitted = true;\n self.emit('error', err || new Error('done() called multiple times; stacktrace may be inaccurate'));\n }\n\n // finished\n function done(err) {\n var ms = self.timeout();\n if (self.timedOut) return;\n if (finished) return multiple(err || self._trace);\n\n // Discard the resolution if this test has already failed asynchronously\n if (self.state) return;\n\n self.clearTimeout();\n self.duration = new Date - start;\n finished = true;\n if (!err && self.duration > ms && self._enableTimeouts) err = new Error('timeout of ' + ms + 'ms exceeded. Ensure the done() callback is being called in this test.');\n fn(err);\n }\n\n // for .resetTimeout()\n this.callback = done;\n\n // explicit async with `done` argument\n if (this.async) {\n this.resetTimeout();\n\n try {\n this.fn.call(ctx, function(err){\n if (err instanceof Error || toString.call(err) === \"[object Error]\") return done(err);\n if (null != err) {\n if (Object.prototype.toString.call(err) === '[object Object]') {\n return done(new Error('done() invoked with non-Error: ' + JSON.stringify(err)));\n } else {\n return done(new Error('done() invoked with non-Error: ' + err));\n }\n }\n done();\n });\n } catch (err) {\n done(utils.getError(err));\n }\n return;\n }\n\n if (this.asyncOnly) {\n return done(new Error('--async-only option in use without declaring `done()`'));\n }\n\n // sync or promise-returning\n try {\n if (this.pending) {\n done();\n } else {\n callFn(this.fn);\n }\n } catch (err) {\n done(utils.getError(err));\n }\n\n function callFn(fn) {\n var result = fn.call(ctx);\n if (result && typeof result.then === 'function') {\n self.resetTimeout();\n result\n .then(function() {\n done()\n },\n function(reason) {\n done(reason || new Error('Promise rejected with no or falsy reason'))\n });\n } else {\n done();\n }\n }\n};\n\n}); // module: runnable.js\n\nrequire.register(\"runner.js\", function(module, exports, require){\n/**\n * Module dependencies.\n */\n\nvar EventEmitter = require('browser/events').EventEmitter\n , debug = require('browser/debug')('mocha:runner')\n , Pending = require('./pending')\n , Test = require('./test')\n , utils = require('./utils')\n , filter = utils.filter\n , keys = utils.keys\n , type = utils.type\n , stringify = utils.stringify\n , stackFilter = utils.stackTraceFilter();\n\n/**\n * Non-enumerable globals.\n */\n\nvar globals = [\n 'setTimeout',\n 'clearTimeout',\n 'setInterval',\n 'clearInterval',\n 'XMLHttpRequest',\n 'Date',\n 'setImmediate',\n 'clearImmediate'\n];\n\n/**\n * Expose `Runner`.\n */\n\nmodule.exports = Runner;\n\n/**\n * Initialize a `Runner` for the given `suite`.\n *\n * Events:\n *\n * - `start` execution started\n * - `end` execution complete\n * - `suite` (suite) test suite execution started\n * - `suite end` (suite) all tests (and sub-suites) have finished\n * - `test` (test) test execution started\n * - `test end` (test) test completed\n * - `hook` (hook) hook execution started\n * - `hook end` (hook) hook complete\n * - `pass` (test) test passed\n * - `fail` (test, err) test failed\n * - `pending` (test) test pending\n *\n * @param {Suite} suite Root suite\n * @param {boolean} [delay] Whether or not to delay execution of root suite\n * until ready.\n * @api public\n */\n\nfunction Runner(suite, delay) {\n var self = this;\n this._globals = [];\n this._abort = false;\n this._delay = delay;\n this.suite = suite;\n this.total = suite.total();\n this.failures = 0;\n this.on('test end', function(test){ self.checkGlobals(test); });\n this.on('hook end', function(hook){ self.checkGlobals(hook); });\n this.grep(/.*/);\n this.globals(this.globalProps().concat(extraGlobals()));\n}\n\n/**\n * Wrapper for setImmediate, process.nextTick, or browser polyfill.\n *\n * @param {Function} fn\n * @api private\n */\n\nRunner.immediately = global.setImmediate || process.nextTick;\n\n/**\n * Inherit from `EventEmitter.prototype`.\n */\n\nfunction F(){};\nF.prototype = EventEmitter.prototype;\nRunner.prototype = new F;\nRunner.prototype.constructor = Runner;\n\n\n/**\n * Run tests with full titles matching `re`. Updates runner.total\n * with number of tests matched.\n *\n * @param {RegExp} re\n * @param {Boolean} invert\n * @return {Runner} for chaining\n * @api public\n */\n\nRunner.prototype.grep = function(re, invert){\n debug('grep %s', re);\n this._grep = re;\n this._invert = invert;\n this.total = this.grepTotal(this.suite);\n return this;\n};\n\n/**\n * Returns the number of tests matching the grep search for the\n * given suite.\n *\n * @param {Suite} suite\n * @return {Number}\n * @api public\n */\n\nRunner.prototype.grepTotal = function(suite) {\n var self = this;\n var total = 0;\n\n suite.eachTest(function(test){\n var match = self._grep.test(test.fullTitle());\n if (self._invert) match = !match;\n if (match) total++;\n });\n\n return total;\n};\n\n/**\n * Return a list of global properties.\n *\n * @return {Array}\n * @api private\n */\n\nRunner.prototype.globalProps = function() {\n var props = utils.keys(global);\n\n // non-enumerables\n for (var i = 0; i < globals.length; ++i) {\n if (~utils.indexOf(props, globals[i])) continue;\n props.push(globals[i]);\n }\n\n return props;\n};\n\n/**\n * Allow the given `arr` of globals.\n *\n * @param {Array} arr\n * @return {Runner} for chaining\n * @api public\n */\n\nRunner.prototype.globals = function(arr){\n if (0 == arguments.length) return this._globals;\n debug('globals %j', arr);\n this._globals = this._globals.concat(arr);\n return this;\n};\n\n/**\n * Check for global variable leaks.\n *\n * @api private\n */\n\nRunner.prototype.checkGlobals = function(test){\n if (this.ignoreLeaks) return;\n var ok = this._globals;\n\n var globals = this.globalProps();\n var leaks;\n\n if (test) {\n ok = ok.concat(test._allowedGlobals || []);\n }\n\n if(this.prevGlobalsLength == globals.length) return;\n this.prevGlobalsLength = globals.length;\n\n leaks = filterLeaks(ok, globals);\n this._globals = this._globals.concat(leaks);\n\n if (leaks.length > 1) {\n this.fail(test, new Error('global leaks detected: ' + leaks.join(', ') + ''));\n } else if (leaks.length) {\n this.fail(test, new Error('global leak detected: ' + leaks[0]));\n }\n};\n\n/**\n * Fail the given `test`.\n *\n * @param {Test} test\n * @param {Error} err\n * @api private\n */\n\nRunner.prototype.fail = function(test, err) {\n ++this.failures;\n test.state = 'failed';\n\n if (!(err instanceof Error)) {\n err = new Error('the ' + type(err) + ' ' + stringify(err) + ' was thrown, throw an Error :)');\n }\n\n err.stack = (this.fullStackTrace || !err.stack)\n ? err.stack\n : stackFilter(err.stack);\n\n this.emit('fail', test, err);\n};\n\n/**\n * Fail the given `hook` with `err`.\n *\n * Hook failures work in the following pattern:\n * - If bail, then exit\n * - Failed `before` hook skips all tests in a suite and subsuites,\n * but jumps to corresponding `after` hook\n * - Failed `before each` hook skips remaining tests in a\n * suite and jumps to corresponding `after each` hook,\n * which is run only once\n * - Failed `after` hook does not alter\n * execution order\n * - Failed `after each` hook skips remaining tests in a\n * suite and subsuites, but executes other `after each`\n * hooks\n *\n * @param {Hook} hook\n * @param {Error} err\n * @api private\n */\n\nRunner.prototype.failHook = function(hook, err){\n this.fail(hook, err);\n if (this.suite.bail()) {\n this.emit('end');\n }\n};\n\n/**\n * Run hook `name` callbacks and then invoke `fn()`.\n *\n * @param {String} name\n * @param {Function} function\n * @api private\n */\n\nRunner.prototype.hook = function(name, fn){\n var suite = this.suite\n , hooks = suite['_' + name]\n , self = this\n , timer;\n\n function next(i) {\n var hook = hooks[i];\n if (!hook) return fn();\n self.currentRunnable = hook;\n\n hook.ctx.currentTest = self.test;\n\n self.emit('hook', hook);\n\n hook.on('error', function(err){\n self.failHook(hook, err);\n });\n\n hook.run(function(err){\n hook.removeAllListeners('error');\n var testError = hook.error();\n if (testError) self.fail(self.test, testError);\n if (err) {\n if (err instanceof Pending) {\n suite.pending = true;\n } else {\n self.failHook(hook, err);\n\n // stop executing hooks, notify callee of hook err\n return fn(err);\n }\n }\n self.emit('hook end', hook);\n delete hook.ctx.currentTest;\n next(++i);\n });\n }\n\n Runner.immediately(function(){\n next(0);\n });\n};\n\n/**\n * Run hook `name` for the given array of `suites`\n * in order, and callback `fn(err, errSuite)`.\n *\n * @param {String} name\n * @param {Array} suites\n * @param {Function} fn\n * @api private\n */\n\nRunner.prototype.hooks = function(name, suites, fn){\n var self = this\n , orig = this.suite;\n\n function next(suite) {\n self.suite = suite;\n\n if (!suite) {\n self.suite = orig;\n return fn();\n }\n\n self.hook(name, function(err){\n if (err) {\n var errSuite = self.suite;\n self.suite = orig;\n return fn(err, errSuite);\n }\n\n next(suites.pop());\n });\n }\n\n next(suites.pop());\n};\n\n/**\n * Run hooks from the top level down.\n *\n * @param {String} name\n * @param {Function} fn\n * @api private\n */\n\nRunner.prototype.hookUp = function(name, fn){\n var suites = [this.suite].concat(this.parents()).reverse();\n this.hooks(name, suites, fn);\n};\n\n/**\n * Run hooks from the bottom up.\n *\n * @param {String} name\n * @param {Function} fn\n * @api private\n */\n\nRunner.prototype.hookDown = function(name, fn){\n var suites = [this.suite].concat(this.parents());\n this.hooks(name, suites, fn);\n};\n\n/**\n * Return an array of parent Suites from\n * closest to furthest.\n *\n * @return {Array}\n * @api private\n */\n\nRunner.prototype.parents = function(){\n var suite = this.suite\n , suites = [];\n while (suite = suite.parent) suites.push(suite);\n return suites;\n};\n\n/**\n * Run the current test and callback `fn(err)`.\n *\n * @param {Function} fn\n * @api private\n */\n\nRunner.prototype.runTest = function(fn){\n var test = this.test\n , self = this;\n\n if (this.asyncOnly) test.asyncOnly = true;\n\n try {\n test.on('error', function(err){\n self.fail(test, err);\n });\n test.run(fn);\n } catch (err) {\n fn(err);\n }\n};\n\n/**\n * Run tests in the given `suite` and invoke\n * the callback `fn()` when complete.\n *\n * @param {Suite} suite\n * @param {Function} fn\n * @api private\n */\n\nRunner.prototype.runTests = function(suite, fn){\n var self = this\n , tests = suite.tests.slice()\n , test;\n\n\n function hookErr(err, errSuite, after) {\n // before/after Each hook for errSuite failed:\n var orig = self.suite;\n\n // for failed 'after each' hook start from errSuite parent,\n // otherwise start from errSuite itself\n self.suite = after ? errSuite.parent : errSuite;\n\n if (self.suite) {\n // call hookUp afterEach\n self.hookUp('afterEach', function(err2, errSuite2) {\n self.suite = orig;\n // some hooks may fail even now\n if (err2) return hookErr(err2, errSuite2, true);\n // report error suite\n fn(errSuite);\n });\n } else {\n // there is no need calling other 'after each' hooks\n self.suite = orig;\n fn(errSuite);\n }\n }\n\n function next(err, errSuite) {\n // if we bail after first err\n if (self.failures && suite._bail) return fn();\n\n if (self._abort) return fn();\n\n if (err) return hookErr(err, errSuite, true);\n\n // next test\n test = tests.shift();\n\n // all done\n if (!test) return fn();\n\n // grep\n var match = self._grep.test(test.fullTitle());\n if (self._invert) match = !match;\n if (!match) return next();\n\n // pending\n if (test.pending) {\n self.emit('pending', test);\n self.emit('test end', test);\n return next();\n }\n\n // execute test and hook(s)\n self.emit('test', self.test = test);\n self.hookDown('beforeEach', function(err, errSuite){\n\n if (suite.pending) {\n self.emit('pending', test);\n self.emit('test end', test);\n return next();\n }\n if (err) return hookErr(err, errSuite, false);\n\n self.currentRunnable = self.test;\n self.runTest(function(err){\n test = self.test;\n\n if (err) {\n if (err instanceof Pending) {\n self.emit('pending', test);\n } else {\n self.fail(test, err);\n }\n self.emit('test end', test);\n\n if (err instanceof Pending) {\n return next();\n }\n\n return self.hookUp('afterEach', next);\n }\n\n test.state = 'passed';\n self.emit('pass', test);\n self.emit('test end', test);\n self.hookUp('afterEach', next);\n });\n });\n }\n\n this.next = next;\n next();\n};\n\n/**\n * Run the given `suite` and invoke the\n * callback `fn()` when complete.\n *\n * @param {Suite} suite\n * @param {Function} fn\n * @api private\n */\n\nRunner.prototype.runSuite = function(suite, fn){\n var total = this.grepTotal(suite)\n , self = this\n , i = 0;\n\n debug('run suite %s', suite.fullTitle());\n\n if (!total) return fn();\n\n this.emit('suite', this.suite = suite);\n\n function next(errSuite) {\n if (errSuite) {\n // current suite failed on a hook from errSuite\n if (errSuite == suite) {\n // if errSuite is current suite\n // continue to the next sibling suite\n return done();\n } else {\n // errSuite is among the parents of current suite\n // stop execution of errSuite and all sub-suites\n return done(errSuite);\n }\n }\n\n if (self._abort) return done();\n\n var curr = suite.suites[i++];\n if (!curr) return done();\n self.runSuite(curr, next);\n }\n\n function done(errSuite) {\n self.suite = suite;\n self.hook('afterAll', function(){\n self.emit('suite end', suite);\n fn(errSuite);\n });\n }\n\n this.hook('beforeAll', function(err){\n if (err) return done();\n self.runTests(suite, next);\n });\n};\n\n/**\n * Handle uncaught exceptions.\n *\n * @param {Error} err\n * @api private\n */\n\nRunner.prototype.uncaught = function(err){\n if (err) {\n debug('uncaught exception %s', err !== function () {\n return this;\n }.call(err) ? err : ( err.message || err ));\n } else {\n debug('uncaught undefined exception');\n err = utils.undefinedError();\n }\n err.uncaught = true;\n\n var runnable = this.currentRunnable;\n if (!runnable) return;\n\n runnable.clearTimeout();\n\n // Ignore errors if complete\n if (runnable.state) return;\n this.fail(runnable, err);\n\n // recover from test\n if ('test' == runnable.type) {\n this.emit('test end', runnable);\n this.hookUp('afterEach', this.next);\n return;\n }\n\n // bail on hooks\n this.emit('end');\n};\n\n/**\n * Run the root suite and invoke `fn(failures)`\n * on completion.\n *\n * @param {Function} fn\n * @return {Runner} for chaining\n * @api public\n */\n\nRunner.prototype.run = function(fn){\n var self = this,\n rootSuite = this.suite;\n\n fn = fn || function(){};\n\n function uncaught(err){\n self.uncaught(err);\n }\n\n function start() {\n self.emit('start');\n self.runSuite(rootSuite, function(){\n debug('finished running');\n self.emit('end');\n });\n }\n\n debug('start');\n\n // callback\n this.on('end', function(){\n debug('end');\n process.removeListener('uncaughtException', uncaught);\n fn(self.failures);\n });\n\n // uncaught exception\n process.on('uncaughtException', uncaught);\n\n if (this._delay) {\n // for reporters, I guess.\n // might be nice to debounce some dots while we wait.\n this.emit('waiting', rootSuite);\n rootSuite.once('run', start);\n }\n else {\n start();\n }\n\n return this;\n};\n\n/**\n * Cleanly abort execution\n *\n * @return {Runner} for chaining\n * @api public\n */\nRunner.prototype.abort = function(){\n debug('aborting');\n this._abort = true;\n};\n\n/**\n * Filter leaks with the given globals flagged as `ok`.\n *\n * @param {Array} ok\n * @param {Array} globals\n * @return {Array}\n * @api private\n */\n\nfunction filterLeaks(ok, globals) {\n return filter(globals, function(key){\n // Firefox and Chrome exposes iframes as index inside the window object\n if (/^d+/.test(key)) return false;\n\n // in firefox\n // if runner runs in an iframe, this iframe's window.getInterface method not init at first\n // it is assigned in some seconds\n if (global.navigator && /^getInterface/.test(key)) return false;\n\n // an iframe could be approached by window[iframeIndex]\n // in ie6,7,8 and opera, iframeIndex is enumerable, this could cause leak\n if (global.navigator && /^\\d+/.test(key)) return false;\n\n // Opera and IE expose global variables for HTML element IDs (issue #243)\n if (/^mocha-/.test(key)) return false;\n\n var matched = filter(ok, function(ok){\n if (~ok.indexOf('*')) return 0 == key.indexOf(ok.split('*')[0]);\n return key == ok;\n });\n return matched.length == 0 && (!global.navigator || 'onerror' !== key);\n });\n}\n\n/**\n * Array of globals dependent on the environment.\n *\n * @return {Array}\n * @api private\n */\n\nfunction extraGlobals() {\n if (typeof(process) === 'object' &&\n typeof(process.version) === 'string') {\n\n var nodeVersion = process.version.split('.').reduce(function(a, v) {\n return a << 8 | v;\n });\n\n // 'errno' was renamed to process._errno in v0.9.11.\n\n if (nodeVersion < 0x00090B) {\n return ['errno'];\n }\n }\n\n return [];\n}\n\n}); // module: runner.js\n\nrequire.register(\"suite.js\", function(module, exports, require){\n/**\n * Module dependencies.\n */\n\nvar EventEmitter = require('browser/events').EventEmitter\n , debug = require('browser/debug')('mocha:suite')\n , milliseconds = require('./ms')\n , utils = require('./utils')\n , Hook = require('./hook');\n\n/**\n * Expose `Suite`.\n */\n\nexports = module.exports = Suite;\n\n/**\n * Create a new `Suite` with the given `title`\n * and parent `Suite`. When a suite with the\n * same title is already present, that suite\n * is returned to provide nicer reporter\n * and more flexible meta-testing.\n *\n * @param {Suite} parent\n * @param {String} title\n * @return {Suite}\n * @api public\n */\n\nexports.create = function(parent, title){\n var suite = new Suite(title, parent.ctx);\n suite.parent = parent;\n if (parent.pending) suite.pending = true;\n title = suite.fullTitle();\n parent.addSuite(suite);\n return suite;\n};\n\n/**\n * Initialize a new `Suite` with the given\n * `title` and `ctx`.\n *\n * @param {String} title\n * @param {Context} ctx\n * @api private\n */\n\nfunction Suite(title, parentContext) {\n this.title = title;\n var context = function() {};\n context.prototype = parentContext;\n this.ctx = new context();\n this.suites = [];\n this.tests = [];\n this.pending = false;\n this._beforeEach = [];\n this._beforeAll = [];\n this._afterEach = [];\n this._afterAll = [];\n this.root = !title;\n this._timeout = 2000;\n this._enableTimeouts = true;\n this._slow = 75;\n this._bail = false;\n this.delayed = false;\n}\n\n/**\n * Inherit from `EventEmitter.prototype`.\n */\n\nfunction F(){};\nF.prototype = EventEmitter.prototype;\nSuite.prototype = new F;\nSuite.prototype.constructor = Suite;\n\n\n/**\n * Return a clone of this `Suite`.\n *\n * @return {Suite}\n * @api private\n */\n\nSuite.prototype.clone = function(){\n var suite = new Suite(this.title);\n debug('clone');\n suite.ctx = this.ctx;\n suite.timeout(this.timeout());\n suite.enableTimeouts(this.enableTimeouts());\n suite.slow(this.slow());\n suite.bail(this.bail());\n return suite;\n};\n\n/**\n * Set timeout `ms` or short-hand such as \"2s\".\n *\n * @param {Number|String} ms\n * @return {Suite|Number} for chaining\n * @api private\n */\n\nSuite.prototype.timeout = function(ms){\n if (0 == arguments.length) return this._timeout;\n if (ms.toString() === '0') this._enableTimeouts = false;\n if ('string' == typeof ms) ms = milliseconds(ms);\n debug('timeout %d', ms);\n this._timeout = parseInt(ms, 10);\n return this;\n};\n\n/**\n * Set timeout `enabled`.\n *\n * @param {Boolean} enabled\n * @return {Suite|Boolean} self or enabled\n * @api private\n */\n\nSuite.prototype.enableTimeouts = function(enabled){\n if (arguments.length === 0) return this._enableTimeouts;\n debug('enableTimeouts %s', enabled);\n this._enableTimeouts = enabled;\n return this;\n};\n\n/**\n * Set slow `ms` or short-hand such as \"2s\".\n *\n * @param {Number|String} ms\n * @return {Suite|Number} for chaining\n * @api private\n */\n\nSuite.prototype.slow = function(ms){\n if (0 === arguments.length) return this._slow;\n if ('string' == typeof ms) ms = milliseconds(ms);\n debug('slow %d', ms);\n this._slow = ms;\n return this;\n};\n\n/**\n * Sets whether to bail after first error.\n *\n * @param {Boolean} bail\n * @return {Suite|Number} for chaining\n * @api private\n */\n\nSuite.prototype.bail = function(bail){\n if (0 == arguments.length) return this._bail;\n debug('bail %s', bail);\n this._bail = bail;\n return this;\n};\n\n/**\n * Run `fn(test[, done])` before running tests.\n *\n * @param {Function} fn\n * @return {Suite} for chaining\n * @api private\n */\n\nSuite.prototype.beforeAll = function(title, fn){\n if (this.pending) return this;\n if ('function' === typeof title) {\n fn = title;\n title = fn.name;\n }\n title = '\"before all\" hook' + (title ? ': ' + title : '');\n\n var hook = new Hook(title, fn);\n hook.parent = this;\n hook.timeout(this.timeout());\n hook.enableTimeouts(this.enableTimeouts());\n hook.slow(this.slow());\n hook.ctx = this.ctx;\n this._beforeAll.push(hook);\n this.emit('beforeAll', hook);\n return this;\n};\n\n/**\n * Run `fn(test[, done])` after running tests.\n *\n * @param {Function} fn\n * @return {Suite} for chaining\n * @api private\n */\n\nSuite.prototype.afterAll = function(title, fn){\n if (this.pending) return this;\n if ('function' === typeof title) {\n fn = title;\n title = fn.name;\n }\n title = '\"after all\" hook' + (title ? ': ' + title : '');\n\n var hook = new Hook(title, fn);\n hook.parent = this;\n hook.timeout(this.timeout());\n hook.enableTimeouts(this.enableTimeouts());\n hook.slow(this.slow());\n hook.ctx = this.ctx;\n this._afterAll.push(hook);\n this.emit('afterAll', hook);\n return this;\n};\n\n/**\n * Run `fn(test[, done])` before each test case.\n *\n * @param {Function} fn\n * @return {Suite} for chaining\n * @api private\n */\n\nSuite.prototype.beforeEach = function(title, fn){\n if (this.pending) return this;\n if ('function' === typeof title) {\n fn = title;\n title = fn.name;\n }\n title = '\"before each\" hook' + (title ? ': ' + title : '');\n\n var hook = new Hook(title, fn);\n hook.parent = this;\n hook.timeout(this.timeout());\n hook.enableTimeouts(this.enableTimeouts());\n hook.slow(this.slow());\n hook.ctx = this.ctx;\n this._beforeEach.push(hook);\n this.emit('beforeEach', hook);\n return this;\n};\n\n/**\n * Run `fn(test[, done])` after each test case.\n *\n * @param {Function} fn\n * @return {Suite} for chaining\n * @api private\n */\n\nSuite.prototype.afterEach = function(title, fn){\n if (this.pending) return this;\n if ('function' === typeof title) {\n fn = title;\n title = fn.name;\n }\n title = '\"after each\" hook' + (title ? ': ' + title : '');\n\n var hook = new Hook(title, fn);\n hook.parent = this;\n hook.timeout(this.timeout());\n hook.enableTimeouts(this.enableTimeouts());\n hook.slow(this.slow());\n hook.ctx = this.ctx;\n this._afterEach.push(hook);\n this.emit('afterEach', hook);\n return this;\n};\n\n/**\n * Add a test `suite`.\n *\n * @param {Suite} suite\n * @return {Suite} for chaining\n * @api private\n */\n\nSuite.prototype.addSuite = function(suite){\n suite.parent = this;\n suite.timeout(this.timeout());\n suite.enableTimeouts(this.enableTimeouts());\n suite.slow(this.slow());\n suite.bail(this.bail());\n this.suites.push(suite);\n this.emit('suite', suite);\n return this;\n};\n\n/**\n * Add a `test` to this suite.\n *\n * @param {Test} test\n * @return {Suite} for chaining\n * @api private\n */\n\nSuite.prototype.addTest = function(test){\n test.parent = this;\n test.timeout(this.timeout());\n test.enableTimeouts(this.enableTimeouts());\n test.slow(this.slow());\n test.ctx = this.ctx;\n this.tests.push(test);\n this.emit('test', test);\n return this;\n};\n\n/**\n * Return the full title generated by recursively\n * concatenating the parent's full title.\n *\n * @return {String}\n * @api public\n */\n\nSuite.prototype.fullTitle = function(){\n if (this.parent) {\n var full = this.parent.fullTitle();\n if (full) return full + ' ' + this.title;\n }\n return this.title;\n};\n\n/**\n * Return the total number of tests.\n *\n * @return {Number}\n * @api public\n */\n\nSuite.prototype.total = function(){\n return utils.reduce(this.suites, function(sum, suite){\n return sum + suite.total();\n }, 0) + this.tests.length;\n};\n\n/**\n * Iterates through each suite recursively to find\n * all tests. Applies a function in the format\n * `fn(test)`.\n *\n * @param {Function} fn\n * @return {Suite}\n * @api private\n */\n\nSuite.prototype.eachTest = function(fn){\n utils.forEach(this.tests, fn);\n utils.forEach(this.suites, function(suite){\n suite.eachTest(fn);\n });\n return this;\n};\n\n/**\n * This will run the root suite if we happen to be running in delayed mode.\n */\nSuite.prototype.run = function run() {\n if (this.root) {\n this.emit('run');\n }\n};\n\n}); // module: suite.js\n\nrequire.register(\"test.js\", function(module, exports, require){\n/**\n * Module dependencies.\n */\n\nvar Runnable = require('./runnable');\n\n/**\n * Expose `Test`.\n */\n\nmodule.exports = Test;\n\n/**\n * Initialize a new `Test` with the given `title` and callback `fn`.\n *\n * @param {String} title\n * @param {Function} fn\n * @api private\n */\n\nfunction Test(title, fn) {\n Runnable.call(this, title, fn);\n this.pending = !fn;\n this.type = 'test';\n}\n\n/**\n * Inherit from `Runnable.prototype`.\n */\n\nfunction F(){};\nF.prototype = Runnable.prototype;\nTest.prototype = new F;\nTest.prototype.constructor = Test;\n\n\n}); // module: test.js\n\nrequire.register(\"utils.js\", function(module, exports, require){\n/**\n * Module dependencies.\n */\n\nvar fs = require('browser/fs')\n , path = require('browser/path')\n , basename = path.basename\n , exists = fs.existsSync || path.existsSync\n , glob = require('browser/glob')\n , join = path.join\n , debug = require('browser/debug')('mocha:watch');\n\n/**\n * Ignored directories.\n */\n\nvar ignore = ['node_modules', '.git'];\n\n/**\n * Escape special characters in the given string of html.\n *\n * @param {String} html\n * @return {String}\n * @api private\n */\n\nexports.escape = function(html){\n return String(html)\n .replace(/&/g, '&')\n .replace(/\"/g, '"')\n .replace(/</g, '<')\n .replace(/>/g, '>');\n};\n\n/**\n * Array#forEach (<=IE8)\n *\n * @param {Array} array\n * @param {Function} fn\n * @param {Object} scope\n * @api private\n */\n\nexports.forEach = function(arr, fn, scope){\n for (var i = 0, l = arr.length; i < l; i++)\n fn.call(scope, arr[i], i);\n};\n\n/**\n * Array#map (<=IE8)\n *\n * @param {Array} array\n * @param {Function} fn\n * @param {Object} scope\n * @api private\n */\n\nexports.map = function(arr, fn, scope){\n var result = [];\n for (var i = 0, l = arr.length; i < l; i++)\n result.push(fn.call(scope, arr[i], i, arr));\n return result;\n};\n\n/**\n * Array#indexOf (<=IE8)\n *\n * @parma {Array} arr\n * @param {Object} obj to find index of\n * @param {Number} start\n * @api private\n */\n\nexports.indexOf = function(arr, obj, start){\n for (var i = start || 0, l = arr.length; i < l; i++) {\n if (arr[i] === obj)\n return i;\n }\n return -1;\n};\n\n/**\n * Array#reduce (<=IE8)\n *\n * @param {Array} array\n * @param {Function} fn\n * @param {Object} initial value\n * @api private\n */\n\nexports.reduce = function(arr, fn, val){\n var rval = val;\n\n for (var i = 0, l = arr.length; i < l; i++) {\n rval = fn(rval, arr[i], i, arr);\n }\n\n return rval;\n};\n\n/**\n * Array#filter (<=IE8)\n *\n * @param {Array} array\n * @param {Function} fn\n * @api private\n */\n\nexports.filter = function(arr, fn){\n var ret = [];\n\n for (var i = 0, l = arr.length; i < l; i++) {\n var val = arr[i];\n if (fn(val, i, arr)) ret.push(val);\n }\n\n return ret;\n};\n\n/**\n * Object.keys (<=IE8)\n *\n * @param {Object} obj\n * @return {Array} keys\n * @api private\n */\n\nexports.keys = Object.keys || function(obj) {\n var keys = []\n , has = Object.prototype.hasOwnProperty; // for `window` on <=IE8\n\n for (var key in obj) {\n if (has.call(obj, key)) {\n keys.push(key);\n }\n }\n\n return keys;\n};\n\n/**\n * Watch the given `files` for changes\n * and invoke `fn(file)` on modification.\n *\n * @param {Array} files\n * @param {Function} fn\n * @api private\n */\n\nexports.watch = function(files, fn){\n var options = { interval: 100 };\n files.forEach(function(file){\n debug('file %s', file);\n fs.watchFile(file, options, function(curr, prev){\n if (prev.mtime < curr.mtime) fn(file);\n });\n });\n};\n\n/**\n * Array.isArray (<=IE8)\n *\n * @param {Object} obj\n * @return {Boolean}\n * @api private\n */\nvar isArray = Array.isArray || function (obj) {\n return '[object Array]' == {}.toString.call(obj);\n};\n\n/**\n * @description\n * Buffer.prototype.toJSON polyfill\n * @type {Function}\n */\nif(typeof Buffer !== 'undefined' && Buffer.prototype) {\n Buffer.prototype.toJSON = Buffer.prototype.toJSON || function () {\n return Array.prototype.slice.call(this, 0);\n };\n}\n\n/**\n * Ignored files.\n */\n\nfunction ignored(path){\n return !~ignore.indexOf(path);\n}\n\n/**\n * Lookup files in the given `dir`.\n *\n * @return {Array}\n * @api private\n */\n\nexports.files = function(dir, ext, ret){\n ret = ret || [];\n ext = ext || ['js'];\n\n var re = new RegExp('\\\\.(' + ext.join('|') + ')$');\n\n fs.readdirSync(dir)\n .filter(ignored)\n .forEach(function(path){\n path = join(dir, path);\n if (fs.statSync(path).isDirectory()) {\n exports.files(path, ext, ret);\n } else if (path.match(re)) {\n ret.push(path);\n }\n });\n\n return ret;\n};\n\n/**\n * Compute a slug from the given `str`.\n *\n * @param {String} str\n * @return {String}\n * @api private\n */\n\nexports.slug = function(str){\n return str\n .toLowerCase()\n .replace(/ +/g, '-')\n .replace(/[^-\\w]/g, '');\n};\n\n/**\n * Strip the function definition from `str`,\n * and re-indent for pre whitespace.\n */\n\nexports.clean = function(str) {\n str = str\n .replace(/\\r\\n?|[\\n\\u2028\\u2029]/g, \"\\n\").replace(/^\\uFEFF/, '')\n .replace(/^function *\\(.*\\)\\s*{|\\(.*\\) *=> *{?/, '')\n .replace(/\\s+\\}$/, '');\n\n var spaces = str.match(/^\\n?( *)/)[1].length\n , tabs = str.match(/^\\n?(\\t*)/)[1].length\n , re = new RegExp('^\\n?' + (tabs ? '\\t' : ' ') + '{' + (tabs ? tabs : spaces) + '}', 'gm');\n\n str = str.replace(re, '');\n\n return exports.trim(str);\n};\n\n/**\n * Trim the given `str`.\n *\n * @param {String} str\n * @return {String}\n * @api private\n */\n\nexports.trim = function(str){\n return str.replace(/^\\s+|\\s+$/g, '');\n};\n\n/**\n * Parse the given `qs`.\n *\n * @param {String} qs\n * @return {Object}\n * @api private\n */\n\nexports.parseQuery = function(qs){\n return exports.reduce(qs.replace('?', '').split('&'), function(obj, pair){\n var i = pair.indexOf('=')\n , key = pair.slice(0, i)\n , val = pair.slice(++i);\n\n obj[key] = decodeURIComponent(val);\n return obj;\n }, {});\n};\n\n/**\n * Highlight the given string of `js`.\n *\n * @param {String} js\n * @return {String}\n * @api private\n */\n\nfunction highlight(js) {\n return js\n .replace(/</g, '<')\n .replace(/>/g, '>')\n .replace(/\\/\\/(.*)/gm, '<span class=\"comment\">//$1</span>')\n .replace(/('.*?')/gm, '<span class=\"string\">$1</span>')\n .replace(/(\\d+\\.\\d+)/gm, '<span class=\"number\">$1</span>')\n .replace(/(\\d+)/gm, '<span class=\"number\">$1</span>')\n .replace(/\\bnew[ \\t]+(\\w+)/gm, '<span class=\"keyword\">new</span> <span class=\"init\">$1</span>')\n .replace(/\\b(function|new|throw|return|var|if|else)\\b/gm, '<span class=\"keyword\">$1</span>')\n}\n\n/**\n * Highlight the contents of tag `name`.\n *\n * @param {String} name\n * @api private\n */\n\nexports.highlightTags = function(name) {\n var code = document.getElementById('mocha').getElementsByTagName(name);\n for (var i = 0, len = code.length; i < len; ++i) {\n code[i].innerHTML = highlight(code[i].innerHTML);\n }\n};\n\n/**\n * If a value could have properties, and has none, this function is called, which returns\n * a string representation of the empty value.\n *\n * Functions w/ no properties return `'[Function]'`\n * Arrays w/ length === 0 return `'[]'`\n * Objects w/ no properties return `'{}'`\n * All else: return result of `value.toString()`\n *\n * @param {*} value Value to inspect\n * @param {string} [type] The type of the value, if known.\n * @returns {string}\n */\nvar emptyRepresentation = function emptyRepresentation(value, type) {\n type = type || exports.type(value);\n\n switch(type) {\n case 'function':\n return '[Function]';\n case 'object':\n return '{}';\n case 'array':\n return '[]';\n default:\n return value.toString();\n }\n};\n\n/**\n * Takes some variable and asks `{}.toString()` what it thinks it is.\n * @param {*} value Anything\n * @example\n * type({}) // 'object'\n * type([]) // 'array'\n * type(1) // 'number'\n * type(false) // 'boolean'\n * type(Infinity) // 'number'\n * type(null) // 'null'\n * type(new Date()) // 'date'\n * type(/foo/) // 'regexp'\n * type('type') // 'string'\n * type(global) // 'global'\n * @api private\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toString\n * @returns {string}\n */\nexports.type = function type(value) {\n if (typeof Buffer !== 'undefined' && Buffer.isBuffer(value)) {\n return 'buffer';\n }\n return Object.prototype.toString.call(value)\n .replace(/^\\[.+\\s(.+?)\\]$/, '$1')\n .toLowerCase();\n};\n\n/**\n * @summary Stringify `value`.\n * @description Different behavior depending on type of value.\n * - If `value` is undefined or null, return `'[undefined]'` or `'[null]'`, respectively.\n * - If `value` is not an object, function or array, return result of `value.toString()` wrapped in double-quotes.\n * - If `value` is an *empty* object, function, or array, return result of function\n * {@link emptyRepresentation}.\n * - If `value` has properties, call {@link exports.canonicalize} on it, then return result of\n * JSON.stringify().\n *\n * @see exports.type\n * @param {*} value\n * @return {string}\n * @api private\n */\n\nexports.stringify = function(value) {\n var type = exports.type(value);\n\n if (!~exports.indexOf(['object', 'array', 'function'], type)) {\n if(type != 'buffer') {\n return jsonStringify(value);\n }\n var json = value.toJSON();\n // Based on the toJSON result\n return jsonStringify(json.data && json.type ? json.data : json, 2)\n .replace(/,(\\n|$)/g, '$1');\n }\n\n for (var prop in value) {\n if (Object.prototype.hasOwnProperty.call(value, prop)) {\n return jsonStringify(exports.canonicalize(value), 2).replace(/,(\\n|$)/g, '$1');\n }\n }\n\n return emptyRepresentation(value, type);\n};\n\n/**\n * @description\n * like JSON.stringify but more sense.\n * @param {Object} object\n * @param {Number=} spaces\n * @param {number=} depth\n * @returns {*}\n * @private\n */\nfunction jsonStringify(object, spaces, depth) {\n if(typeof spaces == 'undefined') return _stringify(object); // primitive types\n\n depth = depth || 1;\n var space = spaces * depth\n , str = isArray(object) ? '[' : '{'\n , end = isArray(object) ? ']' : '}'\n , length = object.length || exports.keys(object).length\n , repeat = function(s, n) { return new Array(n).join(s); }; // `.repeat()` polyfill\n\n function _stringify(val) {\n switch (exports.type(val)) {\n case 'null':\n case 'undefined':\n val = '[' + val + ']';\n break;\n case 'array':\n case 'object':\n val = jsonStringify(val, spaces, depth + 1);\n break;\n case 'boolean':\n case 'regexp':\n case 'number':\n val = val === 0 && (1/val) === -Infinity // `-0`\n ? '-0'\n : val.toString();\n break;\n case 'date':\n val = '[Date: ' + val.toISOString() + ']';\n break;\n case 'buffer':\n var json = val.toJSON();\n // Based on the toJSON result\n json = json.data && json.type ? json.data : json;\n val = '[Buffer: ' + jsonStringify(json, 2, depth + 1) + ']';\n break;\n default:\n val = (val == '[Function]' || val == '[Circular]')\n ? val\n : '\"' + val + '\"'; //string\n }\n return val;\n }\n\n for(var i in object) {\n if(!object.hasOwnProperty(i)) continue; // not my business\n --length;\n str += '\\n ' + repeat(' ', space)\n + (isArray(object) ? '' : '\"' + i + '\": ') // key\n + _stringify(object[i]) // value\n + (length ? ',' : ''); // comma\n }\n\n return str + (str.length != 1 // [], {}\n ? '\\n' + repeat(' ', --space) + end\n : end);\n}\n\n/**\n * Return if obj is a Buffer\n * @param {Object} arg\n * @return {Boolean}\n * @api private\n */\nexports.isBuffer = function (arg) {\n return typeof Buffer !== 'undefined' && Buffer.isBuffer(arg);\n};\n\n/**\n * @summary Return a new Thing that has the keys in sorted order. Recursive.\n * @description If the Thing...\n * - has already been seen, return string `'[Circular]'`\n * - is `undefined`, return string `'[undefined]'`\n * - is `null`, return value `null`\n * - is some other primitive, return the value\n * - is not a primitive or an `Array`, `Object`, or `Function`, return the value of the Thing's `toString()` method\n * - is a non-empty `Array`, `Object`, or `Function`, return the result of calling this function again.\n * - is an empty `Array`, `Object`, or `Function`, return the result of calling `emptyRepresentation()`\n *\n * @param {*} value Thing to inspect. May or may not have properties.\n * @param {Array} [stack=[]] Stack of seen values\n * @return {(Object|Array|Function|string|undefined)}\n * @see {@link exports.stringify}\n * @api private\n */\n\nexports.canonicalize = function(value, stack) {\n var canonicalizedObj,\n type = exports.type(value),\n prop,\n withStack = function withStack(value, fn) {\n stack.push(value);\n fn();\n stack.pop();\n };\n\n stack = stack || [];\n\n if (exports.indexOf(stack, value) !== -1) {\n return '[Circular]';\n }\n\n switch(type) {\n case 'undefined':\n case 'buffer':\n case 'null':\n canonicalizedObj = value;\n break;\n case 'array':\n withStack(value, function () {\n canonicalizedObj = exports.map(value, function (item) {\n return exports.canonicalize(item, stack);\n });\n });\n break;\n case 'function':\n for (prop in value) {\n canonicalizedObj = {};\n break;\n }\n if (!canonicalizedObj) {\n canonicalizedObj = emptyRepresentation(value, type);\n break;\n }\n /* falls through */\n case 'object':\n canonicalizedObj = canonicalizedObj || {};\n withStack(value, function () {\n exports.forEach(exports.keys(value).sort(), function (key) {\n canonicalizedObj[key] = exports.canonicalize(value[key], stack);\n });\n });\n break;\n case 'date':\n case 'number':\n case 'regexp':\n case 'boolean':\n canonicalizedObj = value;\n break;\n default:\n canonicalizedObj = value.toString();\n }\n\n return canonicalizedObj;\n};\n\n/**\n * Lookup file names at the given `path`.\n */\nexports.lookupFiles = function lookupFiles(path, extensions, recursive) {\n var files = [];\n var re = new RegExp('\\\\.(' + extensions.join('|') + ')$');\n\n if (!exists(path)) {\n if (exists(path + '.js')) {\n path += '.js';\n } else {\n files = glob.sync(path);\n if (!files.length) throw new Error(\"cannot resolve path (or pattern) '\" + path + \"'\");\n return files;\n }\n }\n\n try {\n var stat = fs.statSync(path);\n if (stat.isFile()) return path;\n }\n catch (ignored) {\n return;\n }\n\n fs.readdirSync(path).forEach(function(file) {\n file = join(path, file);\n try {\n var stat = fs.statSync(file);\n if (stat.isDirectory()) {\n if (recursive) {\n files = files.concat(lookupFiles(file, extensions, recursive));\n }\n return;\n }\n }\n catch (ignored) {\n return;\n }\n if (!stat.isFile() || !re.test(file) || basename(file)[0] === '.') return;\n files.push(file);\n });\n\n return files;\n};\n\n/**\n * Generate an undefined error with a message warning the user.\n *\n * @return {Error}\n */\n\nexports.undefinedError = function() {\n return new Error('Caught undefined error, did you throw without specifying what?');\n};\n\n/**\n * Generate an undefined error if `err` is not defined.\n *\n * @param {Error} err\n * @return {Error}\n */\n\nexports.getError = function(err) {\n return err || exports.undefinedError();\n};\n\n\n/**\n * @summary\n * This Filter based on `mocha-clean` module.(see: `github.com/rstacruz/mocha-clean`)\n * @description\n * When invoking this function you get a filter function that get the Error.stack as an input,\n * and return a prettify output.\n * (i.e: strip Mocha, node_modules, bower and componentJS from stack trace).\n * @returns {Function}\n */\n\nexports.stackTraceFilter = function() {\n var slash = '/'\n , is = typeof document === 'undefined'\n ? { node: true }\n : { browser: true }\n , cwd = is.node\n ? process.cwd() + slash\n : location.href.replace(/\\/[^\\/]*$/, '/');\n\n function isNodeModule (line) {\n return (~line.indexOf('node_modules'));\n }\n\n function isMochaInternal (line) {\n return (~line.indexOf('node_modules' + slash + 'mocha')) ||\n (~line.indexOf('components' + slash + 'mochajs')) ||\n (~line.indexOf('components' + slash + 'mocha'));\n }\n\n // node_modules, bower, componentJS\n function isBrowserModule(line) {\n return (~line.indexOf('node_modules')) ||\n (~line.indexOf('components'));\n }\n\n function isNodeInternal (line) {\n return (~line.indexOf('(timers.js:')) ||\n (~line.indexOf('(events.js:')) ||\n (~line.indexOf('(node.js:')) ||\n (~line.indexOf('(module.js:')) ||\n (~line.indexOf('GeneratorFunctionPrototype.next (native)')) ||\n false\n }\n\n return function(stack) {\n stack = stack.split('\\n');\n\n stack = exports.reduce(stack, function(list, line) {\n if (is.node && (isNodeModule(line) ||\n isMochaInternal(line) ||\n isNodeInternal(line)))\n return list;\n\n if (is.browser && (isBrowserModule(line)))\n return list;\n\n // Clean up cwd(absolute)\n list.push(line.replace(cwd, ''));\n return list;\n }, []);\n\n return stack.join('\\n');\n }\n};\n}); // module: utils.js\n// The global object is \"self\" in Web Workers.\nvar global = (function() { return this; })();\n\n/**\n * Save timer references to avoid Sinon interfering (see GH-237).\n */\n\nvar Date = global.Date;\nvar setTimeout = global.setTimeout;\nvar setInterval = global.setInterval;\nvar clearTimeout = global.clearTimeout;\nvar clearInterval = global.clearInterval;\n\n/**\n * Node shims.\n *\n * These are meant only to allow\n * mocha.js to run untouched, not\n * to allow running node code in\n * the browser.\n */\n\nvar process = {};\nprocess.exit = function(status){};\nprocess.stdout = {};\n\nvar uncaughtExceptionHandlers = [];\n\nvar originalOnerrorHandler = global.onerror;\n\n/**\n * Remove uncaughtException listener.\n * Revert to original onerror handler if previously defined.\n */\n\nprocess.removeListener = function(e, fn){\n if ('uncaughtException' == e) {\n if (originalOnerrorHandler) {\n global.onerror = originalOnerrorHandler;\n } else {\n global.onerror = function() {};\n }\n var i = Mocha.utils.indexOf(uncaughtExceptionHandlers, fn);\n if (i != -1) { uncaughtExceptionHandlers.splice(i, 1); }\n }\n};\n\n/**\n * Implements uncaughtException listener.\n */\n\nprocess.on = function(e, fn){\n if ('uncaughtException' == e) {\n global.onerror = function(err, url, line){\n fn(new Error(err + ' (' + url + ':' + line + ')'));\n return true;\n };\n uncaughtExceptionHandlers.push(fn);\n }\n};\n\n/**\n * Expose mocha.\n */\n\nvar Mocha = global.Mocha = require('mocha'),\n mocha = global.mocha = new Mocha({ reporter: 'html' });\n\n// The BDD UI is registered by default, but no UI will be functional in the\n// browser without an explicit call to the overridden `mocha.ui` (see below).\n// Ensure that this default UI does not expose its methods to the global scope.\nmocha.suite.removeAllListeners('pre-require');\n\nvar immediateQueue = []\n , immediateTimeout;\n\nfunction timeslice() {\n var immediateStart = new Date().getTime();\n while (immediateQueue.length && (new Date().getTime() - immediateStart) < 100) {\n immediateQueue.shift()();\n }\n if (immediateQueue.length) {\n immediateTimeout = setTimeout(timeslice, 0);\n } else {\n immediateTimeout = null;\n }\n}\n\n/**\n * High-performance override of Runner.immediately.\n */\n\nMocha.Runner.immediately = function(callback) {\n immediateQueue.push(callback);\n if (!immediateTimeout) {\n immediateTimeout = setTimeout(timeslice, 0);\n }\n};\n\n/**\n * Function to allow assertion libraries to throw errors directly into mocha.\n * This is useful when running tests in a browser because window.onerror will\n * only receive the 'message' attribute of the Error.\n */\nmocha.throwError = function(err) {\n Mocha.utils.forEach(uncaughtExceptionHandlers, function (fn) {\n fn(err);\n });\n throw err;\n};\n\n/**\n * Override ui to ensure that the ui functions are initialized.\n * Normally this would happen in Mocha.prototype.loadFiles.\n */\n\nmocha.ui = function(ui){\n Mocha.prototype.ui.call(this, ui);\n this.suite.emit('pre-require', global, null, this);\n return this;\n};\n\n/**\n * Setup mocha with the given setting options.\n */\n\nmocha.setup = function(opts){\n if ('string' == typeof opts) opts = { ui: opts };\n for (var opt in opts) this[opt](opts[opt]);\n return this;\n};\n\n/**\n * Run mocha, returning the Runner.\n */\n\nmocha.run = function(fn){\n var options = mocha.options;\n mocha.globals('location');\n\n var query = Mocha.utils.parseQuery(global.location.search || '');\n if (query.grep) mocha.grep(new RegExp(query.grep));\n if (query.fgrep) mocha.grep(query.fgrep);\n if (query.invert) mocha.invert();\n\n return Mocha.prototype.run.call(mocha, function(err){\n // The DOM Document is not available in Web Workers.\n var document = global.document;\n if (document && document.getElementById('mocha') && options.noHighlighting !== true) {\n Mocha.utils.highlightTags('code');\n }\n if (fn) fn(err);\n });\n};\n\n/**\n * Expose the process shim.\n */\n\nMocha.process = process;\n})();\n"
/***/ },
/* 9 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var chai = __webpack_require__(10);
var assert = chai.assert;
describe('my test suite', function () {
it('should work', function () {
assert(true);
});
});
/***/ },
/* 10 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
module.exports = __webpack_require__(11);
/***/ },
/* 11 */
/***/ function(module, exports, __webpack_require__) {
/*!
* chai
* Copyright(c) 2011-2014 Jake Luer <[email protected]>
* MIT Licensed
*/
'use strict';
var used = [],
_exports = module.exports = {};
/*!
* Chai version
*/
_exports.version = '3.2.0';
/*!
* Assertion Error
*/
_exports.AssertionError = __webpack_require__(13);
/*!
* Utils for plugins (not exported)
*/
var util = __webpack_require__(14);
/**
* # .use(function)
*
* Provides a way to extend the internals of Chai
*
* @param {Function}
* @returns {this} for chaining
* @api public
*/
_exports.use = function (fn) {
if (! ~used.indexOf(fn)) {
fn(this, util);
used.push(fn);
}
return this;
};
/*!
* Utility Functions
*/
_exports.util = util;
/*!
* Configuration
*/
var config = __webpack_require__(26);
_exports.config = config;
/*!
* Primary `Assertion` prototype
*/
var assertion = __webpack_require__(45);
_exports.use(assertion);
/*!
* Core Assertions
*/
var core = __webpack_require__(12);
_exports.use(core);
/*!
* Expect interface
*/
var expect = __webpack_require__(46);
_exports.use(expect);
/*!
* Should interface
*/
var should = __webpack_require__(47);
_exports.use(should);
/*!
* Assert interface
*/
var assert = __webpack_require__(48);
_exports.use(assert);
/***/ },
/* 12 */
/***/ function(module, exports) {
/*!
* chai
* http://chaijs.com
* Copyright(c) 2011-2014 Jake Luer <[email protected]>
* MIT Licensed
*/
'use strict';
module.exports = function (chai, _) {
var Assertion = chai.Assertion,
toString = Object.prototype.toString,
flag = _.flag;
/**
* ### Language Chains
*
* The following are provided as chainable getters to
* improve the readability of your assertions. They
* do not provide testing capabilities unless they
* have been overwritten by a plugin.
*
* **Chains**
*
* - to
* - be
* - been
* - is
* - that
* - which
* - and
* - has
* - have
* - with
* - at
* - of
* - same
*
* @name language chains
* @api public
*/
['to', 'be', 'been', 'is', 'and', 'has', 'have', 'with', 'that', 'which', 'at', 'of', 'same'].forEach(function (chain) {
Assertion.addProperty(chain, function () {
return this;
});
});
/**
* ### .not
*
* Negates any of assertions following in the chain.
*
* expect(foo).to.not.equal('bar');
* expect(goodFn).to.not.throw(Error);
* expect({ foo: 'baz' }).to.have.property('foo')
* .and.not.equal('bar');
*
* @name not
* @api public
*/
Assertion.addProperty('not', function () {
flag(this, 'negate', true);
});
/**
* ### .deep
*
* Sets the `deep` flag, later used by the `equal` and
* `property` assertions.
*
* expect(foo).to.deep.equal({ bar: 'baz' });
* expect({ foo: { bar: { baz: 'quux' } } })
* .to.have.deep.property('foo.bar.baz', 'quux');
*
* `.deep.property` special characters can be escaped
* by adding two slashes before the `.` or `[]`.
*
* var deepCss = { '.link': { '[target]': 42 }};
* expect(deepCss).to.have.deep.property('\\.link.\\[target\\]', 42);
*
* @name deep
* @api public
*/
Assertion.addProperty('deep', function () {
flag(this, 'deep', true);
});
/**
* ### .any
*
* Sets the `any` flag, (opposite of the `all` flag)
* later used in the `keys` assertion.
*
* expect(foo).to.have.any.keys('bar', 'baz');
*
* @name any
* @api public
*/
Assertion.addProperty('any', function () {
flag(this, 'any', true);
flag(this, 'all', false);
});
/**
* ### .all
*
* Sets the `all` flag (opposite of the `any` flag)
* later used by the `keys` assertion.
*
* expect(foo).to.have.all.keys('bar', 'baz');
*
* @name all
* @api public
*/
Assertion.addProperty('all', function () {
flag(this, 'all', true);
flag(this, 'any', false);
});
/**
* ### .a(type)
*
* The `a` and `an` assertions are aliases that can be
* used either as language chains or to assert a value's
* type.
*
* // typeof
* expect('test').to.be.a('string');
* expect({ foo: 'bar' }).to.be.an('object');
* expect(null).to.be.a('null');
* expect(undefined).to.be.an('undefined');
* expect(new Promise).to.be.a('promise');
* expect(new Float32Array()).to.be.a('float32array');
* expect(Symbol()).to.be.a('symbol');
*
* // es6 overrides
* expect({[Symbol.toStringTag]:()=>'foo'}).to.be.a('foo');
*
* // language chain
* expect(foo).to.be.an.instanceof(Foo);
*
* @name a
* @alias an
* @param {String} type
* @param {String} message _optional_
* @api public
*/
function an(type, msg) {
if (msg) flag(this, 'message', msg);
type = type.toLowerCase();
var obj = flag(this, 'object'),
article = ~['a', 'e', 'i', 'o', 'u'].indexOf(type.charAt(0)) ? 'an ' : 'a ';
this.assert(type === _.type(obj), 'expected #{this} to be ' + article + type, 'expected #{this} not to be ' + article + type);
}
Assertion.addChainableMethod('an', an);
Assertion.addChainableMethod('a', an);
/**
* ### .include(value)
*
* The `include` and `contain` assertions can be used as either property
* based language chains or as methods to assert the inclusion of an object
* in an array or a substring in a string. When used as language chains,
* they toggle the `contains` flag for the `keys` assertion.
*
* expect([1,2,3]).to.include(2);
* expect('foobar').to.contain('foo');
* expect({ foo: 'bar', hello: 'universe' }).to.include.keys('foo');
*
* @name include
* @alias contain
* @alias includes
* @alias contains
* @param {Object|String|Number} obj
* @param {String} message _optional_
* @api public
*/
function includeChainingBehavior() {
flag(this, 'contains', true);
}
function include(val, msg) {
if (msg) flag(this, 'message', msg);
var obj = flag(this, 'object');
var expected = false;
if (_.type(obj) === 'array' && _.type(val) === 'object') {
for (var i in obj) {
if (_.eql(obj[i], val)) {
expected = true;
break;
}
}
} else if (_.type(val) === 'object') {
if (!flag(this, 'negate')) {
for (var k in val) new Assertion(obj).property(k, val[k]);
return;
}
var subset = {};
for (var k in val) subset[k] = obj[k];
expected = _.eql(subset, val);
} else {
expected = obj && ~obj.indexOf(val);
}
this.assert(expected, 'expected #{this} to include ' + _.inspect(val), 'expected #{this} to not include ' + _.inspect(val));
}
Assertion.addChainableMethod('include', include, includeChainingBehavior);
Assertion.addChainableMethod('contain', include, includeChainingBehavior);
Assertion.addChainableMethod('contains', include, includeChainingBehavior);
Assertion.addChainableMethod('includes', include, includeChainingBehavior);
/**
* ### .ok
*
* Asserts that the target is truthy.
*
* expect('everthing').to.be.ok;
* expect(1).to.be.ok;
* expect(false).to.not.be.ok;
* expect(undefined).to.not.be.ok;
* expect(null).to.not.be.ok;
*
* @name ok
* @api public
*/
Assertion.addProperty('ok', function () {
this.assert(flag(this, 'object'), 'expected #{this} to be truthy', 'expected #{this} to be falsy');
});
/**
* ### .true
*
* Asserts that the target is `true`.
*
* expect(true).to.be.true;
* expect(1).to.not.be.true;
*
* @name true
* @api public
*/
Assertion.addProperty('true', function () {
this.assert(true === flag(this, 'object'), 'expected #{this} to be true', 'expected #{this} to be false', this.negate ? false : true);
});
/**
* ### .false
*
* Asserts that the target is `false`.
*
* expect(false).to.be.false;
* expect(0).to.not.be.false;
*
* @name false
* @api public
*/
Assertion.addProperty('false', function () {
this.assert(false === flag(this, 'object'), 'expected #{this} to be false', 'expected #{this} to be true', this.negate ? true : false);
});
/**
* ### .null
*
* Asserts that the target is `null`.
*
* expect(null).to.be.null;
* expect(undefined).to.not.be.null;
*
* @name null
* @api public
*/
Assertion.addProperty('null', function () {
this.assert(null === flag(this, 'object'), 'expected #{this} to be null', 'expected #{this} not to be null');
});
/**
* ### .undefined
*
* Asserts that the target is `undefined`.
*
* expect(undefined).to.be.undefined;
* expect(null).to.not.be.undefined;
*
* @name undefined
* @api public
*/
Assertion.addProperty('undefined', function () {
this.assert(undefined === flag(this, 'object'), 'expected #{this} to be undefined', 'expected #{this} not to be undefined');
});
/**
* ### .NaN
* Asserts that the target is `NaN`.
*
* expect('foo').to.be.NaN;
* expect(4).not.to.be.NaN;
*
* @name NaN
* @api public
*/
Assertion.addProperty('NaN', function () {
this.assert(isNaN(flag(this, 'object')), 'expected #{this} to be NaN', 'expected #{this} not to be NaN');
});
/**
* ### .exist
*
* Asserts that the target is neither `null` nor `undefined`.
*
* var foo = 'hi'
* , bar = null
* , baz;
*
* expect(foo).to.exist;
* expect(bar).to.not.exist;
* expect(baz).to.not.exist;
*
* @name exist
* @api public
*/
Assertion.addProperty('exist', function () {
this.assert(null != flag(this, 'object'), 'expected #{this} to exist', 'expected #{this} to not exist');
});
/**
* ### .empty
*
* Asserts that the target's length is `0`. For arrays and strings, it checks
* the `length` property. For objects, it gets the count of
* enumerable keys.
*
* expect([]).to.be.empty;
* expect('').to.be.empty;
* expect({}).to.be.empty;
*
* @name empty
* @api public
*/
Assertion.addProperty('empty', function () {
var obj = flag(this, 'object'),
expected = obj;
if (Array.isArray(obj) || 'string' === typeof object) {
expected = obj.length;
} else if (typeof obj === 'object') {
expected = Object.keys(obj).length;
}
this.assert(!expected, 'expected #{this} to be empty', 'expected #{this} not to be empty');
});
/**
* ### .arguments
*
* Asserts that the target is an arguments object.
*
* function test () {
* expect(arguments).to.be.arguments;
* }
*
* @name arguments
* @alias Arguments
* @api public
*/
function checkArguments() {
var obj = flag(this, 'object'),
type = Object.prototype.toString.call(obj);
this.assert('[object Arguments]' === type, 'expected #{this} to be arguments but got ' + type, 'expected #{this} to not be arguments');
}
Assertion.addProperty('arguments', checkArguments);
Assertion.addProperty('Arguments', checkArguments);
/**
* ### .equal(value)
*
* Asserts that the target is strictly equal (`===`) to `value`.
* Alternately, if the `deep` flag is set, asserts that
* the target is deeply equal to `value`.
*
* expect('hello').to.equal('hello');
* expect(42).to.equal(42);
* expect(1).to.not.equal(true);
* expect({ foo: 'bar' }).to.not.equal({ foo: 'bar' });
* expect({ foo: 'bar' }).to.deep.equal({ foo: 'bar' });
*
* @name equal
* @alias equals
* @alias eq
* @alias deep.equal
* @param {Mixed} value
* @param {String} message _optional_
* @api public
*/
function assertEqual(val, msg) {
if (msg) flag(this, 'message', msg);
var obj = flag(this, 'object');
if (flag(this, 'deep')) {
return this.eql(val);
} else {
this.assert(val === obj, 'expected #{this} to equal #{exp}', 'expected #{this} to not equal #{exp}', val, this._obj, true);
}
}
Assertion.addMethod('equal', assertEqual);
Assertion.addMethod('equals', assertEqual);
Assertion.addMethod('eq', assertEqual);
/**
* ### .eql(value)
*
* Asserts that the target is deeply equal to `value`.
*
* expect({ foo: 'bar' }).to.eql({ foo: 'bar' });
* expect([ 1, 2, 3 ]).to.eql([ 1, 2, 3 ]);
*
* @name eql
* @alias eqls
* @param {Mixed} value
* @param {String} message _optional_
* @api public
*/
function assertEql(obj, msg) {
if (msg) flag(this, 'message', msg);
this.assert(_.eql(obj, flag(this, 'object')), 'expected #{this} to deeply equal #{exp}', 'expected #{this} to not deeply equal #{exp}', obj, this._obj, true);
}
Assertion.addMethod('eql', assertEql);
Assertion.addMethod('eqls', assertEql);
/**
* ### .above(value)
*
* Asserts that the target is greater than `value`.
*
* expect(10).to.be.above(5);
*
* Can also be used in conjunction with `length` to
* assert a minimum length. The benefit being a
* more informative error message than if the length
* was supplied directly.
*
* expect('foo').to.have.length.above(2);
* expect([ 1, 2, 3 ]).to.have.length.above(2);
*
* @name above
* @alias gt
* @alias greaterThan
* @param {Number} value
* @param {String} message _optional_
* @api public
*/
function assertAbove(n, msg) {
if (msg) flag(this, 'message', msg);
var obj = flag(this, 'object');
if (flag(this, 'doLength')) {
new Assertion(obj, msg).to.have.property('length');
var len = obj.length;
this.assert(len > n, 'expected #{this} to have a length above #{exp} but got #{act}', 'expected #{this} to not have a length above #{exp}', n, len);
} else {
this.assert(obj > n, 'expected #{this} to be above ' + n, 'expected #{this} to be at most ' + n);
}
}
Assertion.addMethod('above', assertAbove);
Assertion.addMethod('gt', assertAbove);
Assertion.addMethod('greaterThan', assertAbove);
/**
* ### .least(value)
*
* Asserts that the target is greater than or equal to `value`.
*
* expect(10).to.be.at.least(10);
*
* Can also be used in conjunction with `length` to
* assert a minimum length. The benefit being a
* more informative error message than if the length
* was supplied directly.
*
* expect('foo').to.have.length.of.at.least(2);
* expect([ 1, 2, 3 ]).to.have.length.of.at.least(3);
*
* @name least
* @alias gte
* @param {Number} value
* @param {String} message _optional_
* @api public
*/
function assertLeast(n, msg) {
if (msg) flag(this, 'message', msg);
var obj = flag(this, 'object');
if (flag(this, 'doLength')) {
new Assertion(obj, msg).to.have.property('length');
var len = obj.length;
this.assert(len >= n, 'expected #{this} to have a length at least #{exp} but got #{act}', 'expected #{this} to have a length below #{exp}', n, len);
} else {
this.assert(obj >= n, 'expected #{this} to be at least ' + n, 'expected #{this} to be below ' + n);
}
}
Assertion.addMethod('least', assertLeast);
Assertion.addMethod('gte', assertLeast);
/**