stylus-source 0.31.0 → 0.32.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. checksums.yaml +7 -0
  2. data/VERSION +1 -1
  3. data/vendor/lib/nodes/unit.js +1 -1
  4. data/vendor/lib/parser.js +0 -1
  5. data/vendor/lib/renderer.js +2 -0
  6. data/vendor/lib/visitor/compiler.js +6 -0
  7. data/vendor/node_modules/cssom/README.mdown +34 -0
  8. data/vendor/node_modules/cssom/package.json +2 -1
  9. data/vendor/node_modules/debug/History.md +15 -0
  10. data/vendor/node_modules/debug/Readme.md +3 -18
  11. data/vendor/node_modules/debug/component.json +9 -0
  12. data/vendor/node_modules/debug/debug.js +10 -2
  13. data/vendor/node_modules/debug/index.js +5 -2
  14. data/vendor/node_modules/debug/lib/debug.js +5 -6
  15. data/vendor/node_modules/debug/package.json +11 -6
  16. data/vendor/node_modules/mkdirp/package.json +6 -9
  17. data/vendor/node_modules/mkdirp/{README.markdown → readme.markdown} +26 -24
  18. data/vendor/node_modules/mocha/History.md +140 -58
  19. data/vendor/node_modules/mocha/LICENSE +2 -2
  20. data/vendor/node_modules/mocha/Makefile +20 -5
  21. data/vendor/node_modules/mocha/Readme.md +110 -22
  22. data/vendor/node_modules/mocha/_mocha.js +574 -182
  23. data/vendor/node_modules/mocha/bin/_mocha +39 -22
  24. data/vendor/node_modules/mocha/bin/mocha +6 -2
  25. data/vendor/node_modules/mocha/component.json +16 -0
  26. data/vendor/node_modules/mocha/lib/browser/debug.js +1 -2
  27. data/vendor/node_modules/mocha/lib/browser/diff.js +287 -0
  28. data/vendor/node_modules/mocha/lib/browser/tty.js +7 -2
  29. data/vendor/node_modules/mocha/lib/hook.js +0 -1
  30. data/vendor/node_modules/mocha/lib/interfaces/bdd.js +3 -3
  31. data/vendor/node_modules/mocha/lib/interfaces/exports.js +5 -5
  32. data/vendor/node_modules/mocha/lib/interfaces/qunit.js +38 -9
  33. data/vendor/node_modules/mocha/lib/interfaces/tdd.js +15 -2
  34. data/vendor/node_modules/mocha/lib/mocha.js +20 -4
  35. data/vendor/node_modules/mocha/lib/reporters/base.js +57 -37
  36. data/vendor/node_modules/mocha/lib/reporters/html.js +2 -4
  37. data/vendor/node_modules/mocha/lib/reporters/json-stream.js +4 -14
  38. data/vendor/node_modules/mocha/lib/reporters/json.js +9 -19
  39. data/vendor/node_modules/mocha/lib/reporters/markdown.js +0 -1
  40. data/vendor/node_modules/mocha/lib/reporters/min.js +2 -2
  41. data/vendor/node_modules/mocha/lib/reporters/nyan.js +33 -39
  42. data/vendor/node_modules/mocha/lib/reporters/tap.js +12 -2
  43. data/vendor/node_modules/mocha/lib/reporters/templates/coverage.jade +3 -3
  44. data/vendor/node_modules/mocha/lib/reporters/templates/menu.jade +1 -1
  45. data/vendor/node_modules/mocha/lib/reporters/xunit.js +4 -4
  46. data/vendor/node_modules/mocha/lib/runnable.js +7 -9
  47. data/vendor/node_modules/mocha/lib/runner.js +24 -9
  48. data/vendor/node_modules/mocha/lib/template.html +2 -1
  49. data/vendor/node_modules/mocha/lib/utils.js +3 -3
  50. data/vendor/node_modules/mocha/mocha.css +37 -13
  51. data/vendor/node_modules/mocha/mocha.js +661 -253
  52. data/vendor/node_modules/mocha/node_modules/commander/package.json +5 -1
  53. data/vendor/node_modules/mocha/node_modules/diff/package.json +5 -1
  54. data/vendor/node_modules/mocha/node_modules/glob/LICENSE +27 -0
  55. data/vendor/node_modules/mocha/node_modules/glob/README.md +250 -0
  56. data/vendor/node_modules/mocha/node_modules/glob/examples/g.js +9 -0
  57. data/vendor/node_modules/mocha/node_modules/glob/examples/usr-local.js +9 -0
  58. data/vendor/node_modules/mocha/node_modules/glob/glob.js +675 -0
  59. data/vendor/node_modules/mocha/node_modules/glob/node_modules/graceful-fs/LICENSE +27 -0
  60. data/vendor/node_modules/mocha/node_modules/glob/node_modules/graceful-fs/README.md +33 -0
  61. data/vendor/node_modules/mocha/node_modules/glob/node_modules/graceful-fs/graceful-fs.js +442 -0
  62. data/vendor/node_modules/mocha/node_modules/glob/node_modules/graceful-fs/package.json +49 -0
  63. data/vendor/node_modules/mocha/node_modules/glob/node_modules/graceful-fs/test/open.js +46 -0
  64. data/vendor/node_modules/mocha/node_modules/glob/node_modules/graceful-fs/test/ulimit.js +158 -0
  65. data/vendor/node_modules/mocha/node_modules/glob/node_modules/inherits/README.md +51 -0
  66. data/vendor/node_modules/mocha/node_modules/glob/node_modules/inherits/inherits.js +29 -0
  67. data/vendor/node_modules/mocha/node_modules/glob/node_modules/inherits/package.json +26 -0
  68. data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/LICENSE +23 -0
  69. data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/README.md +218 -0
  70. data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/minimatch.js +1079 -0
  71. data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/AUTHORS +8 -0
  72. data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/LICENSE +23 -0
  73. data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/README.md +97 -0
  74. data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/lib/lru-cache.js +257 -0
  75. data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/package.json +59 -0
  76. data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/s.js +25 -0
  77. data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/test/basic.js +329 -0
  78. data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/test/foreach.js +52 -0
  79. data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/test/memory-leak.js +50 -0
  80. data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/sigmund/LICENSE +27 -0
  81. data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/sigmund/README.md +53 -0
  82. data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/sigmund/bench.js +283 -0
  83. data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/sigmund/package.json +38 -0
  84. data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/sigmund/sigmund.js +39 -0
  85. data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/sigmund/test/basic.js +24 -0
  86. data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/package.json +36 -0
  87. data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/test/basic.js +399 -0
  88. data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/test/brace-expand.js +33 -0
  89. data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/test/caching.js +14 -0
  90. data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/test/defaults.js +274 -0
  91. data/vendor/node_modules/mocha/node_modules/glob/package.json +40 -0
  92. data/vendor/node_modules/mocha/node_modules/glob/test/00-setup.js +176 -0
  93. data/vendor/node_modules/mocha/node_modules/glob/test/bash-comparison.js +63 -0
  94. data/vendor/node_modules/mocha/node_modules/glob/test/bash-results.json +350 -0
  95. data/vendor/node_modules/mocha/node_modules/glob/test/cwd-test.js +55 -0
  96. data/vendor/node_modules/mocha/node_modules/glob/test/globstar-match.js +19 -0
  97. data/vendor/node_modules/mocha/node_modules/glob/test/mark.js +74 -0
  98. data/vendor/node_modules/mocha/node_modules/glob/test/nocase-nomagic.js +113 -0
  99. data/vendor/node_modules/mocha/node_modules/glob/test/pause-resume.js +73 -0
  100. data/vendor/node_modules/mocha/node_modules/glob/test/root-nomount.js +39 -0
  101. data/vendor/node_modules/mocha/node_modules/glob/test/root.js +46 -0
  102. data/vendor/node_modules/mocha/node_modules/glob/test/stat.js +32 -0
  103. data/vendor/node_modules/mocha/node_modules/glob/test/zz-cleanup.js +11 -0
  104. data/vendor/node_modules/mocha/node_modules/growl/History.md +5 -0
  105. data/vendor/node_modules/mocha/node_modules/growl/lib/growl.js +2 -0
  106. data/vendor/node_modules/mocha/node_modules/growl/package.json +7 -3
  107. data/vendor/node_modules/mocha/node_modules/jade/node_modules/mkdirp/package.json +5 -1
  108. data/vendor/node_modules/mocha/node_modules/jade/package.json +5 -1
  109. data/vendor/node_modules/mocha/node_modules/ms/package.json +5 -1
  110. data/vendor/node_modules/mocha/package.json +13 -7
  111. data/vendor/node_modules/mocha/test.js +10 -21
  112. data/vendor/node_modules/should/History.md +5 -0
  113. data/vendor/node_modules/should/Readme.md +172 -172
  114. data/vendor/node_modules/should/lib/eql.js +2 -0
  115. data/vendor/node_modules/should/lib/should.js +4 -3
  116. data/vendor/node_modules/should/package.json +8 -4
  117. data/vendor/node_modules/should/test/should.test.js +27 -0
  118. data/vendor/package.json +1 -1
  119. metadata +61 -35
  120. data/vendor/node_modules/debug/Makefile +0 -4
  121. data/vendor/node_modules/debug/debug.component.js +0 -120
  122. data/vendor/node_modules/debug/head.js +0 -1
  123. data/vendor/node_modules/debug/tail.js +0 -4
  124. data/vendor/node_modules/mocha/node_modules/mkdirp/LICENSE +0 -21
  125. data/vendor/node_modules/mocha/node_modules/mkdirp/README.markdown +0 -61
  126. data/vendor/node_modules/mocha/node_modules/mkdirp/examples/pow.js +0 -6
  127. data/vendor/node_modules/mocha/node_modules/mkdirp/examples/pow.js.orig +0 -6
  128. data/vendor/node_modules/mocha/node_modules/mkdirp/examples/pow.js.rej +0 -19
  129. data/vendor/node_modules/mocha/node_modules/mkdirp/index.js +0 -94
  130. data/vendor/node_modules/mocha/node_modules/mkdirp/package.json +0 -33
  131. data/vendor/node_modules/mocha/node_modules/mkdirp/test/chmod.js +0 -38
  132. data/vendor/node_modules/mocha/node_modules/mkdirp/test/clobber.js +0 -37
  133. data/vendor/node_modules/mocha/node_modules/mkdirp/test/mkdirp.js +0 -28
  134. data/vendor/node_modules/mocha/node_modules/mkdirp/test/perm.js +0 -32
  135. data/vendor/node_modules/mocha/node_modules/mkdirp/test/perm_sync.js +0 -39
  136. data/vendor/node_modules/mocha/node_modules/mkdirp/test/race.js +0 -41
  137. data/vendor/node_modules/mocha/node_modules/mkdirp/test/rel.js +0 -32
  138. data/vendor/node_modules/mocha/node_modules/mkdirp/test/return.js +0 -25
  139. data/vendor/node_modules/mocha/node_modules/mkdirp/test/return_sync.js +0 -24
  140. data/vendor/node_modules/mocha/node_modules/mkdirp/test/root.js +0 -18
  141. data/vendor/node_modules/mocha/node_modules/mkdirp/test/sync.js +0 -32
  142. data/vendor/node_modules/mocha/node_modules/mkdirp/test/umask.js +0 -28
  143. data/vendor/node_modules/mocha/node_modules/mkdirp/test/umask_sync.js +0 -32
