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
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
var program = require('commander')
|
|
8
|
-
,
|
|
8
|
+
, sprintf = require('util').format
|
|
9
9
|
, path = require('path')
|
|
10
10
|
, fs = require('fs')
|
|
11
|
-
,
|
|
11
|
+
, glob = require('glob')
|
|
12
12
|
, resolve = path.resolve
|
|
13
13
|
, exists = fs.existsSync || path.existsSync
|
|
14
14
|
, Mocha = require('../')
|
|
@@ -43,6 +43,12 @@ var files = [];
|
|
|
43
43
|
|
|
44
44
|
var globals = [];
|
|
45
45
|
|
|
46
|
+
/**
|
|
47
|
+
* Requires.
|
|
48
|
+
*/
|
|
49
|
+
|
|
50
|
+
var requires = [];
|
|
51
|
+
|
|
46
52
|
/**
|
|
47
53
|
* Images.
|
|
48
54
|
*/
|
|
@@ -74,7 +80,7 @@ program
|
|
|
74
80
|
.option('--recursive', 'include sub directories')
|
|
75
81
|
.option('--debug-brk', "enable node's debugger breaking on the first line")
|
|
76
82
|
.option('--globals <names>', 'allow the given comma-delimited global [names]', list, [])
|
|
77
|
-
.option('--
|
|
83
|
+
.option('--check-leaks', 'check for global variable leaks')
|
|
78
84
|
.option('--interfaces', 'display available interfaces')
|
|
79
85
|
.option('--reporters', 'display available reporters')
|
|
80
86
|
.option('--compilers <ext>:<module>,...', 'use the given module(s) to compile files', list, [])
|
|
@@ -94,7 +100,8 @@ program
|
|
|
94
100
|
var tmpl = fs.readFileSync(join(__dirname, '..', 'lib/template.html'));
|
|
95
101
|
fs.writeFileSync(join(path, 'mocha.css'), css);
|
|
96
102
|
fs.writeFileSync(join(path, 'mocha.js'), js);
|
|
97
|
-
fs.writeFileSync(join(path, 'tests.
|
|
103
|
+
fs.writeFileSync(join(path, 'tests.js'), '');
|
|
104
|
+
fs.writeFileSync(join(path, 'index.html'), tmpl);
|
|
98
105
|
process.exit(0);
|
|
99
106
|
});
|
|
100
107
|
|
|
@@ -116,7 +123,7 @@ program.on('reporters', function(){
|
|
|
116
123
|
console.log(' list - spec-style listing');
|
|
117
124
|
console.log(' tap - test-anything-protocol');
|
|
118
125
|
console.log(' landing - unicode landing strip');
|
|
119
|
-
console.log(' xunit - xunit
|
|
126
|
+
console.log(' xunit - xunit reporter');
|
|
120
127
|
console.log(' teamcity - teamcity ci support');
|
|
121
128
|
console.log(' html-cov - HTML test coverage');
|
|
122
129
|
console.log(' json-cov - JSON test coverage');
|
|
@@ -145,11 +152,9 @@ program.on('interfaces', function(){
|
|
|
145
152
|
module.paths.push(cwd, join(cwd, 'node_modules'));
|
|
146
153
|
|
|
147
154
|
program.on('require', function(mod){
|
|
148
|
-
var abs = exists(mod)
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
if (abs) mod = join(cwd, mod);
|
|
152
|
-
require(mod);
|
|
155
|
+
var abs = exists(mod) || exists(mod + '.js');
|
|
156
|
+
if (abs) mod = resolve(mod);
|
|
157
|
+
requires.push(mod);
|
|
153
158
|
});
|
|
154
159
|
|
|
155
160
|
// mocha.opts support
|
|
@@ -225,9 +230,9 @@ if (program.grep) mocha.grep(new RegExp(program.grep));
|
|
|
225
230
|
|
|
226
231
|
if (program.invert) mocha.invert();
|
|
227
232
|
|
|
228
|
-
// --
|
|
233
|
+
// --check-leaks
|
|
229
234
|
|
|
230
|
-
if (program.
|
|
235
|
+
if (program.checkLeaks) mocha.checkLeaks();
|
|
231
236
|
|
|
232
237
|
// --growl
|
|
233
238
|
|
|
@@ -256,6 +261,12 @@ program.compilers.forEach(function(c) {
|
|
|
256
261
|
|
|
257
262
|
var re = new RegExp('\\.(' + extensions.join('|') + ')$');
|
|
258
263
|
|
|
264
|
+
// requires
|
|
265
|
+
|
|
266
|
+
requires.forEach(function(mod) {
|
|
267
|
+
require(mod);
|
|
268
|
+
});
|
|
269
|
+
|
|
259
270
|
// files
|
|
260
271
|
|
|
261
272
|
var files = []
|
|
@@ -286,14 +297,13 @@ if (program.watch) {
|
|
|
286
297
|
process.exit();
|
|
287
298
|
});
|
|
288
299
|
|
|
289
|
-
var
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
];
|
|
300
|
+
var spinner = 'win32' == process.platform
|
|
301
|
+
? ['|','/','-','\\']
|
|
302
|
+
: ['◜','◠','◝','◞','◡','◟'];
|
|
303
|
+
|
|
304
|
+
var frames = spinner.map(function(c) {
|
|
305
|
+
return sprintf(' \u001b[96m%s \u001b[90mwatching\u001b[0m', c);
|
|
306
|
+
});
|
|
297
307
|
|
|
298
308
|
var watchFiles = utils.files(cwd);
|
|
299
309
|
|
|
@@ -388,7 +398,14 @@ function stop() {
|
|
|
388
398
|
function lookupFiles(path, recursive) {
|
|
389
399
|
var files = [];
|
|
390
400
|
|
|
391
|
-
if (!exists(path))
|
|
401
|
+
if (!exists(path)) {
|
|
402
|
+
if (exists(path + '.js')) {
|
|
403
|
+
path += '.js'
|
|
404
|
+
} else {
|
|
405
|
+
return glob.sync(path);
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
|
|
392
409
|
var stat = fs.statSync(path);
|
|
393
410
|
if (stat.isFile()) return path;
|
|
394
411
|
|
|
@@ -417,6 +434,6 @@ function play(arr, interval) {
|
|
|
417
434
|
|
|
418
435
|
play.timer = setInterval(function(){
|
|
419
436
|
var str = arr[i++ % len];
|
|
420
|
-
process.stdout.write('\
|
|
437
|
+
process.stdout.write('\u001b[0G' + str);
|
|
421
438
|
}, interval);
|
|
422
439
|
}
|
|
@@ -8,8 +8,10 @@
|
|
|
8
8
|
var spawn = require('child_process').spawn
|
|
9
9
|
, args = [ __dirname + '/_mocha' ];
|
|
10
10
|
|
|
11
|
-
process.argv.slice(2).forEach(function
|
|
12
|
-
|
|
11
|
+
process.argv.slice(2).forEach(function(arg){
|
|
12
|
+
var flag = arg.split('=')[0];
|
|
13
|
+
|
|
14
|
+
switch (flag) {
|
|
13
15
|
case '-d':
|
|
14
16
|
args.unshift('--debug');
|
|
15
17
|
break;
|
|
@@ -26,6 +28,8 @@ process.argv.slice(2).forEach(function (arg) {
|
|
|
26
28
|
case '--harmony':
|
|
27
29
|
case '--harmony-proxies':
|
|
28
30
|
case '--harmony-collections':
|
|
31
|
+
case '--harmony-generators':
|
|
32
|
+
case '--prof':
|
|
29
33
|
args.unshift(arg);
|
|
30
34
|
break;
|
|
31
35
|
default:
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "mocha",
|
|
3
|
+
"version": "1.12.0",
|
|
4
|
+
"repo": "visionmedia/mocha",
|
|
5
|
+
"description": "simple, flexible, fun test framework",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"mocha",
|
|
8
|
+
"test",
|
|
9
|
+
"bdd",
|
|
10
|
+
"tdd",
|
|
11
|
+
"tap"
|
|
12
|
+
],
|
|
13
|
+
"main": "mocha.js",
|
|
14
|
+
"scripts": ["mocha.js"],
|
|
15
|
+
"styles": ["mocha.css"]
|
|
16
|
+
}
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
/* See license.txt for terms of usage */
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Text diff implementation.
|
|
5
|
+
*
|
|
6
|
+
* This library supports the following APIS:
|
|
7
|
+
* JsDiff.diffChars: Character by character diff
|
|
8
|
+
* JsDiff.diffWords: Word (as defined by \b regex) diff which ignores whitespace
|
|
9
|
+
* JsDiff.diffLines: Line based diff
|
|
10
|
+
*
|
|
11
|
+
* JsDiff.diffCss: Diff targeted at CSS content
|
|
12
|
+
*
|
|
13
|
+
* These methods are based on the implementation proposed in
|
|
14
|
+
* "An O(ND) Difference Algorithm and its Variations" (Myers, 1986).
|
|
15
|
+
* http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.4.6927
|
|
16
|
+
*/
|
|
17
|
+
var JsDiff = (function() {
|
|
18
|
+
function clonePath(path) {
|
|
19
|
+
return { newPos: path.newPos, components: path.components.slice(0) };
|
|
20
|
+
}
|
|
21
|
+
function removeEmpty(array) {
|
|
22
|
+
var ret = [];
|
|
23
|
+
for (var i = 0; i < array.length; i++) {
|
|
24
|
+
if (array[i]) {
|
|
25
|
+
ret.push(array[i]);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return ret;
|
|
29
|
+
}
|
|
30
|
+
function escapeHTML(s) {
|
|
31
|
+
var n = s;
|
|
32
|
+
n = n.replace(/&/g, "&");
|
|
33
|
+
n = n.replace(/</g, "<");
|
|
34
|
+
n = n.replace(/>/g, ">");
|
|
35
|
+
n = n.replace(/"/g, """);
|
|
36
|
+
|
|
37
|
+
return n;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
var fbDiff = function(ignoreWhitespace) {
|
|
42
|
+
this.ignoreWhitespace = ignoreWhitespace;
|
|
43
|
+
};
|
|
44
|
+
fbDiff.prototype = {
|
|
45
|
+
diff: function(oldString, newString) {
|
|
46
|
+
// Handle the identity case (this is due to unrolling editLength == 0
|
|
47
|
+
if (newString == oldString) {
|
|
48
|
+
return [{ value: newString }];
|
|
49
|
+
}
|
|
50
|
+
if (!newString) {
|
|
51
|
+
return [{ value: oldString, removed: true }];
|
|
52
|
+
}
|
|
53
|
+
if (!oldString) {
|
|
54
|
+
return [{ value: newString, added: true }];
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
newString = this.tokenize(newString);
|
|
58
|
+
oldString = this.tokenize(oldString);
|
|
59
|
+
|
|
60
|
+
var newLen = newString.length, oldLen = oldString.length;
|
|
61
|
+
var maxEditLength = newLen + oldLen;
|
|
62
|
+
var bestPath = [{ newPos: -1, components: [] }];
|
|
63
|
+
|
|
64
|
+
// Seed editLength = 0
|
|
65
|
+
var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0);
|
|
66
|
+
if (bestPath[0].newPos+1 >= newLen && oldPos+1 >= oldLen) {
|
|
67
|
+
return bestPath[0].components;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
for (var editLength = 1; editLength <= maxEditLength; editLength++) {
|
|
71
|
+
for (var diagonalPath = -1*editLength; diagonalPath <= editLength; diagonalPath+=2) {
|
|
72
|
+
var basePath;
|
|
73
|
+
var addPath = bestPath[diagonalPath-1],
|
|
74
|
+
removePath = bestPath[diagonalPath+1];
|
|
75
|
+
oldPos = (removePath ? removePath.newPos : 0) - diagonalPath;
|
|
76
|
+
if (addPath) {
|
|
77
|
+
// No one else is going to attempt to use this value, clear it
|
|
78
|
+
bestPath[diagonalPath-1] = undefined;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
var canAdd = addPath && addPath.newPos+1 < newLen;
|
|
82
|
+
var canRemove = removePath && 0 <= oldPos && oldPos < oldLen;
|
|
83
|
+
if (!canAdd && !canRemove) {
|
|
84
|
+
bestPath[diagonalPath] = undefined;
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// Select the diagonal that we want to branch from. We select the prior
|
|
89
|
+
// path whose position in the new string is the farthest from the origin
|
|
90
|
+
// and does not pass the bounds of the diff graph
|
|
91
|
+
if (!canAdd || (canRemove && addPath.newPos < removePath.newPos)) {
|
|
92
|
+
basePath = clonePath(removePath);
|
|
93
|
+
this.pushComponent(basePath.components, oldString[oldPos], undefined, true);
|
|
94
|
+
} else {
|
|
95
|
+
basePath = clonePath(addPath);
|
|
96
|
+
basePath.newPos++;
|
|
97
|
+
this.pushComponent(basePath.components, newString[basePath.newPos], true, undefined);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
var oldPos = this.extractCommon(basePath, newString, oldString, diagonalPath);
|
|
101
|
+
|
|
102
|
+
if (basePath.newPos+1 >= newLen && oldPos+1 >= oldLen) {
|
|
103
|
+
return basePath.components;
|
|
104
|
+
} else {
|
|
105
|
+
bestPath[diagonalPath] = basePath;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
|
|
111
|
+
pushComponent: function(components, value, added, removed) {
|
|
112
|
+
var last = components[components.length-1];
|
|
113
|
+
if (last && last.added === added && last.removed === removed) {
|
|
114
|
+
// We need to clone here as the component clone operation is just
|
|
115
|
+
// as shallow array clone
|
|
116
|
+
components[components.length-1] =
|
|
117
|
+
{value: this.join(last.value, value), added: added, removed: removed };
|
|
118
|
+
} else {
|
|
119
|
+
components.push({value: value, added: added, removed: removed });
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
extractCommon: function(basePath, newString, oldString, diagonalPath) {
|
|
123
|
+
var newLen = newString.length,
|
|
124
|
+
oldLen = oldString.length,
|
|
125
|
+
newPos = basePath.newPos,
|
|
126
|
+
oldPos = newPos - diagonalPath;
|
|
127
|
+
while (newPos+1 < newLen && oldPos+1 < oldLen && this.equals(newString[newPos+1], oldString[oldPos+1])) {
|
|
128
|
+
newPos++;
|
|
129
|
+
oldPos++;
|
|
130
|
+
|
|
131
|
+
this.pushComponent(basePath.components, newString[newPos], undefined, undefined);
|
|
132
|
+
}
|
|
133
|
+
basePath.newPos = newPos;
|
|
134
|
+
return oldPos;
|
|
135
|
+
},
|
|
136
|
+
|
|
137
|
+
equals: function(left, right) {
|
|
138
|
+
var reWhitespace = /\S/;
|
|
139
|
+
if (this.ignoreWhitespace && !reWhitespace.test(left) && !reWhitespace.test(right)) {
|
|
140
|
+
return true;
|
|
141
|
+
} else {
|
|
142
|
+
return left == right;
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
join: function(left, right) {
|
|
146
|
+
return left + right;
|
|
147
|
+
},
|
|
148
|
+
tokenize: function(value) {
|
|
149
|
+
return value;
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
var CharDiff = new fbDiff();
|
|
154
|
+
|
|
155
|
+
var WordDiff = new fbDiff(true);
|
|
156
|
+
WordDiff.tokenize = function(value) {
|
|
157
|
+
return removeEmpty(value.split(/(\s+|\b)/));
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
var CssDiff = new fbDiff(true);
|
|
161
|
+
CssDiff.tokenize = function(value) {
|
|
162
|
+
return removeEmpty(value.split(/([{}:;,]|\s+)/));
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
var LineDiff = new fbDiff();
|
|
166
|
+
LineDiff.tokenize = function(value) {
|
|
167
|
+
return value.split(/^/m);
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
return {
|
|
171
|
+
diffChars: function(oldStr, newStr) { return CharDiff.diff(oldStr, newStr); },
|
|
172
|
+
diffWords: function(oldStr, newStr) { return WordDiff.diff(oldStr, newStr); },
|
|
173
|
+
diffLines: function(oldStr, newStr) { return LineDiff.diff(oldStr, newStr); },
|
|
174
|
+
|
|
175
|
+
diffCss: function(oldStr, newStr) { return CssDiff.diff(oldStr, newStr); },
|
|
176
|
+
|
|
177
|
+
createPatch: function(fileName, oldStr, newStr, oldHeader, newHeader) {
|
|
178
|
+
var ret = [];
|
|
179
|
+
|
|
180
|
+
ret.push("Index: " + fileName);
|
|
181
|
+
ret.push("===================================================================");
|
|
182
|
+
ret.push("--- " + fileName + (typeof oldHeader === "undefined" ? "" : "\t" + oldHeader));
|
|
183
|
+
ret.push("+++ " + fileName + (typeof newHeader === "undefined" ? "" : "\t" + newHeader));
|
|
184
|
+
|
|
185
|
+
var diff = LineDiff.diff(oldStr, newStr);
|
|
186
|
+
if (!diff[diff.length-1].value) {
|
|
187
|
+
diff.pop(); // Remove trailing newline add
|
|
188
|
+
}
|
|
189
|
+
diff.push({value: "", lines: []}); // Append an empty value to make cleanup easier
|
|
190
|
+
|
|
191
|
+
function contextLines(lines) {
|
|
192
|
+
return lines.map(function(entry) { return ' ' + entry; });
|
|
193
|
+
}
|
|
194
|
+
function eofNL(curRange, i, current) {
|
|
195
|
+
var last = diff[diff.length-2],
|
|
196
|
+
isLast = i === diff.length-2,
|
|
197
|
+
isLastOfType = i === diff.length-3 && (current.added === !last.added || current.removed === !last.removed);
|
|
198
|
+
|
|
199
|
+
// Figure out if this is the last line for the given file and missing NL
|
|
200
|
+
if (!/\n$/.test(current.value) && (isLast || isLastOfType)) {
|
|
201
|
+
curRange.push('\');
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
var oldRangeStart = 0, newRangeStart = 0, curRange = [],
|
|
206
|
+
oldLine = 1, newLine = 1;
|
|
207
|
+
for (var i = 0; i < diff.length; i++) {
|
|
208
|
+
var current = diff[i],
|
|
209
|
+
lines = current.lines || current.value.replace(/\n$/, "").split("\n");
|
|
210
|
+
current.lines = lines;
|
|
211
|
+
|
|
212
|
+
if (current.added || current.removed) {
|
|
213
|
+
if (!oldRangeStart) {
|
|
214
|
+
var prev = diff[i-1];
|
|
215
|
+
oldRangeStart = oldLine;
|
|
216
|
+
newRangeStart = newLine;
|
|
217
|
+
|
|
218
|
+
if (prev) {
|
|
219
|
+
curRange = contextLines(prev.lines.slice(-4));
|
|
220
|
+
oldRangeStart -= curRange.length;
|
|
221
|
+
newRangeStart -= curRange.length;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
curRange.push.apply(curRange, lines.map(function(entry) { return (current.added?"+":"-") + entry; }));
|
|
225
|
+
eofNL(curRange, i, current);
|
|
226
|
+
|
|
227
|
+
if (current.added) {
|
|
228
|
+
newLine += lines.length;
|
|
229
|
+
} else {
|
|
230
|
+
oldLine += lines.length;
|
|
231
|
+
}
|
|
232
|
+
} else {
|
|
233
|
+
if (oldRangeStart) {
|
|
234
|
+
// Close out any changes that have been output (or join overlapping)
|
|
235
|
+
if (lines.length <= 8 && i < diff.length-2) {
|
|
236
|
+
// Overlapping
|
|
237
|
+
curRange.push.apply(curRange, contextLines(lines));
|
|
238
|
+
} else {
|
|
239
|
+
// end the range and output
|
|
240
|
+
var contextSize = Math.min(lines.length, 4);
|
|
241
|
+
ret.push(
|
|
242
|
+
"@@ -" + oldRangeStart + "," + (oldLine-oldRangeStart+contextSize)
|
|
243
|
+
+ " +" + newRangeStart + "," + (newLine-newRangeStart+contextSize)
|
|
244
|
+
+ " @@");
|
|
245
|
+
ret.push.apply(ret, curRange);
|
|
246
|
+
ret.push.apply(ret, contextLines(lines.slice(0, contextSize)));
|
|
247
|
+
if (lines.length <= 4) {
|
|
248
|
+
eofNL(ret, i, current);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
oldRangeStart = 0; newRangeStart = 0; curRange = [];
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
oldLine += lines.length;
|
|
255
|
+
newLine += lines.length;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
return ret.join('\n') + '\n';
|
|
260
|
+
},
|
|
261
|
+
|
|
262
|
+
convertChangesToXML: function(changes){
|
|
263
|
+
var ret = [];
|
|
264
|
+
for ( var i = 0; i < changes.length; i++) {
|
|
265
|
+
var change = changes[i];
|
|
266
|
+
if (change.added) {
|
|
267
|
+
ret.push("<ins>");
|
|
268
|
+
} else if (change.removed) {
|
|
269
|
+
ret.push("<del>");
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
ret.push(escapeHTML(change.value));
|
|
273
|
+
|
|
274
|
+
if (change.added) {
|
|
275
|
+
ret.push("</ins>");
|
|
276
|
+
} else if (change.removed) {
|
|
277
|
+
ret.push("</del>");
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
return ret.join("");
|
|
281
|
+
}
|
|
282
|
+
};
|
|
283
|
+
})();
|
|
284
|
+
|
|
285
|
+
if (typeof module !== "undefined") {
|
|
286
|
+
module.exports = JsDiff;
|
|
287
|
+
}
|
|
@@ -4,5 +4,10 @@ exports.isatty = function(){
|
|
|
4
4
|
};
|
|
5
5
|
|
|
6
6
|
exports.getWindowSize = function(){
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
if ('innerHeight' in global) {
|
|
8
|
+
return [global.innerHeight, global.innerWidth];
|
|
9
|
+
} else {
|
|
10
|
+
// In a Web Worker, the DOM Window is not available.
|
|
11
|
+
return [640, 480];
|
|
12
|
+
}
|
|
13
|
+
};
|
|
@@ -8,7 +8,7 @@ var Suite = require('../suite')
|
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* BDD-style interface:
|
|
11
|
-
*
|
|
11
|
+
*
|
|
12
12
|
* describe('Array', function(){
|
|
13
13
|
* describe('#indexOf()', function(){
|
|
14
14
|
* it('should return -1 when not present', function(){
|
|
@@ -20,7 +20,7 @@ var Suite = require('../suite')
|
|
|
20
20
|
* });
|
|
21
21
|
* });
|
|
22
22
|
* });
|
|
23
|
-
*
|
|
23
|
+
*
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
26
|
module.exports = function(suite){
|
|
@@ -65,7 +65,7 @@ module.exports = function(suite){
|
|
|
65
65
|
* and callback `fn` containing nested suites
|
|
66
66
|
* and/or tests.
|
|
67
67
|
*/
|
|
68
|
-
|
|
68
|
+
|
|
69
69
|
context.describe = context.context = function(title, fn){
|
|
70
70
|
var suite = Suite.create(suites[0], title);
|
|
71
71
|
suites.unshift(suite);
|
|
@@ -8,19 +8,19 @@ var Suite = require('../suite')
|
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* TDD-style interface:
|
|
11
|
-
*
|
|
11
|
+
*
|
|
12
12
|
* exports.Array = {
|
|
13
13
|
* '#indexOf()': {
|
|
14
14
|
* 'should return -1 when the value is not present': function(){
|
|
15
|
-
*
|
|
15
|
+
*
|
|
16
16
|
* },
|
|
17
17
|
*
|
|
18
18
|
* 'should return the correct index when the value is present': function(){
|
|
19
|
-
*
|
|
19
|
+
*
|
|
20
20
|
* }
|
|
21
21
|
* }
|
|
22
22
|
* };
|
|
23
|
-
*
|
|
23
|
+
*
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
26
|
module.exports = function(suite){
|
|
@@ -57,4 +57,4 @@ module.exports = function(suite){
|
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
-
};
|
|
60
|
+
};
|
|
@@ -8,33 +8,33 @@ var Suite = require('../suite')
|
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* QUnit-style interface:
|
|
11
|
-
*
|
|
11
|
+
*
|
|
12
12
|
* suite('Array');
|
|
13
|
-
*
|
|
13
|
+
*
|
|
14
14
|
* test('#length', function(){
|
|
15
15
|
* var arr = [1,2,3];
|
|
16
16
|
* ok(arr.length == 3);
|
|
17
17
|
* });
|
|
18
|
-
*
|
|
18
|
+
*
|
|
19
19
|
* test('#indexOf()', function(){
|
|
20
20
|
* var arr = [1,2,3];
|
|
21
21
|
* ok(arr.indexOf(1) == 0);
|
|
22
22
|
* ok(arr.indexOf(2) == 1);
|
|
23
23
|
* ok(arr.indexOf(3) == 2);
|
|
24
24
|
* });
|
|
25
|
-
*
|
|
25
|
+
*
|
|
26
26
|
* suite('String');
|
|
27
|
-
*
|
|
27
|
+
*
|
|
28
28
|
* test('#length', function(){
|
|
29
29
|
* ok('foo'.length == 3);
|
|
30
30
|
* });
|
|
31
|
-
*
|
|
31
|
+
*
|
|
32
32
|
*/
|
|
33
33
|
|
|
34
34
|
module.exports = function(suite){
|
|
35
35
|
var suites = [suite];
|
|
36
36
|
|
|
37
|
-
suite.on('pre-require', function(context){
|
|
37
|
+
suite.on('pre-require', function(context, file, mocha){
|
|
38
38
|
|
|
39
39
|
/**
|
|
40
40
|
* Execute before running tests.
|
|
@@ -71,11 +71,21 @@ module.exports = function(suite){
|
|
|
71
71
|
/**
|
|
72
72
|
* Describe a "suite" with the given `title`.
|
|
73
73
|
*/
|
|
74
|
-
|
|
74
|
+
|
|
75
75
|
context.suite = function(title){
|
|
76
76
|
if (suites.length > 1) suites.shift();
|
|
77
77
|
var suite = Suite.create(suites[0], title);
|
|
78
78
|
suites.unshift(suite);
|
|
79
|
+
return suite;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Exclusive test-case.
|
|
84
|
+
*/
|
|
85
|
+
|
|
86
|
+
context.suite.only = function(title, fn){
|
|
87
|
+
var suite = context.suite(title, fn);
|
|
88
|
+
mocha.grep(suite.fullTitle());
|
|
79
89
|
};
|
|
80
90
|
|
|
81
91
|
/**
|
|
@@ -85,7 +95,26 @@ module.exports = function(suite){
|
|
|
85
95
|
*/
|
|
86
96
|
|
|
87
97
|
context.test = function(title, fn){
|
|
88
|
-
|
|
98
|
+
var test = new Test(title, fn);
|
|
99
|
+
suites[0].addTest(test);
|
|
100
|
+
return test;
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Exclusive test-case.
|
|
105
|
+
*/
|
|
106
|
+
|
|
107
|
+
context.test.only = function(title, fn){
|
|
108
|
+
var test = context.test(title, fn);
|
|
109
|
+
mocha.grep(test.fullTitle());
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Pending test case.
|
|
114
|
+
*/
|
|
115
|
+
|
|
116
|
+
context.test.skip = function(title){
|
|
117
|
+
context.test(title);
|
|
89
118
|
};
|
|
90
119
|
});
|
|
91
120
|
};
|
|
@@ -14,7 +14,7 @@ var Suite = require('../suite')
|
|
|
14
14
|
* suiteSetup(function(){
|
|
15
15
|
*
|
|
16
16
|
* });
|
|
17
|
-
*
|
|
17
|
+
*
|
|
18
18
|
* test('should return -1 when not present', function(){
|
|
19
19
|
*
|
|
20
20
|
* });
|
|
@@ -82,6 +82,17 @@ module.exports = function(suite){
|
|
|
82
82
|
return suite;
|
|
83
83
|
};
|
|
84
84
|
|
|
85
|
+
/**
|
|
86
|
+
* Pending suite.
|
|
87
|
+
*/
|
|
88
|
+
context.suite.skip = function(title, fn) {
|
|
89
|
+
var suite = Suite.create(suites[0], title);
|
|
90
|
+
suite.pending = true;
|
|
91
|
+
suites.unshift(suite);
|
|
92
|
+
fn.call(suite);
|
|
93
|
+
suites.shift();
|
|
94
|
+
};
|
|
95
|
+
|
|
85
96
|
/**
|
|
86
97
|
* Exclusive test-case.
|
|
87
98
|
*/
|
|
@@ -98,8 +109,10 @@ module.exports = function(suite){
|
|
|
98
109
|
*/
|
|
99
110
|
|
|
100
111
|
context.test = function(title, fn){
|
|
112
|
+
var suite = suites[0];
|
|
113
|
+
if (suite.pending) var fn = null;
|
|
101
114
|
var test = new Test(title, fn);
|
|
102
|
-
|
|
115
|
+
suite.addTest(test);
|
|
103
116
|
return test;
|
|
104
117
|
};
|
|
105
118
|
|