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.
- checksums.yaml +7 -0
- data/VERSION +1 -1
- data/vendor/lib/nodes/unit.js +1 -1
- data/vendor/lib/parser.js +0 -1
- data/vendor/lib/renderer.js +2 -0
- data/vendor/lib/visitor/compiler.js +6 -0
- data/vendor/node_modules/cssom/README.mdown +34 -0
- data/vendor/node_modules/cssom/package.json +2 -1
- data/vendor/node_modules/debug/History.md +15 -0
- data/vendor/node_modules/debug/Readme.md +3 -18
- data/vendor/node_modules/debug/component.json +9 -0
- data/vendor/node_modules/debug/debug.js +10 -2
- data/vendor/node_modules/debug/index.js +5 -2
- data/vendor/node_modules/debug/lib/debug.js +5 -6
- data/vendor/node_modules/debug/package.json +11 -6
- data/vendor/node_modules/mkdirp/package.json +6 -9
- data/vendor/node_modules/mkdirp/{README.markdown → readme.markdown} +26 -24
- data/vendor/node_modules/mocha/History.md +140 -58
- data/vendor/node_modules/mocha/LICENSE +2 -2
- data/vendor/node_modules/mocha/Makefile +20 -5
- data/vendor/node_modules/mocha/Readme.md +110 -22
- data/vendor/node_modules/mocha/_mocha.js +574 -182
- data/vendor/node_modules/mocha/bin/_mocha +39 -22
- data/vendor/node_modules/mocha/bin/mocha +6 -2
- data/vendor/node_modules/mocha/component.json +16 -0
- data/vendor/node_modules/mocha/lib/browser/debug.js +1 -2
- data/vendor/node_modules/mocha/lib/browser/diff.js +287 -0
- data/vendor/node_modules/mocha/lib/browser/tty.js +7 -2
- data/vendor/node_modules/mocha/lib/hook.js +0 -1
- data/vendor/node_modules/mocha/lib/interfaces/bdd.js +3 -3
- data/vendor/node_modules/mocha/lib/interfaces/exports.js +5 -5
- data/vendor/node_modules/mocha/lib/interfaces/qunit.js +38 -9
- data/vendor/node_modules/mocha/lib/interfaces/tdd.js +15 -2
- data/vendor/node_modules/mocha/lib/mocha.js +20 -4
- data/vendor/node_modules/mocha/lib/reporters/base.js +57 -37
- data/vendor/node_modules/mocha/lib/reporters/html.js +2 -4
- data/vendor/node_modules/mocha/lib/reporters/json-stream.js +4 -14
- data/vendor/node_modules/mocha/lib/reporters/json.js +9 -19
- data/vendor/node_modules/mocha/lib/reporters/markdown.js +0 -1
- data/vendor/node_modules/mocha/lib/reporters/min.js +2 -2
- data/vendor/node_modules/mocha/lib/reporters/nyan.js +33 -39
- data/vendor/node_modules/mocha/lib/reporters/tap.js +12 -2
- data/vendor/node_modules/mocha/lib/reporters/templates/coverage.jade +3 -3
- data/vendor/node_modules/mocha/lib/reporters/templates/menu.jade +1 -1
- data/vendor/node_modules/mocha/lib/reporters/xunit.js +4 -4
- data/vendor/node_modules/mocha/lib/runnable.js +7 -9
- data/vendor/node_modules/mocha/lib/runner.js +24 -9
- data/vendor/node_modules/mocha/lib/template.html +2 -1
- data/vendor/node_modules/mocha/lib/utils.js +3 -3
- data/vendor/node_modules/mocha/mocha.css +37 -13
- data/vendor/node_modules/mocha/mocha.js +661 -253
- data/vendor/node_modules/mocha/node_modules/commander/package.json +5 -1
- data/vendor/node_modules/mocha/node_modules/diff/package.json +5 -1
- data/vendor/node_modules/mocha/node_modules/glob/LICENSE +27 -0
- data/vendor/node_modules/mocha/node_modules/glob/README.md +250 -0
- data/vendor/node_modules/mocha/node_modules/glob/examples/g.js +9 -0
- data/vendor/node_modules/mocha/node_modules/glob/examples/usr-local.js +9 -0
- data/vendor/node_modules/mocha/node_modules/glob/glob.js +675 -0
- data/vendor/node_modules/mocha/node_modules/glob/node_modules/graceful-fs/LICENSE +27 -0
- data/vendor/node_modules/mocha/node_modules/glob/node_modules/graceful-fs/README.md +33 -0
- data/vendor/node_modules/mocha/node_modules/glob/node_modules/graceful-fs/graceful-fs.js +442 -0
- data/vendor/node_modules/mocha/node_modules/glob/node_modules/graceful-fs/package.json +49 -0
- data/vendor/node_modules/mocha/node_modules/glob/node_modules/graceful-fs/test/open.js +46 -0
- data/vendor/node_modules/mocha/node_modules/glob/node_modules/graceful-fs/test/ulimit.js +158 -0
- data/vendor/node_modules/mocha/node_modules/glob/node_modules/inherits/README.md +51 -0
- data/vendor/node_modules/mocha/node_modules/glob/node_modules/inherits/inherits.js +29 -0
- data/vendor/node_modules/mocha/node_modules/glob/node_modules/inherits/package.json +26 -0
- data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/LICENSE +23 -0
- data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/README.md +218 -0
- data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/minimatch.js +1079 -0
- data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/AUTHORS +8 -0
- data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/LICENSE +23 -0
- data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/README.md +97 -0
- data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/lib/lru-cache.js +257 -0
- data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/package.json +59 -0
- data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/s.js +25 -0
- data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/test/basic.js +329 -0
- data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/test/foreach.js +52 -0
- data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/test/memory-leak.js +50 -0
- data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/sigmund/LICENSE +27 -0
- data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/sigmund/README.md +53 -0
- data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/sigmund/bench.js +283 -0
- data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/sigmund/package.json +38 -0
- data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/sigmund/sigmund.js +39 -0
- data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/sigmund/test/basic.js +24 -0
- data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/package.json +36 -0
- data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/test/basic.js +399 -0
- data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/test/brace-expand.js +33 -0
- data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/test/caching.js +14 -0
- data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/test/defaults.js +274 -0
- data/vendor/node_modules/mocha/node_modules/glob/package.json +40 -0
- data/vendor/node_modules/mocha/node_modules/glob/test/00-setup.js +176 -0
- data/vendor/node_modules/mocha/node_modules/glob/test/bash-comparison.js +63 -0
- data/vendor/node_modules/mocha/node_modules/glob/test/bash-results.json +350 -0
- data/vendor/node_modules/mocha/node_modules/glob/test/cwd-test.js +55 -0
- data/vendor/node_modules/mocha/node_modules/glob/test/globstar-match.js +19 -0
- data/vendor/node_modules/mocha/node_modules/glob/test/mark.js +74 -0
- data/vendor/node_modules/mocha/node_modules/glob/test/nocase-nomagic.js +113 -0
- data/vendor/node_modules/mocha/node_modules/glob/test/pause-resume.js +73 -0
- data/vendor/node_modules/mocha/node_modules/glob/test/root-nomount.js +39 -0
- data/vendor/node_modules/mocha/node_modules/glob/test/root.js +46 -0
- data/vendor/node_modules/mocha/node_modules/glob/test/stat.js +32 -0
- data/vendor/node_modules/mocha/node_modules/glob/test/zz-cleanup.js +11 -0
- data/vendor/node_modules/mocha/node_modules/growl/History.md +5 -0
- data/vendor/node_modules/mocha/node_modules/growl/lib/growl.js +2 -0
- data/vendor/node_modules/mocha/node_modules/growl/package.json +7 -3
- data/vendor/node_modules/mocha/node_modules/jade/node_modules/mkdirp/package.json +5 -1
- data/vendor/node_modules/mocha/node_modules/jade/package.json +5 -1
- data/vendor/node_modules/mocha/node_modules/ms/package.json +5 -1
- data/vendor/node_modules/mocha/package.json +13 -7
- data/vendor/node_modules/mocha/test.js +10 -21
- data/vendor/node_modules/should/History.md +5 -0
- data/vendor/node_modules/should/Readme.md +172 -172
- data/vendor/node_modules/should/lib/eql.js +2 -0
- data/vendor/node_modules/should/lib/should.js +4 -3
- data/vendor/node_modules/should/package.json +8 -4
- data/vendor/node_modules/should/test/should.test.js +27 -0
- data/vendor/package.json +1 -1
- metadata +61 -35
- data/vendor/node_modules/debug/Makefile +0 -4
- data/vendor/node_modules/debug/debug.component.js +0 -120
- data/vendor/node_modules/debug/head.js +0 -1
- data/vendor/node_modules/debug/tail.js +0 -4
- data/vendor/node_modules/mocha/node_modules/mkdirp/LICENSE +0 -21
- data/vendor/node_modules/mocha/node_modules/mkdirp/README.markdown +0 -61
- data/vendor/node_modules/mocha/node_modules/mkdirp/examples/pow.js +0 -6
- data/vendor/node_modules/mocha/node_modules/mkdirp/examples/pow.js.orig +0 -6
- data/vendor/node_modules/mocha/node_modules/mkdirp/examples/pow.js.rej +0 -19
- data/vendor/node_modules/mocha/node_modules/mkdirp/index.js +0 -94
- data/vendor/node_modules/mocha/node_modules/mkdirp/package.json +0 -33
- data/vendor/node_modules/mocha/node_modules/mkdirp/test/chmod.js +0 -38
- data/vendor/node_modules/mocha/node_modules/mkdirp/test/clobber.js +0 -37
- data/vendor/node_modules/mocha/node_modules/mkdirp/test/mkdirp.js +0 -28
- data/vendor/node_modules/mocha/node_modules/mkdirp/test/perm.js +0 -32
- data/vendor/node_modules/mocha/node_modules/mkdirp/test/perm_sync.js +0 -39
- data/vendor/node_modules/mocha/node_modules/mkdirp/test/race.js +0 -41
- data/vendor/node_modules/mocha/node_modules/mkdirp/test/rel.js +0 -32
- data/vendor/node_modules/mocha/node_modules/mkdirp/test/return.js +0 -25
- data/vendor/node_modules/mocha/node_modules/mkdirp/test/return_sync.js +0 -24
- data/vendor/node_modules/mocha/node_modules/mkdirp/test/root.js +0 -18
- data/vendor/node_modules/mocha/node_modules/mkdirp/test/sync.js +0 -32
- data/vendor/node_modules/mocha/node_modules/mkdirp/test/umask.js +0 -28
- data/vendor/node_modules/mocha/node_modules/mkdirp/test/umask_sync.js +0 -32
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
;(function(){
|
|
2
2
|
|
|
3
|
-
|
|
4
3
|
// CommonJS require()
|
|
5
4
|
|
|
6
5
|
function require(p){
|
|
@@ -32,11 +31,11 @@ require.register = function (path, fn){
|
|
|
32
31
|
require.relative = function (parent) {
|
|
33
32
|
return function(p){
|
|
34
33
|
if ('.' != p.charAt(0)) return require(p);
|
|
35
|
-
|
|
34
|
+
|
|
36
35
|
var path = parent.split('/')
|
|
37
36
|
, segs = p.split('/');
|
|
38
37
|
path.pop();
|
|
39
|
-
|
|
38
|
+
|
|
40
39
|
for (var i = 0; i < segs.length; i++) {
|
|
41
40
|
var seg = segs[i];
|
|
42
41
|
if ('..' == seg) path.pop();
|
|
@@ -52,12 +51,299 @@ require.register("browser/debug.js", function(module, exports, require){
|
|
|
52
51
|
|
|
53
52
|
module.exports = function(type){
|
|
54
53
|
return function(){
|
|
55
|
-
|
|
56
54
|
}
|
|
57
55
|
};
|
|
56
|
+
|
|
58
57
|
}); // module: browser/debug.js
|
|
59
58
|
|
|
60
59
|
require.register("browser/diff.js", function(module, exports, require){
|
|
60
|
+
/* See license.txt for terms of usage */
|
|
61
|
+
|
|
62
|
+
/*
|
|
63
|
+
* Text diff implementation.
|
|
64
|
+
*
|
|
65
|
+
* This library supports the following APIS:
|
|
66
|
+
* JsDiff.diffChars: Character by character diff
|
|
67
|
+
* JsDiff.diffWords: Word (as defined by \b regex) diff which ignores whitespace
|
|
68
|
+
* JsDiff.diffLines: Line based diff
|
|
69
|
+
*
|
|
70
|
+
* JsDiff.diffCss: Diff targeted at CSS content
|
|
71
|
+
*
|
|
72
|
+
* These methods are based on the implementation proposed in
|
|
73
|
+
* "An O(ND) Difference Algorithm and its Variations" (Myers, 1986).
|
|
74
|
+
* http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.4.6927
|
|
75
|
+
*/
|
|
76
|
+
var JsDiff = (function() {
|
|
77
|
+
function clonePath(path) {
|
|
78
|
+
return { newPos: path.newPos, components: path.components.slice(0) };
|
|
79
|
+
}
|
|
80
|
+
function removeEmpty(array) {
|
|
81
|
+
var ret = [];
|
|
82
|
+
for (var i = 0; i < array.length; i++) {
|
|
83
|
+
if (array[i]) {
|
|
84
|
+
ret.push(array[i]);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return ret;
|
|
88
|
+
}
|
|
89
|
+
function escapeHTML(s) {
|
|
90
|
+
var n = s;
|
|
91
|
+
n = n.replace(/&/g, "&");
|
|
92
|
+
n = n.replace(/</g, "<");
|
|
93
|
+
n = n.replace(/>/g, ">");
|
|
94
|
+
n = n.replace(/"/g, """);
|
|
95
|
+
|
|
96
|
+
return n;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
var fbDiff = function(ignoreWhitespace) {
|
|
101
|
+
this.ignoreWhitespace = ignoreWhitespace;
|
|
102
|
+
};
|
|
103
|
+
fbDiff.prototype = {
|
|
104
|
+
diff: function(oldString, newString) {
|
|
105
|
+
// Handle the identity case (this is due to unrolling editLength == 0
|
|
106
|
+
if (newString == oldString) {
|
|
107
|
+
return [{ value: newString }];
|
|
108
|
+
}
|
|
109
|
+
if (!newString) {
|
|
110
|
+
return [{ value: oldString, removed: true }];
|
|
111
|
+
}
|
|
112
|
+
if (!oldString) {
|
|
113
|
+
return [{ value: newString, added: true }];
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
newString = this.tokenize(newString);
|
|
117
|
+
oldString = this.tokenize(oldString);
|
|
118
|
+
|
|
119
|
+
var newLen = newString.length, oldLen = oldString.length;
|
|
120
|
+
var maxEditLength = newLen + oldLen;
|
|
121
|
+
var bestPath = [{ newPos: -1, components: [] }];
|
|
122
|
+
|
|
123
|
+
// Seed editLength = 0
|
|
124
|
+
var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0);
|
|
125
|
+
if (bestPath[0].newPos+1 >= newLen && oldPos+1 >= oldLen) {
|
|
126
|
+
return bestPath[0].components;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
for (var editLength = 1; editLength <= maxEditLength; editLength++) {
|
|
130
|
+
for (var diagonalPath = -1*editLength; diagonalPath <= editLength; diagonalPath+=2) {
|
|
131
|
+
var basePath;
|
|
132
|
+
var addPath = bestPath[diagonalPath-1],
|
|
133
|
+
removePath = bestPath[diagonalPath+1];
|
|
134
|
+
oldPos = (removePath ? removePath.newPos : 0) - diagonalPath;
|
|
135
|
+
if (addPath) {
|
|
136
|
+
// No one else is going to attempt to use this value, clear it
|
|
137
|
+
bestPath[diagonalPath-1] = undefined;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
var canAdd = addPath && addPath.newPos+1 < newLen;
|
|
141
|
+
var canRemove = removePath && 0 <= oldPos && oldPos < oldLen;
|
|
142
|
+
if (!canAdd && !canRemove) {
|
|
143
|
+
bestPath[diagonalPath] = undefined;
|
|
144
|
+
continue;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// Select the diagonal that we want to branch from. We select the prior
|
|
148
|
+
// path whose position in the new string is the farthest from the origin
|
|
149
|
+
// and does not pass the bounds of the diff graph
|
|
150
|
+
if (!canAdd || (canRemove && addPath.newPos < removePath.newPos)) {
|
|
151
|
+
basePath = clonePath(removePath);
|
|
152
|
+
this.pushComponent(basePath.components, oldString[oldPos], undefined, true);
|
|
153
|
+
} else {
|
|
154
|
+
basePath = clonePath(addPath);
|
|
155
|
+
basePath.newPos++;
|
|
156
|
+
this.pushComponent(basePath.components, newString[basePath.newPos], true, undefined);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
var oldPos = this.extractCommon(basePath, newString, oldString, diagonalPath);
|
|
160
|
+
|
|
161
|
+
if (basePath.newPos+1 >= newLen && oldPos+1 >= oldLen) {
|
|
162
|
+
return basePath.components;
|
|
163
|
+
} else {
|
|
164
|
+
bestPath[diagonalPath] = basePath;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
|
|
170
|
+
pushComponent: function(components, value, added, removed) {
|
|
171
|
+
var last = components[components.length-1];
|
|
172
|
+
if (last && last.added === added && last.removed === removed) {
|
|
173
|
+
// We need to clone here as the component clone operation is just
|
|
174
|
+
// as shallow array clone
|
|
175
|
+
components[components.length-1] =
|
|
176
|
+
{value: this.join(last.value, value), added: added, removed: removed };
|
|
177
|
+
} else {
|
|
178
|
+
components.push({value: value, added: added, removed: removed });
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
extractCommon: function(basePath, newString, oldString, diagonalPath) {
|
|
182
|
+
var newLen = newString.length,
|
|
183
|
+
oldLen = oldString.length,
|
|
184
|
+
newPos = basePath.newPos,
|
|
185
|
+
oldPos = newPos - diagonalPath;
|
|
186
|
+
while (newPos+1 < newLen && oldPos+1 < oldLen && this.equals(newString[newPos+1], oldString[oldPos+1])) {
|
|
187
|
+
newPos++;
|
|
188
|
+
oldPos++;
|
|
189
|
+
|
|
190
|
+
this.pushComponent(basePath.components, newString[newPos], undefined, undefined);
|
|
191
|
+
}
|
|
192
|
+
basePath.newPos = newPos;
|
|
193
|
+
return oldPos;
|
|
194
|
+
},
|
|
195
|
+
|
|
196
|
+
equals: function(left, right) {
|
|
197
|
+
var reWhitespace = /\S/;
|
|
198
|
+
if (this.ignoreWhitespace && !reWhitespace.test(left) && !reWhitespace.test(right)) {
|
|
199
|
+
return true;
|
|
200
|
+
} else {
|
|
201
|
+
return left == right;
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
join: function(left, right) {
|
|
205
|
+
return left + right;
|
|
206
|
+
},
|
|
207
|
+
tokenize: function(value) {
|
|
208
|
+
return value;
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
var CharDiff = new fbDiff();
|
|
213
|
+
|
|
214
|
+
var WordDiff = new fbDiff(true);
|
|
215
|
+
WordDiff.tokenize = function(value) {
|
|
216
|
+
return removeEmpty(value.split(/(\s+|\b)/));
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
var CssDiff = new fbDiff(true);
|
|
220
|
+
CssDiff.tokenize = function(value) {
|
|
221
|
+
return removeEmpty(value.split(/([{}:;,]|\s+)/));
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
var LineDiff = new fbDiff();
|
|
225
|
+
LineDiff.tokenize = function(value) {
|
|
226
|
+
return value.split(/^/m);
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
return {
|
|
230
|
+
diffChars: function(oldStr, newStr) { return CharDiff.diff(oldStr, newStr); },
|
|
231
|
+
diffWords: function(oldStr, newStr) { return WordDiff.diff(oldStr, newStr); },
|
|
232
|
+
diffLines: function(oldStr, newStr) { return LineDiff.diff(oldStr, newStr); },
|
|
233
|
+
|
|
234
|
+
diffCss: function(oldStr, newStr) { return CssDiff.diff(oldStr, newStr); },
|
|
235
|
+
|
|
236
|
+
createPatch: function(fileName, oldStr, newStr, oldHeader, newHeader) {
|
|
237
|
+
var ret = [];
|
|
238
|
+
|
|
239
|
+
ret.push("Index: " + fileName);
|
|
240
|
+
ret.push("===================================================================");
|
|
241
|
+
ret.push("--- " + fileName + (typeof oldHeader === "undefined" ? "" : "\t" + oldHeader));
|
|
242
|
+
ret.push("+++ " + fileName + (typeof newHeader === "undefined" ? "" : "\t" + newHeader));
|
|
243
|
+
|
|
244
|
+
var diff = LineDiff.diff(oldStr, newStr);
|
|
245
|
+
if (!diff[diff.length-1].value) {
|
|
246
|
+
diff.pop(); // Remove trailing newline add
|
|
247
|
+
}
|
|
248
|
+
diff.push({value: "", lines: []}); // Append an empty value to make cleanup easier
|
|
249
|
+
|
|
250
|
+
function contextLines(lines) {
|
|
251
|
+
return lines.map(function(entry) { return ' ' + entry; });
|
|
252
|
+
}
|
|
253
|
+
function eofNL(curRange, i, current) {
|
|
254
|
+
var last = diff[diff.length-2],
|
|
255
|
+
isLast = i === diff.length-2,
|
|
256
|
+
isLastOfType = i === diff.length-3 && (current.added === !last.added || current.removed === !last.removed);
|
|
257
|
+
|
|
258
|
+
// Figure out if this is the last line for the given file and missing NL
|
|
259
|
+
if (!/\n$/.test(current.value) && (isLast || isLastOfType)) {
|
|
260
|
+
curRange.push('\');
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
var oldRangeStart = 0, newRangeStart = 0, curRange = [],
|
|
265
|
+
oldLine = 1, newLine = 1;
|
|
266
|
+
for (var i = 0; i < diff.length; i++) {
|
|
267
|
+
var current = diff[i],
|
|
268
|
+
lines = current.lines || current.value.replace(/\n$/, "").split("\n");
|
|
269
|
+
current.lines = lines;
|
|
270
|
+
|
|
271
|
+
if (current.added || current.removed) {
|
|
272
|
+
if (!oldRangeStart) {
|
|
273
|
+
var prev = diff[i-1];
|
|
274
|
+
oldRangeStart = oldLine;
|
|
275
|
+
newRangeStart = newLine;
|
|
276
|
+
|
|
277
|
+
if (prev) {
|
|
278
|
+
curRange = contextLines(prev.lines.slice(-4));
|
|
279
|
+
oldRangeStart -= curRange.length;
|
|
280
|
+
newRangeStart -= curRange.length;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
curRange.push.apply(curRange, lines.map(function(entry) { return (current.added?"+":"-") + entry; }));
|
|
284
|
+
eofNL(curRange, i, current);
|
|
285
|
+
|
|
286
|
+
if (current.added) {
|
|
287
|
+
newLine += lines.length;
|
|
288
|
+
} else {
|
|
289
|
+
oldLine += lines.length;
|
|
290
|
+
}
|
|
291
|
+
} else {
|
|
292
|
+
if (oldRangeStart) {
|
|
293
|
+
// Close out any changes that have been output (or join overlapping)
|
|
294
|
+
if (lines.length <= 8 && i < diff.length-2) {
|
|
295
|
+
// Overlapping
|
|
296
|
+
curRange.push.apply(curRange, contextLines(lines));
|
|
297
|
+
} else {
|
|
298
|
+
// end the range and output
|
|
299
|
+
var contextSize = Math.min(lines.length, 4);
|
|
300
|
+
ret.push(
|
|
301
|
+
"@@ -" + oldRangeStart + "," + (oldLine-oldRangeStart+contextSize)
|
|
302
|
+
+ " +" + newRangeStart + "," + (newLine-newRangeStart+contextSize)
|
|
303
|
+
+ " @@");
|
|
304
|
+
ret.push.apply(ret, curRange);
|
|
305
|
+
ret.push.apply(ret, contextLines(lines.slice(0, contextSize)));
|
|
306
|
+
if (lines.length <= 4) {
|
|
307
|
+
eofNL(ret, i, current);
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
oldRangeStart = 0; newRangeStart = 0; curRange = [];
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
oldLine += lines.length;
|
|
314
|
+
newLine += lines.length;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
return ret.join('\n') + '\n';
|
|
319
|
+
},
|
|
320
|
+
|
|
321
|
+
convertChangesToXML: function(changes){
|
|
322
|
+
var ret = [];
|
|
323
|
+
for ( var i = 0; i < changes.length; i++) {
|
|
324
|
+
var change = changes[i];
|
|
325
|
+
if (change.added) {
|
|
326
|
+
ret.push("<ins>");
|
|
327
|
+
} else if (change.removed) {
|
|
328
|
+
ret.push("<del>");
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
ret.push(escapeHTML(change.value));
|
|
332
|
+
|
|
333
|
+
if (change.added) {
|
|
334
|
+
ret.push("</ins>");
|
|
335
|
+
} else if (change.removed) {
|
|
336
|
+
ret.push("</del>");
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
return ret.join("");
|
|
340
|
+
}
|
|
341
|
+
};
|
|
342
|
+
})();
|
|
343
|
+
|
|
344
|
+
if (typeof module !== "undefined") {
|
|
345
|
+
module.exports = JsDiff;
|
|
346
|
+
}
|
|
61
347
|
|
|
62
348
|
}); // module: browser/diff.js
|
|
63
349
|
|
|
@@ -386,8 +672,14 @@ exports.isatty = function(){
|
|
|
386
672
|
};
|
|
387
673
|
|
|
388
674
|
exports.getWindowSize = function(){
|
|
389
|
-
|
|
675
|
+
if ('innerHeight' in global) {
|
|
676
|
+
return [global.innerHeight, global.innerWidth];
|
|
677
|
+
} else {
|
|
678
|
+
// In a Web Worker, the DOM Window is not available.
|
|
679
|
+
return [640, 480];
|
|
680
|
+
}
|
|
390
681
|
};
|
|
682
|
+
|
|
391
683
|
}); // module: browser/tty.js
|
|
392
684
|
|
|
393
685
|
require.register("context.js", function(module, exports, require){
|
|
@@ -494,7 +786,9 @@ function Hook(title, fn) {
|
|
|
494
786
|
* Inherit from `Runnable.prototype`.
|
|
495
787
|
*/
|
|
496
788
|
|
|
497
|
-
|
|
789
|
+
function F(){};
|
|
790
|
+
F.prototype = Runnable.prototype;
|
|
791
|
+
Hook.prototype = new F;
|
|
498
792
|
Hook.prototype.constructor = Hook;
|
|
499
793
|
|
|
500
794
|
|
|
@@ -516,7 +810,6 @@ Hook.prototype.error = function(err){
|
|
|
516
810
|
this._error = err;
|
|
517
811
|
};
|
|
518
812
|
|
|
519
|
-
|
|
520
813
|
}); // module: hook.js
|
|
521
814
|
|
|
522
815
|
require.register("interfaces/bdd.js", function(module, exports, require){
|
|
@@ -530,7 +823,7 @@ var Suite = require('../suite')
|
|
|
530
823
|
|
|
531
824
|
/**
|
|
532
825
|
* BDD-style interface:
|
|
533
|
-
*
|
|
826
|
+
*
|
|
534
827
|
* describe('Array', function(){
|
|
535
828
|
* describe('#indexOf()', function(){
|
|
536
829
|
* it('should return -1 when not present', function(){
|
|
@@ -542,7 +835,7 @@ var Suite = require('../suite')
|
|
|
542
835
|
* });
|
|
543
836
|
* });
|
|
544
837
|
* });
|
|
545
|
-
*
|
|
838
|
+
*
|
|
546
839
|
*/
|
|
547
840
|
|
|
548
841
|
module.exports = function(suite){
|
|
@@ -587,7 +880,7 @@ module.exports = function(suite){
|
|
|
587
880
|
* and callback `fn` containing nested suites
|
|
588
881
|
* and/or tests.
|
|
589
882
|
*/
|
|
590
|
-
|
|
883
|
+
|
|
591
884
|
context.describe = context.context = function(title, fn){
|
|
592
885
|
var suite = Suite.create(suites[0], title);
|
|
593
886
|
suites.unshift(suite);
|
|
@@ -667,19 +960,19 @@ var Suite = require('../suite')
|
|
|
667
960
|
|
|
668
961
|
/**
|
|
669
962
|
* TDD-style interface:
|
|
670
|
-
*
|
|
963
|
+
*
|
|
671
964
|
* exports.Array = {
|
|
672
965
|
* '#indexOf()': {
|
|
673
966
|
* 'should return -1 when the value is not present': function(){
|
|
674
|
-
*
|
|
967
|
+
*
|
|
675
968
|
* },
|
|
676
969
|
*
|
|
677
970
|
* 'should return the correct index when the value is present': function(){
|
|
678
|
-
*
|
|
971
|
+
*
|
|
679
972
|
* }
|
|
680
973
|
* }
|
|
681
974
|
* };
|
|
682
|
-
*
|
|
975
|
+
*
|
|
683
976
|
*/
|
|
684
977
|
|
|
685
978
|
module.exports = function(suite){
|
|
@@ -717,6 +1010,7 @@ module.exports = function(suite){
|
|
|
717
1010
|
}
|
|
718
1011
|
}
|
|
719
1012
|
};
|
|
1013
|
+
|
|
720
1014
|
}); // module: interfaces/exports.js
|
|
721
1015
|
|
|
722
1016
|
require.register("interfaces/index.js", function(module, exports, require){
|
|
@@ -739,33 +1033,33 @@ var Suite = require('../suite')
|
|
|
739
1033
|
|
|
740
1034
|
/**
|
|
741
1035
|
* QUnit-style interface:
|
|
742
|
-
*
|
|
1036
|
+
*
|
|
743
1037
|
* suite('Array');
|
|
744
|
-
*
|
|
1038
|
+
*
|
|
745
1039
|
* test('#length', function(){
|
|
746
1040
|
* var arr = [1,2,3];
|
|
747
1041
|
* ok(arr.length == 3);
|
|
748
1042
|
* });
|
|
749
|
-
*
|
|
1043
|
+
*
|
|
750
1044
|
* test('#indexOf()', function(){
|
|
751
1045
|
* var arr = [1,2,3];
|
|
752
1046
|
* ok(arr.indexOf(1) == 0);
|
|
753
1047
|
* ok(arr.indexOf(2) == 1);
|
|
754
1048
|
* ok(arr.indexOf(3) == 2);
|
|
755
1049
|
* });
|
|
756
|
-
*
|
|
1050
|
+
*
|
|
757
1051
|
* suite('String');
|
|
758
|
-
*
|
|
1052
|
+
*
|
|
759
1053
|
* test('#length', function(){
|
|
760
1054
|
* ok('foo'.length == 3);
|
|
761
1055
|
* });
|
|
762
|
-
*
|
|
1056
|
+
*
|
|
763
1057
|
*/
|
|
764
1058
|
|
|
765
1059
|
module.exports = function(suite){
|
|
766
1060
|
var suites = [suite];
|
|
767
1061
|
|
|
768
|
-
suite.on('pre-require', function(context){
|
|
1062
|
+
suite.on('pre-require', function(context, file, mocha){
|
|
769
1063
|
|
|
770
1064
|
/**
|
|
771
1065
|
* Execute before running tests.
|
|
@@ -802,11 +1096,21 @@ module.exports = function(suite){
|
|
|
802
1096
|
/**
|
|
803
1097
|
* Describe a "suite" with the given `title`.
|
|
804
1098
|
*/
|
|
805
|
-
|
|
1099
|
+
|
|
806
1100
|
context.suite = function(title){
|
|
807
1101
|
if (suites.length > 1) suites.shift();
|
|
808
1102
|
var suite = Suite.create(suites[0], title);
|
|
809
1103
|
suites.unshift(suite);
|
|
1104
|
+
return suite;
|
|
1105
|
+
};
|
|
1106
|
+
|
|
1107
|
+
/**
|
|
1108
|
+
* Exclusive test-case.
|
|
1109
|
+
*/
|
|
1110
|
+
|
|
1111
|
+
context.suite.only = function(title, fn){
|
|
1112
|
+
var suite = context.suite(title, fn);
|
|
1113
|
+
mocha.grep(suite.fullTitle());
|
|
810
1114
|
};
|
|
811
1115
|
|
|
812
1116
|
/**
|
|
@@ -816,7 +1120,26 @@ module.exports = function(suite){
|
|
|
816
1120
|
*/
|
|
817
1121
|
|
|
818
1122
|
context.test = function(title, fn){
|
|
819
|
-
|
|
1123
|
+
var test = new Test(title, fn);
|
|
1124
|
+
suites[0].addTest(test);
|
|
1125
|
+
return test;
|
|
1126
|
+
};
|
|
1127
|
+
|
|
1128
|
+
/**
|
|
1129
|
+
* Exclusive test-case.
|
|
1130
|
+
*/
|
|
1131
|
+
|
|
1132
|
+
context.test.only = function(title, fn){
|
|
1133
|
+
var test = context.test(title, fn);
|
|
1134
|
+
mocha.grep(test.fullTitle());
|
|
1135
|
+
};
|
|
1136
|
+
|
|
1137
|
+
/**
|
|
1138
|
+
* Pending test case.
|
|
1139
|
+
*/
|
|
1140
|
+
|
|
1141
|
+
context.test.skip = function(title){
|
|
1142
|
+
context.test(title);
|
|
820
1143
|
};
|
|
821
1144
|
});
|
|
822
1145
|
};
|
|
@@ -840,7 +1163,7 @@ var Suite = require('../suite')
|
|
|
840
1163
|
* suiteSetup(function(){
|
|
841
1164
|
*
|
|
842
1165
|
* });
|
|
843
|
-
*
|
|
1166
|
+
*
|
|
844
1167
|
* test('should return -1 when not present', function(){
|
|
845
1168
|
*
|
|
846
1169
|
* });
|
|
@@ -908,6 +1231,17 @@ module.exports = function(suite){
|
|
|
908
1231
|
return suite;
|
|
909
1232
|
};
|
|
910
1233
|
|
|
1234
|
+
/**
|
|
1235
|
+
* Pending suite.
|
|
1236
|
+
*/
|
|
1237
|
+
context.suite.skip = function(title, fn) {
|
|
1238
|
+
var suite = Suite.create(suites[0], title);
|
|
1239
|
+
suite.pending = true;
|
|
1240
|
+
suites.unshift(suite);
|
|
1241
|
+
fn.call(suite);
|
|
1242
|
+
suites.shift();
|
|
1243
|
+
};
|
|
1244
|
+
|
|
911
1245
|
/**
|
|
912
1246
|
* Exclusive test-case.
|
|
913
1247
|
*/
|
|
@@ -924,8 +1258,10 @@ module.exports = function(suite){
|
|
|
924
1258
|
*/
|
|
925
1259
|
|
|
926
1260
|
context.test = function(title, fn){
|
|
1261
|
+
var suite = suites[0];
|
|
1262
|
+
if (suite.pending) var fn = null;
|
|
927
1263
|
var test = new Test(title, fn);
|
|
928
|
-
|
|
1264
|
+
suite.addTest(test);
|
|
929
1265
|
return test;
|
|
930
1266
|
};
|
|
931
1267
|
|
|
@@ -1005,6 +1341,7 @@ function image(name) {
|
|
|
1005
1341
|
* - `reporter` reporter instance, defaults to `mocha.reporters.Dot`
|
|
1006
1342
|
* - `globals` array of accepted globals
|
|
1007
1343
|
* - `timeout` timeout in milliseconds
|
|
1344
|
+
* - `bail` bail on the first test failure
|
|
1008
1345
|
* - `slow` milliseconds to wait before considering a test slow
|
|
1009
1346
|
* - `ignoreLeaks` ignore global leaks
|
|
1010
1347
|
* - `grep` string or regexp to filter tests with
|
|
@@ -1020,11 +1357,25 @@ function Mocha(options) {
|
|
|
1020
1357
|
this.grep(options.grep);
|
|
1021
1358
|
this.suite = new exports.Suite('', new exports.Context);
|
|
1022
1359
|
this.ui(options.ui);
|
|
1360
|
+
this.bail(options.bail);
|
|
1023
1361
|
this.reporter(options.reporter);
|
|
1024
1362
|
if (options.timeout) this.timeout(options.timeout);
|
|
1025
1363
|
if (options.slow) this.slow(options.slow);
|
|
1026
1364
|
}
|
|
1027
1365
|
|
|
1366
|
+
/**
|
|
1367
|
+
* Enable or disable bailing on the first failure.
|
|
1368
|
+
*
|
|
1369
|
+
* @param {Boolean} [bail]
|
|
1370
|
+
* @api public
|
|
1371
|
+
*/
|
|
1372
|
+
|
|
1373
|
+
Mocha.prototype.bail = function(bail){
|
|
1374
|
+
if (0 == arguments.length) bail = true;
|
|
1375
|
+
this.suite.bail(bail);
|
|
1376
|
+
return this;
|
|
1377
|
+
};
|
|
1378
|
+
|
|
1028
1379
|
/**
|
|
1029
1380
|
* Add test `file`.
|
|
1030
1381
|
*
|
|
@@ -1040,7 +1391,7 @@ Mocha.prototype.addFile = function(file){
|
|
|
1040
1391
|
/**
|
|
1041
1392
|
* Set reporter to `reporter`, defaults to "dot".
|
|
1042
1393
|
*
|
|
1043
|
-
* @param {String|Function} reporter name
|
|
1394
|
+
* @param {String|Function} reporter name or constructor
|
|
1044
1395
|
* @api public
|
|
1045
1396
|
*/
|
|
1046
1397
|
|
|
@@ -1147,12 +1498,13 @@ Mocha.prototype.invert = function(){
|
|
|
1147
1498
|
/**
|
|
1148
1499
|
* Ignore global leaks.
|
|
1149
1500
|
*
|
|
1501
|
+
* @param {Boolean} ignore
|
|
1150
1502
|
* @return {Mocha}
|
|
1151
1503
|
* @api public
|
|
1152
1504
|
*/
|
|
1153
1505
|
|
|
1154
|
-
Mocha.prototype.ignoreLeaks = function(){
|
|
1155
|
-
this.options.ignoreLeaks =
|
|
1506
|
+
Mocha.prototype.ignoreLeaks = function(ignore){
|
|
1507
|
+
this.options.ignoreLeaks = !!ignore;
|
|
1156
1508
|
return this;
|
|
1157
1509
|
};
|
|
1158
1510
|
|
|
@@ -1245,7 +1597,7 @@ Mocha.prototype.run = function(fn){
|
|
|
1245
1597
|
var options = this.options;
|
|
1246
1598
|
var runner = new exports.Runner(suite);
|
|
1247
1599
|
var reporter = new this._reporter(runner);
|
|
1248
|
-
runner.ignoreLeaks = options.ignoreLeaks;
|
|
1600
|
+
runner.ignoreLeaks = false !== options.ignoreLeaks;
|
|
1249
1601
|
runner.asyncOnly = options.asyncOnly;
|
|
1250
1602
|
if (options.grep) runner.grep(options.grep, options.invert);
|
|
1251
1603
|
if (options.globals) runner.globals(options.globals);
|
|
@@ -1406,7 +1758,7 @@ exports.colors = {
|
|
|
1406
1758
|
/**
|
|
1407
1759
|
* Default symbol map.
|
|
1408
1760
|
*/
|
|
1409
|
-
|
|
1761
|
+
|
|
1410
1762
|
exports.symbols = {
|
|
1411
1763
|
ok: '✓',
|
|
1412
1764
|
err: '✖',
|
|
@@ -1503,19 +1855,21 @@ exports.list = function(failures){
|
|
|
1503
1855
|
, expected = err.expected
|
|
1504
1856
|
, escape = true;
|
|
1505
1857
|
|
|
1858
|
+
// uncaught
|
|
1859
|
+
if (err.uncaught) {
|
|
1860
|
+
msg = 'Uncaught ' + msg;
|
|
1861
|
+
}
|
|
1862
|
+
|
|
1506
1863
|
// explicitly show diff
|
|
1507
|
-
if (err.showDiff) {
|
|
1864
|
+
if (err.showDiff && sameType(actual, expected)) {
|
|
1508
1865
|
escape = false;
|
|
1509
|
-
err.actual = actual =
|
|
1510
|
-
err.expected = expected =
|
|
1866
|
+
err.actual = actual = stringify(actual);
|
|
1867
|
+
err.expected = expected = stringify(expected);
|
|
1511
1868
|
}
|
|
1512
1869
|
|
|
1513
1870
|
// actual / expected diff
|
|
1514
1871
|
if ('string' == typeof actual && 'string' == typeof expected) {
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
if (len < 20) msg = errorDiff(err, 'Chars', escape);
|
|
1518
|
-
else msg = errorDiff(err, 'Words', escape);
|
|
1872
|
+
msg = errorDiff(err, 'Words', escape);
|
|
1519
1873
|
|
|
1520
1874
|
// linenos
|
|
1521
1875
|
var lines = msg.split('\n');
|
|
@@ -1624,48 +1978,38 @@ function Base(runner) {
|
|
|
1624
1978
|
*/
|
|
1625
1979
|
|
|
1626
1980
|
Base.prototype.epilogue = function(){
|
|
1627
|
-
var stats = this.stats
|
|
1628
|
-
|
|
1629
|
-
|
|
1981
|
+
var stats = this.stats;
|
|
1982
|
+
var tests;
|
|
1983
|
+
var fmt;
|
|
1630
1984
|
|
|
1631
1985
|
console.log();
|
|
1632
1986
|
|
|
1633
|
-
|
|
1634
|
-
return 1 == n ? 'test' : 'tests';
|
|
1635
|
-
}
|
|
1636
|
-
|
|
1637
|
-
// failure
|
|
1638
|
-
if (stats.failures) {
|
|
1639
|
-
fmt = color('bright fail', ' ' + exports.symbols.err)
|
|
1640
|
-
+ color('fail', ' %d of %d %s failed')
|
|
1641
|
-
+ color('light', ':')
|
|
1642
|
-
|
|
1643
|
-
console.error(fmt,
|
|
1644
|
-
stats.failures,
|
|
1645
|
-
this.runner.total,
|
|
1646
|
-
pluralize(this.runner.total));
|
|
1647
|
-
|
|
1648
|
-
Base.list(this.failures);
|
|
1649
|
-
console.error();
|
|
1650
|
-
return;
|
|
1651
|
-
}
|
|
1652
|
-
|
|
1653
|
-
// pass
|
|
1987
|
+
// passes
|
|
1654
1988
|
fmt = color('bright pass', ' ')
|
|
1655
|
-
+ color('green', ' %d
|
|
1989
|
+
+ color('green', ' %d passing')
|
|
1656
1990
|
+ color('light', ' (%s)');
|
|
1657
1991
|
|
|
1658
1992
|
console.log(fmt,
|
|
1659
|
-
stats.
|
|
1660
|
-
pluralize(stats.tests),
|
|
1993
|
+
stats.passes || 0,
|
|
1661
1994
|
ms(stats.duration));
|
|
1662
1995
|
|
|
1663
1996
|
// pending
|
|
1664
1997
|
if (stats.pending) {
|
|
1665
1998
|
fmt = color('pending', ' ')
|
|
1666
|
-
+ color('pending', ' %d
|
|
1999
|
+
+ color('pending', ' %d pending');
|
|
1667
2000
|
|
|
1668
|
-
console.log(fmt, stats.pending
|
|
2001
|
+
console.log(fmt, stats.pending);
|
|
2002
|
+
}
|
|
2003
|
+
|
|
2004
|
+
// failures
|
|
2005
|
+
if (stats.failures) {
|
|
2006
|
+
fmt = color('fail', ' %d failing');
|
|
2007
|
+
|
|
2008
|
+
console.error(fmt,
|
|
2009
|
+
stats.failures);
|
|
2010
|
+
|
|
2011
|
+
Base.list(this.failures);
|
|
2012
|
+
console.error();
|
|
1669
2013
|
}
|
|
1670
2014
|
|
|
1671
2015
|
console.log();
|
|
@@ -1722,6 +2066,34 @@ function colorLines(name, str) {
|
|
|
1722
2066
|
}).join('\n');
|
|
1723
2067
|
}
|
|
1724
2068
|
|
|
2069
|
+
/**
|
|
2070
|
+
* Stringify `obj`.
|
|
2071
|
+
*
|
|
2072
|
+
* @param {Mixed} obj
|
|
2073
|
+
* @return {String}
|
|
2074
|
+
* @api private
|
|
2075
|
+
*/
|
|
2076
|
+
|
|
2077
|
+
function stringify(obj) {
|
|
2078
|
+
if (obj instanceof RegExp) return obj.toString();
|
|
2079
|
+
return JSON.stringify(obj, null, 2);
|
|
2080
|
+
}
|
|
2081
|
+
|
|
2082
|
+
/**
|
|
2083
|
+
* Check that a / b have the same type.
|
|
2084
|
+
*
|
|
2085
|
+
* @param {Object} a
|
|
2086
|
+
* @param {Object} b
|
|
2087
|
+
* @return {Boolean}
|
|
2088
|
+
* @api private
|
|
2089
|
+
*/
|
|
2090
|
+
|
|
2091
|
+
function sameType(a, b) {
|
|
2092
|
+
a = Object.prototype.toString.call(a);
|
|
2093
|
+
b = Object.prototype.toString.call(b);
|
|
2094
|
+
return a == b;
|
|
2095
|
+
}
|
|
2096
|
+
|
|
1725
2097
|
}); // module: reporters/base.js
|
|
1726
2098
|
|
|
1727
2099
|
require.register("reporters/doc.js", function(module, exports, require){
|
|
@@ -1846,7 +2218,9 @@ function Dot(runner) {
|
|
|
1846
2218
|
* Inherit from `Base.prototype`.
|
|
1847
2219
|
*/
|
|
1848
2220
|
|
|
1849
|
-
|
|
2221
|
+
function F(){};
|
|
2222
|
+
F.prototype = Base.prototype;
|
|
2223
|
+
Dot.prototype = new F;
|
|
1850
2224
|
Dot.prototype.constructor = Dot;
|
|
1851
2225
|
|
|
1852
2226
|
}); // module: reporters/dot.js
|
|
@@ -2024,12 +2398,10 @@ function HTML(runner, root) {
|
|
|
2024
2398
|
});
|
|
2025
2399
|
|
|
2026
2400
|
runner.on('fail', function(test, err){
|
|
2027
|
-
if ('hook' == test.type
|
|
2401
|
+
if ('hook' == test.type) runner.emit('test end', test);
|
|
2028
2402
|
});
|
|
2029
2403
|
|
|
2030
2404
|
runner.on('test end', function(test){
|
|
2031
|
-
window.scrollTo(0, document.body.scrollHeight);
|
|
2032
|
-
|
|
2033
2405
|
// TODO: add to stats
|
|
2034
2406
|
var percent = stats.tests / this.total * 100 | 0;
|
|
2035
2407
|
if (progress) progress.update(percent).draw(ctx);
|
|
@@ -2073,7 +2445,7 @@ function HTML(runner, root) {
|
|
|
2073
2445
|
|
|
2074
2446
|
on(h2, 'click', function(){
|
|
2075
2447
|
pre.style.display = 'none' == pre.style.display
|
|
2076
|
-
? '
|
|
2448
|
+
? 'block'
|
|
2077
2449
|
: 'none';
|
|
2078
2450
|
});
|
|
2079
2451
|
|
|
@@ -2382,7 +2754,6 @@ function List(runner) {
|
|
|
2382
2754
|
});
|
|
2383
2755
|
|
|
2384
2756
|
runner.on('fail', function(test, err){
|
|
2385
|
-
test.error = err;
|
|
2386
2757
|
console.log(JSON.stringify(['fail', clean(test)]));
|
|
2387
2758
|
});
|
|
2388
2759
|
|
|
@@ -2401,20 +2772,11 @@ function List(runner) {
|
|
|
2401
2772
|
*/
|
|
2402
2773
|
|
|
2403
2774
|
function clean(test) {
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
fullTitle: test.fullTitle()
|
|
2407
|
-
duration: test.duration
|
|
2408
|
-
};
|
|
2409
|
-
|
|
2410
|
-
if (test.error) {
|
|
2411
|
-
obj.error = {
|
|
2412
|
-
message: test.error.message,
|
|
2413
|
-
stack: test.error.stack
|
|
2414
|
-
};
|
|
2775
|
+
return {
|
|
2776
|
+
title: test.title
|
|
2777
|
+
, fullTitle: test.fullTitle()
|
|
2778
|
+
, duration: test.duration
|
|
2415
2779
|
}
|
|
2416
|
-
|
|
2417
|
-
return obj;
|
|
2418
2780
|
}
|
|
2419
2781
|
}); // module: reporters/json-stream.js
|
|
2420
2782
|
|
|
@@ -2457,17 +2819,16 @@ function JSONReporter(runner) {
|
|
|
2457
2819
|
passes.push(test);
|
|
2458
2820
|
});
|
|
2459
2821
|
|
|
2460
|
-
runner.on('fail', function(test
|
|
2461
|
-
test.error = err;
|
|
2822
|
+
runner.on('fail', function(test){
|
|
2462
2823
|
failures.push(test);
|
|
2463
2824
|
});
|
|
2464
2825
|
|
|
2465
2826
|
runner.on('end', function(){
|
|
2466
2827
|
var obj = {
|
|
2467
|
-
|
|
2468
|
-
tests: tests.map(clean)
|
|
2469
|
-
failures: failures.map(clean)
|
|
2470
|
-
passes: passes.map(clean)
|
|
2828
|
+
stats: self.stats
|
|
2829
|
+
, tests: tests.map(clean)
|
|
2830
|
+
, failures: failures.map(clean)
|
|
2831
|
+
, passes: passes.map(clean)
|
|
2471
2832
|
};
|
|
2472
2833
|
|
|
2473
2834
|
process.stdout.write(JSON.stringify(obj, null, 2));
|
|
@@ -2484,20 +2845,11 @@ function JSONReporter(runner) {
|
|
|
2484
2845
|
*/
|
|
2485
2846
|
|
|
2486
2847
|
function clean(test) {
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
fullTitle: test.fullTitle()
|
|
2490
|
-
duration: test.duration
|
|
2491
|
-
};
|
|
2492
|
-
|
|
2493
|
-
if (test.error) {
|
|
2494
|
-
obj.error = {
|
|
2495
|
-
message: test.error.message,
|
|
2496
|
-
stack: test.error.stack
|
|
2497
|
-
};
|
|
2848
|
+
return {
|
|
2849
|
+
title: test.title
|
|
2850
|
+
, fullTitle: test.fullTitle()
|
|
2851
|
+
, duration: test.duration
|
|
2498
2852
|
}
|
|
2499
|
-
|
|
2500
|
-
return obj;
|
|
2501
2853
|
}
|
|
2502
2854
|
}); // module: reporters/json.js
|
|
2503
2855
|
|
|
@@ -2598,7 +2950,9 @@ function Landing(runner) {
|
|
|
2598
2950
|
* Inherit from `Base.prototype`.
|
|
2599
2951
|
*/
|
|
2600
2952
|
|
|
2601
|
-
|
|
2953
|
+
function F(){};
|
|
2954
|
+
F.prototype = Base.prototype;
|
|
2955
|
+
Landing.prototype = new F;
|
|
2602
2956
|
Landing.prototype.constructor = Landing;
|
|
2603
2957
|
|
|
2604
2958
|
}); // module: reporters/landing.js
|
|
@@ -2667,7 +3021,9 @@ function List(runner) {
|
|
|
2667
3021
|
* Inherit from `Base.prototype`.
|
|
2668
3022
|
*/
|
|
2669
3023
|
|
|
2670
|
-
|
|
3024
|
+
function F(){};
|
|
3025
|
+
F.prototype = Base.prototype;
|
|
3026
|
+
List.prototype = new F;
|
|
2671
3027
|
List.prototype.constructor = List;
|
|
2672
3028
|
|
|
2673
3029
|
|
|
@@ -2699,7 +3055,6 @@ function Markdown(runner) {
|
|
|
2699
3055
|
|
|
2700
3056
|
var self = this
|
|
2701
3057
|
, stats = this.stats
|
|
2702
|
-
, total = runner.total
|
|
2703
3058
|
, level = 0
|
|
2704
3059
|
, buf = '';
|
|
2705
3060
|
|
|
@@ -2791,7 +3146,7 @@ exports = module.exports = Min;
|
|
|
2791
3146
|
|
|
2792
3147
|
function Min(runner) {
|
|
2793
3148
|
Base.call(this, runner);
|
|
2794
|
-
|
|
3149
|
+
|
|
2795
3150
|
runner.on('start', function(){
|
|
2796
3151
|
// clear screen
|
|
2797
3152
|
process.stdout.write('\u001b[2J');
|
|
@@ -2806,13 +3161,15 @@ function Min(runner) {
|
|
|
2806
3161
|
* Inherit from `Base.prototype`.
|
|
2807
3162
|
*/
|
|
2808
3163
|
|
|
2809
|
-
|
|
3164
|
+
function F(){};
|
|
3165
|
+
F.prototype = Base.prototype;
|
|
3166
|
+
Min.prototype = new F;
|
|
2810
3167
|
Min.prototype.constructor = Min;
|
|
2811
3168
|
|
|
3169
|
+
|
|
2812
3170
|
}); // module: reporters/min.js
|
|
2813
3171
|
|
|
2814
3172
|
require.register("reporters/nyan.js", function(module, exports, require){
|
|
2815
|
-
|
|
2816
3173
|
/**
|
|
2817
3174
|
* Module dependencies.
|
|
2818
3175
|
*/
|
|
@@ -2958,44 +3315,39 @@ NyanCat.prototype.drawRainbow = function(){
|
|
|
2958
3315
|
NyanCat.prototype.drawNyanCat = function(status) {
|
|
2959
3316
|
var self = this;
|
|
2960
3317
|
var startWidth = this.scoreboardWidth + this.trajectories[0].length;
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
write(padding + '"" "" ');
|
|
2995
|
-
write('\n');
|
|
2996
|
-
break;
|
|
2997
|
-
}
|
|
2998
|
-
});
|
|
3318
|
+
var color = '\u001b[' + startWidth + 'C';
|
|
3319
|
+
var padding = '';
|
|
3320
|
+
|
|
3321
|
+
write(color);
|
|
3322
|
+
write('_,------,');
|
|
3323
|
+
write('\n');
|
|
3324
|
+
|
|
3325
|
+
write(color);
|
|
3326
|
+
padding = self.tick ? ' ' : ' ';
|
|
3327
|
+
write('_|' + padding + '/\\_/\\ ');
|
|
3328
|
+
write('\n');
|
|
3329
|
+
|
|
3330
|
+
write(color);
|
|
3331
|
+
padding = self.tick ? '_' : '__';
|
|
3332
|
+
var tail = self.tick ? '~' : '^';
|
|
3333
|
+
var face;
|
|
3334
|
+
switch (status) {
|
|
3335
|
+
case 'pass':
|
|
3336
|
+
face = '( ^ .^)';
|
|
3337
|
+
break;
|
|
3338
|
+
case 'fail':
|
|
3339
|
+
face = '( o .o)';
|
|
3340
|
+
break;
|
|
3341
|
+
default:
|
|
3342
|
+
face = '( - .-)';
|
|
3343
|
+
}
|
|
3344
|
+
write(tail + '|' + padding + face + ' ');
|
|
3345
|
+
write('\n');
|
|
3346
|
+
|
|
3347
|
+
write(color);
|
|
3348
|
+
padding = self.tick ? ' ' : ' ';
|
|
3349
|
+
write(padding + '"" "" ');
|
|
3350
|
+
write('\n');
|
|
2999
3351
|
|
|
3000
3352
|
this.cursorUp(this.numberOfLines);
|
|
3001
3353
|
};
|
|
@@ -3070,7 +3422,9 @@ function write(string) {
|
|
|
3070
3422
|
* Inherit from `Base.prototype`.
|
|
3071
3423
|
*/
|
|
3072
3424
|
|
|
3073
|
-
|
|
3425
|
+
function F(){};
|
|
3426
|
+
F.prototype = Base.prototype;
|
|
3427
|
+
NyanCat.prototype = new F;
|
|
3074
3428
|
NyanCat.prototype.constructor = NyanCat;
|
|
3075
3429
|
|
|
3076
3430
|
|
|
@@ -3162,7 +3516,9 @@ function Progress(runner, options) {
|
|
|
3162
3516
|
* Inherit from `Base.prototype`.
|
|
3163
3517
|
*/
|
|
3164
3518
|
|
|
3165
|
-
|
|
3519
|
+
function F(){};
|
|
3520
|
+
F.prototype = Base.prototype;
|
|
3521
|
+
Progress.prototype = new F;
|
|
3166
3522
|
Progress.prototype.constructor = Progress;
|
|
3167
3523
|
|
|
3168
3524
|
|
|
@@ -3255,7 +3611,9 @@ function Spec(runner) {
|
|
|
3255
3611
|
* Inherit from `Base.prototype`.
|
|
3256
3612
|
*/
|
|
3257
3613
|
|
|
3258
|
-
|
|
3614
|
+
function F(){};
|
|
3615
|
+
F.prototype = Base.prototype;
|
|
3616
|
+
Spec.prototype = new F;
|
|
3259
3617
|
Spec.prototype.constructor = Spec;
|
|
3260
3618
|
|
|
3261
3619
|
|
|
@@ -3289,7 +3647,9 @@ function TAP(runner) {
|
|
|
3289
3647
|
|
|
3290
3648
|
var self = this
|
|
3291
3649
|
, stats = this.stats
|
|
3292
|
-
, n = 1
|
|
3650
|
+
, n = 1
|
|
3651
|
+
, passes = 0
|
|
3652
|
+
, failures = 0;
|
|
3293
3653
|
|
|
3294
3654
|
runner.on('start', function(){
|
|
3295
3655
|
var total = runner.grepTotal(runner.suite);
|
|
@@ -3305,12 +3665,20 @@ function TAP(runner) {
|
|
|
3305
3665
|
});
|
|
3306
3666
|
|
|
3307
3667
|
runner.on('pass', function(test){
|
|
3668
|
+
passes++;
|
|
3308
3669
|
console.log('ok %d %s', n, title(test));
|
|
3309
3670
|
});
|
|
3310
3671
|
|
|
3311
3672
|
runner.on('fail', function(test, err){
|
|
3673
|
+
failures++;
|
|
3312
3674
|
console.log('not ok %d %s', n, title(test));
|
|
3313
|
-
console.log(err.stack.replace(/^/gm, ' '));
|
|
3675
|
+
if (err.stack) console.log(err.stack.replace(/^/gm, ' '));
|
|
3676
|
+
});
|
|
3677
|
+
|
|
3678
|
+
runner.on('end', function(){
|
|
3679
|
+
console.log('# tests ' + (passes + failures));
|
|
3680
|
+
console.log('# pass ' + passes);
|
|
3681
|
+
console.log('# fail ' + failures);
|
|
3314
3682
|
});
|
|
3315
3683
|
}
|
|
3316
3684
|
|
|
@@ -3439,7 +3807,7 @@ function XUnit(runner) {
|
|
|
3439
3807
|
runner.on('pass', function(test){
|
|
3440
3808
|
tests.push(test);
|
|
3441
3809
|
});
|
|
3442
|
-
|
|
3810
|
+
|
|
3443
3811
|
runner.on('fail', function(test){
|
|
3444
3812
|
tests.push(test);
|
|
3445
3813
|
});
|
|
@@ -3450,13 +3818,13 @@ function XUnit(runner) {
|
|
|
3450
3818
|
, tests: stats.tests
|
|
3451
3819
|
, failures: stats.failures
|
|
3452
3820
|
, errors: stats.failures
|
|
3453
|
-
,
|
|
3821
|
+
, skipped: stats.tests - stats.failures - stats.passes
|
|
3454
3822
|
, timestamp: (new Date).toUTCString()
|
|
3455
|
-
, time: stats.duration / 1000
|
|
3823
|
+
, time: (stats.duration / 1000) || 0
|
|
3456
3824
|
}, false));
|
|
3457
3825
|
|
|
3458
3826
|
tests.forEach(test);
|
|
3459
|
-
console.log('</testsuite>');
|
|
3827
|
+
console.log('</testsuite>');
|
|
3460
3828
|
});
|
|
3461
3829
|
}
|
|
3462
3830
|
|
|
@@ -3464,7 +3832,9 @@ function XUnit(runner) {
|
|
|
3464
3832
|
* Inherit from `Base.prototype`.
|
|
3465
3833
|
*/
|
|
3466
3834
|
|
|
3467
|
-
|
|
3835
|
+
function F(){};
|
|
3836
|
+
F.prototype = Base.prototype;
|
|
3837
|
+
XUnit.prototype = new F;
|
|
3468
3838
|
XUnit.prototype.constructor = XUnit;
|
|
3469
3839
|
|
|
3470
3840
|
|
|
@@ -3572,7 +3942,9 @@ function Runnable(title, fn) {
|
|
|
3572
3942
|
* Inherit from `EventEmitter.prototype`.
|
|
3573
3943
|
*/
|
|
3574
3944
|
|
|
3575
|
-
|
|
3945
|
+
function F(){};
|
|
3946
|
+
F.prototype = EventEmitter.prototype;
|
|
3947
|
+
Runnable.prototype = new F;
|
|
3576
3948
|
Runnable.prototype.constructor = Runnable;
|
|
3577
3949
|
|
|
3578
3950
|
|
|
@@ -3654,16 +4026,14 @@ Runnable.prototype.inspect = function(){
|
|
|
3654
4026
|
*/
|
|
3655
4027
|
|
|
3656
4028
|
Runnable.prototype.resetTimeout = function(){
|
|
3657
|
-
var self = this
|
|
3658
|
-
|
|
4029
|
+
var self = this;
|
|
4030
|
+
var ms = this.timeout() || 1e9;
|
|
3659
4031
|
|
|
3660
4032
|
this.clearTimeout();
|
|
3661
|
-
|
|
3662
|
-
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
}, ms);
|
|
3666
|
-
}
|
|
4033
|
+
this.timer = setTimeout(function(){
|
|
4034
|
+
self.callback(new Error('timeout of ' + ms + 'ms exceeded'));
|
|
4035
|
+
self.timedOut = true;
|
|
4036
|
+
}, ms);
|
|
3667
4037
|
};
|
|
3668
4038
|
|
|
3669
4039
|
/**
|
|
@@ -3717,7 +4087,7 @@ Runnable.prototype.run = function(fn){
|
|
|
3717
4087
|
if (this.async) {
|
|
3718
4088
|
try {
|
|
3719
4089
|
this.fn.call(ctx, function(err){
|
|
3720
|
-
if (toString.call(err) === "[object Error]") return done(err);
|
|
4090
|
+
if (err instanceof Error || toString.call(err) === "[object Error]") return done(err);
|
|
3721
4091
|
if (null != err) return done(new Error('done() invoked with non-Error: ' + err));
|
|
3722
4092
|
done();
|
|
3723
4093
|
});
|
|
@@ -3744,7 +4114,6 @@ Runnable.prototype.run = function(fn){
|
|
|
3744
4114
|
}); // module: runnable.js
|
|
3745
4115
|
|
|
3746
4116
|
require.register("runner.js", function(module, exports, require){
|
|
3747
|
-
|
|
3748
4117
|
/**
|
|
3749
4118
|
* Module dependencies.
|
|
3750
4119
|
*/
|
|
@@ -3754,8 +4123,7 @@ var EventEmitter = require('browser/events').EventEmitter
|
|
|
3754
4123
|
, Test = require('./test')
|
|
3755
4124
|
, utils = require('./utils')
|
|
3756
4125
|
, filter = utils.filter
|
|
3757
|
-
, keys = utils.keys
|
|
3758
|
-
, noop = function(){};
|
|
4126
|
+
, keys = utils.keys;
|
|
3759
4127
|
|
|
3760
4128
|
/**
|
|
3761
4129
|
* Non-enumerable globals.
|
|
@@ -3791,6 +4159,7 @@ module.exports = Runner;
|
|
|
3791
4159
|
* - `hook end` (hook) hook complete
|
|
3792
4160
|
* - `pass` (test) test passed
|
|
3793
4161
|
* - `fail` (test, err) test failed
|
|
4162
|
+
* - `pending` (test) test pending
|
|
3794
4163
|
*
|
|
3795
4164
|
* @api public
|
|
3796
4165
|
*/
|
|
@@ -3807,11 +4176,22 @@ function Runner(suite) {
|
|
|
3807
4176
|
this.globals(this.globalProps().concat(['errno']));
|
|
3808
4177
|
}
|
|
3809
4178
|
|
|
4179
|
+
/**
|
|
4180
|
+
* Wrapper for setImmediate, process.nextTick, or browser polyfill.
|
|
4181
|
+
*
|
|
4182
|
+
* @param {Function} fn
|
|
4183
|
+
* @api private
|
|
4184
|
+
*/
|
|
4185
|
+
|
|
4186
|
+
Runner.immediately = global.setImmediate || process.nextTick;
|
|
4187
|
+
|
|
3810
4188
|
/**
|
|
3811
4189
|
* Inherit from `EventEmitter.prototype`.
|
|
3812
4190
|
*/
|
|
3813
4191
|
|
|
3814
|
-
|
|
4192
|
+
function F(){};
|
|
4193
|
+
F.prototype = EventEmitter.prototype;
|
|
4194
|
+
Runner.prototype = new F;
|
|
3815
4195
|
Runner.prototype.constructor = Runner;
|
|
3816
4196
|
|
|
3817
4197
|
|
|
@@ -3867,7 +4247,7 @@ Runner.prototype.globalProps = function() {
|
|
|
3867
4247
|
|
|
3868
4248
|
// non-enumerables
|
|
3869
4249
|
for (var i = 0; i < globals.length; ++i) {
|
|
3870
|
-
if (~
|
|
4250
|
+
if (~utils.indexOf(props, globals[i])) continue;
|
|
3871
4251
|
props.push(globals[i]);
|
|
3872
4252
|
}
|
|
3873
4253
|
|
|
@@ -3929,9 +4309,11 @@ Runner.prototype.checkGlobals = function(test){
|
|
|
3929
4309
|
Runner.prototype.fail = function(test, err){
|
|
3930
4310
|
++this.failures;
|
|
3931
4311
|
test.state = 'failed';
|
|
4312
|
+
|
|
3932
4313
|
if ('string' == typeof err) {
|
|
3933
4314
|
err = new Error('the string "' + err + '" was thrown, throw an Error :)');
|
|
3934
4315
|
}
|
|
4316
|
+
|
|
3935
4317
|
this.emit('fail', test, err);
|
|
3936
4318
|
};
|
|
3937
4319
|
|
|
@@ -3970,8 +4352,11 @@ Runner.prototype.hook = function(name, fn){
|
|
|
3970
4352
|
function next(i) {
|
|
3971
4353
|
var hook = hooks[i];
|
|
3972
4354
|
if (!hook) return fn();
|
|
4355
|
+
if (self.failures && suite.bail()) return fn();
|
|
3973
4356
|
self.currentRunnable = hook;
|
|
3974
4357
|
|
|
4358
|
+
hook.ctx.currentTest = self.test;
|
|
4359
|
+
|
|
3975
4360
|
self.emit('hook', hook);
|
|
3976
4361
|
|
|
3977
4362
|
hook.on('error', function(err){
|
|
@@ -3984,11 +4369,12 @@ Runner.prototype.hook = function(name, fn){
|
|
|
3984
4369
|
if (testError) self.fail(self.test, testError);
|
|
3985
4370
|
if (err) return self.failHook(hook, err);
|
|
3986
4371
|
self.emit('hook end', hook);
|
|
4372
|
+
delete hook.ctx.currentTest;
|
|
3987
4373
|
next(++i);
|
|
3988
4374
|
});
|
|
3989
4375
|
}
|
|
3990
4376
|
|
|
3991
|
-
|
|
4377
|
+
Runner.immediately(function(){
|
|
3992
4378
|
next(0);
|
|
3993
4379
|
});
|
|
3994
4380
|
};
|
|
@@ -4231,13 +4617,12 @@ Runner.prototype.run = function(fn){
|
|
|
4231
4617
|
var self = this
|
|
4232
4618
|
, fn = fn || function(){};
|
|
4233
4619
|
|
|
4234
|
-
|
|
4235
|
-
|
|
4236
|
-
// uncaught callback
|
|
4237
|
-
function uncaught(err) {
|
|
4620
|
+
function uncaught(err){
|
|
4238
4621
|
self.uncaught(err);
|
|
4239
4622
|
}
|
|
4240
4623
|
|
|
4624
|
+
debug('start');
|
|
4625
|
+
|
|
4241
4626
|
// callback
|
|
4242
4627
|
this.on('end', function(){
|
|
4243
4628
|
debug('end');
|
|
@@ -4269,6 +4654,8 @@ Runner.prototype.run = function(fn){
|
|
|
4269
4654
|
|
|
4270
4655
|
function filterLeaks(ok, globals) {
|
|
4271
4656
|
return filter(globals, function(key){
|
|
4657
|
+
// Firefox and Chrome exposes iframes as index inside the window object
|
|
4658
|
+
if (/^d+/.test(key)) return false;
|
|
4272
4659
|
var matched = filter(ok, function(ok){
|
|
4273
4660
|
if (~ok.indexOf('*')) return 0 == key.indexOf(ok.split('*')[0]);
|
|
4274
4661
|
// Opera and IE expose global variables for HTML element IDs (issue #243)
|
|
@@ -4350,7 +4737,9 @@ function Suite(title, ctx) {
|
|
|
4350
4737
|
* Inherit from `EventEmitter.prototype`.
|
|
4351
4738
|
*/
|
|
4352
4739
|
|
|
4353
|
-
|
|
4740
|
+
function F(){};
|
|
4741
|
+
F.prototype = EventEmitter.prototype;
|
|
4742
|
+
Suite.prototype = new F;
|
|
4354
4743
|
Suite.prototype.constructor = Suite;
|
|
4355
4744
|
|
|
4356
4745
|
|
|
@@ -4615,7 +5004,9 @@ function Test(title, fn) {
|
|
|
4615
5004
|
* Inherit from `Runnable.prototype`.
|
|
4616
5005
|
*/
|
|
4617
5006
|
|
|
4618
|
-
|
|
5007
|
+
function F(){};
|
|
5008
|
+
F.prototype = Runnable.prototype;
|
|
5009
|
+
Test.prototype = new F;
|
|
4619
5010
|
Test.prototype.constructor = Test;
|
|
4620
5011
|
|
|
4621
5012
|
|
|
@@ -4687,7 +5078,7 @@ exports.indexOf = function(arr, obj, start){
|
|
|
4687
5078
|
|
|
4688
5079
|
/**
|
|
4689
5080
|
* Array#reduce (<=IE8)
|
|
4690
|
-
*
|
|
5081
|
+
*
|
|
4691
5082
|
* @param {Array} array
|
|
4692
5083
|
* @param {Function} fn
|
|
4693
5084
|
* @param {Object} initial value
|
|
@@ -4820,8 +5211,8 @@ exports.clean = function(str) {
|
|
|
4820
5211
|
.replace(/^function *\(.*\) *{/, '')
|
|
4821
5212
|
.replace(/\s+\}$/, '');
|
|
4822
5213
|
|
|
4823
|
-
var
|
|
4824
|
-
, re = new RegExp('^
|
|
5214
|
+
var whitespace = str.match(/^\n?(\s*)/)[1]
|
|
5215
|
+
, re = new RegExp('^' + whitespace, 'gm');
|
|
4825
5216
|
|
|
4826
5217
|
str = str.replace(re, '');
|
|
4827
5218
|
|
|
@@ -4906,6 +5297,19 @@ exports.highlightTags = function(name) {
|
|
|
4906
5297
|
};
|
|
4907
5298
|
|
|
4908
5299
|
}); // module: utils.js
|
|
5300
|
+
// The global object is "self" in Web Workers.
|
|
5301
|
+
global = (function() { return this; })();
|
|
5302
|
+
|
|
5303
|
+
/**
|
|
5304
|
+
* Save timer references to avoid Sinon interfering (see GH-237).
|
|
5305
|
+
*/
|
|
5306
|
+
|
|
5307
|
+
var Date = global.Date;
|
|
5308
|
+
var setTimeout = global.setTimeout;
|
|
5309
|
+
var setInterval = global.setInterval;
|
|
5310
|
+
var clearTimeout = global.clearTimeout;
|
|
5311
|
+
var clearInterval = global.clearInterval;
|
|
5312
|
+
|
|
4909
5313
|
/**
|
|
4910
5314
|
* Node shims.
|
|
4911
5315
|
*
|
|
@@ -4915,38 +5319,9 @@ exports.highlightTags = function(name) {
|
|
|
4915
5319
|
* the browser.
|
|
4916
5320
|
*/
|
|
4917
5321
|
|
|
4918
|
-
process = {};
|
|
5322
|
+
var process = {};
|
|
4919
5323
|
process.exit = function(status){};
|
|
4920
5324
|
process.stdout = {};
|
|
4921
|
-
global = window;
|
|
4922
|
-
|
|
4923
|
-
/**
|
|
4924
|
-
* next tick implementation.
|
|
4925
|
-
*/
|
|
4926
|
-
|
|
4927
|
-
process.nextTick = (function(){
|
|
4928
|
-
// postMessage behaves badly on IE8
|
|
4929
|
-
if (window.ActiveXObject || !window.postMessage) {
|
|
4930
|
-
return function(fn){ fn() };
|
|
4931
|
-
}
|
|
4932
|
-
|
|
4933
|
-
// based on setZeroTimeout by David Baron
|
|
4934
|
-
// - http://dbaron.org/log/20100309-faster-timeouts
|
|
4935
|
-
var timeouts = []
|
|
4936
|
-
, name = 'mocha-zero-timeout'
|
|
4937
|
-
|
|
4938
|
-
window.addEventListener('message', function(e){
|
|
4939
|
-
if (e.source == window && e.data == name) {
|
|
4940
|
-
if (e.stopPropagation) e.stopPropagation();
|
|
4941
|
-
if (timeouts.length) timeouts.shift()();
|
|
4942
|
-
}
|
|
4943
|
-
}, true);
|
|
4944
|
-
|
|
4945
|
-
return function(fn){
|
|
4946
|
-
timeouts.push(fn);
|
|
4947
|
-
window.postMessage(name, '*');
|
|
4948
|
-
}
|
|
4949
|
-
})();
|
|
4950
5325
|
|
|
4951
5326
|
/**
|
|
4952
5327
|
* Remove uncaughtException listener.
|
|
@@ -4954,7 +5329,7 @@ process.nextTick = (function(){
|
|
|
4954
5329
|
|
|
4955
5330
|
process.removeListener = function(e){
|
|
4956
5331
|
if ('uncaughtException' == e) {
|
|
4957
|
-
|
|
5332
|
+
global.onerror = function() {};
|
|
4958
5333
|
}
|
|
4959
5334
|
};
|
|
4960
5335
|
|
|
@@ -4964,57 +5339,90 @@ process.removeListener = function(e){
|
|
|
4964
5339
|
|
|
4965
5340
|
process.on = function(e, fn){
|
|
4966
5341
|
if ('uncaughtException' == e) {
|
|
4967
|
-
|
|
5342
|
+
global.onerror = function(err, url, line){
|
|
5343
|
+
fn(new Error(err + ' (' + url + ':' + line + ')'));
|
|
5344
|
+
};
|
|
4968
5345
|
}
|
|
4969
5346
|
};
|
|
4970
5347
|
|
|
4971
|
-
|
|
4972
|
-
|
|
5348
|
+
/**
|
|
5349
|
+
* Expose mocha.
|
|
5350
|
+
*/
|
|
4973
5351
|
|
|
4974
|
-
|
|
4975
|
-
|
|
4976
|
-
*/
|
|
5352
|
+
var Mocha = global.Mocha = require('mocha'),
|
|
5353
|
+
mocha = global.mocha = new Mocha({ reporter: 'html' });
|
|
4977
5354
|
|
|
4978
|
-
|
|
4979
|
-
|
|
5355
|
+
var immediateQueue = []
|
|
5356
|
+
, immediateTimeout;
|
|
4980
5357
|
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
|
|
4984
|
-
|
|
5358
|
+
function timeslice() {
|
|
5359
|
+
var immediateStart = new Date().getTime();
|
|
5360
|
+
while (immediateQueue.length && (new Date().getTime() - immediateStart) < 100) {
|
|
5361
|
+
immediateQueue.shift()();
|
|
5362
|
+
}
|
|
5363
|
+
if (immediateQueue.length) {
|
|
5364
|
+
immediateTimeout = setTimeout(timeslice, 0);
|
|
5365
|
+
} else {
|
|
5366
|
+
immediateTimeout = null;
|
|
5367
|
+
}
|
|
5368
|
+
}
|
|
4985
5369
|
|
|
4986
|
-
|
|
4987
|
-
|
|
4988
|
-
|
|
4989
|
-
return this;
|
|
4990
|
-
};
|
|
5370
|
+
/**
|
|
5371
|
+
* High-performance override of Runner.immediately.
|
|
5372
|
+
*/
|
|
4991
5373
|
|
|
4992
|
-
|
|
4993
|
-
|
|
4994
|
-
|
|
5374
|
+
Mocha.Runner.immediately = function(callback) {
|
|
5375
|
+
immediateQueue.push(callback);
|
|
5376
|
+
if (!immediateTimeout) {
|
|
5377
|
+
immediateTimeout = setTimeout(timeslice, 0);
|
|
5378
|
+
}
|
|
5379
|
+
};
|
|
4995
5380
|
|
|
4996
|
-
|
|
4997
|
-
|
|
4998
|
-
|
|
4999
|
-
|
|
5000
|
-
|
|
5381
|
+
/**
|
|
5382
|
+
* Override ui to ensure that the ui functions are initialized.
|
|
5383
|
+
* Normally this would happen in Mocha.prototype.loadFiles.
|
|
5384
|
+
*/
|
|
5385
|
+
|
|
5386
|
+
mocha.ui = function(ui){
|
|
5387
|
+
Mocha.prototype.ui.call(this, ui);
|
|
5388
|
+
this.suite.emit('pre-require', global, null, this);
|
|
5389
|
+
return this;
|
|
5390
|
+
};
|
|
5391
|
+
|
|
5392
|
+
/**
|
|
5393
|
+
* Setup mocha with the given setting options.
|
|
5394
|
+
*/
|
|
5395
|
+
|
|
5396
|
+
mocha.setup = function(opts){
|
|
5397
|
+
if ('string' == typeof opts) opts = { ui: opts };
|
|
5398
|
+
for (var opt in opts) this[opt](opts[opt]);
|
|
5399
|
+
return this;
|
|
5400
|
+
};
|
|
5001
5401
|
|
|
5002
|
-
|
|
5003
|
-
|
|
5004
|
-
|
|
5402
|
+
/**
|
|
5403
|
+
* Run mocha, returning the Runner.
|
|
5404
|
+
*/
|
|
5005
5405
|
|
|
5006
|
-
|
|
5007
|
-
|
|
5008
|
-
|
|
5406
|
+
mocha.run = function(fn){
|
|
5407
|
+
var options = mocha.options;
|
|
5408
|
+
mocha.globals('location');
|
|
5009
5409
|
|
|
5010
|
-
|
|
5011
|
-
|
|
5012
|
-
|
|
5410
|
+
var query = Mocha.utils.parseQuery(global.location.search || '');
|
|
5411
|
+
if (query.grep) mocha.grep(query.grep);
|
|
5412
|
+
if (query.invert) mocha.invert();
|
|
5013
5413
|
|
|
5014
|
-
|
|
5414
|
+
return Mocha.prototype.run.call(mocha, function(){
|
|
5415
|
+
// The DOM Document is not available in Web Workers.
|
|
5416
|
+
if (global.document) {
|
|
5015
5417
|
Mocha.utils.highlightTags('code');
|
|
5016
|
-
|
|
5017
|
-
|
|
5018
|
-
};
|
|
5019
|
-
}
|
|
5418
|
+
}
|
|
5419
|
+
if (fn) fn();
|
|
5420
|
+
});
|
|
5421
|
+
};
|
|
5422
|
+
|
|
5423
|
+
/**
|
|
5424
|
+
* Expose the process shim.
|
|
5425
|
+
*/
|
|
5426
|
+
|
|
5427
|
+
Mocha.process = process;
|
|
5020
5428
|
})();
|