@@ -30,11 +30,11 @@ require.register = function (path, fn){
30
30
  require.relative = function (parent) {
31
31
  return function(p){
32
32
  if ('.' != p.charAt(0)) return require(p);
33
-
33
+
34
34
  var path = parent.split('/')
35
35
  , segs = p.split('/');
36
36
  path.pop();
37
-
37
+
38
38
  for (var i = 0; i < segs.length; i++) {
39
39
  var seg = segs[i];
40
40
  if ('..' == seg) path.pop();
@@ -50,12 +50,299 @@ require.register("browser/debug.js", function(module, exports, require){
50
50
 
51
51
  module.exports = function(type){
52
52
  return function(){
53
-
54
53
  }
55
54
  };
55
+
56
56
  }); // module: browser/debug.js
57
57
 
58
58
  require.register("browser/diff.js", function(module, exports, require){
59
+ /* See license.txt for terms of usage */
60
+
61
+ /*
62
+ * Text diff implementation.
63
+ *
64
+ * This library supports the following APIS:
65
+ * JsDiff.diffChars: Character by character diff
66
+ * JsDiff.diffWords: Word (as defined by \b regex) diff which ignores whitespace
67
+ * JsDiff.diffLines: Line based diff
68
+ *
69
+ * JsDiff.diffCss: Diff targeted at CSS content
70
+ *
71
+ * These methods are based on the implementation proposed in
72
+ * "An O(ND) Difference Algorithm and its Variations" (Myers, 1986).
73
+ * http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.4.6927
74
+ */
75
+ var JsDiff = (function() {
76
+ function clonePath(path) {
77
+ return { newPos: path.newPos, components: path.components.slice(0) };
78
+ }
79
+ function removeEmpty(array) {
80
+ var ret = [];
81
+ for (var i = 0; i < array.length; i++) {
82
+ if (array[i]) {
83
+ ret.push(array[i]);
84
+ }
85
+ }
86
+ return ret;
87
+ }
88
+ function escapeHTML(s) {
89
+ var n = s;
90
+ n = n.replace(/&/g, "&amp;");
91
+ n = n.replace(/</g, "&lt;");
92
+ n = n.replace(/>/g, "&gt;");
93
+ n = n.replace(/"/g, "&quot;");
94
+
95
+ return n;
96
+ }
97
+
98
+
99
+ var fbDiff = function(ignoreWhitespace) {
100
+ this.ignoreWhitespace = ignoreWhitespace;
101
+ };
102
+ fbDiff.prototype = {
103
+ diff: function(oldString, newString) {
104
+ // Handle the identity case (this is due to unrolling editLength == 0
105
+ if (newString == oldString) {
106
+ return [{ value: newString }];
107
+ }
108
+ if (!newString) {
109
+ return [{ value: oldString, removed: true }];
110
+ }
111
+ if (!oldString) {
112
+ return [{ value: newString, added: true }];
113
+ }
114
+
115
+ newString = this.tokenize(newString);
116
+ oldString = this.tokenize(oldString);
117
+
118
+ var newLen = newString.length, oldLen = oldString.length;
119
+ var maxEditLength = newLen + oldLen;
120
+ var bestPath = [{ newPos: -1, components: [] }];
121
+
122
+ // Seed editLength = 0
123
+ var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0);
124
+ if (bestPath[0].newPos+1 >= newLen && oldPos+1 >= oldLen) {
125
+ return bestPath[0].components;
126
+ }
127
+
128
+ for (var editLength = 1; editLength <= maxEditLength; editLength++) {
129
+ for (var diagonalPath = -1*editLength; diagonalPath <= editLength; diagonalPath+=2) {
130
+ var basePath;
131
+ var addPath = bestPath[diagonalPath-1],
132
+ removePath = bestPath[diagonalPath+1];
133
+ oldPos = (removePath ? removePath.newPos : 0) - diagonalPath;
134
+ if (addPath) {
135
+ // No one else is going to attempt to use this value, clear it
136
+ bestPath[diagonalPath-1] = undefined;
137
+ }
138
+
139
+ var canAdd = addPath && addPath.newPos+1 < newLen;
140
+ var canRemove = removePath && 0 <= oldPos && oldPos < oldLen;
141
+ if (!canAdd && !canRemove) {
142
+ bestPath[diagonalPath] = undefined;
143
+ continue;
144
+ }
145
+
146
+ // Select the diagonal that we want to branch from. We select the prior
147
+ // path whose position in the new string is the farthest from the origin
148
+ // and does not pass the bounds of the diff graph
149
+ if (!canAdd || (canRemove && addPath.newPos < removePath.newPos)) {
150
+ basePath = clonePath(removePath);
151
+ this.pushComponent(basePath.components, oldString[oldPos], undefined, true);
152
+ } else {
153
+ basePath = clonePath(addPath);
154
+ basePath.newPos++;
155
+ this.pushComponent(basePath.components, newString[basePath.newPos], true, undefined);
156
+ }
157
+
158
+ var oldPos = this.extractCommon(basePath, newString, oldString, diagonalPath);
159
+
160
+ if (basePath.newPos+1 >= newLen && oldPos+1 >= oldLen) {
161
+ return basePath.components;
162
+ } else {
163
+ bestPath[diagonalPath] = basePath;
164
+ }
165
+ }
166
+ }
167
+ },
168
+
169
+ pushComponent: function(components, value, added, removed) {
170
+ var last = components[components.length-1];
171
+ if (last && last.added === added && last.removed === removed) {
172
+ // We need to clone here as the component clone operation is just
173
+ // as shallow array clone
174
+ components[components.length-1] =
175
+ {value: this.join(last.value, value), added: added, removed: removed };
176
+ } else {
177
+ components.push({value: value, added: added, removed: removed });
178
+ }
179
+ },
180
+ extractCommon: function(basePath, newString, oldString, diagonalPath) {
181
+ var newLen = newString.length,
182
+ oldLen = oldString.length,
183
+ newPos = basePath.newPos,
184
+ oldPos = newPos - diagonalPath;
185
+ while (newPos+1 < newLen && oldPos+1 < oldLen && this.equals(newString[newPos+1], oldString[oldPos+1])) {
186
+ newPos++;
187
+ oldPos++;
188
+
189
+ this.pushComponent(basePath.components, newString[newPos], undefined, undefined);
190
+ }
191
+ basePath.newPos = newPos;
192
+ return oldPos;
193
+ },
194
+
195
+ equals: function(left, right) {
196
+ var reWhitespace = /\S/;
197
+ if (this.ignoreWhitespace && !reWhitespace.test(left) && !reWhitespace.test(right)) {
198
+ return true;
199
+ } else {
200
+ return left == right;
201
+ }
202
+ },
203
+ join: function(left, right) {
204
+ return left + right;
205
+ },
206
+ tokenize: function(value) {
207
+ return value;
208
+ }
209
+ };
210
+
211
+ var CharDiff = new fbDiff();
212
+
213
+ var WordDiff = new fbDiff(true);
214
+ WordDiff.tokenize = function(value) {
215
+ return removeEmpty(value.split(/(\s+|\b)/));
216
+ };
217
+
218
+ var CssDiff = new fbDiff(true);
219
+ CssDiff.tokenize = function(value) {
220
+ return removeEmpty(value.split(/([{}:;,]|\s+)/));
221
+ };
222
+
223
+ var LineDiff = new fbDiff();
224
+ LineDiff.tokenize = function(value) {
225
+ return value.split(/^/m);
226
+ };
227
+
228
+ return {
229
+ diffChars: function(oldStr, newStr) { return CharDiff.diff(oldStr, newStr); },
230
+ diffWords: function(oldStr, newStr) { return WordDiff.diff(oldStr, newStr); },
231
+ diffLines: function(oldStr, newStr) { return LineDiff.diff(oldStr, newStr); },
232
+
233
+ diffCss: function(oldStr, newStr) { return CssDiff.diff(oldStr, newStr); },
234
+
235
+ createPatch: function(fileName, oldStr, newStr, oldHeader, newHeader) {
236
+ var ret = [];
237
+
238
+ ret.push("Index: " + fileName);
239
+ ret.push("===================================================================");
240
+ ret.push("--- " + fileName + (typeof oldHeader === "undefined" ? "" : "\t" + oldHeader));
241
+ ret.push("+++ " + fileName + (typeof newHeader === "undefined" ? "" : "\t" + newHeader));
242
+
243
+ var diff = LineDiff.diff(oldStr, newStr);
244
+ if (!diff[diff.length-1].value) {
245
+ diff.pop(); // Remove trailing newline add
246
+ }
247
+ diff.push({value: "", lines: []}); // Append an empty value to make cleanup easier
248
+
249
+ function contextLines(lines) {
250
+ return lines.map(function(entry) { return ' ' + entry; });
251
+ }
252
+ function eofNL(curRange, i, current) {
253
+ var last = diff[diff.length-2],
254
+ isLast = i === diff.length-2,
255
+ isLastOfType = i === diff.length-3 && (current.added === !last.added || current.removed === !last.removed);
256
+
257
+ // Figure out if this is the last line for the given file and missing NL
258
+ if (!/\n$/.test(current.value) && (isLast || isLastOfType)) {
259
+ curRange.push('\');
260
+ }
261
+ }
262
+
263
+ var oldRangeStart = 0, newRangeStart = 0, curRange = [],
264
+ oldLine = 1, newLine = 1;
265
+ for (var i = 0; i < diff.length; i++) {
266
+ var current = diff[i],
267
+ lines = current.lines || current.value.replace(/\n$/, "").split("\n");
268
+ current.lines = lines;
269
+
270
+ if (current.added || current.removed) {
271
+ if (!oldRangeStart) {
272
+ var prev = diff[i-1];
273
+ oldRangeStart = oldLine;
274
+ newRangeStart = newLine;
275
+
276
+ if (prev) {
277
+ curRange = contextLines(prev.lines.slice(-4));
278
+ oldRangeStart -= curRange.length;
279
+ newRangeStart -= curRange.length;
280
+ }
281
+ }
282
+ curRange.push.apply(curRange, lines.map(function(entry) { return (current.added?"+":"-") + entry; }));
283
+ eofNL(curRange, i, current);
284
+
285
+ if (current.added) {
286
+ newLine += lines.length;
287
+ } else {
288
+ oldLine += lines.length;
289
+ }
290
+ } else {
291
+ if (oldRangeStart) {
292
+ // Close out any changes that have been output (or join overlapping)
293
+ if (lines.length <= 8 && i < diff.length-2) {
294
+ // Overlapping
295
+ curRange.push.apply(curRange, contextLines(lines));
296
+ } else {
297
+ // end the range and output
298
+ var contextSize = Math.min(lines.length, 4);
299
+ ret.push(
300
+ "@@ -" + oldRangeStart + "," + (oldLine-oldRangeStart+contextSize)
301
+ + " +" + newRangeStart + "," + (newLine-newRangeStart+contextSize)
302
+ + " @@");
303
+ ret.push.apply(ret, curRange);
304
+ ret.push.apply(ret, contextLines(lines.slice(0, contextSize)));
305
+ if (lines.length <= 4) {
306
+ eofNL(ret, i, current);
307
+ }
308
+
309
+ oldRangeStart = 0; newRangeStart = 0; curRange = [];
310
+ }
311
+ }
312
+ oldLine += lines.length;
313
+ newLine += lines.length;
314
+ }
315
+ }
316
+
317
+ return ret.join('\n') + '\n';
318
+ },
319
+
320
+ convertChangesToXML: function(changes){
321
+ var ret = [];
322
+ for ( var i = 0; i < changes.length; i++) {
323
+ var change = changes[i];
324
+ if (change.added) {
325
+ ret.push("<ins>");
326
+ } else if (change.removed) {
327
+ ret.push("<del>");
328
+ }
329
+
330
+ ret.push(escapeHTML(change.value));
331
+
332
+ if (change.added) {
333
+ ret.push("</ins>");
334
+ } else if (change.removed) {
335
+ ret.push("</del>");
336
+ }
337
+ }
338
+ return ret.join("");
339
+ }
340
+ };
341
+ })();
342
+
343
+ if (typeof module !== "undefined") {
344
+ module.exports = JsDiff;
345
+ }
59
346
 
60
347
  }); // module: browser/diff.js
61
348
 
@@ -384,8 +671,14 @@ exports.isatty = function(){
384
671
  };
385
672
 
386
673
  exports.getWindowSize = function(){
387
- return [window.innerHeight, window.innerWidth];
674
+ if ('innerHeight' in global) {
675
+ return [global.innerHeight, global.innerWidth];
676
+ } else {
677
+ // In a Web Worker, the DOM Window is not available.
678
+ return [640, 480];
679
+ }
388
680
  };
681
+
389
682
  }); // module: browser/tty.js
390
683
 
391
684
  require.register("context.js", function(module, exports, require){
@@ -492,7 +785,9 @@ function Hook(title, fn) {
492
785
  * Inherit from `Runnable.prototype`.
493
786
  */
494
787
 
495
- Hook.prototype = new Runnable;
788
+ function F(){};
789
+ F.prototype = Runnable.prototype;
790
+ Hook.prototype = new F;
496
791
  Hook.prototype.constructor = Hook;
497
792
 
498
793
 
@@ -514,7 +809,6 @@ Hook.prototype.error = function(err){
514
809
  this._error = err;
515
810
  };
516
811
 
517
-
518
812
  }); // module: hook.js
519
813
 
520
814
  require.register("interfaces/bdd.js", function(module, exports, require){
@@ -528,7 +822,7 @@ var Suite = require('../suite')
528
822
 
529
823
  /**
530
824
  * BDD-style interface:
531
- *
825
+ *
532
826
  * describe('Array', function(){
533
827
  * describe('#indexOf()', function(){
534
828
  * it('should return -1 when not present', function(){
@@ -540,7 +834,7 @@ var Suite = require('../suite')
540
834
  * });
541
835
  * });
542
836
  * });
543
- *
837
+ *
544
838
  */
545
839
 
546
840
  module.exports = function(suite){
@@ -585,7 +879,7 @@ module.exports = function(suite){
585
879
  * and callback `fn` containing nested suites
586
880
  * and/or tests.
587
881
  */
588
-
882
+
589
883
  context.describe = context.context = function(title, fn){
590
884
  var suite = Suite.create(suites[0], title);
591
885
  suites.unshift(suite);
@@ -665,19 +959,19 @@ var Suite = require('../suite')
665
959
 
666
960
  /**
667
961
  * TDD-style interface:
668
- *
962
+ *
669
963
  * exports.Array = {
670
964
  * '#indexOf()': {
671
965
  * 'should return -1 when the value is not present': function(){
672
- *
966
+ *
673
967
  * },
674
968
  *
675
969
  * 'should return the correct index when the value is present': function(){
676
- *
970
+ *
677
971
  * }
678
972
  * }
679
973
  * };
680
- *
974
+ *
681
975
  */
682
976
 
683
977
  module.exports = function(suite){
@@ -715,6 +1009,7 @@ module.exports = function(suite){
715
1009
  }
716
1010
  }
717
1011
  };
1012
+
718
1013
  }); // module: interfaces/exports.js
719
1014
 
720
1015
  require.register("interfaces/index.js", function(module, exports, require){
@@ -737,33 +1032,33 @@ var Suite = require('../suite')
737
1032
 
738
1033
  /**
739
1034
  * QUnit-style interface:
740
- *
1035
+ *
741
1036
  * suite('Array');
742
- *
1037
+ *
743
1038
  * test('#length', function(){
744
1039
  * var arr = [1,2,3];
745
1040
  * ok(arr.length == 3);
746
1041
  * });
747
- *
1042
+ *
748
1043
  * test('#indexOf()', function(){
749
1044
  * var arr = [1,2,3];
750
1045
  * ok(arr.indexOf(1) == 0);
751
1046
  * ok(arr.indexOf(2) == 1);
752
1047
  * ok(arr.indexOf(3) == 2);
753
1048
  * });
754
- *
1049
+ *
755
1050
  * suite('String');
756
- *
1051
+ *
757
1052
  * test('#length', function(){
758
1053
  * ok('foo'.length == 3);
759
1054
  * });
760
- *
1055
+ *
761
1056
  */
762
1057
 
763
1058
  module.exports = function(suite){
764
1059
  var suites = [suite];
765
1060
 
766
- suite.on('pre-require', function(context){
1061
+ suite.on('pre-require', function(context, file, mocha){
767
1062
 
768
1063
  /**
769
1064
  * Execute before running tests.
@@ -800,11 +1095,21 @@ module.exports = function(suite){
800
1095
  /**
801
1096
  * Describe a "suite" with the given `title`.
802
1097
  */
803
-
1098
+
804
1099
  context.suite = function(title){
805
1100
  if (suites.length > 1) suites.shift();
806
1101
  var suite = Suite.create(suites[0], title);
807
1102
  suites.unshift(suite);
1103
+ return suite;
1104
+ };
1105
+
1106
+ /**
1107
+ * Exclusive test-case.
1108
+ */
1109
+
1110
+ context.suite.only = function(title, fn){
1111
+ var suite = context.suite(title, fn);
1112
+ mocha.grep(suite.fullTitle());
808
1113
  };
809
1114
 
810
1115
  /**
@@ -814,7 +1119,26 @@ module.exports = function(suite){
814
1119
  */
815
1120
 
816
1121
  context.test = function(title, fn){
817
- suites[0].addTest(new Test(title, fn));
1122
+ var test = new Test(title, fn);
1123
+ suites[0].addTest(test);
1124
+ return test;
1125
+ };
1126
+
1127
+ /**
1128
+ * Exclusive test-case.
1129
+ */
1130
+
1131
+ context.test.only = function(title, fn){
1132
+ var test = context.test(title, fn);
1133
+ mocha.grep(test.fullTitle());
1134
+ };
1135
+
1136
+ /**
1137
+ * Pending test case.
1138
+ */
1139
+
1140
+ context.test.skip = function(title){
1141
+ context.test(title);
818
1142
  };
819
1143
  });
820
1144
  };
@@ -838,7 +1162,7 @@ var Suite = require('../suite')
838
1162
  * suiteSetup(function(){
839
1163
  *
840
1164
  * });
841
- *
1165
+ *
842
1166
  * test('should return -1 when not present', function(){
843
1167
  *
844
1168
  * });
@@ -906,6 +1230,17 @@ module.exports = function(suite){
906
1230
  return suite;
907
1231
  };
908
1232
 
1233
+ /**
1234
+ * Pending suite.
1235
+ */
1236
+ context.suite.skip = function(title, fn) {
1237
+ var suite = Suite.create(suites[0], title);
1238
+ suite.pending = true;
1239
+ suites.unshift(suite);
1240
+ fn.call(suite);
1241
+ suites.shift();
1242
+ };
1243
+
909
1244
  /**
910
1245
  * Exclusive test-case.
911
1246
  */
@@ -922,8 +1257,10 @@ module.exports = function(suite){
922
1257
  */
923
1258
 
924
1259
  context.test = function(title, fn){
1260
+ var suite = suites[0];
1261
+ if (suite.pending) var fn = null;
925
1262
  var test = new Test(title, fn);
926
- suites[0].addTest(test);
1263
+ suite.addTest(test);
927
1264
  return test;
928
1265
  };
929
1266
 
@@ -1003,6 +1340,7 @@ function image(name) {
1003
1340
  * - `reporter` reporter instance, defaults to `mocha.reporters.Dot`
1004
1341
  * - `globals` array of accepted globals
1005
1342
  * - `timeout` timeout in milliseconds
1343
+ * - `bail` bail on the first test failure
1006
1344
  * - `slow` milliseconds to wait before considering a test slow
1007
1345
  * - `ignoreLeaks` ignore global leaks
1008
1346
  * - `grep` string or regexp to filter tests with
@@ -1018,11 +1356,25 @@ function Mocha(options) {
1018
1356
  this.grep(options.grep);
1019
1357
  this.suite = new exports.Suite('', new exports.Context);
1020
1358
  this.ui(options.ui);
1359
+ this.bail(options.bail);
1021
1360
  this.reporter(options.reporter);
1022
1361
  if (options.timeout) this.timeout(options.timeout);
1023
1362
  if (options.slow) this.slow(options.slow);
1024
1363
  }
1025
1364
 
1365
+ /**
1366
+ * Enable or disable bailing on the first failure.
1367
+ *
1368
+ * @param {Boolean} [bail]
1369
+ * @api public
1370
+ */
1371
+
1372
+ Mocha.prototype.bail = function(bail){
1373
+ if (0 == arguments.length) bail = true;
1374
+ this.suite.bail(bail);
1375
+ return this;
1376
+ };
1377
+
1026
1378
  /**
1027
1379
  * Add test `file`.
1028
1380
  *
@@ -1038,7 +1390,7 @@ Mocha.prototype.addFile = function(file){
1038
1390
  /**
1039
1391
  * Set reporter to `reporter`, defaults to "dot".
1040
1392
  *
1041
- * @param {String|Function} reporter name of a reporter or a reporter constructor
1393
+ * @param {String|Function} reporter name or constructor
1042
1394
  * @api public
1043
1395
  */
1044
1396
 
@@ -1145,12 +1497,13 @@ Mocha.prototype.invert = function(){
1145
1497
  /**
1146
1498
  * Ignore global leaks.
1147
1499
  *
1500
+ * @param {Boolean} ignore
1148
1501
  * @return {Mocha}
1149
1502
  * @api public
1150
1503
  */
1151
1504
 
1152
- Mocha.prototype.ignoreLeaks = function(){
1153
- this.options.ignoreLeaks = true;
1505
+ Mocha.prototype.ignoreLeaks = function(ignore){
1506
+ this.options.ignoreLeaks = !!ignore;
1154
1507
  return this;
1155
1508
  };
1156
1509
 
@@ -1243,7 +1596,7 @@ Mocha.prototype.run = function(fn){
1243
1596
  var options = this.options;
1244
1597
  var runner = new exports.Runner(suite);
1245
1598
  var reporter = new this._reporter(runner);
1246
- runner.ignoreLeaks = options.ignoreLeaks;
1599
+ runner.ignoreLeaks = false !== options.ignoreLeaks;
1247
1600
  runner.asyncOnly = options.asyncOnly;
1248
1601
  if (options.grep) runner.grep(options.grep, options.invert);
1249
1602
  if (options.globals) runner.globals(options.globals);
@@ -1404,7 +1757,7 @@ exports.colors = {
1404
1757
  /**
1405
1758
  * Default symbol map.
1406
1759
  */
1407
-
1760
+
1408
1761
  exports.symbols = {
1409
1762
  ok: '✓',
1410
1763
  err: '✖',
@@ -1501,19 +1854,21 @@ exports.list = function(failures){
1501
1854
  , expected = err.expected
1502
1855
  , escape = true;
1503
1856
 
1857
+ // uncaught
1858
+ if (err.uncaught) {
1859
+ msg = 'Uncaught ' + msg;
1860
+ }
1861
+
1504
1862
  // explicitly show diff
1505
- if (err.showDiff) {
1863
+ if (err.showDiff && sameType(actual, expected)) {
1506
1864
  escape = false;
1507
- err.actual = actual = JSON.stringify(actual, null, 2);
1508
- err.expected = expected = JSON.stringify(expected, null, 2);
1865
+ err.actual = actual = stringify(actual);
1866
+ err.expected = expected = stringify(expected);
1509
1867
  }
1510
1868
 
1511
1869
  // actual / expected diff
1512
1870
  if ('string' == typeof actual && 'string' == typeof expected) {
1513
- var len = Math.max(actual.length, expected.length);
1514
-
1515
- if (len < 20) msg = errorDiff(err, 'Chars', escape);
1516
- else msg = errorDiff(err, 'Words', escape);
1871
+ msg = errorDiff(err, 'Words', escape);
1517
1872
 
1518
1873
  // linenos
1519
1874
  var lines = msg.split('\n');
@@ -1622,48 +1977,38 @@ function Base(runner) {
1622
1977
  */
1623
1978
 
1624
1979
  Base.prototype.epilogue = function(){
1625
- var stats = this.stats
1626
- , fmt
1627
- , tests;
1980
+ var stats = this.stats;
1981
+ var tests;
1982
+ var fmt;
1628
1983
 
1629
1984
  console.log();
1630
1985
 
1631
- function pluralize(n) {
1632
- return 1 == n ? 'test' : 'tests';
1633
- }
1634
-
1635
- // failure
1636
- if (stats.failures) {
1637
- fmt = color('bright fail', ' ' + exports.symbols.err)
1638
- + color('fail', ' %d of %d %s failed')
1639
- + color('light', ':')
1640
-
1641
- console.error(fmt,
1642
- stats.failures,
1643
- this.runner.total,
1644
- pluralize(this.runner.total));
1645
-
1646
- Base.list(this.failures);
1647
- console.error();
1648
- return;
1649
- }
1650
-
1651
- // pass
1986
+ // passes
1652
1987
  fmt = color('bright pass', ' ')
1653
- + color('green', ' %d %s complete')
1988
+ + color('green', ' %d passing')
1654
1989
  + color('light', ' (%s)');
1655
1990
 
1656
1991
  console.log(fmt,
1657
- stats.tests || 0,
1658
- pluralize(stats.tests),
1992
+ stats.passes || 0,
1659
1993
  ms(stats.duration));
1660
1994
 
1661
1995
  // pending
1662
1996
  if (stats.pending) {
1663
1997
  fmt = color('pending', ' ')
1664
- + color('pending', ' %d %s pending');
1998
+ + color('pending', ' %d pending');
1999
+
2000
+ console.log(fmt, stats.pending);
2001
+ }
2002
+
2003
+ // failures
2004
+ if (stats.failures) {
2005
+ fmt = color('fail', ' %d failing');
1665
2006
 
1666
- console.log(fmt, stats.pending, pluralize(stats.pending));
2007
+ console.error(fmt,
2008
+ stats.failures);
2009
+
2010
+ Base.list(this.failures);
2011
+ console.error();
1667
2012
  }
1668
2013
 
1669
2014
  console.log();
@@ -1720,6 +2065,34 @@ function colorLines(name, str) {
1720
2065
  }).join('\n');
1721
2066
  }
1722
2067
 
2068
+ /**
2069
+ * Stringify `obj`.
2070
+ *
2071
+ * @param {Mixed} obj
2072
+ * @return {String}
2073
+ * @api private
2074
+ */
2075
+
2076
+ function stringify(obj) {
2077
+ if (obj instanceof RegExp) return obj.toString();
2078
+ return JSON.stringify(obj, null, 2);
2079
+ }
2080
+
2081
+ /**
2082
+ * Check that a / b have the same type.
2083
+ *
2084
+ * @param {Object} a
2085
+ * @param {Object} b
2086
+ * @return {Boolean}
2087
+ * @api private
2088
+ */
2089
+
2090
+ function sameType(a, b) {
2091
+ a = Object.prototype.toString.call(a);
2092
+ b = Object.prototype.toString.call(b);
2093
+ return a == b;
2094
+ }
2095
+
1723
2096
  }); // module: reporters/base.js
1724
2097
 
1725
2098
  require.register("reporters/doc.js", function(module, exports, require){
@@ -1844,7 +2217,9 @@ function Dot(runner) {
1844
2217
  * Inherit from `Base.prototype`.
1845
2218
  */
1846
2219
 
1847
- Dot.prototype = new Base;
2220
+ function F(){};
2221
+ F.prototype = Base.prototype;
2222
+ Dot.prototype = new F;
1848
2223
  Dot.prototype.constructor = Dot;
1849
2224
 
1850
2225
  }); // module: reporters/dot.js
@@ -2022,12 +2397,10 @@ function HTML(runner, root) {
2022
2397
  });
2023
2398
 
2024
2399
  runner.on('fail', function(test, err){
2025
- if ('hook' == test.type || err.uncaught) runner.emit('test end', test);
2400
+ if ('hook' == test.type) runner.emit('test end', test);
2026
2401
  });
2027
2402
 
2028
2403
  runner.on('test end', function(test){
2029
- window.scrollTo(0, document.body.scrollHeight);
2030
-
2031
2404
  // TODO: add to stats
2032
2405
  var percent = stats.tests / this.total * 100 | 0;
2033
2406
  if (progress) progress.update(percent).draw(ctx);
@@ -2071,7 +2444,7 @@ function HTML(runner, root) {
2071
2444
 
2072
2445
  on(h2, 'click', function(){
2073
2446
  pre.style.display = 'none' == pre.style.display
2074
- ? 'inline-block'
2447
+ ? 'block'
2075
2448
  : 'none';
2076
2449
  });
2077
2450
 
@@ -2380,7 +2753,6 @@ function List(runner) {
2380
2753
  });
2381
2754
 
2382
2755
  runner.on('fail', function(test, err){
2383
- test.error = err;
2384
2756
  console.log(JSON.stringify(['fail', clean(test)]));
2385
2757
  });
2386
2758
 
@@ -2399,20 +2771,11 @@ function List(runner) {
2399
2771
  */
2400
2772
 
2401
2773
  function clean(test) {
2402
- var obj = {
2403
- title: test.title,
2404
- fullTitle: test.fullTitle(),
2405
- duration: test.duration
2406
- };
2407
-
2408
- if (test.error) {
2409
- obj.error = {
2410
- message: test.error.message,
2411
- stack: test.error.stack
2412
- };
2774
+ return {
2775
+ title: test.title
2776
+ , fullTitle: test.fullTitle()
2777
+ , duration: test.duration
2413
2778
  }
2414
-
2415
- return obj;
2416
2779
  }
2417
2780
  }); // module: reporters/json-stream.js
2418
2781
 
@@ -2455,17 +2818,16 @@ function JSONReporter(runner) {
2455
2818
  passes.push(test);
2456
2819
  });
2457
2820
 
2458
- runner.on('fail', function(test, err){
2459
- test.error = err;
2821
+ runner.on('fail', function(test){
2460
2822
  failures.push(test);
2461
2823
  });
2462
2824
 
2463
2825
  runner.on('end', function(){
2464
2826
  var obj = {
2465
- stats: self.stats,
2466
- tests: tests.map(clean),
2467
- failures: failures.map(clean),
2468
- passes: passes.map(clean)
2827
+ stats: self.stats
2828
+ , tests: tests.map(clean)
2829
+ , failures: failures.map(clean)
2830
+ , passes: passes.map(clean)
2469
2831
  };
2470
2832
 
2471
2833
  process.stdout.write(JSON.stringify(obj, null, 2));
@@ -2482,20 +2844,11 @@ function JSONReporter(runner) {
2482
2844
  */
2483
2845
 
2484
2846
  function clean(test) {
2485
- var obj = {
2486
- title: test.title,
2487
- fullTitle: test.fullTitle(),
2488
- duration: test.duration
2489
- };
2490
-
2491
- if (test.error) {
2492
- obj.error = {
2493
- message: test.error.message,
2494
- stack: test.error.stack
2495
- };
2847
+ return {
2848
+ title: test.title
2849
+ , fullTitle: test.fullTitle()
2850
+ , duration: test.duration
2496
2851
  }
2497
-
2498
- return obj;
2499
2852
  }
2500
2853
  }); // module: reporters/json.js
2501
2854
 
@@ -2596,7 +2949,9 @@ function Landing(runner) {
2596
2949
  * Inherit from `Base.prototype`.
2597
2950
  */
2598
2951
 
2599
- Landing.prototype = new Base;
2952
+ function F(){};
2953
+ F.prototype = Base.prototype;
2954
+ Landing.prototype = new F;
2600
2955
  Landing.prototype.constructor = Landing;
2601
2956
 
2602
2957
  }); // module: reporters/landing.js
@@ -2665,7 +3020,9 @@ function List(runner) {
2665
3020
  * Inherit from `Base.prototype`.
2666
3021
  */
2667
3022
 
2668
- List.prototype = new Base;
3023
+ function F(){};
3024
+ F.prototype = Base.prototype;
3025
+ List.prototype = new F;
2669
3026
  List.prototype.constructor = List;
2670
3027
 
2671
3028
 
@@ -2697,7 +3054,6 @@ function Markdown(runner) {
2697
3054
 
2698
3055
  var self = this
2699
3056
  , stats = this.stats
2700
- , total = runner.total
2701
3057
  , level = 0
2702
3058
  , buf = '';
2703
3059
 
@@ -2789,7 +3145,7 @@ exports = module.exports = Min;
2789
3145
 
2790
3146
  function Min(runner) {
2791
3147
  Base.call(this, runner);
2792
-
3148
+
2793
3149
  runner.on('start', function(){
2794
3150
  // clear screen
2795
3151
  process.stdout.write('\u001b[2J');
@@ -2804,13 +3160,15 @@ function Min(runner) {
2804
3160
  * Inherit from `Base.prototype`.
2805
3161
  */
2806
3162
 
2807
- Min.prototype = new Base;
3163
+ function F(){};
3164
+ F.prototype = Base.prototype;
3165
+ Min.prototype = new F;
2808
3166
  Min.prototype.constructor = Min;
2809
3167
 
3168
+
2810
3169
  }); // module: reporters/min.js
2811
3170
 
2812
3171
  require.register("reporters/nyan.js", function(module, exports, require){
2813
-
2814
3172
  /**
2815
3173
  * Module dependencies.
2816
3174
  */
@@ -2956,44 +3314,39 @@ NyanCat.prototype.drawRainbow = function(){
2956
3314
  NyanCat.prototype.drawNyanCat = function(status) {
2957
3315
  var self = this;
2958
3316
  var startWidth = this.scoreboardWidth + this.trajectories[0].length;
2959
-
2960
- [0, 1, 2, 3].forEach(function(index) {
2961
- write('\u001b[' + startWidth + 'C');
2962
-
2963
- switch (index) {
2964
- case 0:
2965
- write('_,------,');
2966
- write('\n');
2967
- break;
2968
- case 1:
2969
- var padding = self.tick ? ' ' : ' ';
2970
- write('_|' + padding + '/\\_/\\ ');
2971
- write('\n');
2972
- break;
2973
- case 2:
2974
- var padding = self.tick ? '_' : '__';
2975
- var tail = self.tick ? '~' : '^';
2976
- var face;
2977
- switch (status) {
2978
- case 'pass':
2979
- face = '( ^ .^)';
2980
- break;
2981
- case 'fail':
2982
- face = '( o .o)';
2983
- break;
2984
- default:
2985
- face = '( - .-)';
2986
- }
2987
- write(tail + '|' + padding + face + ' ');
2988
- write('\n');
2989
- break;
2990
- case 3:
2991
- var padding = self.tick ? ' ' : ' ';
2992
- write(padding + '"" "" ');
2993
- write('\n');
2994
- break;
2995
- }
2996
- });
3317
+ var color = '\u001b[' + startWidth + 'C';
3318
+ var padding = '';
3319
+
3320
+ write(color);
3321
+ write('_,------,');
3322
+ write('\n');
3323
+
3324
+ write(color);
3325
+ padding = self.tick ? ' ' : ' ';
3326
+ write('_|' + padding + '/\\_/\\ ');
3327
+ write('\n');
3328
+
3329
+ write(color);
3330
+ padding = self.tick ? '_' : '__';
3331
+ var tail = self.tick ? '~' : '^';
3332
+ var face;
3333
+ switch (status) {
3334
+ case 'pass':
3335
+ face = '( ^ .^)';
3336
+ break;
3337
+ case 'fail':
3338
+ face = '( o .o)';
3339
+ break;
3340
+ default:
3341
+ face = '( - .-)';
3342
+ }
3343
+ write(tail + '|' + padding + face + ' ');
3344
+ write('\n');
3345
+
3346
+ write(color);
3347
+ padding = self.tick ? ' ' : ' ';
3348
+ write(padding + '"" "" ');
3349
+ write('\n');
2997
3350
 
2998
3351
  this.cursorUp(this.numberOfLines);
2999
3352
  };
@@ -3068,7 +3421,9 @@ function write(string) {
3068
3421
  * Inherit from `Base.prototype`.
3069
3422
  */
3070
3423
 
3071
- NyanCat.prototype = new Base;
3424
+ function F(){};
3425
+ F.prototype = Base.prototype;
3426
+ NyanCat.prototype = new F;
3072
3427
  NyanCat.prototype.constructor = NyanCat;
3073
3428
 
3074
3429
 
@@ -3160,7 +3515,9 @@ function Progress(runner, options) {
3160
3515
  * Inherit from `Base.prototype`.
3161
3516
  */
3162
3517
 
3163
- Progress.prototype = new Base;
3518
+ function F(){};
3519
+ F.prototype = Base.prototype;
3520
+ Progress.prototype = new F;
3164
3521
  Progress.prototype.constructor = Progress;
3165
3522
 
3166
3523
 
@@ -3253,7 +3610,9 @@ function Spec(runner) {
3253
3610
  * Inherit from `Base.prototype`.
3254
3611
  */
3255
3612
 
3256
- Spec.prototype = new Base;
3613
+ function F(){};
3614
+ F.prototype = Base.prototype;
3615
+ Spec.prototype = new F;
3257
3616
  Spec.prototype.constructor = Spec;
3258
3617
 
3259
3618
 
@@ -3287,7 +3646,9 @@ function TAP(runner) {
3287
3646
 
3288
3647
  var self = this
3289
3648
  , stats = this.stats
3290
- , n = 1;
3649
+ , n = 1
3650
+ , passes = 0
3651
+ , failures = 0;
3291
3652
 
3292
3653
  runner.on('start', function(){
3293
3654
  var total = runner.grepTotal(runner.suite);
@@ -3303,12 +3664,20 @@ function TAP(runner) {
3303
3664
  });
3304
3665
 
3305
3666
  runner.on('pass', function(test){
3667
+ passes++;
3306
3668
  console.log('ok %d %s', n, title(test));
3307
3669
  });
3308
3670
 
3309
3671
  runner.on('fail', function(test, err){
3672
+ failures++;
3310
3673
  console.log('not ok %d %s', n, title(test));
3311
- console.log(err.stack.replace(/^/gm, ' '));
3674
+ if (err.stack) console.log(err.stack.replace(/^/gm, ' '));
3675
+ });
3676
+
3677
+ runner.on('end', function(){
3678
+ console.log('# tests ' + (passes + failures));
3679
+ console.log('# pass ' + passes);
3680
+ console.log('# fail ' + failures);
3312
3681
  });
3313
3682
  }
3314
3683
 
@@ -3437,7 +3806,7 @@ function XUnit(runner) {
3437
3806
  runner.on('pass', function(test){
3438
3807
  tests.push(test);
3439
3808
  });
3440
-
3809
+
3441
3810
  runner.on('fail', function(test){
3442
3811
  tests.push(test);
3443
3812
  });
@@ -3448,13 +3817,13 @@ function XUnit(runner) {
3448
3817
  , tests: stats.tests
3449
3818
  , failures: stats.failures
3450
3819
  , errors: stats.failures
3451
- , skip: stats.tests - stats.failures - stats.passes
3820
+ , skipped: stats.tests - stats.failures - stats.passes
3452
3821
  , timestamp: (new Date).toUTCString()
3453
- , time: stats.duration / 1000
3822
+ , time: (stats.duration / 1000) || 0
3454
3823
  }, false));
3455
3824
 
3456
3825
  tests.forEach(test);
3457
- console.log('</testsuite>');
3826
+ console.log('</testsuite>');
3458
3827
  });
3459
3828
  }
3460
3829
 
@@ -3462,7 +3831,9 @@ function XUnit(runner) {
3462
3831
  * Inherit from `Base.prototype`.
3463
3832
  */
3464
3833
 
3465
- XUnit.prototype = new Base;
3834
+ function F(){};
3835
+ F.prototype = Base.prototype;
3836
+ XUnit.prototype = new F;
3466
3837
  XUnit.prototype.constructor = XUnit;
3467
3838
 
3468
3839
 
@@ -3570,7 +3941,9 @@ function Runnable(title, fn) {
3570
3941
  * Inherit from `EventEmitter.prototype`.
3571
3942
  */
3572
3943
 
3573
- Runnable.prototype = new EventEmitter;
3944
+ function F(){};
3945
+ F.prototype = EventEmitter.prototype;
3946
+ Runnable.prototype = new F;
3574
3947
  Runnable.prototype.constructor = Runnable;
3575
3948
 
3576
3949
 
@@ -3652,16 +4025,14 @@ Runnable.prototype.inspect = function(){
3652
4025
  */
3653
4026
 
3654
4027
  Runnable.prototype.resetTimeout = function(){
3655
- var self = this
3656
- , ms = this.timeout();
4028
+ var self = this;
4029
+ var ms = this.timeout() || 1e9;
3657
4030
 
3658
4031
  this.clearTimeout();
3659
- if (ms) {
3660
- this.timer = setTimeout(function(){
3661
- self.callback(new Error('timeout of ' + ms + 'ms exceeded'));
3662
- self.timedOut = true;
3663
- }, ms);
3664
- }
4032
+ this.timer = setTimeout(function(){
4033
+ self.callback(new Error('timeout of ' + ms + 'ms exceeded'));
4034
+ self.timedOut = true;
4035
+ }, ms);
3665
4036
  };
3666
4037
 
3667
4038
  /**
@@ -3715,7 +4086,7 @@ Runnable.prototype.run = function(fn){
3715
4086
  if (this.async) {
3716
4087
  try {
3717
4088
  this.fn.call(ctx, function(err){
3718
- if (toString.call(err) === "[object Error]") return done(err);
4089
+ if (err instanceof Error || toString.call(err) === "[object Error]") return done(err);
3719
4090
  if (null != err) return done(new Error('done() invoked with non-Error: ' + err));
3720
4091
  done();
3721
4092
  });
@@ -3742,7 +4113,6 @@ Runnable.prototype.run = function(fn){
3742
4113
  }); // module: runnable.js
3743
4114
 
3744
4115
  require.register("runner.js", function(module, exports, require){
3745
-
3746
4116
  /**
3747
4117
  * Module dependencies.
3748
4118
  */
@@ -3752,8 +4122,7 @@ var EventEmitter = require('browser/events').EventEmitter
3752
4122
  , Test = require('./test')
3753
4123
  , utils = require('./utils')
3754
4124
  , filter = utils.filter
3755
- , keys = utils.keys
3756
- , noop = function(){};
4125
+ , keys = utils.keys;
3757
4126
 
3758
4127
  /**
3759
4128
  * Non-enumerable globals.
@@ -3789,6 +4158,7 @@ module.exports = Runner;
3789
4158
  * - `hook end` (hook) hook complete
3790
4159
  * - `pass` (test) test passed
3791
4160
  * - `fail` (test, err) test failed
4161
+ * - `pending` (test) test pending
3792
4162
  *
3793
4163
  * @api public
3794
4164
  */
@@ -3805,11 +4175,22 @@ function Runner(suite) {
3805
4175
  this.globals(this.globalProps().concat(['errno']));
3806
4176
  }
3807
4177
 
4178
+ /**
4179
+ * Wrapper for setImmediate, process.nextTick, or browser polyfill.
4180
+ *
4181
+ * @param {Function} fn
4182
+ * @api private
4183
+ */
4184
+
4185
+ Runner.immediately = global.setImmediate || process.nextTick;
4186
+
3808
4187
  /**
3809
4188
  * Inherit from `EventEmitter.prototype`.
3810
4189
  */
3811
4190
 
3812
- Runner.prototype = new EventEmitter;
4191
+ function F(){};
4192
+ F.prototype = EventEmitter.prototype;
4193
+ Runner.prototype = new F;
3813
4194
  Runner.prototype.constructor = Runner;
3814
4195
 
3815
4196
 
@@ -3865,7 +4246,7 @@ Runner.prototype.globalProps = function() {
3865
4246
 
3866
4247
  // non-enumerables
3867
4248
  for (var i = 0; i < globals.length; ++i) {
3868
- if (~props.indexOf(globals[i])) continue;
4249
+ if (~utils.indexOf(props, globals[i])) continue;
3869
4250
  props.push(globals[i]);
3870
4251
  }
3871
4252
 
@@ -3927,9 +4308,11 @@ Runner.prototype.checkGlobals = function(test){
3927
4308
  Runner.prototype.fail = function(test, err){
3928
4309
  ++this.failures;
3929
4310
  test.state = 'failed';
4311
+
3930
4312
  if ('string' == typeof err) {
3931
4313
  err = new Error('the string "' + err + '" was thrown, throw an Error :)');
3932
4314
  }
4315
+
3933
4316
  this.emit('fail', test, err);
3934
4317
  };
3935
4318
 
@@ -3968,8 +4351,11 @@ Runner.prototype.hook = function(name, fn){
3968
4351
  function next(i) {
3969
4352
  var hook = hooks[i];
3970
4353
  if (!hook) return fn();
4354
+ if (self.failures && suite.bail()) return fn();
3971
4355
  self.currentRunnable = hook;
3972
4356
 
4357
+ hook.ctx.currentTest = self.test;
4358
+
3973
4359
  self.emit('hook', hook);
3974
4360
 
3975
4361
  hook.on('error', function(err){
@@ -3982,11 +4368,12 @@ Runner.prototype.hook = function(name, fn){
3982
4368
  if (testError) self.fail(self.test, testError);
3983
4369
  if (err) return self.failHook(hook, err);
3984
4370
  self.emit('hook end', hook);
4371
+ delete hook.ctx.currentTest;
3985
4372
  next(++i);
3986
4373
  });
3987
4374
  }
3988
4375
 
3989
- process.nextTick(function(){
4376
+ Runner.immediately(function(){
3990
4377
  next(0);
3991
4378
  });
3992
4379
  };
@@ -4229,13 +4616,12 @@ Runner.prototype.run = function(fn){
4229
4616
  var self = this
4230
4617
  , fn = fn || function(){};
4231
4618
 
4232
- debug('start');
4233
-
4234
- // uncaught callback
4235
- function uncaught(err) {
4619
+ function uncaught(err){
4236
4620
  self.uncaught(err);
4237
4621
  }
4238
4622
 
4623
+ debug('start');
4624
+
4239
4625
  // callback
4240
4626
  this.on('end', function(){
4241
4627
  debug('end');
@@ -4267,6 +4653,8 @@ Runner.prototype.run = function(fn){
4267
4653
 
4268
4654
  function filterLeaks(ok, globals) {
4269
4655
  return filter(globals, function(key){
4656
+ // Firefox and Chrome exposes iframes as index inside the window object
4657
+ if (/^d+/.test(key)) return false;
4270
4658
  var matched = filter(ok, function(ok){
4271
4659
  if (~ok.indexOf('*')) return 0 == key.indexOf(ok.split('*')[0]);
4272
4660
  // Opera and IE expose global variables for HTML element IDs (issue #243)
@@ -4348,7 +4736,9 @@ function Suite(title, ctx) {
4348
4736
  * Inherit from `EventEmitter.prototype`.
4349
4737
  */
4350
4738
 
4351
- Suite.prototype = new EventEmitter;
4739
+ function F(){};
4740
+ F.prototype = EventEmitter.prototype;
4741
+ Suite.prototype = new F;
4352
4742
  Suite.prototype.constructor = Suite;
4353
4743
 
4354
4744
 
@@ -4613,7 +5003,9 @@ function Test(title, fn) {
4613
5003
  * Inherit from `Runnable.prototype`.
4614
5004
  */
4615
5005
 
4616
- Test.prototype = new Runnable;
5006
+ function F(){};
5007
+ F.prototype = Runnable.prototype;
5008
+ Test.prototype = new F;
4617
5009
  Test.prototype.constructor = Test;
4618
5010
 
4619
5011
 
@@ -4685,7 +5077,7 @@ exports.indexOf = function(arr, obj, start){
4685
5077
 
4686
5078
  /**
4687
5079
  * Array#reduce (<=IE8)
4688
- *
5080
+ *
4689
5081
  * @param {Array} array
4690
5082
  * @param {Function} fn
4691
5083
  * @param {Object} initial value
@@ -4818,8 +5210,8 @@ exports.clean = function(str) {
4818
5210
  .replace(/^function *\(.*\) *{/, '')
4819
5211
  .replace(/\s+\}$/, '');
4820
5212
 
4821
- var spaces = str.match(/^\n?( *)/)[1].length
4822
- , re = new RegExp('^ {' + spaces + '}', 'gm');
5213
+ var whitespace = str.match(/^\n?(\s*)/)[1]
5214
+ , re = new RegExp('^' + whitespace, 'gm');
4823
5215
 
4824
5216
  str = str.replace(re, '');
4825
5217