initial commit
This commit is contained in:
22
node_modules/mocha/LICENSE
generated
vendored
Normal file
22
node_modules/mocha/LICENSE
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2011-2015 TJ Holowaychuk <tj@vision-media.ca>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
'Software'), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
11
node_modules/mocha/README.md
generated
vendored
Normal file
11
node_modules/mocha/README.md
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
[](http://travis-ci.org/mochajs/mocha) [](https://gitter.im/mochajs/mocha?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
|
||||
[](http://mochajs.org)
|
||||
|
||||
Mocha is a simple, flexible, fun JavaScript test framework for node.js and the browser. For more information view the [documentation](http://mochajs.org).
|
||||
|
||||
## Links
|
||||
|
||||
- [Google Group](http://groups.google.com/group/mochajs)
|
||||
- [Wiki](https://github.com/mochajs/mocha/wiki)
|
||||
- Mocha [Extensions and reporters](https://github.com/mochajs/mocha/wiki)
|
492
node_modules/mocha/bin/_mocha
generated
vendored
Executable file
492
node_modules/mocha/bin/_mocha
generated
vendored
Executable file
@ -0,0 +1,492 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var program = require('commander'),
|
||||
path = require('path'),
|
||||
fs = require('fs'),
|
||||
resolve = path.resolve,
|
||||
exists = fs.existsSync || path.existsSync,
|
||||
Mocha = require('../'),
|
||||
utils = Mocha.utils,
|
||||
join = path.join,
|
||||
cwd = process.cwd(),
|
||||
getOptions = require('./options'),
|
||||
mocha = new Mocha;
|
||||
|
||||
/**
|
||||
* Save timer references to avoid Sinon interfering (see GH-237).
|
||||
*/
|
||||
|
||||
var Date = global.Date
|
||||
, setTimeout = global.setTimeout
|
||||
, setInterval = global.setInterval
|
||||
, clearTimeout = global.clearTimeout
|
||||
, clearInterval = global.clearInterval;
|
||||
|
||||
/**
|
||||
* Files.
|
||||
*/
|
||||
|
||||
var files = [];
|
||||
|
||||
/**
|
||||
* Globals.
|
||||
*/
|
||||
|
||||
var globals = [];
|
||||
|
||||
/**
|
||||
* Requires.
|
||||
*/
|
||||
|
||||
var requires = [];
|
||||
|
||||
/**
|
||||
* Images.
|
||||
*/
|
||||
|
||||
var images = {
|
||||
fail: __dirname + '/../images/error.png'
|
||||
, pass: __dirname + '/../images/ok.png'
|
||||
};
|
||||
|
||||
// options
|
||||
|
||||
program
|
||||
.version(JSON.parse(fs.readFileSync(__dirname + '/../package.json', 'utf8')).version)
|
||||
.usage('[debug] [options] [files]')
|
||||
.option('-A, --async-only', "force all tests to take a callback (async)")
|
||||
.option('-c, --colors', 'force enabling of colors')
|
||||
.option('-C, --no-colors', 'force disabling of colors')
|
||||
.option('-G, --growl', 'enable growl notification support')
|
||||
.option('-O, --reporter-options <k=v,k2=v2,...>', 'reporter-specific options')
|
||||
.option('-R, --reporter <name>', 'specify the reporter to use', 'spec')
|
||||
.option('-S, --sort', "sort test files")
|
||||
.option('-b, --bail', "bail after first test failure")
|
||||
.option('-d, --debug', "enable node's debugger, synonym for node --debug")
|
||||
.option('-g, --grep <pattern>', 'only run tests matching <pattern>')
|
||||
.option('-f, --fgrep <string>', 'only run tests containing <string>')
|
||||
.option('-gc, --expose-gc', 'expose gc extension')
|
||||
.option('-i, --invert', 'inverts --grep and --fgrep matches')
|
||||
.option('-r, --require <name>', 'require the given module')
|
||||
.option('-s, --slow <ms>', '"slow" test threshold in milliseconds [75]')
|
||||
.option('-t, --timeout <ms>', 'set test-case timeout in milliseconds [2000]')
|
||||
.option('-u, --ui <name>', 'specify user-interface (bdd|tdd|exports)', 'bdd')
|
||||
.option('-w, --watch', 'watch files for changes')
|
||||
.option('--check-leaks', 'check for global variable leaks')
|
||||
.option('--full-trace', 'display the full stack trace')
|
||||
.option('--compilers <ext>:<module>,...', 'use the given module(s) to compile files', list, [])
|
||||
.option('--debug-brk', "enable node's debugger breaking on the first line")
|
||||
.option('--globals <names>', 'allow the given comma-delimited global [names]', list, [])
|
||||
.option('--harmony', 'enable all harmony features (except typeof)')
|
||||
.option('--es_staging', 'enable all staged features')
|
||||
.option('--harmony-collections', 'enable harmony collections (sets, maps, and weak maps)')
|
||||
.option('--harmony-generators', 'enable harmony generators')
|
||||
.option('--harmony-proxies', 'enable harmony proxies')
|
||||
.option('--harmony_shipping', 'enable all shipped harmony fetaures (iojs)')
|
||||
.option('--harmony_arrow_functions', 'enable "harmony arrow functions" (iojs)')
|
||||
.option('--harmony_proxies', 'enable "harmony proxies" (iojs)')
|
||||
.option('--harmony_classes', 'enable "harmony classes" (iojs)')
|
||||
.option('--inline-diffs', 'display actual/expected differences inline within each string')
|
||||
.option('--interfaces', 'display available interfaces')
|
||||
.option('--no-deprecation', 'silence deprecation warnings')
|
||||
.option('--no-exit', 'require a clean shutdown of the event loop: mocha will not call process.exit')
|
||||
.option('--no-timeouts', 'disables timeouts, given implicitly with --debug')
|
||||
.option('--opts <path>', 'specify opts path', 'test/mocha.opts')
|
||||
.option('--prof', 'log statistical profiling information')
|
||||
.option('--recursive', 'include sub directories')
|
||||
.option('--reporters', 'display available reporters')
|
||||
.option('--throw-deprecation', 'throw an exception anytime a deprecated function is used')
|
||||
.option('--trace', 'trace function calls')
|
||||
.option('--trace-deprecation', 'show stack traces on deprecations')
|
||||
.option('--watch-extensions <ext>,...', 'additional extensions to monitor with --watch', list, [])
|
||||
.option('--delay', 'wait for async suite definition')
|
||||
|
||||
program.name = 'mocha';
|
||||
|
||||
// init command
|
||||
|
||||
program
|
||||
.command('init <path>')
|
||||
.description('initialize a client-side mocha setup at <path>')
|
||||
.action(function(path){
|
||||
var mkdir = require('mkdirp');
|
||||
mkdir.sync(path);
|
||||
var css = fs.readFileSync(join(__dirname, '..', 'mocha.css'));
|
||||
var js = fs.readFileSync(join(__dirname, '..', 'mocha.js'));
|
||||
var tmpl = fs.readFileSync(join(__dirname, '..', 'lib/template.html'));
|
||||
fs.writeFileSync(join(path, 'mocha.css'), css);
|
||||
fs.writeFileSync(join(path, 'mocha.js'), js);
|
||||
fs.writeFileSync(join(path, 'tests.js'), '');
|
||||
fs.writeFileSync(join(path, 'index.html'), tmpl);
|
||||
process.exit(0);
|
||||
});
|
||||
|
||||
// --globals
|
||||
|
||||
program.on('globals', function(val){
|
||||
globals = globals.concat(list(val));
|
||||
});
|
||||
|
||||
// --reporters
|
||||
|
||||
program.on('reporters', function(){
|
||||
console.log();
|
||||
console.log(' dot - dot matrix');
|
||||
console.log(' doc - html documentation');
|
||||
console.log(' spec - hierarchical spec list');
|
||||
console.log(' json - single json object');
|
||||
console.log(' progress - progress bar');
|
||||
console.log(' list - spec-style listing');
|
||||
console.log(' tap - test-anything-protocol');
|
||||
console.log(' landing - unicode landing strip');
|
||||
console.log(' xunit - xunit reporter');
|
||||
console.log(' html-cov - HTML test coverage');
|
||||
console.log(' json-cov - JSON test coverage');
|
||||
console.log(' min - minimal reporter (great with --watch)');
|
||||
console.log(' json-stream - newline delimited json events');
|
||||
console.log(' markdown - markdown documentation (github flavour)');
|
||||
console.log(' nyan - nyan cat!');
|
||||
console.log();
|
||||
process.exit();
|
||||
});
|
||||
|
||||
// --interfaces
|
||||
|
||||
program.on('interfaces', function(){
|
||||
console.log('');
|
||||
console.log(' bdd');
|
||||
console.log(' tdd');
|
||||
console.log(' qunit');
|
||||
console.log(' exports');
|
||||
console.log('');
|
||||
process.exit();
|
||||
});
|
||||
|
||||
// -r, --require
|
||||
|
||||
module.paths.push(cwd, join(cwd, 'node_modules'));
|
||||
|
||||
program.on('require', function(mod){
|
||||
var abs = exists(mod) || exists(mod + '.js');
|
||||
if (abs) mod = resolve(mod);
|
||||
requires.push(mod);
|
||||
});
|
||||
|
||||
// load mocha.opts into process.argv
|
||||
|
||||
getOptions();
|
||||
|
||||
// parse args
|
||||
|
||||
program.parse(process.argv);
|
||||
|
||||
// infinite stack traces
|
||||
|
||||
Error.stackTraceLimit = Infinity; // TODO: config
|
||||
|
||||
// reporter options
|
||||
|
||||
var reporterOptions = {};
|
||||
if (program.reporterOptions !== undefined) {
|
||||
program.reporterOptions.split(",").forEach(function(opt) {
|
||||
var L = opt.split("=");
|
||||
if (L.length != 2) {
|
||||
throw new Error("invalid reporter option '" + opt + "'");
|
||||
}
|
||||
reporterOptions[L[0]] = L[1];
|
||||
});
|
||||
}
|
||||
|
||||
// reporter
|
||||
|
||||
mocha.reporter(program.reporter, reporterOptions);
|
||||
|
||||
// interface
|
||||
|
||||
mocha.ui(program.ui);
|
||||
|
||||
// load reporter
|
||||
|
||||
try {
|
||||
Reporter = require('../lib/reporters/' + program.reporter);
|
||||
} catch (err) {
|
||||
try {
|
||||
Reporter = require(program.reporter);
|
||||
} catch (err) {
|
||||
throw new Error('reporter "' + program.reporter + '" does not exist');
|
||||
}
|
||||
}
|
||||
|
||||
// --no-colors
|
||||
|
||||
if (!program.colors) mocha.useColors(false);
|
||||
|
||||
// --colors
|
||||
|
||||
if (~process.argv.indexOf('--colors') ||
|
||||
~process.argv.indexOf('-c')) {
|
||||
mocha.useColors(true);
|
||||
}
|
||||
|
||||
// --inline-diffs
|
||||
|
||||
if (program.inlineDiffs) mocha.useInlineDiffs(true);
|
||||
|
||||
// --slow <ms>
|
||||
|
||||
if (program.slow) mocha.suite.slow(program.slow);
|
||||
|
||||
// --no-timeouts
|
||||
|
||||
if (!program.timeouts) mocha.enableTimeouts(false);
|
||||
|
||||
// --timeout
|
||||
|
||||
if (program.timeout) mocha.suite.timeout(program.timeout);
|
||||
|
||||
// --bail
|
||||
|
||||
mocha.suite.bail(program.bail);
|
||||
|
||||
// --grep
|
||||
|
||||
if (program.grep) mocha.grep(new RegExp(program.grep));
|
||||
|
||||
// --fgrep
|
||||
|
||||
if (program.fgrep) mocha.grep(program.fgrep);
|
||||
|
||||
// --invert
|
||||
|
||||
if (program.invert) mocha.invert();
|
||||
|
||||
// --check-leaks
|
||||
|
||||
if (program.checkLeaks) mocha.checkLeaks();
|
||||
|
||||
// --stack-trace
|
||||
|
||||
if(program.fullTrace) mocha.fullTrace();
|
||||
|
||||
// --growl
|
||||
|
||||
if (program.growl) mocha.growl();
|
||||
|
||||
// --async-only
|
||||
|
||||
if (program.asyncOnly) mocha.asyncOnly();
|
||||
|
||||
// --delay
|
||||
|
||||
if (program.delay) mocha.delay();
|
||||
|
||||
// --globals
|
||||
|
||||
mocha.globals(globals);
|
||||
|
||||
// custom compiler support
|
||||
|
||||
var extensions = ['js'];
|
||||
program.compilers.forEach(function(c) {
|
||||
var compiler = c.split(':')
|
||||
, ext = compiler[0]
|
||||
, mod = compiler[1];
|
||||
|
||||
if (mod[0] == '.') mod = join(process.cwd(), mod);
|
||||
require(mod);
|
||||
extensions.push(ext);
|
||||
program.watchExtensions.push(ext);
|
||||
});
|
||||
|
||||
// requires
|
||||
|
||||
requires.forEach(function(mod) {
|
||||
require(mod);
|
||||
});
|
||||
|
||||
//args
|
||||
|
||||
var args = program.args;
|
||||
|
||||
// default files to test/*.{js,coffee}
|
||||
|
||||
if (!args.length) args.push('test');
|
||||
|
||||
args.forEach(function(arg){
|
||||
files = files.concat(utils.lookupFiles(arg, extensions, program.recursive));
|
||||
});
|
||||
|
||||
// resolve
|
||||
|
||||
files = files.map(function(path){
|
||||
return resolve(path);
|
||||
});
|
||||
|
||||
if (program.sort) {
|
||||
files.sort();
|
||||
}
|
||||
|
||||
// --watch
|
||||
|
||||
var runner;
|
||||
if (program.watch) {
|
||||
console.log();
|
||||
hideCursor();
|
||||
process.on('SIGINT', function(){
|
||||
showCursor();
|
||||
console.log('\n');
|
||||
process.exit();
|
||||
});
|
||||
|
||||
|
||||
var watchFiles = utils.files(cwd, [ 'js' ].concat(program.watchExtensions));
|
||||
var runAgain = false;
|
||||
|
||||
function loadAndRun() {
|
||||
try {
|
||||
mocha.files = files;
|
||||
runAgain = false;
|
||||
runner = mocha.run(function(){
|
||||
runner = null;
|
||||
if (runAgain) {
|
||||
rerun();
|
||||
}
|
||||
});
|
||||
} catch(e) {
|
||||
console.log(e.stack);
|
||||
}
|
||||
}
|
||||
|
||||
function purge() {
|
||||
watchFiles.forEach(function(file){
|
||||
delete require.cache[file];
|
||||
});
|
||||
}
|
||||
|
||||
loadAndRun();
|
||||
|
||||
function rerun() {
|
||||
purge();
|
||||
stop()
|
||||
if (!program.grep)
|
||||
mocha.grep(null);
|
||||
mocha.suite = mocha.suite.clone();
|
||||
mocha.suite.ctx = new Mocha.Context;
|
||||
mocha.ui(program.ui);
|
||||
loadAndRun();
|
||||
}
|
||||
|
||||
utils.watch(watchFiles, function(){
|
||||
runAgain = true;
|
||||
if (runner) {
|
||||
runner.abort();
|
||||
} else {
|
||||
rerun();
|
||||
}
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// load
|
||||
|
||||
mocha.files = files;
|
||||
runner = mocha.run(program.exit ? exit : exitLater);
|
||||
|
||||
function exitLater(code) {
|
||||
process.on('exit', function() { process.exit(code) })
|
||||
}
|
||||
|
||||
function exit(code) {
|
||||
// flush output for Node.js Windows pipe bug
|
||||
// https://github.com/joyent/node/issues/6247 is just one bug example
|
||||
// https://github.com/visionmedia/mocha/issues/333 has a good discussion
|
||||
function done() {
|
||||
if (!(draining--)) process.exit(code);
|
||||
}
|
||||
|
||||
var draining = 0;
|
||||
var streams = [process.stdout, process.stderr];
|
||||
|
||||
streams.forEach(function(stream){
|
||||
// submit empty write request and wait for completion
|
||||
draining += 1;
|
||||
stream.write('', done);
|
||||
});
|
||||
|
||||
done();
|
||||
}
|
||||
|
||||
process.on('SIGINT', function() { runner.abort(); })
|
||||
|
||||
// enable growl notifications
|
||||
|
||||
function growl(runner, reporter) {
|
||||
var notify = require('growl');
|
||||
|
||||
runner.on('end', function(){
|
||||
var stats = reporter.stats;
|
||||
if (stats.failures) {
|
||||
var msg = stats.failures + ' of ' + runner.total + ' tests failed';
|
||||
notify(msg, { name: 'mocha', title: 'Failed', image: images.fail });
|
||||
} else {
|
||||
notify(stats.passes + ' tests passed in ' + stats.duration + 'ms', {
|
||||
name: 'mocha'
|
||||
, title: 'Passed'
|
||||
, image: images.pass
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse list.
|
||||
*/
|
||||
|
||||
function list(str) {
|
||||
return str.split(/ *, */);
|
||||
}
|
||||
|
||||
/**
|
||||
* Hide the cursor.
|
||||
*/
|
||||
|
||||
function hideCursor(){
|
||||
process.stdout.write('\u001b[?25l');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the cursor.
|
||||
*/
|
||||
|
||||
function showCursor(){
|
||||
process.stdout.write('\u001b[?25h');
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop play()ing.
|
||||
*/
|
||||
|
||||
function stop() {
|
||||
process.stdout.write('\u001b[2K');
|
||||
clearInterval(play.timer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Play the given array of strings.
|
||||
*/
|
||||
|
||||
function play(arr, interval) {
|
||||
var len = arr.length
|
||||
, interval = interval || 100
|
||||
, i = 0;
|
||||
|
||||
play.timer = setInterval(function(){
|
||||
var str = arr[i++ % len];
|
||||
process.stdout.write('\u001b[0G' + str);
|
||||
}, interval);
|
||||
}
|
76
node_modules/mocha/bin/mocha
generated
vendored
Executable file
76
node_modules/mocha/bin/mocha
generated
vendored
Executable file
@ -0,0 +1,76 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* This tiny wrapper file checks for known node flags and appends them
|
||||
* when found, before invoking the "real" _mocha(1) executable.
|
||||
*/
|
||||
|
||||
var spawn = require('child_process').spawn,
|
||||
path = require('path'),
|
||||
fs = require('fs'),
|
||||
args = [path.join(__dirname, '_mocha')],
|
||||
getOptions = require('./options');
|
||||
|
||||
// load mocha.opts into process.argv
|
||||
|
||||
getOptions();
|
||||
|
||||
process.argv.slice(2).forEach(function(arg){
|
||||
var flag = arg.split('=')[0];
|
||||
|
||||
switch (flag) {
|
||||
case '-d':
|
||||
args.unshift('--debug');
|
||||
args.push('--no-timeouts');
|
||||
break;
|
||||
case 'debug':
|
||||
case '--debug':
|
||||
case '--debug-brk':
|
||||
args.unshift(arg);
|
||||
args.push('--no-timeouts');
|
||||
break;
|
||||
case '-gc':
|
||||
case '--expose-gc':
|
||||
args.unshift('--expose-gc');
|
||||
break;
|
||||
case '--gc-global':
|
||||
case '--harmony':
|
||||
case '--es_staging':
|
||||
case '--harmony-proxies':
|
||||
case '--harmony-collections':
|
||||
case '--harmony-generators':
|
||||
case '--harmony_shipping':
|
||||
case '--harmony_arrow_functions':
|
||||
case '--harmony_proxies':
|
||||
case '--harmony_classes':
|
||||
case '--no-deprecation':
|
||||
case '--prof':
|
||||
case '--throw-deprecation':
|
||||
case '--trace-deprecation':
|
||||
case '--allow-natives-syntax':
|
||||
args.unshift(arg);
|
||||
break;
|
||||
default:
|
||||
if (0 == arg.indexOf('--trace')) args.unshift(arg);
|
||||
else args.push(arg);
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
var proc = spawn(process.execPath, args, { stdio: 'inherit' });
|
||||
proc.on('exit', function (code, signal) {
|
||||
process.on('exit', function(){
|
||||
if (signal) {
|
||||
process.kill(process.pid, signal);
|
||||
} else {
|
||||
process.exit(code);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// terminate children.
|
||||
process.on('SIGINT', function () {
|
||||
proc.kill('SIGINT'); // calls runner.abort()
|
||||
proc.kill('SIGTERM'); // if that didn't work, we're probably in an infinite loop, so make it die.
|
||||
process.kill(process.pid, 'SIGINT');
|
||||
});
|
36
node_modules/mocha/bin/options.js
generated
vendored
Normal file
36
node_modules/mocha/bin/options.js
generated
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
/**
|
||||
* Dependencies.
|
||||
*/
|
||||
|
||||
var fs = require('fs');
|
||||
|
||||
/**
|
||||
* Export `getOptions`.
|
||||
*/
|
||||
|
||||
module.exports = getOptions;
|
||||
|
||||
/**
|
||||
* Get options.
|
||||
*/
|
||||
|
||||
function getOptions() {
|
||||
var optsPath = process.argv.indexOf('--opts') !== -1
|
||||
? process.argv[process.argv.indexOf('--opts') + 1]
|
||||
: 'test/mocha.opts';
|
||||
|
||||
try {
|
||||
var opts = fs.readFileSync(optsPath, 'utf8')
|
||||
.trim()
|
||||
.split(/\s+/)
|
||||
.filter(function(value) {
|
||||
return value ? true : false;
|
||||
});
|
||||
|
||||
process.argv = process.argv
|
||||
.slice(0, 2)
|
||||
.concat(opts.concat(process.argv.slice(2)));
|
||||
} catch (err) {
|
||||
// ignore
|
||||
}
|
||||
}
|
BIN
node_modules/mocha/images/error.png
generated
vendored
Normal file
BIN
node_modules/mocha/images/error.png
generated
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 412 B |
BIN
node_modules/mocha/images/ok.png
generated
vendored
Normal file
BIN
node_modules/mocha/images/ok.png
generated
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 388 B |
3
node_modules/mocha/index.js
generated
vendored
Normal file
3
node_modules/mocha/index.js
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
module.exports = process.env.COV
|
||||
? require('./lib-cov/mocha')
|
||||
: require('./lib/mocha');
|
4
node_modules/mocha/lib/browser/debug.js
generated
vendored
Normal file
4
node_modules/mocha/lib/browser/debug.js
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
module.exports = function(type){
|
||||
return function(){
|
||||
}
|
||||
};
|
369
node_modules/mocha/lib/browser/diff.js
generated
vendored
Normal file
369
node_modules/mocha/lib/browser/diff.js
generated
vendored
Normal file
@ -0,0 +1,369 @@
|
||||
/* See LICENSE file for terms of use */
|
||||
|
||||
/*
|
||||
* Text diff implementation.
|
||||
*
|
||||
* This library supports the following APIS:
|
||||
* JsDiff.diffChars: Character by character diff
|
||||
* JsDiff.diffWords: Word (as defined by \b regex) diff which ignores whitespace
|
||||
* JsDiff.diffLines: Line based diff
|
||||
*
|
||||
* JsDiff.diffCss: Diff targeted at CSS content
|
||||
*
|
||||
* These methods are based on the implementation proposed in
|
||||
* "An O(ND) Difference Algorithm and its Variations" (Myers, 1986).
|
||||
* http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.4.6927
|
||||
*/
|
||||
var JsDiff = (function() {
|
||||
/*jshint maxparams: 5*/
|
||||
function clonePath(path) {
|
||||
return { newPos: path.newPos, components: path.components.slice(0) };
|
||||
}
|
||||
function removeEmpty(array) {
|
||||
var ret = [];
|
||||
for (var i = 0; i < array.length; i++) {
|
||||
if (array[i]) {
|
||||
ret.push(array[i]);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
function escapeHTML(s) {
|
||||
var n = s;
|
||||
n = n.replace(/&/g, '&');
|
||||
n = n.replace(/</g, '<');
|
||||
n = n.replace(/>/g, '>');
|
||||
n = n.replace(/"/g, '"');
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
var Diff = function(ignoreWhitespace) {
|
||||
this.ignoreWhitespace = ignoreWhitespace;
|
||||
};
|
||||
Diff.prototype = {
|
||||
diff: function(oldString, newString) {
|
||||
// Handle the identity case (this is due to unrolling editLength == 0
|
||||
if (newString === oldString) {
|
||||
return [{ value: newString }];
|
||||
}
|
||||
if (!newString) {
|
||||
return [{ value: oldString, removed: true }];
|
||||
}
|
||||
if (!oldString) {
|
||||
return [{ value: newString, added: true }];
|
||||
}
|
||||
|
||||
newString = this.tokenize(newString);
|
||||
oldString = this.tokenize(oldString);
|
||||
|
||||
var newLen = newString.length, oldLen = oldString.length;
|
||||
var maxEditLength = newLen + oldLen;
|
||||
var bestPath = [{ newPos: -1, components: [] }];
|
||||
|
||||
// Seed editLength = 0
|
||||
var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0);
|
||||
if (bestPath[0].newPos+1 >= newLen && oldPos+1 >= oldLen) {
|
||||
return bestPath[0].components;
|
||||
}
|
||||
|
||||
for (var editLength = 1; editLength <= maxEditLength; editLength++) {
|
||||
for (var diagonalPath = -1*editLength; diagonalPath <= editLength; diagonalPath+=2) {
|
||||
var basePath;
|
||||
var addPath = bestPath[diagonalPath-1],
|
||||
removePath = bestPath[diagonalPath+1];
|
||||
oldPos = (removePath ? removePath.newPos : 0) - diagonalPath;
|
||||
if (addPath) {
|
||||
// No one else is going to attempt to use this value, clear it
|
||||
bestPath[diagonalPath-1] = undefined;
|
||||
}
|
||||
|
||||
var canAdd = addPath && addPath.newPos+1 < newLen;
|
||||
var canRemove = removePath && 0 <= oldPos && oldPos < oldLen;
|
||||
if (!canAdd && !canRemove) {
|
||||
bestPath[diagonalPath] = undefined;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Select the diagonal that we want to branch from. We select the prior
|
||||
// path whose position in the new string is the farthest from the origin
|
||||
// and does not pass the bounds of the diff graph
|
||||
if (!canAdd || (canRemove && addPath.newPos < removePath.newPos)) {
|
||||
basePath = clonePath(removePath);
|
||||
this.pushComponent(basePath.components, oldString[oldPos], undefined, true);
|
||||
} else {
|
||||
basePath = clonePath(addPath);
|
||||
basePath.newPos++;
|
||||
this.pushComponent(basePath.components, newString[basePath.newPos], true, undefined);
|
||||
}
|
||||
|
||||
var oldPos = this.extractCommon(basePath, newString, oldString, diagonalPath);
|
||||
|
||||
if (basePath.newPos+1 >= newLen && oldPos+1 >= oldLen) {
|
||||
return basePath.components;
|
||||
} else {
|
||||
bestPath[diagonalPath] = basePath;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
pushComponent: function(components, value, added, removed) {
|
||||
var last = components[components.length-1];
|
||||
if (last && last.added === added && last.removed === removed) {
|
||||
// We need to clone here as the component clone operation is just
|
||||
// as shallow array clone
|
||||
components[components.length-1] =
|
||||
{value: this.join(last.value, value), added: added, removed: removed };
|
||||
} else {
|
||||
components.push({value: value, added: added, removed: removed });
|
||||
}
|
||||
},
|
||||
extractCommon: function(basePath, newString, oldString, diagonalPath) {
|
||||
var newLen = newString.length,
|
||||
oldLen = oldString.length,
|
||||
newPos = basePath.newPos,
|
||||
oldPos = newPos - diagonalPath;
|
||||
while (newPos+1 < newLen && oldPos+1 < oldLen && this.equals(newString[newPos+1], oldString[oldPos+1])) {
|
||||
newPos++;
|
||||
oldPos++;
|
||||
|
||||
this.pushComponent(basePath.components, newString[newPos], undefined, undefined);
|
||||
}
|
||||
basePath.newPos = newPos;
|
||||
return oldPos;
|
||||
},
|
||||
|
||||
equals: function(left, right) {
|
||||
var reWhitespace = /\S/;
|
||||
if (this.ignoreWhitespace && !reWhitespace.test(left) && !reWhitespace.test(right)) {
|
||||
return true;
|
||||
} else {
|
||||
return left === right;
|
||||
}
|
||||
},
|
||||
join: function(left, right) {
|
||||
return left + right;
|
||||
},
|
||||
tokenize: function(value) {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
var CharDiff = new Diff();
|
||||
|
||||
var WordDiff = new Diff(true);
|
||||
var WordWithSpaceDiff = new Diff();
|
||||
WordDiff.tokenize = WordWithSpaceDiff.tokenize = function(value) {
|
||||
return removeEmpty(value.split(/(\s+|\b)/));
|
||||
};
|
||||
|
||||
var CssDiff = new Diff(true);
|
||||
CssDiff.tokenize = function(value) {
|
||||
return removeEmpty(value.split(/([{}:;,]|\s+)/));
|
||||
};
|
||||
|
||||
var LineDiff = new Diff();
|
||||
LineDiff.tokenize = function(value) {
|
||||
var retLines = [],
|
||||
lines = value.split(/^/m);
|
||||
|
||||
for(var i = 0; i < lines.length; i++) {
|
||||
var line = lines[i],
|
||||
lastLine = lines[i - 1];
|
||||
|
||||
// Merge lines that may contain windows new lines
|
||||
if (line == '\n' && lastLine && lastLine[lastLine.length - 1] === '\r') {
|
||||
retLines[retLines.length - 1] += '\n';
|
||||
} else if (line) {
|
||||
retLines.push(line);
|
||||
}
|
||||
}
|
||||
|
||||
return retLines;
|
||||
};
|
||||
|
||||
return {
|
||||
Diff: Diff,
|
||||
|
||||
diffChars: function(oldStr, newStr) { return CharDiff.diff(oldStr, newStr); },
|
||||
diffWords: function(oldStr, newStr) { return WordDiff.diff(oldStr, newStr); },
|
||||
diffWordsWithSpace: function(oldStr, newStr) { return WordWithSpaceDiff.diff(oldStr, newStr); },
|
||||
diffLines: function(oldStr, newStr) { return LineDiff.diff(oldStr, newStr); },
|
||||
|
||||
diffCss: function(oldStr, newStr) { return CssDiff.diff(oldStr, newStr); },
|
||||
|
||||
createPatch: function(fileName, oldStr, newStr, oldHeader, newHeader) {
|
||||
var ret = [];
|
||||
|
||||
ret.push('Index: ' + fileName);
|
||||
ret.push('===================================================================');
|
||||
ret.push('--- ' + fileName + (typeof oldHeader === 'undefined' ? '' : '\t' + oldHeader));
|
||||
ret.push('+++ ' + fileName + (typeof newHeader === 'undefined' ? '' : '\t' + newHeader));
|
||||
|
||||
var diff = LineDiff.diff(oldStr, newStr);
|
||||
if (!diff[diff.length-1].value) {
|
||||
diff.pop(); // Remove trailing newline add
|
||||
}
|
||||
diff.push({value: '', lines: []}); // Append an empty value to make cleanup easier
|
||||
|
||||
function contextLines(lines) {
|
||||
return lines.map(function(entry) { return ' ' + entry; });
|
||||
}
|
||||
function eofNL(curRange, i, current) {
|
||||
var last = diff[diff.length-2],
|
||||
isLast = i === diff.length-2,
|
||||
isLastOfType = i === diff.length-3 && (current.added !== last.added || current.removed !== last.removed);
|
||||
|
||||
// Figure out if this is the last line for the given file and missing NL
|
||||
if (!/\n$/.test(current.value) && (isLast || isLastOfType)) {
|
||||
curRange.push('\\ No newline at end of file');
|
||||
}
|
||||
}
|
||||
|
||||
var oldRangeStart = 0, newRangeStart = 0, curRange = [],
|
||||
oldLine = 1, newLine = 1;
|
||||
for (var i = 0; i < diff.length; i++) {
|
||||
var current = diff[i],
|
||||
lines = current.lines || current.value.replace(/\n$/, '').split('\n');
|
||||
current.lines = lines;
|
||||
|
||||
if (current.added || current.removed) {
|
||||
if (!oldRangeStart) {
|
||||
var prev = diff[i-1];
|
||||
oldRangeStart = oldLine;
|
||||
newRangeStart = newLine;
|
||||
|
||||
if (prev) {
|
||||
curRange = contextLines(prev.lines.slice(-4));
|
||||
oldRangeStart -= curRange.length;
|
||||
newRangeStart -= curRange.length;
|
||||
}
|
||||
}
|
||||
curRange.push.apply(curRange, lines.map(function(entry) { return (current.added?'+':'-') + entry; }));
|
||||
eofNL(curRange, i, current);
|
||||
|
||||
if (current.added) {
|
||||
newLine += lines.length;
|
||||
} else {
|
||||
oldLine += lines.length;
|
||||
}
|
||||
} else {
|
||||
if (oldRangeStart) {
|
||||
// Close out any changes that have been output (or join overlapping)
|
||||
if (lines.length <= 8 && i < diff.length-2) {
|
||||
// Overlapping
|
||||
curRange.push.apply(curRange, contextLines(lines));
|
||||
} else {
|
||||
// end the range and output
|
||||
var contextSize = Math.min(lines.length, 4);
|
||||
ret.push(
|
||||
'@@ -' + oldRangeStart + ',' + (oldLine-oldRangeStart+contextSize)
|
||||
+ ' +' + newRangeStart + ',' + (newLine-newRangeStart+contextSize)
|
||||
+ ' @@');
|
||||
ret.push.apply(ret, curRange);
|
||||
ret.push.apply(ret, contextLines(lines.slice(0, contextSize)));
|
||||
if (lines.length <= 4) {
|
||||
eofNL(ret, i, current);
|
||||
}
|
||||
|
||||
oldRangeStart = 0; newRangeStart = 0; curRange = [];
|
||||
}
|
||||
}
|
||||
oldLine += lines.length;
|
||||
newLine += lines.length;
|
||||
}
|
||||
}
|
||||
|
||||
return ret.join('\n') + '\n';
|
||||
},
|
||||
|
||||
applyPatch: function(oldStr, uniDiff) {
|
||||
var diffstr = uniDiff.split('\n');
|
||||
var diff = [];
|
||||
var remEOFNL = false,
|
||||
addEOFNL = false;
|
||||
|
||||
for (var i = (diffstr[0][0]==='I'?4:0); i < diffstr.length; i++) {
|
||||
if(diffstr[i][0] === '@') {
|
||||
var meh = diffstr[i].split(/@@ -(\d+),(\d+) \+(\d+),(\d+) @@/);
|
||||
diff.unshift({
|
||||
start:meh[3],
|
||||
oldlength:meh[2],
|
||||
oldlines:[],
|
||||
newlength:meh[4],
|
||||
newlines:[]
|
||||
});
|
||||
} else if(diffstr[i][0] === '+') {
|
||||
diff[0].newlines.push(diffstr[i].substr(1));
|
||||
} else if(diffstr[i][0] === '-') {
|
||||
diff[0].oldlines.push(diffstr[i].substr(1));
|
||||
} else if(diffstr[i][0] === ' ') {
|
||||
diff[0].newlines.push(diffstr[i].substr(1));
|
||||
diff[0].oldlines.push(diffstr[i].substr(1));
|
||||
} else if(diffstr[i][0] === '\\') {
|
||||
if (diffstr[i-1][0] === '+') {
|
||||
remEOFNL = true;
|
||||
} else if(diffstr[i-1][0] === '-') {
|
||||
addEOFNL = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var str = oldStr.split('\n');
|
||||
for (var i = diff.length - 1; i >= 0; i--) {
|
||||
var d = diff[i];
|
||||
for (var j = 0; j < d.oldlength; j++) {
|
||||
if(str[d.start-1+j] !== d.oldlines[j]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Array.prototype.splice.apply(str,[d.start-1,+d.oldlength].concat(d.newlines));
|
||||
}
|
||||
|
||||
if (remEOFNL) {
|
||||
while (!str[str.length-1]) {
|
||||
str.pop();
|
||||
}
|
||||
} else if (addEOFNL) {
|
||||
str.push('');
|
||||
}
|
||||
return str.join('\n');
|
||||
},
|
||||
|
||||
convertChangesToXML: function(changes){
|
||||
var ret = [];
|
||||
for ( var i = 0; i < changes.length; i++) {
|
||||
var change = changes[i];
|
||||
if (change.added) {
|
||||
ret.push('<ins>');
|
||||
} else if (change.removed) {
|
||||
ret.push('<del>');
|
||||
}
|
||||
|
||||
ret.push(escapeHTML(change.value));
|
||||
|
||||
if (change.added) {
|
||||
ret.push('</ins>');
|
||||
} else if (change.removed) {
|
||||
ret.push('</del>');
|
||||
}
|
||||
}
|
||||
return ret.join('');
|
||||
},
|
||||
|
||||
// See: http://code.google.com/p/google-diff-match-patch/wiki/API
|
||||
convertChangesToDMP: function(changes){
|
||||
var ret = [], change;
|
||||
for ( var i = 0; i < changes.length; i++) {
|
||||
change = changes[i];
|
||||
ret.push([(change.added ? 1 : change.removed ? -1 : 0), change.value]);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
if (typeof module !== 'undefined') {
|
||||
module.exports = JsDiff;
|
||||
}
|
11
node_modules/mocha/lib/browser/escape-string-regexp.js
generated
vendored
Normal file
11
node_modules/mocha/lib/browser/escape-string-regexp.js
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
'use strict';
|
||||
|
||||
var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
|
||||
|
||||
module.exports = function (str) {
|
||||
if (typeof str !== 'string') {
|
||||
throw new TypeError('Expected a string');
|
||||
}
|
||||
|
||||
return str.replace(matchOperatorsRe, '\\$&');
|
||||
};
|
177
node_modules/mocha/lib/browser/events.js
generated
vendored
Normal file
177
node_modules/mocha/lib/browser/events.js
generated
vendored
Normal file
@ -0,0 +1,177 @@
|
||||
/**
|
||||
* Module exports.
|
||||
*/
|
||||
|
||||
exports.EventEmitter = EventEmitter;
|
||||
|
||||
/**
|
||||
* Check if `obj` is an array.
|
||||
*/
|
||||
|
||||
function isArray(obj) {
|
||||
return '[object Array]' == {}.toString.call(obj);
|
||||
}
|
||||
|
||||
/**
|
||||
* Event emitter constructor.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function EventEmitter(){};
|
||||
|
||||
/**
|
||||
* Adds a listener.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
EventEmitter.prototype.on = function (name, fn) {
|
||||
if (!this.$events) {
|
||||
this.$events = {};
|
||||
}
|
||||
|
||||
if (!this.$events[name]) {
|
||||
this.$events[name] = fn;
|
||||
} else if (isArray(this.$events[name])) {
|
||||
this.$events[name].push(fn);
|
||||
} else {
|
||||
this.$events[name] = [this.$events[name], fn];
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
EventEmitter.prototype.addListener = EventEmitter.prototype.on;
|
||||
|
||||
/**
|
||||
* Adds a volatile listener.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
EventEmitter.prototype.once = function (name, fn) {
|
||||
var self = this;
|
||||
|
||||
function on () {
|
||||
self.removeListener(name, on);
|
||||
fn.apply(this, arguments);
|
||||
};
|
||||
|
||||
on.listener = fn;
|
||||
this.on(name, on);
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Removes a listener.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
EventEmitter.prototype.removeListener = function (name, fn) {
|
||||
if (this.$events && this.$events[name]) {
|
||||
var list = this.$events[name];
|
||||
|
||||
if (isArray(list)) {
|
||||
var pos = -1;
|
||||
|
||||
for (var i = 0, l = list.length; i < l; i++) {
|
||||
if (list[i] === fn || (list[i].listener && list[i].listener === fn)) {
|
||||
pos = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (pos < 0) {
|
||||
return this;
|
||||
}
|
||||
|
||||
list.splice(pos, 1);
|
||||
|
||||
if (!list.length) {
|
||||
delete this.$events[name];
|
||||
}
|
||||
} else if (list === fn || (list.listener && list.listener === fn)) {
|
||||
delete this.$events[name];
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Removes all listeners for an event.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
EventEmitter.prototype.removeAllListeners = function (name) {
|
||||
if (name === undefined) {
|
||||
this.$events = {};
|
||||
return this;
|
||||
}
|
||||
|
||||
if (this.$events && this.$events[name]) {
|
||||
this.$events[name] = null;
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets all listeners for a certain event.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
EventEmitter.prototype.listeners = function (name) {
|
||||
if (!this.$events) {
|
||||
this.$events = {};
|
||||
}
|
||||
|
||||
if (!this.$events[name]) {
|
||||
this.$events[name] = [];
|
||||
}
|
||||
|
||||
if (!isArray(this.$events[name])) {
|
||||
this.$events[name] = [this.$events[name]];
|
||||
}
|
||||
|
||||
return this.$events[name];
|
||||
};
|
||||
|
||||
/**
|
||||
* Emits an event.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
EventEmitter.prototype.emit = function (name) {
|
||||
if (!this.$events) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var handler = this.$events[name];
|
||||
|
||||
if (!handler) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var args = [].slice.call(arguments, 1);
|
||||
|
||||
if ('function' == typeof handler) {
|
||||
handler.apply(this, args);
|
||||
} else if (isArray(handler)) {
|
||||
var listeners = handler.slice();
|
||||
|
||||
for (var i = 0, l = listeners.length; i < l; i++) {
|
||||
listeners[i].apply(this, args);
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
0
node_modules/mocha/lib/browser/fs.js
generated
vendored
Normal file
0
node_modules/mocha/lib/browser/fs.js
generated
vendored
Normal file
0
node_modules/mocha/lib/browser/glob.js
generated
vendored
Normal file
0
node_modules/mocha/lib/browser/glob.js
generated
vendored
Normal file
0
node_modules/mocha/lib/browser/path.js
generated
vendored
Normal file
0
node_modules/mocha/lib/browser/path.js
generated
vendored
Normal file
125
node_modules/mocha/lib/browser/progress.js
generated
vendored
Normal file
125
node_modules/mocha/lib/browser/progress.js
generated
vendored
Normal file
@ -0,0 +1,125 @@
|
||||
/**
|
||||
* Expose `Progress`.
|
||||
*/
|
||||
|
||||
module.exports = Progress;
|
||||
|
||||
/**
|
||||
* Initialize a new `Progress` indicator.
|
||||
*/
|
||||
|
||||
function Progress() {
|
||||
this.percent = 0;
|
||||
this.size(0);
|
||||
this.fontSize(11);
|
||||
this.font('helvetica, arial, sans-serif');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set progress size to `n`.
|
||||
*
|
||||
* @param {Number} n
|
||||
* @return {Progress} for chaining
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Progress.prototype.size = function(n){
|
||||
this._size = n;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Set text to `str`.
|
||||
*
|
||||
* @param {String} str
|
||||
* @return {Progress} for chaining
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Progress.prototype.text = function(str){
|
||||
this._text = str;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Set font size to `n`.
|
||||
*
|
||||
* @param {Number} n
|
||||
* @return {Progress} for chaining
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Progress.prototype.fontSize = function(n){
|
||||
this._fontSize = n;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Set font `family`.
|
||||
*
|
||||
* @param {String} family
|
||||
* @return {Progress} for chaining
|
||||
*/
|
||||
|
||||
Progress.prototype.font = function(family){
|
||||
this._font = family;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Update percentage to `n`.
|
||||
*
|
||||
* @param {Number} n
|
||||
* @return {Progress} for chaining
|
||||
*/
|
||||
|
||||
Progress.prototype.update = function(n){
|
||||
this.percent = n;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Draw on `ctx`.
|
||||
*
|
||||
* @param {CanvasRenderingContext2d} ctx
|
||||
* @return {Progress} for chaining
|
||||
*/
|
||||
|
||||
Progress.prototype.draw = function(ctx){
|
||||
try {
|
||||
var percent = Math.min(this.percent, 100)
|
||||
, size = this._size
|
||||
, half = size / 2
|
||||
, x = half
|
||||
, y = half
|
||||
, rad = half - 1
|
||||
, fontSize = this._fontSize;
|
||||
|
||||
ctx.font = fontSize + 'px ' + this._font;
|
||||
|
||||
var angle = Math.PI * 2 * (percent / 100);
|
||||
ctx.clearRect(0, 0, size, size);
|
||||
|
||||
// outer circle
|
||||
ctx.strokeStyle = '#9f9f9f';
|
||||
ctx.beginPath();
|
||||
ctx.arc(x, y, rad, 0, angle, false);
|
||||
ctx.stroke();
|
||||
|
||||
// inner circle
|
||||
ctx.strokeStyle = '#eee';
|
||||
ctx.beginPath();
|
||||
ctx.arc(x, y, rad - 1, 0, angle, true);
|
||||
ctx.stroke();
|
||||
|
||||
// text
|
||||
var text = this._text || (percent | 0) + '%'
|
||||
, w = ctx.measureText(text).width;
|
||||
|
||||
ctx.fillText(
|
||||
text
|
||||
, x - w / 2 + 1
|
||||
, y + fontSize / 2 - 1);
|
||||
} catch (ex) {} //don't fail if we can't render progress
|
||||
return this;
|
||||
};
|
12
node_modules/mocha/lib/browser/tty.js
generated
vendored
Normal file
12
node_modules/mocha/lib/browser/tty.js
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
exports.isatty = function(){
|
||||
return true;
|
||||
};
|
||||
|
||||
exports.getWindowSize = function(){
|
||||
if ('innerHeight' in global) {
|
||||
return [global.innerHeight, global.innerWidth];
|
||||
} else {
|
||||
// In a Web Worker, the DOM Window is not available.
|
||||
return [640, 480];
|
||||
}
|
||||
};
|
95
node_modules/mocha/lib/context.js
generated
vendored
Normal file
95
node_modules/mocha/lib/context.js
generated
vendored
Normal file
@ -0,0 +1,95 @@
|
||||
/**
|
||||
* Expose `Context`.
|
||||
*/
|
||||
|
||||
module.exports = Context;
|
||||
|
||||
/**
|
||||
* Initialize a new `Context`.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function Context(){}
|
||||
|
||||
/**
|
||||
* Set or get the context `Runnable` to `runnable`.
|
||||
*
|
||||
* @param {Runnable} runnable
|
||||
* @return {Context}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Context.prototype.runnable = function(runnable){
|
||||
if (0 == arguments.length) return this._runnable;
|
||||
this.test = this._runnable = runnable;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Set test timeout `ms`.
|
||||
*
|
||||
* @param {Number} ms
|
||||
* @return {Context} self
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Context.prototype.timeout = function(ms){
|
||||
if (arguments.length === 0) return this.runnable().timeout();
|
||||
this.runnable().timeout(ms);
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Set test timeout `enabled`.
|
||||
*
|
||||
* @param {Boolean} enabled
|
||||
* @return {Context} self
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Context.prototype.enableTimeouts = function (enabled) {
|
||||
this.runnable().enableTimeouts(enabled);
|
||||
return this;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Set test slowness threshold `ms`.
|
||||
*
|
||||
* @param {Number} ms
|
||||
* @return {Context} self
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Context.prototype.slow = function(ms){
|
||||
this.runnable().slow(ms);
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Mark a test as skipped.
|
||||
*
|
||||
* @return {Context} self
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Context.prototype.skip = function(){
|
||||
this.runnable().skip();
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Inspect the context void of `._runnable`.
|
||||
*
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Context.prototype.inspect = function(){
|
||||
return JSON.stringify(this, function(key, val){
|
||||
if ('_runnable' == key) return;
|
||||
if ('test' == key) return;
|
||||
return val;
|
||||
}, 2);
|
||||
};
|
48
node_modules/mocha/lib/hook.js
generated
vendored
Normal file
48
node_modules/mocha/lib/hook.js
generated
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var Runnable = require('./runnable');
|
||||
|
||||
/**
|
||||
* Expose `Hook`.
|
||||
*/
|
||||
|
||||
module.exports = Hook;
|
||||
|
||||
/**
|
||||
* Initialize a new `Hook` with the given `title` and callback `fn`.
|
||||
*
|
||||
* @param {String} title
|
||||
* @param {Function} fn
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function Hook(title, fn) {
|
||||
Runnable.call(this, title, fn);
|
||||
this.type = 'hook';
|
||||
}
|
||||
|
||||
/**
|
||||
* Inherit from `Runnable.prototype`.
|
||||
*/
|
||||
|
||||
Hook.prototype.__proto__ = Runnable.prototype;
|
||||
|
||||
/**
|
||||
* Get or set the test `err`.
|
||||
*
|
||||
* @param {Error} err
|
||||
* @return {Error}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Hook.prototype.error = function(err){
|
||||
if (0 == arguments.length) {
|
||||
var err = this._error;
|
||||
this._error = null;
|
||||
return err;
|
||||
}
|
||||
|
||||
this._error = err;
|
||||
};
|
115
node_modules/mocha/lib/interfaces/bdd.js
generated
vendored
Normal file
115
node_modules/mocha/lib/interfaces/bdd.js
generated
vendored
Normal file
@ -0,0 +1,115 @@
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var Suite = require('../suite')
|
||||
, Test = require('../test')
|
||||
, utils = require('../utils')
|
||||
, escapeRe = require('escape-string-regexp');
|
||||
|
||||
/**
|
||||
* BDD-style interface:
|
||||
*
|
||||
* describe('Array', function(){
|
||||
* describe('#indexOf()', function(){
|
||||
* it('should return -1 when not present', function(){
|
||||
*
|
||||
* });
|
||||
*
|
||||
* it('should return the index when present', function(){
|
||||
*
|
||||
* });
|
||||
* });
|
||||
* });
|
||||
*
|
||||
*/
|
||||
|
||||
module.exports = function(suite){
|
||||
var suites = [suite];
|
||||
|
||||
suite.on('pre-require', function(context, file, mocha){
|
||||
|
||||
var common = require('./common')(suites, context);
|
||||
|
||||
context.before = common.before;
|
||||
context.after = common.after;
|
||||
context.beforeEach = common.beforeEach;
|
||||
context.afterEach = common.afterEach;
|
||||
context.run = mocha.options.delay && common.runWithSuite(suite);
|
||||
/**
|
||||
* Describe a "suite" with the given `title`
|
||||
* and callback `fn` containing nested suites
|
||||
* and/or tests.
|
||||
*/
|
||||
|
||||
context.describe = context.context = function(title, fn){
|
||||
var suite = Suite.create(suites[0], title);
|
||||
suite.file = file;
|
||||
suites.unshift(suite);
|
||||
fn.call(suite);
|
||||
suites.shift();
|
||||
return suite;
|
||||
};
|
||||
|
||||
/**
|
||||
* Pending describe.
|
||||
*/
|
||||
|
||||
context.xdescribe =
|
||||
context.xcontext =
|
||||
context.describe.skip = function(title, fn){
|
||||
var suite = Suite.create(suites[0], title);
|
||||
suite.pending = true;
|
||||
suites.unshift(suite);
|
||||
fn.call(suite);
|
||||
suites.shift();
|
||||
};
|
||||
|
||||
/**
|
||||
* Exclusive suite.
|
||||
*/
|
||||
|
||||
context.describe.only = function(title, fn){
|
||||
var suite = context.describe(title, fn);
|
||||
mocha.grep(suite.fullTitle());
|
||||
return suite;
|
||||
};
|
||||
|
||||
/**
|
||||
* Describe a specification or test-case
|
||||
* with the given `title` and callback `fn`
|
||||
* acting as a thunk.
|
||||
*/
|
||||
|
||||
context.it = context.specify = function(title, fn){
|
||||
var suite = suites[0];
|
||||
if (suite.pending) fn = null;
|
||||
var test = new Test(title, fn);
|
||||
test.file = file;
|
||||
suite.addTest(test);
|
||||
return test;
|
||||
};
|
||||
|
||||
/**
|
||||
* Exclusive test-case.
|
||||
*/
|
||||
|
||||
context.it.only = function(title, fn){
|
||||
var test = context.it(title, fn);
|
||||
var reString = '^' + escapeRe(test.fullTitle()) + '$';
|
||||
mocha.grep(new RegExp(reString));
|
||||
return test;
|
||||
};
|
||||
|
||||
/**
|
||||
* Pending test case.
|
||||
*/
|
||||
|
||||
context.xit =
|
||||
context.xspecify =
|
||||
context.it.skip = function(title){
|
||||
context.it(title);
|
||||
};
|
||||
|
||||
});
|
||||
};
|
58
node_modules/mocha/lib/interfaces/common.js
generated
vendored
Normal file
58
node_modules/mocha/lib/interfaces/common.js
generated
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
/**
|
||||
* Functions common to more than one interface
|
||||
* @module lib/interfaces/common
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
module.exports = function (suites, context) {
|
||||
|
||||
return {
|
||||
/**
|
||||
* This is only present if flag --delay is passed into Mocha. It triggers
|
||||
* root suite execution. Returns a function which runs the root suite.
|
||||
*/
|
||||
runWithSuite: function runWithSuite(suite) {
|
||||
return function run() {
|
||||
suite.run();
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* Execute before running tests.
|
||||
*/
|
||||
before: function (name, fn) {
|
||||
suites[0].beforeAll(name, fn);
|
||||
},
|
||||
|
||||
/**
|
||||
* Execute after running tests.
|
||||
*/
|
||||
after: function (name, fn) {
|
||||
suites[0].afterAll(name, fn);
|
||||
},
|
||||
|
||||
/**
|
||||
* Execute before each test case.
|
||||
*/
|
||||
beforeEach: function (name, fn) {
|
||||
suites[0].beforeEach(name, fn);
|
||||
},
|
||||
|
||||
/**
|
||||
* Execute after each test case.
|
||||
*/
|
||||
afterEach: function (name, fn) {
|
||||
suites[0].afterEach(name, fn);
|
||||
},
|
||||
|
||||
test: {
|
||||
/**
|
||||
* Pending test case.
|
||||
*/
|
||||
skip: function (title) {
|
||||
context.test(title);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
61
node_modules/mocha/lib/interfaces/exports.js
generated
vendored
Normal file
61
node_modules/mocha/lib/interfaces/exports.js
generated
vendored
Normal file
@ -0,0 +1,61 @@
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var Suite = require('../suite')
|
||||
, Test = require('../test');
|
||||
|
||||
/**
|
||||
* TDD-style interface:
|
||||
*
|
||||
* exports.Array = {
|
||||
* '#indexOf()': {
|
||||
* 'should return -1 when the value is not present': function(){
|
||||
*
|
||||
* },
|
||||
*
|
||||
* 'should return the correct index when the value is present': function(){
|
||||
*
|
||||
* }
|
||||
* }
|
||||
* };
|
||||
*
|
||||
*/
|
||||
|
||||
module.exports = function(suite){
|
||||
var suites = [suite];
|
||||
|
||||
suite.on('require', visit);
|
||||
|
||||
function visit(obj, file) {
|
||||
var suite;
|
||||
for (var key in obj) {
|
||||
if ('function' == typeof obj[key]) {
|
||||
var fn = obj[key];
|
||||
switch (key) {
|
||||
case 'before':
|
||||
suites[0].beforeAll(fn);
|
||||
break;
|
||||
case 'after':
|
||||
suites[0].afterAll(fn);
|
||||
break;
|
||||
case 'beforeEach':
|
||||
suites[0].beforeEach(fn);
|
||||
break;
|
||||
case 'afterEach':
|
||||
suites[0].afterEach(fn);
|
||||
break;
|
||||
default:
|
||||
var test = new Test(key, fn);
|
||||
test.file = file;
|
||||
suites[0].addTest(test);
|
||||
}
|
||||
} else {
|
||||
suite = Suite.create(suites[0], key);
|
||||
suites.unshift(suite);
|
||||
visit(obj[key]);
|
||||
suites.shift();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
4
node_modules/mocha/lib/interfaces/index.js
generated
vendored
Normal file
4
node_modules/mocha/lib/interfaces/index.js
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
exports.bdd = require('./bdd');
|
||||
exports.tdd = require('./tdd');
|
||||
exports.qunit = require('./qunit');
|
||||
exports.exports = require('./exports');
|
94
node_modules/mocha/lib/interfaces/qunit.js
generated
vendored
Normal file
94
node_modules/mocha/lib/interfaces/qunit.js
generated
vendored
Normal file
@ -0,0 +1,94 @@
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var Suite = require('../suite')
|
||||
, Test = require('../test')
|
||||
, escapeRe = require('escape-string-regexp')
|
||||
, utils = require('../utils');
|
||||
|
||||
/**
|
||||
* QUnit-style interface:
|
||||
*
|
||||
* suite('Array');
|
||||
*
|
||||
* test('#length', function(){
|
||||
* var arr = [1,2,3];
|
||||
* ok(arr.length == 3);
|
||||
* });
|
||||
*
|
||||
* test('#indexOf()', function(){
|
||||
* var arr = [1,2,3];
|
||||
* ok(arr.indexOf(1) == 0);
|
||||
* ok(arr.indexOf(2) == 1);
|
||||
* ok(arr.indexOf(3) == 2);
|
||||
* });
|
||||
*
|
||||
* suite('String');
|
||||
*
|
||||
* test('#length', function(){
|
||||
* ok('foo'.length == 3);
|
||||
* });
|
||||
*
|
||||
*/
|
||||
|
||||
module.exports = function(suite){
|
||||
var suites = [suite];
|
||||
|
||||
suite.on('pre-require', function(context, file, mocha){
|
||||
|
||||
var common = require('./common')(suites, context);
|
||||
|
||||
context.before = common.before;
|
||||
context.after = common.after;
|
||||
context.beforeEach = common.beforeEach;
|
||||
context.afterEach = common.afterEach;
|
||||
context.run = mocha.options.delay && common.runWithSuite(suite);
|
||||
/**
|
||||
* Describe a "suite" with the given `title`.
|
||||
*/
|
||||
|
||||
context.suite = function(title){
|
||||
if (suites.length > 1) suites.shift();
|
||||
var suite = Suite.create(suites[0], title);
|
||||
suite.file = file;
|
||||
suites.unshift(suite);
|
||||
return suite;
|
||||
};
|
||||
|
||||
/**
|
||||
* Exclusive test-case.
|
||||
*/
|
||||
|
||||
context.suite.only = function(title, fn){
|
||||
var suite = context.suite(title, fn);
|
||||
mocha.grep(suite.fullTitle());
|
||||
};
|
||||
|
||||
/**
|
||||
* Describe a specification or test-case
|
||||
* with the given `title` and callback `fn`
|
||||
* acting as a thunk.
|
||||
*/
|
||||
|
||||
context.test = function(title, fn){
|
||||
var test = new Test(title, fn);
|
||||
test.file = file;
|
||||
suites[0].addTest(test);
|
||||
return test;
|
||||
};
|
||||
|
||||
/**
|
||||
* Exclusive test-case.
|
||||
*/
|
||||
|
||||
context.test.only = function(title, fn){
|
||||
var test = context.test(title, fn);
|
||||
var reString = '^' + escapeRe(test.fullTitle()) + '$';
|
||||
mocha.grep(new RegExp(reString));
|
||||
};
|
||||
|
||||
context.test.skip = common.test.skip;
|
||||
|
||||
});
|
||||
};
|
109
node_modules/mocha/lib/interfaces/tdd.js
generated
vendored
Normal file
109
node_modules/mocha/lib/interfaces/tdd.js
generated
vendored
Normal file
@ -0,0 +1,109 @@
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var Suite = require('../suite')
|
||||
, Test = require('../test')
|
||||
, escapeRe = require('escape-string-regexp')
|
||||
, utils = require('../utils');
|
||||
|
||||
/**
|
||||
* TDD-style interface:
|
||||
*
|
||||
* suite('Array', function(){
|
||||
* suite('#indexOf()', function(){
|
||||
* suiteSetup(function(){
|
||||
*
|
||||
* });
|
||||
*
|
||||
* test('should return -1 when not present', function(){
|
||||
*
|
||||
* });
|
||||
*
|
||||
* test('should return the index when present', function(){
|
||||
*
|
||||
* });
|
||||
*
|
||||
* suiteTeardown(function(){
|
||||
*
|
||||
* });
|
||||
* });
|
||||
* });
|
||||
*
|
||||
*/
|
||||
|
||||
module.exports = function(suite){
|
||||
var suites = [suite];
|
||||
|
||||
suite.on('pre-require', function(context, file, mocha){
|
||||
|
||||
var common = require('./common')(suites, context);
|
||||
|
||||
context.setup = common.beforeEach;
|
||||
context.teardown = common.afterEach;
|
||||
context.suiteSetup = common.before;
|
||||
context.suiteTeardown = common.after;
|
||||
context.run = mocha.options.delay && common.runWithSuite(suite);
|
||||
/**
|
||||
* Describe a "suite" with the given `title`
|
||||
* and callback `fn` containing nested suites
|
||||
* and/or tests.
|
||||
*/
|
||||
|
||||
context.suite = function(title, fn){
|
||||
var suite = Suite.create(suites[0], title);
|
||||
suite.file = file;
|
||||
suites.unshift(suite);
|
||||
fn.call(suite);
|
||||
suites.shift();
|
||||
return suite;
|
||||
};
|
||||
|
||||
/**
|
||||
* Pending suite.
|
||||
*/
|
||||
context.suite.skip = function(title, fn) {
|
||||
var suite = Suite.create(suites[0], title);
|
||||
suite.pending = true;
|
||||
suites.unshift(suite);
|
||||
fn.call(suite);
|
||||
suites.shift();
|
||||
};
|
||||
|
||||
/**
|
||||
* Exclusive test-case.
|
||||
*/
|
||||
|
||||
context.suite.only = function(title, fn){
|
||||
var suite = context.suite(title, fn);
|
||||
mocha.grep(suite.fullTitle());
|
||||
};
|
||||
|
||||
/**
|
||||
* Describe a specification or test-case
|
||||
* with the given `title` and callback `fn`
|
||||
* acting as a thunk.
|
||||
*/
|
||||
|
||||
context.test = function(title, fn){
|
||||
var suite = suites[0];
|
||||
if (suite.pending) fn = null;
|
||||
var test = new Test(title, fn);
|
||||
test.file = file;
|
||||
suite.addTest(test);
|
||||
return test;
|
||||
};
|
||||
|
||||
/**
|
||||
* Exclusive test-case.
|
||||
*/
|
||||
|
||||
context.test.only = function(title, fn){
|
||||
var test = context.test(title, fn);
|
||||
var reString = '^' + escapeRe(test.fullTitle()) + '$';
|
||||
mocha.grep(new RegExp(reString));
|
||||
};
|
||||
|
||||
context.test.skip = common.test.skip;
|
||||
});
|
||||
};
|
446
node_modules/mocha/lib/mocha.js
generated
vendored
Normal file
446
node_modules/mocha/lib/mocha.js
generated
vendored
Normal file
@ -0,0 +1,446 @@
|
||||
/*!
|
||||
* mocha
|
||||
* Copyright(c) 2011 TJ Holowaychuk <tj@vision-media.ca>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var path = require('path')
|
||||
, escapeRe = require('escape-string-regexp')
|
||||
, utils = require('./utils');
|
||||
|
||||
/**
|
||||
* Expose `Mocha`.
|
||||
*/
|
||||
|
||||
exports = module.exports = Mocha;
|
||||
|
||||
/**
|
||||
* To require local UIs and reporters when running in node.
|
||||
*/
|
||||
|
||||
if (typeof process !== 'undefined' && typeof process.cwd === 'function') {
|
||||
var join = path.join
|
||||
, cwd = process.cwd();
|
||||
module.paths.push(cwd, join(cwd, 'node_modules'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Expose internals.
|
||||
*/
|
||||
|
||||
exports.utils = utils;
|
||||
exports.interfaces = require('./interfaces');
|
||||
exports.reporters = require('./reporters');
|
||||
exports.Runnable = require('./runnable');
|
||||
exports.Context = require('./context');
|
||||
exports.Runner = require('./runner');
|
||||
exports.Suite = require('./suite');
|
||||
exports.Hook = require('./hook');
|
||||
exports.Test = require('./test');
|
||||
|
||||
/**
|
||||
* Return image `name` path.
|
||||
*
|
||||
* @param {String} name
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function image(name) {
|
||||
return __dirname + '/../images/' + name + '.png';
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup mocha with `options`.
|
||||
*
|
||||
* Options:
|
||||
*
|
||||
* - `ui` name "bdd", "tdd", "exports" etc
|
||||
* - `reporter` reporter instance, defaults to `mocha.reporters.spec`
|
||||
* - `globals` array of accepted globals
|
||||
* - `timeout` timeout in milliseconds
|
||||
* - `bail` bail on the first test failure
|
||||
* - `slow` milliseconds to wait before considering a test slow
|
||||
* - `ignoreLeaks` ignore global leaks
|
||||
* - `fullTrace` display the full stack-trace on failing
|
||||
* - `grep` string or regexp to filter tests with
|
||||
*
|
||||
* @param {Object} options
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function Mocha(options) {
|
||||
options = options || {};
|
||||
this.files = [];
|
||||
this.options = options;
|
||||
if (options.grep) this.grep(new RegExp(options.grep));
|
||||
if (options.fgrep) this.grep(options.fgrep);
|
||||
this.suite = new exports.Suite('', new exports.Context);
|
||||
this.ui(options.ui);
|
||||
this.bail(options.bail);
|
||||
this.reporter(options.reporter, options.reporterOptions);
|
||||
if (null != options.timeout) this.timeout(options.timeout);
|
||||
this.useColors(options.useColors);
|
||||
if (options.enableTimeouts !== null) this.enableTimeouts(options.enableTimeouts);
|
||||
if (options.slow) this.slow(options.slow);
|
||||
|
||||
this.suite.on('pre-require', function (context) {
|
||||
exports.afterEach = context.afterEach || context.teardown;
|
||||
exports.after = context.after || context.suiteTeardown;
|
||||
exports.beforeEach = context.beforeEach || context.setup;
|
||||
exports.before = context.before || context.suiteSetup;
|
||||
exports.describe = context.describe || context.suite;
|
||||
exports.it = context.it || context.test;
|
||||
exports.setup = context.setup || context.beforeEach;
|
||||
exports.suiteSetup = context.suiteSetup || context.before;
|
||||
exports.suiteTeardown = context.suiteTeardown || context.after;
|
||||
exports.suite = context.suite || context.describe;
|
||||
exports.teardown = context.teardown || context.afterEach;
|
||||
exports.test = context.test || context.it;
|
||||
exports.run = context.run;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable or disable bailing on the first failure.
|
||||
*
|
||||
* @param {Boolean} [bail]
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Mocha.prototype.bail = function(bail){
|
||||
if (0 == arguments.length) bail = true;
|
||||
this.suite.bail(bail);
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Add test `file`.
|
||||
*
|
||||
* @param {String} file
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Mocha.prototype.addFile = function(file){
|
||||
this.files.push(file);
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Set reporter to `reporter`, defaults to "spec".
|
||||
*
|
||||
* @param {String|Function} reporter name or constructor
|
||||
* @param {Object} reporterOptions optional options
|
||||
* @api public
|
||||
*/
|
||||
Mocha.prototype.reporter = function(reporter, reporterOptions){
|
||||
if ('function' == typeof reporter) {
|
||||
this._reporter = reporter;
|
||||
} else {
|
||||
reporter = reporter || 'spec';
|
||||
var _reporter;
|
||||
try { _reporter = require('./reporters/' + reporter); } catch (err) {}
|
||||
if (!_reporter) try { _reporter = require(reporter); } catch (err) {
|
||||
err.message.indexOf('Cannot find module') !== -1
|
||||
? console.warn('"' + reporter + '" reporter not found')
|
||||
: console.warn('"' + reporter + '" reporter blew up with error:\n' + err.stack);
|
||||
}
|
||||
if (!_reporter && reporter === 'teamcity')
|
||||
console.warn('The Teamcity reporter was moved to a package named ' +
|
||||
'mocha-teamcity-reporter ' +
|
||||
'(https://npmjs.org/package/mocha-teamcity-reporter).');
|
||||
if (!_reporter) throw new Error('invalid reporter "' + reporter + '"');
|
||||
this._reporter = _reporter;
|
||||
}
|
||||
this.options.reporterOptions = reporterOptions;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Set test UI `name`, defaults to "bdd".
|
||||
*
|
||||
* @param {String} bdd
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Mocha.prototype.ui = function(name){
|
||||
name = name || 'bdd';
|
||||
this._ui = exports.interfaces[name];
|
||||
if (!this._ui) try { this._ui = require(name); } catch (err) {}
|
||||
if (!this._ui) throw new Error('invalid interface "' + name + '"');
|
||||
this._ui = this._ui(this.suite);
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Load registered files.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Mocha.prototype.loadFiles = function(fn){
|
||||
var self = this;
|
||||
var suite = this.suite;
|
||||
var pending = this.files.length;
|
||||
this.files.forEach(function(file){
|
||||
file = path.resolve(file);
|
||||
suite.emit('pre-require', global, file, self);
|
||||
suite.emit('require', require(file), file, self);
|
||||
suite.emit('post-require', global, file, self);
|
||||
--pending || (fn && fn());
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Enable growl support.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Mocha.prototype._growl = function(runner, reporter) {
|
||||
var notify = require('growl');
|
||||
|
||||
runner.on('end', function(){
|
||||
var stats = reporter.stats;
|
||||
if (stats.failures) {
|
||||
var msg = stats.failures + ' of ' + runner.total + ' tests failed';
|
||||
notify(msg, { name: 'mocha', title: 'Failed', image: image('error') });
|
||||
} else {
|
||||
notify(stats.passes + ' tests passed in ' + stats.duration + 'ms', {
|
||||
name: 'mocha'
|
||||
, title: 'Passed'
|
||||
, image: image('ok')
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Add regexp to grep, if `re` is a string it is escaped.
|
||||
*
|
||||
* @param {RegExp|String} re
|
||||
* @return {Mocha}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Mocha.prototype.grep = function(re){
|
||||
this.options.grep = 'string' == typeof re
|
||||
? new RegExp(escapeRe(re))
|
||||
: re;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Invert `.grep()` matches.
|
||||
*
|
||||
* @return {Mocha}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Mocha.prototype.invert = function(){
|
||||
this.options.invert = true;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Ignore global leaks.
|
||||
*
|
||||
* @param {Boolean} ignore
|
||||
* @return {Mocha}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Mocha.prototype.ignoreLeaks = function(ignore){
|
||||
this.options.ignoreLeaks = !!ignore;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Enable global leak checking.
|
||||
*
|
||||
* @return {Mocha}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Mocha.prototype.checkLeaks = function(){
|
||||
this.options.ignoreLeaks = false;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Display long stack-trace on failing
|
||||
*
|
||||
* @return {Mocha}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Mocha.prototype.fullTrace = function() {
|
||||
this.options.fullStackTrace = true;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Enable growl support.
|
||||
*
|
||||
* @return {Mocha}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Mocha.prototype.growl = function(){
|
||||
this.options.growl = true;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Ignore `globals` array or string.
|
||||
*
|
||||
* @param {Array|String} globals
|
||||
* @return {Mocha}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Mocha.prototype.globals = function(globals){
|
||||
this.options.globals = (this.options.globals || []).concat(globals);
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Emit color output.
|
||||
*
|
||||
* @param {Boolean} colors
|
||||
* @return {Mocha}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Mocha.prototype.useColors = function(colors){
|
||||
if (colors !== undefined) {
|
||||
this.options.useColors = colors;
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Use inline diffs rather than +/-.
|
||||
*
|
||||
* @param {Boolean} inlineDiffs
|
||||
* @return {Mocha}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Mocha.prototype.useInlineDiffs = function(inlineDiffs) {
|
||||
this.options.useInlineDiffs = arguments.length && inlineDiffs != undefined
|
||||
? inlineDiffs
|
||||
: false;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Set the timeout in milliseconds.
|
||||
*
|
||||
* @param {Number} timeout
|
||||
* @return {Mocha}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Mocha.prototype.timeout = function(timeout){
|
||||
this.suite.timeout(timeout);
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Set slowness threshold in milliseconds.
|
||||
*
|
||||
* @param {Number} slow
|
||||
* @return {Mocha}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Mocha.prototype.slow = function(slow){
|
||||
this.suite.slow(slow);
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Enable timeouts.
|
||||
*
|
||||
* @param {Boolean} enabled
|
||||
* @return {Mocha}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Mocha.prototype.enableTimeouts = function(enabled) {
|
||||
this.suite.enableTimeouts(arguments.length && enabled !== undefined
|
||||
? enabled
|
||||
: true);
|
||||
return this
|
||||
};
|
||||
|
||||
/**
|
||||
* Makes all tests async (accepting a callback)
|
||||
*
|
||||
* @return {Mocha}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Mocha.prototype.asyncOnly = function(){
|
||||
this.options.asyncOnly = true;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Disable syntax highlighting (in browser).
|
||||
* @returns {Mocha}
|
||||
* @api public
|
||||
*/
|
||||
Mocha.prototype.noHighlighting = function() {
|
||||
this.options.noHighlighting = true;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Delay root suite execution.
|
||||
* @returns {Mocha}
|
||||
* @api public
|
||||
*/
|
||||
Mocha.prototype.delay = function delay() {
|
||||
this.options.delay = true;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Run tests and invoke `fn()` when complete.
|
||||
*
|
||||
* @param {Function} fn
|
||||
* @return {Runner}
|
||||
* @api public
|
||||
*/
|
||||
Mocha.prototype.run = function(fn){
|
||||
if (this.files.length) this.loadFiles();
|
||||
var suite = this.suite;
|
||||
var options = this.options;
|
||||
options.files = this.files;
|
||||
var runner = new exports.Runner(suite, options.delay);
|
||||
var reporter = new this._reporter(runner, options);
|
||||
runner.ignoreLeaks = false !== options.ignoreLeaks;
|
||||
runner.fullStackTrace = options.fullStackTrace;
|
||||
runner.asyncOnly = options.asyncOnly;
|
||||
if (options.grep) runner.grep(options.grep, options.invert);
|
||||
if (options.globals) runner.globals(options.globals);
|
||||
if (options.growl) this._growl(runner, reporter);
|
||||
if (options.useColors !== undefined) {
|
||||
exports.reporters.Base.useColors = options.useColors;
|
||||
}
|
||||
exports.reporters.Base.inlineDiffs = options.useInlineDiffs;
|
||||
|
||||
function done(failures) {
|
||||
if (reporter.done) {
|
||||
reporter.done(failures, fn);
|
||||
} else fn && fn(failures);
|
||||
}
|
||||
|
||||
return runner.run(done);
|
||||
};
|
109
node_modules/mocha/lib/ms.js
generated
vendored
Normal file
109
node_modules/mocha/lib/ms.js
generated
vendored
Normal file
@ -0,0 +1,109 @@
|
||||
/**
|
||||
* Helpers.
|
||||
*/
|
||||
|
||||
var s = 1000;
|
||||
var m = s * 60;
|
||||
var h = m * 60;
|
||||
var d = h * 24;
|
||||
var y = d * 365.25;
|
||||
|
||||
/**
|
||||
* Parse or format the given `val`.
|
||||
*
|
||||
* Options:
|
||||
*
|
||||
* - `long` verbose formatting [false]
|
||||
*
|
||||
* @param {String|Number} val
|
||||
* @param {Object} options
|
||||
* @return {String|Number}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
module.exports = function(val, options){
|
||||
options = options || {};
|
||||
if ('string' == typeof val) return parse(val);
|
||||
return options['long'] ? longFormat(val) : shortFormat(val);
|
||||
};
|
||||
|
||||
/**
|
||||
* Parse the given `str` and return milliseconds.
|
||||
*
|
||||
* @param {String} str
|
||||
* @return {Number}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function parse(str) {
|
||||
var match = /^((?:\d+)?\.?\d+) *(ms|seconds?|s|minutes?|m|hours?|h|days?|d|years?|y)?$/i.exec(str);
|
||||
if (!match) return;
|
||||
var n = parseFloat(match[1]);
|
||||
var type = (match[2] || 'ms').toLowerCase();
|
||||
switch (type) {
|
||||
case 'years':
|
||||
case 'year':
|
||||
case 'y':
|
||||
return n * y;
|
||||
case 'days':
|
||||
case 'day':
|
||||
case 'd':
|
||||
return n * d;
|
||||
case 'hours':
|
||||
case 'hour':
|
||||
case 'h':
|
||||
return n * h;
|
||||
case 'minutes':
|
||||
case 'minute':
|
||||
case 'm':
|
||||
return n * m;
|
||||
case 'seconds':
|
||||
case 'second':
|
||||
case 's':
|
||||
return n * s;
|
||||
case 'ms':
|
||||
return n;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Short format for `ms`.
|
||||
*
|
||||
* @param {Number} ms
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function shortFormat(ms) {
|
||||
if (ms >= d) return Math.round(ms / d) + 'd';
|
||||
if (ms >= h) return Math.round(ms / h) + 'h';
|
||||
if (ms >= m) return Math.round(ms / m) + 'm';
|
||||
if (ms >= s) return Math.round(ms / s) + 's';
|
||||
return ms + 'ms';
|
||||
}
|
||||
|
||||
/**
|
||||
* Long format for `ms`.
|
||||
*
|
||||
* @param {Number} ms
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function longFormat(ms) {
|
||||
return plural(ms, d, 'day')
|
||||
|| plural(ms, h, 'hour')
|
||||
|| plural(ms, m, 'minute')
|
||||
|| plural(ms, s, 'second')
|
||||
|| ms + ' ms';
|
||||
}
|
||||
|
||||
/**
|
||||
* Pluralization helper.
|
||||
*/
|
||||
|
||||
function plural(ms, n, name) {
|
||||
if (ms < n) return;
|
||||
if (ms < n * 1.5) return Math.floor(ms / n) + ' ' + name;
|
||||
return Math.ceil(ms / n) + ' ' + name + 's';
|
||||
}
|
16
node_modules/mocha/lib/pending.js
generated
vendored
Normal file
16
node_modules/mocha/lib/pending.js
generated
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
|
||||
/**
|
||||
* Expose `Pending`.
|
||||
*/
|
||||
|
||||
module.exports = Pending;
|
||||
|
||||
/**
|
||||
* Initialize a new `Pending` error with the given message.
|
||||
*
|
||||
* @param {String} message
|
||||
*/
|
||||
|
||||
function Pending(message) {
|
||||
this.message = message;
|
||||
}
|
464
node_modules/mocha/lib/reporters/base.js
generated
vendored
Normal file
464
node_modules/mocha/lib/reporters/base.js
generated
vendored
Normal file
@ -0,0 +1,464 @@
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var tty = require('tty')
|
||||
, diff = require('diff')
|
||||
, ms = require('../ms')
|
||||
, utils = require('../utils')
|
||||
, supportsColor = process.env ? require('supports-color') : null;
|
||||
|
||||
/**
|
||||
* Save timer references to avoid Sinon interfering (see GH-237).
|
||||
*/
|
||||
|
||||
var Date = global.Date
|
||||
, setTimeout = global.setTimeout
|
||||
, setInterval = global.setInterval
|
||||
, clearTimeout = global.clearTimeout
|
||||
, clearInterval = global.clearInterval;
|
||||
|
||||
/**
|
||||
* Check if both stdio streams are associated with a tty.
|
||||
*/
|
||||
|
||||
var isatty = tty.isatty(1) && tty.isatty(2);
|
||||
|
||||
/**
|
||||
* Expose `Base`.
|
||||
*/
|
||||
|
||||
exports = module.exports = Base;
|
||||
|
||||
/**
|
||||
* Enable coloring by default, except in the browser interface.
|
||||
*/
|
||||
|
||||
exports.useColors = process.env
|
||||
? (supportsColor || (process.env.MOCHA_COLORS !== undefined))
|
||||
: false;
|
||||
|
||||
/**
|
||||
* Inline diffs instead of +/-
|
||||
*/
|
||||
|
||||
exports.inlineDiffs = false;
|
||||
|
||||
/**
|
||||
* Default color map.
|
||||
*/
|
||||
|
||||
exports.colors = {
|
||||
'pass': 90
|
||||
, 'fail': 31
|
||||
, 'bright pass': 92
|
||||
, 'bright fail': 91
|
||||
, 'bright yellow': 93
|
||||
, 'pending': 36
|
||||
, 'suite': 0
|
||||
, 'error title': 0
|
||||
, 'error message': 31
|
||||
, 'error stack': 90
|
||||
, 'checkmark': 32
|
||||
, 'fast': 90
|
||||
, 'medium': 33
|
||||
, 'slow': 31
|
||||
, 'green': 32
|
||||
, 'light': 90
|
||||
, 'diff gutter': 90
|
||||
, 'diff added': 42
|
||||
, 'diff removed': 41
|
||||
};
|
||||
|
||||
/**
|
||||
* Default symbol map.
|
||||
*/
|
||||
|
||||
exports.symbols = {
|
||||
ok: '✓',
|
||||
err: '✖',
|
||||
dot: '․'
|
||||
};
|
||||
|
||||
// With node.js on Windows: use symbols available in terminal default fonts
|
||||
if ('win32' == process.platform) {
|
||||
exports.symbols.ok = '\u221A';
|
||||
exports.symbols.err = '\u00D7';
|
||||
exports.symbols.dot = '.';
|
||||
}
|
||||
|
||||
/**
|
||||
* Color `str` with the given `type`,
|
||||
* allowing colors to be disabled,
|
||||
* as well as user-defined color
|
||||
* schemes.
|
||||
*
|
||||
* @param {String} type
|
||||
* @param {String} str
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
var color = exports.color = function(type, str) {
|
||||
if (!exports.useColors) return String(str);
|
||||
return '\u001b[' + exports.colors[type] + 'm' + str + '\u001b[0m';
|
||||
};
|
||||
|
||||
/**
|
||||
* Expose term window size, with some
|
||||
* defaults for when stderr is not a tty.
|
||||
*/
|
||||
|
||||
exports.window = {
|
||||
width: isatty
|
||||
? process.stdout.getWindowSize
|
||||
? process.stdout.getWindowSize(1)[0]
|
||||
: tty.getWindowSize()[1]
|
||||
: 75
|
||||
};
|
||||
|
||||
/**
|
||||
* Expose some basic cursor interactions
|
||||
* that are common among reporters.
|
||||
*/
|
||||
|
||||
exports.cursor = {
|
||||
hide: function(){
|
||||
isatty && process.stdout.write('\u001b[?25l');
|
||||
},
|
||||
|
||||
show: function(){
|
||||
isatty && process.stdout.write('\u001b[?25h');
|
||||
},
|
||||
|
||||
deleteLine: function(){
|
||||
isatty && process.stdout.write('\u001b[2K');
|
||||
},
|
||||
|
||||
beginningOfLine: function(){
|
||||
isatty && process.stdout.write('\u001b[0G');
|
||||
},
|
||||
|
||||
CR: function(){
|
||||
if (isatty) {
|
||||
exports.cursor.deleteLine();
|
||||
exports.cursor.beginningOfLine();
|
||||
} else {
|
||||
process.stdout.write('\r');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Outut the given `failures` as a list.
|
||||
*
|
||||
* @param {Array} failures
|
||||
* @api public
|
||||
*/
|
||||
|
||||
exports.list = function(failures){
|
||||
console.log();
|
||||
failures.forEach(function(test, i){
|
||||
// format
|
||||
var fmt = color('error title', ' %s) %s:\n')
|
||||
+ color('error message', ' %s')
|
||||
+ color('error stack', '\n%s\n');
|
||||
|
||||
// msg
|
||||
var err = test.err
|
||||
, message = err.message || ''
|
||||
, stack = err.stack || message
|
||||
, index = stack.indexOf(message)
|
||||
, actual = err.actual
|
||||
, expected = err.expected
|
||||
, escape = true;
|
||||
if (index === -1) {
|
||||
msg = message;
|
||||
} else {
|
||||
index += message.length;
|
||||
msg = stack.slice(0, index);
|
||||
// remove msg from stack
|
||||
stack = stack.slice(index + 1);
|
||||
}
|
||||
|
||||
// uncaught
|
||||
if (err.uncaught) {
|
||||
msg = 'Uncaught ' + msg;
|
||||
}
|
||||
// explicitly show diff
|
||||
if (err.showDiff !== false && sameType(actual, expected)
|
||||
&& expected !== undefined) {
|
||||
|
||||
escape = false;
|
||||
err.actual = actual = utils.stringify(actual);
|
||||
err.expected = expected = utils.stringify(expected);
|
||||
|
||||
fmt = color('error title', ' %s) %s:\n%s') + color('error stack', '\n%s\n');
|
||||
var match = message.match(/^([^:]+): expected/);
|
||||
msg = '\n ' + color('error message', match ? match[1] : msg);
|
||||
|
||||
if (exports.inlineDiffs) {
|
||||
msg += inlineDiff(err, escape);
|
||||
} else {
|
||||
msg += unifiedDiff(err, escape);
|
||||
}
|
||||
}
|
||||
|
||||
// indent stack trace
|
||||
stack = stack.replace(/^/gm, ' ');
|
||||
|
||||
console.log(fmt, (i + 1), test.fullTitle(), msg, stack);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Initialize a new `Base` reporter.
|
||||
*
|
||||
* All other reporters generally
|
||||
* inherit from this reporter, providing
|
||||
* stats such as test duration, number
|
||||
* of tests passed / failed etc.
|
||||
*
|
||||
* @param {Runner} runner
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function Base(runner) {
|
||||
var self = this
|
||||
, stats = this.stats = { suites: 0, tests: 0, passes: 0, pending: 0, failures: 0 }
|
||||
, failures = this.failures = [];
|
||||
|
||||
if (!runner) return;
|
||||
this.runner = runner;
|
||||
|
||||
runner.stats = stats;
|
||||
|
||||
runner.on('start', function(){
|
||||
stats.start = new Date;
|
||||
});
|
||||
|
||||
runner.on('suite', function(suite){
|
||||
stats.suites = stats.suites || 0;
|
||||
suite.root || stats.suites++;
|
||||
});
|
||||
|
||||
runner.on('test end', function(test){
|
||||
stats.tests = stats.tests || 0;
|
||||
stats.tests++;
|
||||
});
|
||||
|
||||
runner.on('pass', function(test){
|
||||
stats.passes = stats.passes || 0;
|
||||
|
||||
var medium = test.slow() / 2;
|
||||
test.speed = test.duration > test.slow()
|
||||
? 'slow'
|
||||
: test.duration > medium
|
||||
? 'medium'
|
||||
: 'fast';
|
||||
|
||||
stats.passes++;
|
||||
});
|
||||
|
||||
runner.on('fail', function(test, err){
|
||||
stats.failures = stats.failures || 0;
|
||||
stats.failures++;
|
||||
test.err = err;
|
||||
failures.push(test);
|
||||
});
|
||||
|
||||
runner.on('end', function(){
|
||||
stats.end = new Date;
|
||||
stats.duration = new Date - stats.start;
|
||||
});
|
||||
|
||||
runner.on('pending', function(){
|
||||
stats.pending++;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Output common epilogue used by many of
|
||||
* the bundled reporters.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Base.prototype.epilogue = function(){
|
||||
var stats = this.stats;
|
||||
var tests;
|
||||
var fmt;
|
||||
|
||||
console.log();
|
||||
|
||||
// passes
|
||||
fmt = color('bright pass', ' ')
|
||||
+ color('green', ' %d passing')
|
||||
+ color('light', ' (%s)');
|
||||
|
||||
console.log(fmt,
|
||||
stats.passes || 0,
|
||||
ms(stats.duration));
|
||||
|
||||
// pending
|
||||
if (stats.pending) {
|
||||
fmt = color('pending', ' ')
|
||||
+ color('pending', ' %d pending');
|
||||
|
||||
console.log(fmt, stats.pending);
|
||||
}
|
||||
|
||||
// failures
|
||||
if (stats.failures) {
|
||||
fmt = color('fail', ' %d failing');
|
||||
|
||||
console.log(fmt, stats.failures);
|
||||
|
||||
Base.list(this.failures);
|
||||
console.log();
|
||||
}
|
||||
|
||||
console.log();
|
||||
};
|
||||
|
||||
/**
|
||||
* Pad the given `str` to `len`.
|
||||
*
|
||||
* @param {String} str
|
||||
* @param {String} len
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function pad(str, len) {
|
||||
str = String(str);
|
||||
return Array(len - str.length + 1).join(' ') + str;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns an inline diff between 2 strings with coloured ANSI output
|
||||
*
|
||||
* @param {Error} Error with actual/expected
|
||||
* @return {String} Diff
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function inlineDiff(err, escape) {
|
||||
var msg = errorDiff(err, 'WordsWithSpace', escape);
|
||||
|
||||
// linenos
|
||||
var lines = msg.split('\n');
|
||||
if (lines.length > 4) {
|
||||
var width = String(lines.length).length;
|
||||
msg = lines.map(function(str, i){
|
||||
return pad(++i, width) + ' |' + ' ' + str;
|
||||
}).join('\n');
|
||||
}
|
||||
|
||||
// legend
|
||||
msg = '\n'
|
||||
+ color('diff removed', 'actual')
|
||||
+ ' '
|
||||
+ color('diff added', 'expected')
|
||||
+ '\n\n'
|
||||
+ msg
|
||||
+ '\n';
|
||||
|
||||
// indent
|
||||
msg = msg.replace(/^/gm, ' ');
|
||||
return msg;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a unified diff between 2 strings
|
||||
*
|
||||
* @param {Error} Error with actual/expected
|
||||
* @return {String} Diff
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function unifiedDiff(err, escape) {
|
||||
var indent = ' ';
|
||||
function cleanUp(line) {
|
||||
if (escape) {
|
||||
line = escapeInvisibles(line);
|
||||
}
|
||||
if (line[0] === '+') return indent + colorLines('diff added', line);
|
||||
if (line[0] === '-') return indent + colorLines('diff removed', line);
|
||||
if (line.match(/\@\@/)) return null;
|
||||
if (line.match(/\\ No newline/)) return null;
|
||||
else return indent + line;
|
||||
}
|
||||
function notBlank(line) {
|
||||
return line != null;
|
||||
}
|
||||
var msg = diff.createPatch('string', err.actual, err.expected);
|
||||
var lines = msg.split('\n').splice(4);
|
||||
return '\n '
|
||||
+ colorLines('diff added', '+ expected') + ' '
|
||||
+ colorLines('diff removed', '- actual')
|
||||
+ '\n\n'
|
||||
+ lines.map(cleanUp).filter(notBlank).join('\n');
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a character diff for `err`.
|
||||
*
|
||||
* @param {Error} err
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function errorDiff(err, type, escape) {
|
||||
var actual = escape ? escapeInvisibles(err.actual) : err.actual;
|
||||
var expected = escape ? escapeInvisibles(err.expected) : err.expected;
|
||||
return diff['diff' + type](actual, expected).map(function(str){
|
||||
if (str.added) return colorLines('diff added', str.value);
|
||||
if (str.removed) return colorLines('diff removed', str.value);
|
||||
return str.value;
|
||||
}).join('');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string with all invisible characters in plain text
|
||||
*
|
||||
* @param {String} line
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
function escapeInvisibles(line) {
|
||||
return line.replace(/\t/g, '<tab>')
|
||||
.replace(/\r/g, '<CR>')
|
||||
.replace(/\n/g, '<LF>\n');
|
||||
}
|
||||
|
||||
/**
|
||||
* Color lines for `str`, using the color `name`.
|
||||
*
|
||||
* @param {String} name
|
||||
* @param {String} str
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function colorLines(name, str) {
|
||||
return str.split('\n').map(function(str){
|
||||
return color(name, str);
|
||||
}).join('\n');
|
||||
}
|
||||
|
||||
/**
|
||||
* Check that a / b have the same type.
|
||||
*
|
||||
* @param {Object} a
|
||||
* @param {Object} b
|
||||
* @return {Boolean}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function sameType(a, b) {
|
||||
a = Object.prototype.toString.call(a);
|
||||
b = Object.prototype.toString.call(b);
|
||||
return a == b;
|
||||
}
|
62
node_modules/mocha/lib/reporters/doc.js
generated
vendored
Normal file
62
node_modules/mocha/lib/reporters/doc.js
generated
vendored
Normal file
@ -0,0 +1,62 @@
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var Base = require('./base')
|
||||
, utils = require('../utils');
|
||||
|
||||
/**
|
||||
* Expose `Doc`.
|
||||
*/
|
||||
|
||||
exports = module.exports = Doc;
|
||||
|
||||
/**
|
||||
* Initialize a new `Doc` reporter.
|
||||
*
|
||||
* @param {Runner} runner
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function Doc(runner) {
|
||||
Base.call(this, runner);
|
||||
|
||||
var self = this
|
||||
, stats = this.stats
|
||||
, total = runner.total
|
||||
, indents = 2;
|
||||
|
||||
function indent() {
|
||||
return Array(indents).join(' ');
|
||||
}
|
||||
|
||||
runner.on('suite', function(suite){
|
||||
if (suite.root) return;
|
||||
++indents;
|
||||
console.log('%s<section class="suite">', indent());
|
||||
++indents;
|
||||
console.log('%s<h1>%s</h1>', indent(), utils.escape(suite.title));
|
||||
console.log('%s<dl>', indent());
|
||||
});
|
||||
|
||||
runner.on('suite end', function(suite){
|
||||
if (suite.root) return;
|
||||
console.log('%s</dl>', indent());
|
||||
--indents;
|
||||
console.log('%s</section>', indent());
|
||||
--indents;
|
||||
});
|
||||
|
||||
runner.on('pass', function(test){
|
||||
console.log('%s <dt>%s</dt>', indent(), utils.escape(test.title));
|
||||
var code = utils.escape(utils.clean(test.fn.toString()));
|
||||
console.log('%s <dd><pre><code>%s</code></pre></dd>', indent(), code);
|
||||
});
|
||||
|
||||
runner.on('fail', function(test, err){
|
||||
console.log('%s <dt class="error">%s</dt>', indent(), utils.escape(test.title));
|
||||
var code = utils.escape(utils.clean(test.fn.toString()));
|
||||
console.log('%s <dd class="error"><pre><code>%s</code></pre></dd>', indent(), code);
|
||||
console.log('%s <dd class="error">%s</dd>', indent(), utils.escape(err));
|
||||
});
|
||||
}
|
62
node_modules/mocha/lib/reporters/dot.js
generated
vendored
Normal file
62
node_modules/mocha/lib/reporters/dot.js
generated
vendored
Normal file
@ -0,0 +1,62 @@
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var Base = require('./base')
|
||||
, color = Base.color;
|
||||
|
||||
/**
|
||||
* Expose `Dot`.
|
||||
*/
|
||||
|
||||
exports = module.exports = Dot;
|
||||
|
||||
/**
|
||||
* Initialize a new `Dot` matrix test reporter.
|
||||
*
|
||||
* @param {Runner} runner
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function Dot(runner) {
|
||||
Base.call(this, runner);
|
||||
|
||||
var self = this
|
||||
, stats = this.stats
|
||||
, width = Base.window.width * .75 | 0
|
||||
, n = -1;
|
||||
|
||||
runner.on('start', function(){
|
||||
process.stdout.write('\n');
|
||||
});
|
||||
|
||||
runner.on('pending', function(test){
|
||||
if (++n % width == 0) process.stdout.write('\n ');
|
||||
process.stdout.write(color('pending', Base.symbols.dot));
|
||||
});
|
||||
|
||||
runner.on('pass', function(test){
|
||||
if (++n % width == 0) process.stdout.write('\n ');
|
||||
if ('slow' == test.speed) {
|
||||
process.stdout.write(color('bright yellow', Base.symbols.dot));
|
||||
} else {
|
||||
process.stdout.write(color(test.speed, Base.symbols.dot));
|
||||
}
|
||||
});
|
||||
|
||||
runner.on('fail', function(test, err){
|
||||
if (++n % width == 0) process.stdout.write('\n ');
|
||||
process.stdout.write(color('fail', Base.symbols.dot));
|
||||
});
|
||||
|
||||
runner.on('end', function(){
|
||||
console.log();
|
||||
self.epilogue();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Inherit from `Base.prototype`.
|
||||
*/
|
||||
|
||||
Dot.prototype.__proto__ = Base.prototype;
|
50
node_modules/mocha/lib/reporters/html-cov.js
generated
vendored
Normal file
50
node_modules/mocha/lib/reporters/html-cov.js
generated
vendored
Normal file
@ -0,0 +1,50 @@
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var JSONCov = require('./json-cov')
|
||||
, fs = require('fs');
|
||||
|
||||
/**
|
||||
* Expose `HTMLCov`.
|
||||
*/
|
||||
|
||||
exports = module.exports = HTMLCov;
|
||||
|
||||
/**
|
||||
* Initialize a new `JsCoverage` reporter.
|
||||
*
|
||||
* @param {Runner} runner
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function HTMLCov(runner) {
|
||||
var jade = require('jade')
|
||||
, file = __dirname + '/templates/coverage.jade'
|
||||
, str = fs.readFileSync(file, 'utf8')
|
||||
, fn = jade.compile(str, { filename: file })
|
||||
, self = this;
|
||||
|
||||
JSONCov.call(this, runner, false);
|
||||
|
||||
runner.on('end', function(){
|
||||
process.stdout.write(fn({
|
||||
cov: self.cov
|
||||
, coverageClass: coverageClass
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Return coverage class for `n`.
|
||||
*
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function coverageClass(n) {
|
||||
if (n >= 75) return 'high';
|
||||
if (n >= 50) return 'medium';
|
||||
if (n >= 25) return 'low';
|
||||
return 'terrible';
|
||||
}
|
287
node_modules/mocha/lib/reporters/html.js
generated
vendored
Normal file
287
node_modules/mocha/lib/reporters/html.js
generated
vendored
Normal file
@ -0,0 +1,287 @@
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var Base = require('./base')
|
||||
, utils = require('../utils')
|
||||
, Progress = require('../browser/progress')
|
||||
, escape = utils.escape;
|
||||
|
||||
/**
|
||||
* Save timer references to avoid Sinon interfering (see GH-237).
|
||||
*/
|
||||
|
||||
var Date = global.Date
|
||||
, setTimeout = global.setTimeout
|
||||
, setInterval = global.setInterval
|
||||
, clearTimeout = global.clearTimeout
|
||||
, clearInterval = global.clearInterval;
|
||||
|
||||
/**
|
||||
* Expose `HTML`.
|
||||
*/
|
||||
|
||||
exports = module.exports = HTML;
|
||||
|
||||
/**
|
||||
* Stats template.
|
||||
*/
|
||||
|
||||
var statsTemplate = '<ul id="mocha-stats">'
|
||||
+ '<li class="progress"><canvas width="40" height="40"></canvas></li>'
|
||||
+ '<li class="passes"><a href="#">passes:</a> <em>0</em></li>'
|
||||
+ '<li class="failures"><a href="#">failures:</a> <em>0</em></li>'
|
||||
+ '<li class="duration">duration: <em>0</em>s</li>'
|
||||
+ '</ul>';
|
||||
|
||||
/**
|
||||
* Initialize a new `HTML` reporter.
|
||||
*
|
||||
* @param {Runner} runner
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function HTML(runner) {
|
||||
Base.call(this, runner);
|
||||
|
||||
var self = this
|
||||
, stats = this.stats
|
||||
, total = runner.total
|
||||
, stat = fragment(statsTemplate)
|
||||
, items = stat.getElementsByTagName('li')
|
||||
, passes = items[1].getElementsByTagName('em')[0]
|
||||
, passesLink = items[1].getElementsByTagName('a')[0]
|
||||
, failures = items[2].getElementsByTagName('em')[0]
|
||||
, failuresLink = items[2].getElementsByTagName('a')[0]
|
||||
, duration = items[3].getElementsByTagName('em')[0]
|
||||
, canvas = stat.getElementsByTagName('canvas')[0]
|
||||
, report = fragment('<ul id="mocha-report"></ul>')
|
||||
, stack = [report]
|
||||
, progress
|
||||
, ctx
|
||||
, root = document.getElementById('mocha');
|
||||
|
||||
if (canvas.getContext) {
|
||||
var ratio = window.devicePixelRatio || 1;
|
||||
canvas.style.width = canvas.width;
|
||||
canvas.style.height = canvas.height;
|
||||
canvas.width *= ratio;
|
||||
canvas.height *= ratio;
|
||||
ctx = canvas.getContext('2d');
|
||||
ctx.scale(ratio, ratio);
|
||||
progress = new Progress;
|
||||
}
|
||||
|
||||
if (!root) return error('#mocha div missing, add it to your document');
|
||||
|
||||
// pass toggle
|
||||
on(passesLink, 'click', function(){
|
||||
unhide();
|
||||
var name = /pass/.test(report.className) ? '' : ' pass';
|
||||
report.className = report.className.replace(/fail|pass/g, '') + name;
|
||||
if (report.className.trim()) hideSuitesWithout('test pass');
|
||||
});
|
||||
|
||||
// failure toggle
|
||||
on(failuresLink, 'click', function(){
|
||||
unhide();
|
||||
var name = /fail/.test(report.className) ? '' : ' fail';
|
||||
report.className = report.className.replace(/fail|pass/g, '') + name;
|
||||
if (report.className.trim()) hideSuitesWithout('test fail');
|
||||
});
|
||||
|
||||
root.appendChild(stat);
|
||||
root.appendChild(report);
|
||||
|
||||
if (progress) progress.size(40);
|
||||
|
||||
runner.on('suite', function(suite){
|
||||
if (suite.root) return;
|
||||
|
||||
// suite
|
||||
var url = self.suiteURL(suite);
|
||||
var el = fragment('<li class="suite"><h1><a href="%s">%s</a></h1></li>', url, escape(suite.title));
|
||||
|
||||
// container
|
||||
stack[0].appendChild(el);
|
||||
stack.unshift(document.createElement('ul'));
|
||||
el.appendChild(stack[0]);
|
||||
});
|
||||
|
||||
runner.on('suite end', function(suite){
|
||||
if (suite.root) return;
|
||||
stack.shift();
|
||||
});
|
||||
|
||||
runner.on('fail', function(test, err){
|
||||
if ('hook' == test.type) runner.emit('test end', test);
|
||||
});
|
||||
|
||||
runner.on('test end', function(test){
|
||||
// TODO: add to stats
|
||||
var percent = stats.tests / this.total * 100 | 0;
|
||||
if (progress) progress.update(percent).draw(ctx);
|
||||
|
||||
// update stats
|
||||
var ms = new Date - stats.start;
|
||||
text(passes, stats.passes);
|
||||
text(failures, stats.failures);
|
||||
text(duration, (ms / 1000).toFixed(2));
|
||||
|
||||
// test
|
||||
if ('passed' == test.state) {
|
||||
var url = self.testURL(test);
|
||||
var el = fragment('<li class="test pass %e"><h2>%e<span class="duration">%ems</span> <a href="%s" class="replay">‣</a></h2></li>', test.speed, test.title, test.duration, url);
|
||||
} else if (test.pending) {
|
||||
var el = fragment('<li class="test pass pending"><h2>%e</h2></li>', test.title);
|
||||
} else {
|
||||
var el = fragment('<li class="test fail"><h2>%e <a href="%e" class="replay">‣</a></h2></li>', test.title, self.testURL(test));
|
||||
var str = test.err.stack || test.err.toString();
|
||||
|
||||
// FF / Opera do not add the message
|
||||
if (!~str.indexOf(test.err.message)) {
|
||||
str = test.err.message + '\n' + str;
|
||||
}
|
||||
|
||||
// <=IE7 stringifies to [Object Error]. Since it can be overloaded, we
|
||||
// check for the result of the stringifying.
|
||||
if ('[object Error]' == str) str = test.err.message;
|
||||
|
||||
// Safari doesn't give you a stack. Let's at least provide a source line.
|
||||
if (!test.err.stack && test.err.sourceURL && test.err.line !== undefined) {
|
||||
str += "\n(" + test.err.sourceURL + ":" + test.err.line + ")";
|
||||
}
|
||||
|
||||
el.appendChild(fragment('<pre class="error">%e</pre>', str));
|
||||
}
|
||||
|
||||
// toggle code
|
||||
// TODO: defer
|
||||
if (!test.pending) {
|
||||
var h2 = el.getElementsByTagName('h2')[0];
|
||||
|
||||
on(h2, 'click', function(){
|
||||
pre.style.display = 'none' == pre.style.display
|
||||
? 'block'
|
||||
: 'none';
|
||||
});
|
||||
|
||||
var pre = fragment('<pre><code>%e</code></pre>', utils.clean(test.fn.toString()));
|
||||
el.appendChild(pre);
|
||||
pre.style.display = 'none';
|
||||
}
|
||||
|
||||
// Don't call .appendChild if #mocha-report was already .shift()'ed off the stack.
|
||||
if (stack[0]) stack[0].appendChild(el);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes a URL, preserving querystring ("search") parameters.
|
||||
* @param {string} s
|
||||
* @returns {string} your new URL
|
||||
*/
|
||||
var makeUrl = function makeUrl(s) {
|
||||
var search = window.location.search;
|
||||
|
||||
// Remove previous grep query parameter if present
|
||||
if (search) {
|
||||
search = search.replace(/[?&]grep=[^&\s]*/g, '').replace(/^&/, '?');
|
||||
}
|
||||
|
||||
return window.location.pathname + (search ? search + '&' : '?' ) + 'grep=' + encodeURIComponent(s);
|
||||
};
|
||||
|
||||
/**
|
||||
* Provide suite URL
|
||||
*
|
||||
* @param {Object} [suite]
|
||||
*/
|
||||
HTML.prototype.suiteURL = function(suite){
|
||||
return makeUrl(suite.fullTitle());
|
||||
};
|
||||
|
||||
/**
|
||||
* Provide test URL
|
||||
*
|
||||
* @param {Object} [test]
|
||||
*/
|
||||
|
||||
HTML.prototype.testURL = function(test){
|
||||
return makeUrl(test.fullTitle());
|
||||
};
|
||||
|
||||
/**
|
||||
* Display error `msg`.
|
||||
*/
|
||||
|
||||
function error(msg) {
|
||||
document.body.appendChild(fragment('<div id="mocha-error">%s</div>', msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a DOM fragment from `html`.
|
||||
*/
|
||||
|
||||
function fragment(html) {
|
||||
var args = arguments
|
||||
, div = document.createElement('div')
|
||||
, i = 1;
|
||||
|
||||
div.innerHTML = html.replace(/%([se])/g, function(_, type){
|
||||
switch (type) {
|
||||
case 's': return String(args[i++]);
|
||||
case 'e': return escape(args[i++]);
|
||||
}
|
||||
});
|
||||
|
||||
return div.firstChild;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for suites that do not have elements
|
||||
* with `classname`, and hide them.
|
||||
*/
|
||||
|
||||
function hideSuitesWithout(classname) {
|
||||
var suites = document.getElementsByClassName('suite');
|
||||
for (var i = 0; i < suites.length; i++) {
|
||||
var els = suites[i].getElementsByClassName(classname);
|
||||
if (0 == els.length) suites[i].className += ' hidden';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unhide .hidden suites.
|
||||
*/
|
||||
|
||||
function unhide() {
|
||||
var els = document.getElementsByClassName('suite hidden');
|
||||
for (var i = 0; i < els.length; ++i) {
|
||||
els[i].className = els[i].className.replace('suite hidden', 'suite');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set `el` text to `str`.
|
||||
*/
|
||||
|
||||
function text(el, str) {
|
||||
if (el.textContent) {
|
||||
el.textContent = str;
|
||||
} else {
|
||||
el.innerText = str;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Listen on `event` with callback `fn`.
|
||||
*/
|
||||
|
||||
function on(el, event, fn) {
|
||||
if (el.addEventListener) {
|
||||
el.addEventListener(event, fn, false);
|
||||
} else {
|
||||
el.attachEvent('on' + event, fn);
|
||||
}
|
||||
}
|
17
node_modules/mocha/lib/reporters/index.js
generated
vendored
Normal file
17
node_modules/mocha/lib/reporters/index.js
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
exports.Base = require('./base');
|
||||
exports.Dot = require('./dot');
|
||||
exports.Doc = require('./doc');
|
||||
exports.TAP = require('./tap');
|
||||
exports.JSON = require('./json');
|
||||
exports.HTML = require('./html');
|
||||
exports.List = require('./list');
|
||||
exports.Min = require('./min');
|
||||
exports.Spec = require('./spec');
|
||||
exports.Nyan = require('./nyan');
|
||||
exports.XUnit = require('./xunit');
|
||||
exports.Markdown = require('./markdown');
|
||||
exports.Progress = require('./progress');
|
||||
exports.Landing = require('./landing');
|
||||
exports.JSONCov = require('./json-cov');
|
||||
exports.HTMLCov = require('./html-cov');
|
||||
exports.JSONStream = require('./json-stream');
|
152
node_modules/mocha/lib/reporters/json-cov.js
generated
vendored
Normal file
152
node_modules/mocha/lib/reporters/json-cov.js
generated
vendored
Normal file
@ -0,0 +1,152 @@
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var Base = require('./base');
|
||||
|
||||
/**
|
||||
* Expose `JSONCov`.
|
||||
*/
|
||||
|
||||
exports = module.exports = JSONCov;
|
||||
|
||||
/**
|
||||
* Initialize a new `JsCoverage` reporter.
|
||||
*
|
||||
* @param {Runner} runner
|
||||
* @param {Boolean} output
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function JSONCov(runner, output) {
|
||||
var self = this
|
||||
, output = 1 == arguments.length ? true : output;
|
||||
|
||||
Base.call(this, runner);
|
||||
|
||||
var tests = []
|
||||
, failures = []
|
||||
, passes = [];
|
||||
|
||||
runner.on('test end', function(test){
|
||||
tests.push(test);
|
||||
});
|
||||
|
||||
runner.on('pass', function(test){
|
||||
passes.push(test);
|
||||
});
|
||||
|
||||
runner.on('fail', function(test){
|
||||
failures.push(test);
|
||||
});
|
||||
|
||||
runner.on('end', function(){
|
||||
var cov = global._$jscoverage || {};
|
||||
var result = self.cov = map(cov);
|
||||
result.stats = self.stats;
|
||||
result.tests = tests.map(clean);
|
||||
result.failures = failures.map(clean);
|
||||
result.passes = passes.map(clean);
|
||||
if (!output) return;
|
||||
process.stdout.write(JSON.stringify(result, null, 2 ));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Map jscoverage data to a JSON structure
|
||||
* suitable for reporting.
|
||||
*
|
||||
* @param {Object} cov
|
||||
* @return {Object}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function map(cov) {
|
||||
var ret = {
|
||||
instrumentation: 'node-jscoverage'
|
||||
, sloc: 0
|
||||
, hits: 0
|
||||
, misses: 0
|
||||
, coverage: 0
|
||||
, files: []
|
||||
};
|
||||
|
||||
for (var filename in cov) {
|
||||
var data = coverage(filename, cov[filename]);
|
||||
ret.files.push(data);
|
||||
ret.hits += data.hits;
|
||||
ret.misses += data.misses;
|
||||
ret.sloc += data.sloc;
|
||||
}
|
||||
|
||||
ret.files.sort(function(a, b) {
|
||||
return a.filename.localeCompare(b.filename);
|
||||
});
|
||||
|
||||
if (ret.sloc > 0) {
|
||||
ret.coverage = (ret.hits / ret.sloc) * 100;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Map jscoverage data for a single source file
|
||||
* to a JSON structure suitable for reporting.
|
||||
*
|
||||
* @param {String} filename name of the source file
|
||||
* @param {Object} data jscoverage coverage data
|
||||
* @return {Object}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function coverage(filename, data) {
|
||||
var ret = {
|
||||
filename: filename,
|
||||
coverage: 0,
|
||||
hits: 0,
|
||||
misses: 0,
|
||||
sloc: 0,
|
||||
source: {}
|
||||
};
|
||||
|
||||
data.source.forEach(function(line, num){
|
||||
num++;
|
||||
|
||||
if (data[num] === 0) {
|
||||
ret.misses++;
|
||||
ret.sloc++;
|
||||
} else if (data[num] !== undefined) {
|
||||
ret.hits++;
|
||||
ret.sloc++;
|
||||
}
|
||||
|
||||
ret.source[num] = {
|
||||
source: line
|
||||
, coverage: data[num] === undefined
|
||||
? ''
|
||||
: data[num]
|
||||
};
|
||||
});
|
||||
|
||||
ret.coverage = ret.hits / ret.sloc * 100;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a plain-object representation of `test`
|
||||
* free of cyclic properties etc.
|
||||
*
|
||||
* @param {Object} test
|
||||
* @return {Object}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function clean(test) {
|
||||
return {
|
||||
title: test.title
|
||||
, fullTitle: test.fullTitle()
|
||||
, duration: test.duration
|
||||
}
|
||||
}
|
62
node_modules/mocha/lib/reporters/json-stream.js
generated
vendored
Normal file
62
node_modules/mocha/lib/reporters/json-stream.js
generated
vendored
Normal file
@ -0,0 +1,62 @@
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var Base = require('./base')
|
||||
, color = Base.color;
|
||||
|
||||
/**
|
||||
* Expose `List`.
|
||||
*/
|
||||
|
||||
exports = module.exports = List;
|
||||
|
||||
/**
|
||||
* Initialize a new `List` test reporter.
|
||||
*
|
||||
* @param {Runner} runner
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function List(runner) {
|
||||
Base.call(this, runner);
|
||||
|
||||
var self = this
|
||||
, stats = this.stats
|
||||
, total = runner.total;
|
||||
|
||||
runner.on('start', function(){
|
||||
console.log(JSON.stringify(['start', { total: total }]));
|
||||
});
|
||||
|
||||
runner.on('pass', function(test){
|
||||
console.log(JSON.stringify(['pass', clean(test)]));
|
||||
});
|
||||
|
||||
runner.on('fail', function(test, err){
|
||||
test = clean(test);
|
||||
test.err = err.message;
|
||||
console.log(JSON.stringify(['fail', test]));
|
||||
});
|
||||
|
||||
runner.on('end', function(){
|
||||
process.stdout.write(JSON.stringify(['end', self.stats]));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a plain-object representation of `test`
|
||||
* free of cyclic properties etc.
|
||||
*
|
||||
* @param {Object} test
|
||||
* @return {Object}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function clean(test) {
|
||||
return {
|
||||
title: test.title
|
||||
, fullTitle: test.fullTitle()
|
||||
, duration: test.duration
|
||||
}
|
||||
}
|
92
node_modules/mocha/lib/reporters/json.js
generated
vendored
Normal file
92
node_modules/mocha/lib/reporters/json.js
generated
vendored
Normal file
@ -0,0 +1,92 @@
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var Base = require('./base')
|
||||
, cursor = Base.cursor
|
||||
, color = Base.color;
|
||||
|
||||
/**
|
||||
* Expose `JSON`.
|
||||
*/
|
||||
|
||||
exports = module.exports = JSONReporter;
|
||||
|
||||
/**
|
||||
* Initialize a new `JSON` reporter.
|
||||
*
|
||||
* @param {Runner} runner
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function JSONReporter(runner) {
|
||||
var self = this;
|
||||
Base.call(this, runner);
|
||||
|
||||
var tests = []
|
||||
, pending = []
|
||||
, failures = []
|
||||
, passes = [];
|
||||
|
||||
runner.on('test end', function(test){
|
||||
tests.push(test);
|
||||
});
|
||||
|
||||
runner.on('pass', function(test){
|
||||
passes.push(test);
|
||||
});
|
||||
|
||||
runner.on('fail', function(test){
|
||||
failures.push(test);
|
||||
});
|
||||
|
||||
runner.on('pending', function(test){
|
||||
pending.push(test);
|
||||
});
|
||||
|
||||
runner.on('end', function(){
|
||||
var obj = {
|
||||
stats: self.stats,
|
||||
tests: tests.map(clean),
|
||||
pending: pending.map(clean),
|
||||
failures: failures.map(clean),
|
||||
passes: passes.map(clean)
|
||||
};
|
||||
|
||||
runner.testResults = obj;
|
||||
|
||||
process.stdout.write(JSON.stringify(obj, null, 2));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a plain-object representation of `test`
|
||||
* free of cyclic properties etc.
|
||||
*
|
||||
* @param {Object} test
|
||||
* @return {Object}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function clean(test) {
|
||||
return {
|
||||
title: test.title,
|
||||
fullTitle: test.fullTitle(),
|
||||
duration: test.duration,
|
||||
err: errorJSON(test.err || {})
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Transform `error` into a JSON object.
|
||||
* @param {Error} err
|
||||
* @return {Object}
|
||||
*/
|
||||
|
||||
function errorJSON(err) {
|
||||
var res = {};
|
||||
Object.getOwnPropertyNames(err).forEach(function(key) {
|
||||
res[key] = err[key];
|
||||
}, err);
|
||||
return res;
|
||||
}
|
96
node_modules/mocha/lib/reporters/landing.js
generated
vendored
Normal file
96
node_modules/mocha/lib/reporters/landing.js
generated
vendored
Normal file
@ -0,0 +1,96 @@
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var Base = require('./base')
|
||||
, cursor = Base.cursor
|
||||
, color = Base.color;
|
||||
|
||||
/**
|
||||
* Expose `Landing`.
|
||||
*/
|
||||
|
||||
exports = module.exports = Landing;
|
||||
|
||||
/**
|
||||
* Airplane color.
|
||||
*/
|
||||
|
||||
Base.colors.plane = 0;
|
||||
|
||||
/**
|
||||
* Airplane crash color.
|
||||
*/
|
||||
|
||||
Base.colors['plane crash'] = 31;
|
||||
|
||||
/**
|
||||
* Runway color.
|
||||
*/
|
||||
|
||||
Base.colors.runway = 90;
|
||||
|
||||
/**
|
||||
* Initialize a new `Landing` reporter.
|
||||
*
|
||||
* @param {Runner} runner
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function Landing(runner) {
|
||||
Base.call(this, runner);
|
||||
|
||||
var self = this
|
||||
, stats = this.stats
|
||||
, width = Base.window.width * .75 | 0
|
||||
, total = runner.total
|
||||
, stream = process.stdout
|
||||
, plane = color('plane', '✈')
|
||||
, crashed = -1
|
||||
, n = 0;
|
||||
|
||||
function runway() {
|
||||
var buf = Array(width).join('-');
|
||||
return ' ' + color('runway', buf);
|
||||
}
|
||||
|
||||
runner.on('start', function(){
|
||||
stream.write('\n\n\n ');
|
||||
cursor.hide();
|
||||
});
|
||||
|
||||
runner.on('test end', function(test){
|
||||
// check if the plane crashed
|
||||
var col = -1 == crashed
|
||||
? width * ++n / total | 0
|
||||
: crashed;
|
||||
|
||||
// show the crash
|
||||
if ('failed' == test.state) {
|
||||
plane = color('plane crash', '✈');
|
||||
crashed = col;
|
||||
}
|
||||
|
||||
// render landing strip
|
||||
stream.write('\u001b['+(width+1)+'D\u001b[2A');
|
||||
stream.write(runway());
|
||||
stream.write('\n ');
|
||||
stream.write(color('runway', Array(col).join('⋅')));
|
||||
stream.write(plane)
|
||||
stream.write(color('runway', Array(width - col).join('⋅') + '\n'));
|
||||
stream.write(runway());
|
||||
stream.write('\u001b[0m');
|
||||
});
|
||||
|
||||
runner.on('end', function(){
|
||||
cursor.show();
|
||||
console.log();
|
||||
self.epilogue();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Inherit from `Base.prototype`.
|
||||
*/
|
||||
|
||||
Landing.prototype.__proto__ = Base.prototype;
|
63
node_modules/mocha/lib/reporters/list.js
generated
vendored
Normal file
63
node_modules/mocha/lib/reporters/list.js
generated
vendored
Normal file
@ -0,0 +1,63 @@
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var Base = require('./base')
|
||||
, cursor = Base.cursor
|
||||
, color = Base.color;
|
||||
|
||||
/**
|
||||
* Expose `List`.
|
||||
*/
|
||||
|
||||
exports = module.exports = List;
|
||||
|
||||
/**
|
||||
* Initialize a new `List` test reporter.
|
||||
*
|
||||
* @param {Runner} runner
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function List(runner) {
|
||||
Base.call(this, runner);
|
||||
|
||||
var self = this
|
||||
, stats = this.stats
|
||||
, n = 0;
|
||||
|
||||
runner.on('start', function(){
|
||||
console.log();
|
||||
});
|
||||
|
||||
runner.on('test', function(test){
|
||||
process.stdout.write(color('pass', ' ' + test.fullTitle() + ': '));
|
||||
});
|
||||
|
||||
runner.on('pending', function(test){
|
||||
var fmt = color('checkmark', ' -')
|
||||
+ color('pending', ' %s');
|
||||
console.log(fmt, test.fullTitle());
|
||||
});
|
||||
|
||||
runner.on('pass', function(test){
|
||||
var fmt = color('checkmark', ' '+Base.symbols.dot)
|
||||
+ color('pass', ' %s: ')
|
||||
+ color(test.speed, '%dms');
|
||||
cursor.CR();
|
||||
console.log(fmt, test.fullTitle(), test.duration);
|
||||
});
|
||||
|
||||
runner.on('fail', function(test, err){
|
||||
cursor.CR();
|
||||
console.log(color('fail', ' %d) %s'), ++n, test.fullTitle());
|
||||
});
|
||||
|
||||
runner.on('end', self.epilogue.bind(self));
|
||||
}
|
||||
|
||||
/**
|
||||
* Inherit from `Base.prototype`.
|
||||
*/
|
||||
|
||||
List.prototype.__proto__ = Base.prototype;
|
100
node_modules/mocha/lib/reporters/markdown.js
generated
vendored
Normal file
100
node_modules/mocha/lib/reporters/markdown.js
generated
vendored
Normal file
@ -0,0 +1,100 @@
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var Base = require('./base')
|
||||
, utils = require('../utils');
|
||||
|
||||
/**
|
||||
* Constants
|
||||
*/
|
||||
|
||||
var SUITE_PREFIX = '$';
|
||||
|
||||
/**
|
||||
* Expose `Markdown`.
|
||||
*/
|
||||
|
||||
exports = module.exports = Markdown;
|
||||
|
||||
/**
|
||||
* Initialize a new `Markdown` reporter.
|
||||
*
|
||||
* @param {Runner} runner
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function Markdown(runner) {
|
||||
Base.call(this, runner);
|
||||
|
||||
var self = this
|
||||
, stats = this.stats
|
||||
, level = 0
|
||||
, buf = '';
|
||||
|
||||
function title(str) {
|
||||
return Array(level).join('#') + ' ' + str;
|
||||
}
|
||||
|
||||
function indent() {
|
||||
return Array(level).join(' ');
|
||||
}
|
||||
|
||||
function mapTOC(suite, obj) {
|
||||
var ret = obj,
|
||||
key = SUITE_PREFIX + suite.title;
|
||||
obj = obj[key] = obj[key] || { suite: suite };
|
||||
suite.suites.forEach(function(suite){
|
||||
mapTOC(suite, obj);
|
||||
});
|
||||
return ret;
|
||||
}
|
||||
|
||||
function stringifyTOC(obj, level) {
|
||||
++level;
|
||||
var buf = '';
|
||||
var link;
|
||||
for (var key in obj) {
|
||||
if ('suite' == key) continue;
|
||||
if (key !== SUITE_PREFIX) {
|
||||
link = ' - [' + key.substring(1) + ']';
|
||||
link += '(#' + utils.slug(obj[key].suite.fullTitle()) + ')\n';
|
||||
buf += Array(level).join(' ') + link;
|
||||
}
|
||||
buf += stringifyTOC(obj[key], level);
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
|
||||
function generateTOC(suite) {
|
||||
var obj = mapTOC(suite, {});
|
||||
return stringifyTOC(obj, 0);
|
||||
}
|
||||
|
||||
generateTOC(runner.suite);
|
||||
|
||||
runner.on('suite', function(suite){
|
||||
++level;
|
||||
var slug = utils.slug(suite.fullTitle());
|
||||
buf += '<a name="' + slug + '"></a>' + '\n';
|
||||
buf += title(suite.title) + '\n';
|
||||
});
|
||||
|
||||
runner.on('suite end', function(suite){
|
||||
--level;
|
||||
});
|
||||
|
||||
runner.on('pass', function(test){
|
||||
var code = utils.clean(test.fn.toString());
|
||||
buf += test.title + '.\n';
|
||||
buf += '\n```js\n';
|
||||
buf += code + '\n';
|
||||
buf += '```\n\n';
|
||||
});
|
||||
|
||||
runner.on('end', function(){
|
||||
process.stdout.write('# TOC\n');
|
||||
process.stdout.write(generateTOC(runner.suite));
|
||||
process.stdout.write(buf);
|
||||
});
|
||||
}
|
37
node_modules/mocha/lib/reporters/min.js
generated
vendored
Normal file
37
node_modules/mocha/lib/reporters/min.js
generated
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var Base = require('./base');
|
||||
|
||||
/**
|
||||
* Expose `Min`.
|
||||
*/
|
||||
|
||||
exports = module.exports = Min;
|
||||
|
||||
/**
|
||||
* Initialize a new `Min` minimal test reporter (best used with --watch).
|
||||
*
|
||||
* @param {Runner} runner
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function Min(runner) {
|
||||
Base.call(this, runner);
|
||||
|
||||
runner.on('start', function(){
|
||||
// clear screen
|
||||
process.stdout.write('\u001b[2J');
|
||||
// set cursor position
|
||||
process.stdout.write('\u001b[1;3H');
|
||||
});
|
||||
|
||||
runner.on('end', this.epilogue.bind(this));
|
||||
}
|
||||
|
||||
/**
|
||||
* Inherit from `Base.prototype`.
|
||||
*/
|
||||
|
||||
Min.prototype.__proto__ = Base.prototype;
|
260
node_modules/mocha/lib/reporters/nyan.js
generated
vendored
Normal file
260
node_modules/mocha/lib/reporters/nyan.js
generated
vendored
Normal file
@ -0,0 +1,260 @@
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var Base = require('./base');
|
||||
|
||||
/**
|
||||
* Expose `Dot`.
|
||||
*/
|
||||
|
||||
exports = module.exports = NyanCat;
|
||||
|
||||
/**
|
||||
* Initialize a new `Dot` matrix test reporter.
|
||||
*
|
||||
* @param {Runner} runner
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function NyanCat(runner) {
|
||||
Base.call(this, runner);
|
||||
var self = this
|
||||
, stats = this.stats
|
||||
, width = Base.window.width * .75 | 0
|
||||
, rainbowColors = this.rainbowColors = self.generateColors()
|
||||
, colorIndex = this.colorIndex = 0
|
||||
, numerOfLines = this.numberOfLines = 4
|
||||
, trajectories = this.trajectories = [[], [], [], []]
|
||||
, nyanCatWidth = this.nyanCatWidth = 11
|
||||
, trajectoryWidthMax = this.trajectoryWidthMax = (width - nyanCatWidth)
|
||||
, scoreboardWidth = this.scoreboardWidth = 5
|
||||
, tick = this.tick = 0
|
||||
, n = 0;
|
||||
|
||||
runner.on('start', function(){
|
||||
Base.cursor.hide();
|
||||
self.draw();
|
||||
});
|
||||
|
||||
runner.on('pending', function(test){
|
||||
self.draw();
|
||||
});
|
||||
|
||||
runner.on('pass', function(test){
|
||||
self.draw();
|
||||
});
|
||||
|
||||
runner.on('fail', function(test, err){
|
||||
self.draw();
|
||||
});
|
||||
|
||||
runner.on('end', function(){
|
||||
Base.cursor.show();
|
||||
for (var i = 0; i < self.numberOfLines; i++) write('\n');
|
||||
self.epilogue();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw the nyan cat
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
NyanCat.prototype.draw = function(){
|
||||
this.appendRainbow();
|
||||
this.drawScoreboard();
|
||||
this.drawRainbow();
|
||||
this.drawNyanCat();
|
||||
this.tick = !this.tick;
|
||||
};
|
||||
|
||||
/**
|
||||
* Draw the "scoreboard" showing the number
|
||||
* of passes, failures and pending tests.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
NyanCat.prototype.drawScoreboard = function(){
|
||||
var stats = this.stats;
|
||||
|
||||
function draw(type, n) {
|
||||
write(' ');
|
||||
write(Base.color(type, n));
|
||||
write('\n');
|
||||
}
|
||||
|
||||
draw('green', stats.passes);
|
||||
draw('fail', stats.failures);
|
||||
draw('pending', stats.pending);
|
||||
write('\n');
|
||||
|
||||
this.cursorUp(this.numberOfLines);
|
||||
};
|
||||
|
||||
/**
|
||||
* Append the rainbow.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
NyanCat.prototype.appendRainbow = function(){
|
||||
var segment = this.tick ? '_' : '-';
|
||||
var rainbowified = this.rainbowify(segment);
|
||||
|
||||
for (var index = 0; index < this.numberOfLines; index++) {
|
||||
var trajectory = this.trajectories[index];
|
||||
if (trajectory.length >= this.trajectoryWidthMax) trajectory.shift();
|
||||
trajectory.push(rainbowified);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Draw the rainbow.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
NyanCat.prototype.drawRainbow = function(){
|
||||
var self = this;
|
||||
|
||||
this.trajectories.forEach(function(line, index) {
|
||||
write('\u001b[' + self.scoreboardWidth + 'C');
|
||||
write(line.join(''));
|
||||
write('\n');
|
||||
});
|
||||
|
||||
this.cursorUp(this.numberOfLines);
|
||||
};
|
||||
|
||||
/**
|
||||
* Draw the nyan cat
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
NyanCat.prototype.drawNyanCat = function() {
|
||||
var self = this;
|
||||
var startWidth = this.scoreboardWidth + this.trajectories[0].length;
|
||||
var dist = '\u001b[' + startWidth + 'C';
|
||||
var padding = '';
|
||||
|
||||
write(dist);
|
||||
write('_,------,');
|
||||
write('\n');
|
||||
|
||||
write(dist);
|
||||
padding = self.tick ? ' ' : ' ';
|
||||
write('_|' + padding + '/\\_/\\ ');
|
||||
write('\n');
|
||||
|
||||
write(dist);
|
||||
padding = self.tick ? '_' : '__';
|
||||
var tail = self.tick ? '~' : '^';
|
||||
var face;
|
||||
write(tail + '|' + padding + this.face() + ' ');
|
||||
write('\n');
|
||||
|
||||
write(dist);
|
||||
padding = self.tick ? ' ' : ' ';
|
||||
write(padding + '"" "" ');
|
||||
write('\n');
|
||||
|
||||
this.cursorUp(this.numberOfLines);
|
||||
};
|
||||
|
||||
/**
|
||||
* Draw nyan cat face.
|
||||
*
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
NyanCat.prototype.face = function() {
|
||||
var stats = this.stats;
|
||||
if (stats.failures) {
|
||||
return '( x .x)';
|
||||
} else if (stats.pending) {
|
||||
return '( o .o)';
|
||||
} else if(stats.passes) {
|
||||
return '( ^ .^)';
|
||||
} else {
|
||||
return '( - .-)';
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Move cursor up `n`.
|
||||
*
|
||||
* @param {Number} n
|
||||
* @api private
|
||||
*/
|
||||
|
||||
NyanCat.prototype.cursorUp = function(n) {
|
||||
write('\u001b[' + n + 'A');
|
||||
};
|
||||
|
||||
/**
|
||||
* Move cursor down `n`.
|
||||
*
|
||||
* @param {Number} n
|
||||
* @api private
|
||||
*/
|
||||
|
||||
NyanCat.prototype.cursorDown = function(n) {
|
||||
write('\u001b[' + n + 'B');
|
||||
};
|
||||
|
||||
/**
|
||||
* Generate rainbow colors.
|
||||
*
|
||||
* @return {Array}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
NyanCat.prototype.generateColors = function(){
|
||||
var colors = [];
|
||||
|
||||
for (var i = 0; i < (6 * 7); i++) {
|
||||
var pi3 = Math.floor(Math.PI / 3);
|
||||
var n = (i * (1.0 / 6));
|
||||
var r = Math.floor(3 * Math.sin(n) + 3);
|
||||
var g = Math.floor(3 * Math.sin(n + 2 * pi3) + 3);
|
||||
var b = Math.floor(3 * Math.sin(n + 4 * pi3) + 3);
|
||||
colors.push(36 * r + 6 * g + b + 16);
|
||||
}
|
||||
|
||||
return colors;
|
||||
};
|
||||
|
||||
/**
|
||||
* Apply rainbow to the given `str`.
|
||||
*
|
||||
* @param {String} str
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
NyanCat.prototype.rainbowify = function(str){
|
||||
if (!Base.useColors)
|
||||
return str;
|
||||
var color = this.rainbowColors[this.colorIndex % this.rainbowColors.length];
|
||||
this.colorIndex += 1;
|
||||
return '\u001b[38;5;' + color + 'm' + str + '\u001b[0m';
|
||||
};
|
||||
|
||||
/**
|
||||
* Stdout helper.
|
||||
*/
|
||||
|
||||
function write(string) {
|
||||
process.stdout.write(string);
|
||||
}
|
||||
|
||||
/**
|
||||
* Inherit from `Base.prototype`.
|
||||
*/
|
||||
|
||||
NyanCat.prototype.__proto__ = Base.prototype;
|
92
node_modules/mocha/lib/reporters/progress.js
generated
vendored
Normal file
92
node_modules/mocha/lib/reporters/progress.js
generated
vendored
Normal file
@ -0,0 +1,92 @@
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var Base = require('./base')
|
||||
, cursor = Base.cursor
|
||||
, color = Base.color;
|
||||
|
||||
/**
|
||||
* Expose `Progress`.
|
||||
*/
|
||||
|
||||
exports = module.exports = Progress;
|
||||
|
||||
/**
|
||||
* General progress bar color.
|
||||
*/
|
||||
|
||||
Base.colors.progress = 90;
|
||||
|
||||
/**
|
||||
* Initialize a new `Progress` bar test reporter.
|
||||
*
|
||||
* @param {Runner} runner
|
||||
* @param {Object} options
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function Progress(runner, options) {
|
||||
Base.call(this, runner);
|
||||
|
||||
var self = this
|
||||
, options = options || {}
|
||||
, stats = this.stats
|
||||
, width = Base.window.width * .50 | 0
|
||||
, total = runner.total
|
||||
, complete = 0
|
||||
, max = Math.max
|
||||
, lastN = -1;
|
||||
|
||||
// default chars
|
||||
options.open = options.open || '[';
|
||||
options.complete = options.complete || '▬';
|
||||
options.incomplete = options.incomplete || Base.symbols.dot;
|
||||
options.close = options.close || ']';
|
||||
options.verbose = false;
|
||||
|
||||
// tests started
|
||||
runner.on('start', function(){
|
||||
console.log();
|
||||
cursor.hide();
|
||||
});
|
||||
|
||||
// tests complete
|
||||
runner.on('test end', function(){
|
||||
complete++;
|
||||
var incomplete = total - complete
|
||||
, percent = complete / total
|
||||
, n = width * percent | 0
|
||||
, i = width - n;
|
||||
|
||||
if (lastN === n && !options.verbose) {
|
||||
// Don't re-render the line if it hasn't changed
|
||||
return;
|
||||
}
|
||||
lastN = n;
|
||||
|
||||
cursor.CR();
|
||||
process.stdout.write('\u001b[J');
|
||||
process.stdout.write(color('progress', ' ' + options.open));
|
||||
process.stdout.write(Array(n).join(options.complete));
|
||||
process.stdout.write(Array(i).join(options.incomplete));
|
||||
process.stdout.write(color('progress', options.close));
|
||||
if (options.verbose) {
|
||||
process.stdout.write(color('progress', ' ' + complete + ' of ' + total));
|
||||
}
|
||||
});
|
||||
|
||||
// tests are complete, output some stats
|
||||
// and the failures if any
|
||||
runner.on('end', function(){
|
||||
cursor.show();
|
||||
console.log();
|
||||
self.epilogue();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Inherit from `Base.prototype`.
|
||||
*/
|
||||
|
||||
Progress.prototype.__proto__ = Base.prototype;
|
82
node_modules/mocha/lib/reporters/spec.js
generated
vendored
Normal file
82
node_modules/mocha/lib/reporters/spec.js
generated
vendored
Normal file
@ -0,0 +1,82 @@
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var Base = require('./base')
|
||||
, cursor = Base.cursor
|
||||
, color = Base.color;
|
||||
|
||||
/**
|
||||
* Expose `Spec`.
|
||||
*/
|
||||
|
||||
exports = module.exports = Spec;
|
||||
|
||||
/**
|
||||
* Initialize a new `Spec` test reporter.
|
||||
*
|
||||
* @param {Runner} runner
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function Spec(runner) {
|
||||
Base.call(this, runner);
|
||||
|
||||
var self = this
|
||||
, stats = this.stats
|
||||
, indents = 0
|
||||
, n = 0;
|
||||
|
||||
function indent() {
|
||||
return Array(indents).join(' ')
|
||||
}
|
||||
|
||||
runner.on('start', function(){
|
||||
console.log();
|
||||
});
|
||||
|
||||
runner.on('suite', function(suite){
|
||||
++indents;
|
||||
console.log(color('suite', '%s%s'), indent(), suite.title);
|
||||
});
|
||||
|
||||
runner.on('suite end', function(suite){
|
||||
--indents;
|
||||
if (1 == indents) console.log();
|
||||
});
|
||||
|
||||
runner.on('pending', function(test){
|
||||
var fmt = indent() + color('pending', ' - %s');
|
||||
console.log(fmt, test.title);
|
||||
});
|
||||
|
||||
runner.on('pass', function(test){
|
||||
if ('fast' == test.speed) {
|
||||
var fmt = indent()
|
||||
+ color('checkmark', ' ' + Base.symbols.ok)
|
||||
+ color('pass', ' %s');
|
||||
cursor.CR();
|
||||
console.log(fmt, test.title);
|
||||
} else {
|
||||
var fmt = indent()
|
||||
+ color('checkmark', ' ' + Base.symbols.ok)
|
||||
+ color('pass', ' %s')
|
||||
+ color(test.speed, ' (%dms)');
|
||||
cursor.CR();
|
||||
console.log(fmt, test.title, test.duration);
|
||||
}
|
||||
});
|
||||
|
||||
runner.on('fail', function(test, err){
|
||||
cursor.CR();
|
||||
console.log(indent() + color('fail', ' %d) %s'), ++n, test.title);
|
||||
});
|
||||
|
||||
runner.on('end', self.epilogue.bind(self));
|
||||
}
|
||||
|
||||
/**
|
||||
* Inherit from `Base.prototype`.
|
||||
*/
|
||||
|
||||
Spec.prototype.__proto__ = Base.prototype;
|
72
node_modules/mocha/lib/reporters/tap.js
generated
vendored
Normal file
72
node_modules/mocha/lib/reporters/tap.js
generated
vendored
Normal file
@ -0,0 +1,72 @@
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var Base = require('./base')
|
||||
, cursor = Base.cursor
|
||||
, color = Base.color;
|
||||
|
||||
/**
|
||||
* Expose `TAP`.
|
||||
*/
|
||||
|
||||
exports = module.exports = TAP;
|
||||
|
||||
/**
|
||||
* Initialize a new `TAP` reporter.
|
||||
*
|
||||
* @param {Runner} runner
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function TAP(runner) {
|
||||
Base.call(this, runner);
|
||||
|
||||
var self = this
|
||||
, stats = this.stats
|
||||
, n = 1
|
||||
, passes = 0
|
||||
, failures = 0;
|
||||
|
||||
runner.on('start', function(){
|
||||
var total = runner.grepTotal(runner.suite);
|
||||
console.log('%d..%d', 1, total);
|
||||
});
|
||||
|
||||
runner.on('test end', function(){
|
||||
++n;
|
||||
});
|
||||
|
||||
runner.on('pending', function(test){
|
||||
console.log('ok %d %s # SKIP -', n, title(test));
|
||||
});
|
||||
|
||||
runner.on('pass', function(test){
|
||||
passes++;
|
||||
console.log('ok %d %s', n, title(test));
|
||||
});
|
||||
|
||||
runner.on('fail', function(test, err){
|
||||
failures++;
|
||||
console.log('not ok %d %s', n, title(test));
|
||||
if (err.stack) console.log(err.stack.replace(/^/gm, ' '));
|
||||
});
|
||||
|
||||
runner.on('end', function(){
|
||||
console.log('# tests ' + (passes + failures));
|
||||
console.log('# pass ' + passes);
|
||||
console.log('# fail ' + failures);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a TAP-safe title of `test`
|
||||
*
|
||||
* @param {Object} test
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function title(test) {
|
||||
return test.fullTitle().replace(/#/g, '');
|
||||
}
|
51
node_modules/mocha/lib/reporters/templates/coverage.jade
generated
vendored
Normal file
51
node_modules/mocha/lib/reporters/templates/coverage.jade
generated
vendored
Normal file
@ -0,0 +1,51 @@
|
||||
doctype html
|
||||
html
|
||||
head
|
||||
title Coverage
|
||||
meta(charset='utf-8')
|
||||
include script.html
|
||||
include style.html
|
||||
body
|
||||
#coverage
|
||||
h1#overview Coverage
|
||||
include menu
|
||||
|
||||
#stats(class=coverageClass(cov.coverage))
|
||||
.percentage #{cov.coverage | 0}%
|
||||
.sloc= cov.sloc
|
||||
.hits= cov.hits
|
||||
.misses= cov.misses
|
||||
|
||||
#files
|
||||
for file in cov.files
|
||||
.file
|
||||
h2(id=file.filename)= file.filename
|
||||
#stats(class=coverageClass(file.coverage))
|
||||
.percentage #{file.coverage | 0}%
|
||||
.sloc= file.sloc
|
||||
.hits= file.hits
|
||||
.misses= file.misses
|
||||
|
||||
table#source
|
||||
thead
|
||||
tr
|
||||
th Line
|
||||
th Hits
|
||||
th Source
|
||||
tbody
|
||||
for line, number in file.source
|
||||
if line.coverage > 0
|
||||
tr.hit
|
||||
td.line= number
|
||||
td.hits= line.coverage
|
||||
td.source= line.source
|
||||
else if 0 === line.coverage
|
||||
tr.miss
|
||||
td.line= number
|
||||
td.hits 0
|
||||
td.source= line.source
|
||||
else
|
||||
tr
|
||||
td.line= number
|
||||
td.hits
|
||||
td.source= line.source || ' '
|
13
node_modules/mocha/lib/reporters/templates/menu.jade
generated
vendored
Normal file
13
node_modules/mocha/lib/reporters/templates/menu.jade
generated
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
#menu
|
||||
li
|
||||
a(href='#overview') overview
|
||||
for file in cov.files
|
||||
li
|
||||
span.cov(class=coverageClass(file.coverage)) #{file.coverage | 0}
|
||||
a(href='##{file.filename}')
|
||||
segments = file.filename.split('/')
|
||||
basename = segments.pop()
|
||||
if segments.length
|
||||
span.dirname= segments.join('/') + '/'
|
||||
span.basename= basename
|
||||
a#logo(href='http://mochajs.org/') m
|
34
node_modules/mocha/lib/reporters/templates/script.html
generated
vendored
Normal file
34
node_modules/mocha/lib/reporters/templates/script.html
generated
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
<script>
|
||||
|
||||
headings = [];
|
||||
|
||||
onload = function(){
|
||||
headings = document.querySelectorAll('h2');
|
||||
};
|
||||
|
||||
onscroll = function(e){
|
||||
var heading = find(window.scrollY);
|
||||
if (!heading) return;
|
||||
var links = document.querySelectorAll('#menu a')
|
||||
, link;
|
||||
|
||||
for (var i = 0, len = links.length; i < len; ++i) {
|
||||
link = links[i];
|
||||
link.className = link.getAttribute('href') == '#' + heading.id
|
||||
? 'active'
|
||||
: '';
|
||||
}
|
||||
};
|
||||
|
||||
function find(y) {
|
||||
var i = headings.length
|
||||
, heading;
|
||||
|
||||
while (i--) {
|
||||
heading = headings[i];
|
||||
if (y >= heading.offsetTop) {
|
||||
return heading;
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
324
node_modules/mocha/lib/reporters/templates/style.html
generated
vendored
Normal file
324
node_modules/mocha/lib/reporters/templates/style.html
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
149
node_modules/mocha/lib/reporters/xunit.js
generated
vendored
Normal file
149
node_modules/mocha/lib/reporters/xunit.js
generated
vendored
Normal file
@ -0,0 +1,149 @@
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var Base = require('./base')
|
||||
, utils = require('../utils')
|
||||
, fs = require('fs')
|
||||
, escape = utils.escape;
|
||||
|
||||
/**
|
||||
* Save timer references to avoid Sinon interfering (see GH-237).
|
||||
*/
|
||||
|
||||
var Date = global.Date
|
||||
, setTimeout = global.setTimeout
|
||||
, setInterval = global.setInterval
|
||||
, clearTimeout = global.clearTimeout
|
||||
, clearInterval = global.clearInterval;
|
||||
|
||||
/**
|
||||
* Expose `XUnit`.
|
||||
*/
|
||||
|
||||
exports = module.exports = XUnit;
|
||||
|
||||
/**
|
||||
* Initialize a new `XUnit` reporter.
|
||||
*
|
||||
* @param {Runner} runner
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function XUnit(runner, options) {
|
||||
Base.call(this, runner);
|
||||
var stats = this.stats
|
||||
, tests = []
|
||||
, self = this;
|
||||
|
||||
if (options.reporterOptions && options.reporterOptions.output) {
|
||||
if (! fs.createWriteStream) {
|
||||
throw new Error('file output not supported in browser');
|
||||
}
|
||||
self.fileStream = fs.createWriteStream(options.reporterOptions.output);
|
||||
}
|
||||
|
||||
runner.on('pending', function(test){
|
||||
tests.push(test);
|
||||
});
|
||||
|
||||
runner.on('pass', function(test){
|
||||
tests.push(test);
|
||||
});
|
||||
|
||||
runner.on('fail', function(test){
|
||||
tests.push(test);
|
||||
});
|
||||
|
||||
runner.on('end', function(){
|
||||
self.write(tag('testsuite', {
|
||||
name: 'Mocha Tests'
|
||||
, tests: stats.tests
|
||||
, failures: stats.failures
|
||||
, errors: stats.failures
|
||||
, skipped: stats.tests - stats.failures - stats.passes
|
||||
, timestamp: (new Date).toUTCString()
|
||||
, time: (stats.duration / 1000) || 0
|
||||
}, false));
|
||||
|
||||
tests.forEach(function(t) { self.test(t); });
|
||||
self.write('</testsuite>');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Override done to close the stream (if it's a file).
|
||||
*/
|
||||
XUnit.prototype.done = function(failures, fn) {
|
||||
if (this.fileStream) {
|
||||
this.fileStream.end(function() {
|
||||
fn(failures);
|
||||
});
|
||||
} else {
|
||||
fn(failures);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Inherit from `Base.prototype`.
|
||||
*/
|
||||
|
||||
XUnit.prototype.__proto__ = Base.prototype;
|
||||
|
||||
/**
|
||||
* Write out the given line
|
||||
*/
|
||||
XUnit.prototype.write = function(line) {
|
||||
if (this.fileStream) {
|
||||
this.fileStream.write(line + '\n');
|
||||
} else {
|
||||
console.log(line);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Output tag for the given `test.`
|
||||
*/
|
||||
|
||||
XUnit.prototype.test = function(test, ostream) {
|
||||
var attrs = {
|
||||
classname: test.parent.fullTitle()
|
||||
, name: test.title
|
||||
, time: (test.duration / 1000) || 0
|
||||
};
|
||||
|
||||
if ('failed' == test.state) {
|
||||
var err = test.err;
|
||||
this.write(tag('testcase', attrs, false, tag('failure', {}, false, cdata(escape(err.message) + "\n" + err.stack))));
|
||||
} else if (test.pending) {
|
||||
this.write(tag('testcase', attrs, false, tag('skipped', {}, true)));
|
||||
} else {
|
||||
this.write(tag('testcase', attrs, true) );
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* HTML tag helper.
|
||||
*/
|
||||
|
||||
function tag(name, attrs, close, content) {
|
||||
var end = close ? '/>' : '>'
|
||||
, pairs = []
|
||||
, tag;
|
||||
|
||||
for (var key in attrs) {
|
||||
pairs.push(key + '="' + escape(attrs[key]) + '"');
|
||||
}
|
||||
|
||||
tag = '<' + name + (pairs.length ? ' ' + pairs.join(' ') : '') + end;
|
||||
if (content) tag += content + '</' + name + end;
|
||||
return tag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return cdata escaped CDATA `str`.
|
||||
*/
|
||||
|
||||
function cdata(str) {
|
||||
return '<![CDATA[' + escape(str) + ']]>';
|
||||
}
|
280
node_modules/mocha/lib/runnable.js
generated
vendored
Normal file
280
node_modules/mocha/lib/runnable.js
generated
vendored
Normal file
@ -0,0 +1,280 @@
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var EventEmitter = require('events').EventEmitter
|
||||
, debug = require('debug')('mocha:runnable')
|
||||
, Pending = require('./pending')
|
||||
, milliseconds = require('./ms')
|
||||
, utils = require('./utils');
|
||||
|
||||
/**
|
||||
* Save timer references to avoid Sinon interfering (see GH-237).
|
||||
*/
|
||||
|
||||
var Date = global.Date
|
||||
, setTimeout = global.setTimeout
|
||||
, setInterval = global.setInterval
|
||||
, clearTimeout = global.clearTimeout
|
||||
, clearInterval = global.clearInterval;
|
||||
|
||||
/**
|
||||
* Object#toString().
|
||||
*/
|
||||
|
||||
var toString = Object.prototype.toString;
|
||||
|
||||
/**
|
||||
* Expose `Runnable`.
|
||||
*/
|
||||
|
||||
module.exports = Runnable;
|
||||
|
||||
/**
|
||||
* Initialize a new `Runnable` with the given `title` and callback `fn`.
|
||||
*
|
||||
* @param {String} title
|
||||
* @param {Function} fn
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function Runnable(title, fn) {
|
||||
this.title = title;
|
||||
this.fn = fn;
|
||||
this.async = fn && fn.length;
|
||||
this.sync = ! this.async;
|
||||
this._timeout = 2000;
|
||||
this._slow = 75;
|
||||
this._enableTimeouts = true;
|
||||
this.timedOut = false;
|
||||
this._trace = new Error('done() called multiple times')
|
||||
}
|
||||
|
||||
/**
|
||||
* Inherit from `EventEmitter.prototype`.
|
||||
*/
|
||||
|
||||
Runnable.prototype.__proto__ = EventEmitter.prototype;
|
||||
|
||||
/**
|
||||
* Set & get timeout `ms`.
|
||||
*
|
||||
* @param {Number|String} ms
|
||||
* @return {Runnable|Number} ms or self
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Runnable.prototype.timeout = function(ms){
|
||||
if (0 == arguments.length) return this._timeout;
|
||||
if (ms === 0) this._enableTimeouts = false;
|
||||
if ('string' == typeof ms) ms = milliseconds(ms);
|
||||
debug('timeout %d', ms);
|
||||
this._timeout = ms;
|
||||
if (this.timer) this.resetTimeout();
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Set & get slow `ms`.
|
||||
*
|
||||
* @param {Number|String} ms
|
||||
* @return {Runnable|Number} ms or self
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Runnable.prototype.slow = function(ms){
|
||||
if (0 === arguments.length) return this._slow;
|
||||
if ('string' == typeof ms) ms = milliseconds(ms);
|
||||
debug('timeout %d', ms);
|
||||
this._slow = ms;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Set and & get timeout `enabled`.
|
||||
*
|
||||
* @param {Boolean} enabled
|
||||
* @return {Runnable|Boolean} enabled or self
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Runnable.prototype.enableTimeouts = function(enabled){
|
||||
if (arguments.length === 0) return this._enableTimeouts;
|
||||
debug('enableTimeouts %s', enabled);
|
||||
this._enableTimeouts = enabled;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Halt and mark as pending.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Runnable.prototype.skip = function(){
|
||||
throw new Pending();
|
||||
};
|
||||
|
||||
/**
|
||||
* Return the full title generated by recursively
|
||||
* concatenating the parent's full title.
|
||||
*
|
||||
* @return {String}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Runnable.prototype.fullTitle = function(){
|
||||
return this.parent.fullTitle() + ' ' + this.title;
|
||||
};
|
||||
|
||||
/**
|
||||
* Clear the timeout.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Runnable.prototype.clearTimeout = function(){
|
||||
clearTimeout(this.timer);
|
||||
};
|
||||
|
||||
/**
|
||||
* Inspect the runnable void of private properties.
|
||||
*
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Runnable.prototype.inspect = function(){
|
||||
return JSON.stringify(this, function(key, val){
|
||||
if ('_' == key[0]) return;
|
||||
if ('parent' == key) return '#<Suite>';
|
||||
if ('ctx' == key) return '#<Context>';
|
||||
return val;
|
||||
}, 2);
|
||||
};
|
||||
|
||||
/**
|
||||
* Reset the timeout.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Runnable.prototype.resetTimeout = function(){
|
||||
var self = this;
|
||||
var ms = this.timeout() || 1e9;
|
||||
|
||||
if (!this._enableTimeouts) return;
|
||||
this.clearTimeout();
|
||||
this.timer = setTimeout(function(){
|
||||
if (!self._enableTimeouts) return;
|
||||
self.callback(new Error('timeout of ' + ms + 'ms exceeded. Ensure the done() callback is being called in this test.'));
|
||||
self.timedOut = true;
|
||||
}, ms);
|
||||
};
|
||||
|
||||
/**
|
||||
* Whitelist these globals for this test run
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
Runnable.prototype.globals = function(arr){
|
||||
var self = this;
|
||||
this._allowedGlobals = arr;
|
||||
};
|
||||
|
||||
/**
|
||||
* Run the test and invoke `fn(err)`.
|
||||
*
|
||||
* @param {Function} fn
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Runnable.prototype.run = function(fn){
|
||||
var self = this
|
||||
, start = new Date
|
||||
, ctx = this.ctx
|
||||
, finished
|
||||
, emitted;
|
||||
|
||||
// Some times the ctx exists but it is not runnable
|
||||
if (ctx && ctx.runnable) ctx.runnable(this);
|
||||
|
||||
// called multiple times
|
||||
function multiple(err) {
|
||||
if (emitted) return;
|
||||
emitted = true;
|
||||
self.emit('error', err || new Error('done() called multiple times; stacktrace may be inaccurate'));
|
||||
}
|
||||
|
||||
// finished
|
||||
function done(err) {
|
||||
var ms = self.timeout();
|
||||
if (self.timedOut) return;
|
||||
if (finished) return multiple(err || self._trace);
|
||||
|
||||
// Discard the resolution if this test has already failed asynchronously
|
||||
if (self.state) return;
|
||||
|
||||
self.clearTimeout();
|
||||
self.duration = new Date - start;
|
||||
finished = true;
|
||||
if (!err && self.duration > ms && self._enableTimeouts) err = new Error('timeout of ' + ms + 'ms exceeded. Ensure the done() callback is being called in this test.');
|
||||
fn(err);
|
||||
}
|
||||
|
||||
// for .resetTimeout()
|
||||
this.callback = done;
|
||||
|
||||
// explicit async with `done` argument
|
||||
if (this.async) {
|
||||
this.resetTimeout();
|
||||
|
||||
try {
|
||||
this.fn.call(ctx, function(err){
|
||||
if (err instanceof Error || toString.call(err) === "[object Error]") return done(err);
|
||||
if (null != err) {
|
||||
if (Object.prototype.toString.call(err) === '[object Object]') {
|
||||
return done(new Error('done() invoked with non-Error: ' + JSON.stringify(err)));
|
||||
} else {
|
||||
return done(new Error('done() invoked with non-Error: ' + err));
|
||||
}
|
||||
}
|
||||
done();
|
||||
});
|
||||
} catch (err) {
|
||||
done(utils.getError(err));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.asyncOnly) {
|
||||
return done(new Error('--async-only option in use without declaring `done()`'));
|
||||
}
|
||||
|
||||
// sync or promise-returning
|
||||
try {
|
||||
if (this.pending) {
|
||||
done();
|
||||
} else {
|
||||
callFn(this.fn);
|
||||
}
|
||||
} catch (err) {
|
||||
done(utils.getError(err));
|
||||
}
|
||||
|
||||
function callFn(fn) {
|
||||
var result = fn.call(ctx);
|
||||
if (result && typeof result.then === 'function') {
|
||||
self.resetTimeout();
|
||||
result
|
||||
.then(function() {
|
||||
done()
|
||||
},
|
||||
function(reason) {
|
||||
done(reason || new Error('Promise rejected with no or falsy reason'))
|
||||
});
|
||||
} else {
|
||||
done();
|
||||
}
|
||||
}
|
||||
};
|
716
node_modules/mocha/lib/runner.js
generated
vendored
Normal file
716
node_modules/mocha/lib/runner.js
generated
vendored
Normal file
@ -0,0 +1,716 @@
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var EventEmitter = require('events').EventEmitter
|
||||
, debug = require('debug')('mocha:runner')
|
||||
, Pending = require('./pending')
|
||||
, Test = require('./test')
|
||||
, utils = require('./utils')
|
||||
, filter = utils.filter
|
||||
, keys = utils.keys
|
||||
, type = utils.type
|
||||
, stringify = utils.stringify
|
||||
, stackFilter = utils.stackTraceFilter();
|
||||
|
||||
/**
|
||||
* Non-enumerable globals.
|
||||
*/
|
||||
|
||||
var globals = [
|
||||
'setTimeout',
|
||||
'clearTimeout',
|
||||
'setInterval',
|
||||
'clearInterval',
|
||||
'XMLHttpRequest',
|
||||
'Date',
|
||||
'setImmediate',
|
||||
'clearImmediate'
|
||||
];
|
||||
|
||||
/**
|
||||
* Expose `Runner`.
|
||||
*/
|
||||
|
||||
module.exports = Runner;
|
||||
|
||||
/**
|
||||
* Initialize a `Runner` for the given `suite`.
|
||||
*
|
||||
* Events:
|
||||
*
|
||||
* - `start` execution started
|
||||
* - `end` execution complete
|
||||
* - `suite` (suite) test suite execution started
|
||||
* - `suite end` (suite) all tests (and sub-suites) have finished
|
||||
* - `test` (test) test execution started
|
||||
* - `test end` (test) test completed
|
||||
* - `hook` (hook) hook execution started
|
||||
* - `hook end` (hook) hook complete
|
||||
* - `pass` (test) test passed
|
||||
* - `fail` (test, err) test failed
|
||||
* - `pending` (test) test pending
|
||||
*
|
||||
* @param {Suite} suite Root suite
|
||||
* @param {boolean} [delay] Whether or not to delay execution of root suite
|
||||
* until ready.
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function Runner(suite, delay) {
|
||||
var self = this;
|
||||
this._globals = [];
|
||||
this._abort = false;
|
||||
this._delay = delay;
|
||||
this.suite = suite;
|
||||
this.total = suite.total();
|
||||
this.failures = 0;
|
||||
this.on('test end', function(test){ self.checkGlobals(test); });
|
||||
this.on('hook end', function(hook){ self.checkGlobals(hook); });
|
||||
this.grep(/.*/);
|
||||
this.globals(this.globalProps().concat(extraGlobals()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper for setImmediate, process.nextTick, or browser polyfill.
|
||||
*
|
||||
* @param {Function} fn
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Runner.immediately = global.setImmediate || process.nextTick;
|
||||
|
||||
/**
|
||||
* Inherit from `EventEmitter.prototype`.
|
||||
*/
|
||||
|
||||
Runner.prototype.__proto__ = EventEmitter.prototype;
|
||||
|
||||
/**
|
||||
* Run tests with full titles matching `re`. Updates runner.total
|
||||
* with number of tests matched.
|
||||
*
|
||||
* @param {RegExp} re
|
||||
* @param {Boolean} invert
|
||||
* @return {Runner} for chaining
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Runner.prototype.grep = function(re, invert){
|
||||
debug('grep %s', re);
|
||||
this._grep = re;
|
||||
this._invert = invert;
|
||||
this.total = this.grepTotal(this.suite);
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the number of tests matching the grep search for the
|
||||
* given suite.
|
||||
*
|
||||
* @param {Suite} suite
|
||||
* @return {Number}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Runner.prototype.grepTotal = function(suite) {
|
||||
var self = this;
|
||||
var total = 0;
|
||||
|
||||
suite.eachTest(function(test){
|
||||
var match = self._grep.test(test.fullTitle());
|
||||
if (self._invert) match = !match;
|
||||
if (match) total++;
|
||||
});
|
||||
|
||||
return total;
|
||||
};
|
||||
|
||||
/**
|
||||
* Return a list of global properties.
|
||||
*
|
||||
* @return {Array}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Runner.prototype.globalProps = function() {
|
||||
var props = utils.keys(global);
|
||||
|
||||
// non-enumerables
|
||||
for (var i = 0; i < globals.length; ++i) {
|
||||
if (~utils.indexOf(props, globals[i])) continue;
|
||||
props.push(globals[i]);
|
||||
}
|
||||
|
||||
return props;
|
||||
};
|
||||
|
||||
/**
|
||||
* Allow the given `arr` of globals.
|
||||
*
|
||||
* @param {Array} arr
|
||||
* @return {Runner} for chaining
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Runner.prototype.globals = function(arr){
|
||||
if (0 == arguments.length) return this._globals;
|
||||
debug('globals %j', arr);
|
||||
this._globals = this._globals.concat(arr);
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Check for global variable leaks.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Runner.prototype.checkGlobals = function(test){
|
||||
if (this.ignoreLeaks) return;
|
||||
var ok = this._globals;
|
||||
|
||||
var globals = this.globalProps();
|
||||
var leaks;
|
||||
|
||||
if (test) {
|
||||
ok = ok.concat(test._allowedGlobals || []);
|
||||
}
|
||||
|
||||
if(this.prevGlobalsLength == globals.length) return;
|
||||
this.prevGlobalsLength = globals.length;
|
||||
|
||||
leaks = filterLeaks(ok, globals);
|
||||
this._globals = this._globals.concat(leaks);
|
||||
|
||||
if (leaks.length > 1) {
|
||||
this.fail(test, new Error('global leaks detected: ' + leaks.join(', ') + ''));
|
||||
} else if (leaks.length) {
|
||||
this.fail(test, new Error('global leak detected: ' + leaks[0]));
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Fail the given `test`.
|
||||
*
|
||||
* @param {Test} test
|
||||
* @param {Error} err
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Runner.prototype.fail = function(test, err) {
|
||||
++this.failures;
|
||||
test.state = 'failed';
|
||||
|
||||
if (!(err instanceof Error)) {
|
||||
err = new Error('the ' + type(err) + ' ' + stringify(err) + ' was thrown, throw an Error :)');
|
||||
}
|
||||
|
||||
err.stack = (this.fullStackTrace || !err.stack)
|
||||
? err.stack
|
||||
: stackFilter(err.stack);
|
||||
|
||||
this.emit('fail', test, err);
|
||||
};
|
||||
|
||||
/**
|
||||
* Fail the given `hook` with `err`.
|
||||
*
|
||||
* Hook failures work in the following pattern:
|
||||
* - If bail, then exit
|
||||
* - Failed `before` hook skips all tests in a suite and subsuites,
|
||||
* but jumps to corresponding `after` hook
|
||||
* - Failed `before each` hook skips remaining tests in a
|
||||
* suite and jumps to corresponding `after each` hook,
|
||||
* which is run only once
|
||||
* - Failed `after` hook does not alter
|
||||
* execution order
|
||||
* - Failed `after each` hook skips remaining tests in a
|
||||
* suite and subsuites, but executes other `after each`
|
||||
* hooks
|
||||
*
|
||||
* @param {Hook} hook
|
||||
* @param {Error} err
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Runner.prototype.failHook = function(hook, err){
|
||||
this.fail(hook, err);
|
||||
if (this.suite.bail()) {
|
||||
this.emit('end');
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Run hook `name` callbacks and then invoke `fn()`.
|
||||
*
|
||||
* @param {String} name
|
||||
* @param {Function} function
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Runner.prototype.hook = function(name, fn){
|
||||
var suite = this.suite
|
||||
, hooks = suite['_' + name]
|
||||
, self = this
|
||||
, timer;
|
||||
|
||||
function next(i) {
|
||||
var hook = hooks[i];
|
||||
if (!hook) return fn();
|
||||
self.currentRunnable = hook;
|
||||
|
||||
hook.ctx.currentTest = self.test;
|
||||
|
||||
self.emit('hook', hook);
|
||||
|
||||
hook.on('error', function(err){
|
||||
self.failHook(hook, err);
|
||||
});
|
||||
|
||||
hook.run(function(err){
|
||||
hook.removeAllListeners('error');
|
||||
var testError = hook.error();
|
||||
if (testError) self.fail(self.test, testError);
|
||||
if (err) {
|
||||
if (err instanceof Pending) {
|
||||
suite.pending = true;
|
||||
} else {
|
||||
self.failHook(hook, err);
|
||||
|
||||
// stop executing hooks, notify callee of hook err
|
||||
return fn(err);
|
||||
}
|
||||
}
|
||||
self.emit('hook end', hook);
|
||||
delete hook.ctx.currentTest;
|
||||
next(++i);
|
||||
});
|
||||
}
|
||||
|
||||
Runner.immediately(function(){
|
||||
next(0);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Run hook `name` for the given array of `suites`
|
||||
* in order, and callback `fn(err, errSuite)`.
|
||||
*
|
||||
* @param {String} name
|
||||
* @param {Array} suites
|
||||
* @param {Function} fn
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Runner.prototype.hooks = function(name, suites, fn){
|
||||
var self = this
|
||||
, orig = this.suite;
|
||||
|
||||
function next(suite) {
|
||||
self.suite = suite;
|
||||
|
||||
if (!suite) {
|
||||
self.suite = orig;
|
||||
return fn();
|
||||
}
|
||||
|
||||
self.hook(name, function(err){
|
||||
if (err) {
|
||||
var errSuite = self.suite;
|
||||
self.suite = orig;
|
||||
return fn(err, errSuite);
|
||||
}
|
||||
|
||||
next(suites.pop());
|
||||
});
|
||||
}
|
||||
|
||||
next(suites.pop());
|
||||
};
|
||||
|
||||
/**
|
||||
* Run hooks from the top level down.
|
||||
*
|
||||
* @param {String} name
|
||||
* @param {Function} fn
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Runner.prototype.hookUp = function(name, fn){
|
||||
var suites = [this.suite].concat(this.parents()).reverse();
|
||||
this.hooks(name, suites, fn);
|
||||
};
|
||||
|
||||
/**
|
||||
* Run hooks from the bottom up.
|
||||
*
|
||||
* @param {String} name
|
||||
* @param {Function} fn
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Runner.prototype.hookDown = function(name, fn){
|
||||
var suites = [this.suite].concat(this.parents());
|
||||
this.hooks(name, suites, fn);
|
||||
};
|
||||
|
||||
/**
|
||||
* Return an array of parent Suites from
|
||||
* closest to furthest.
|
||||
*
|
||||
* @return {Array}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Runner.prototype.parents = function(){
|
||||
var suite = this.suite
|
||||
, suites = [];
|
||||
while (suite = suite.parent) suites.push(suite);
|
||||
return suites;
|
||||
};
|
||||
|
||||
/**
|
||||
* Run the current test and callback `fn(err)`.
|
||||
*
|
||||
* @param {Function} fn
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Runner.prototype.runTest = function(fn){
|
||||
var test = this.test
|
||||
, self = this;
|
||||
|
||||
if (this.asyncOnly) test.asyncOnly = true;
|
||||
|
||||
try {
|
||||
test.on('error', function(err){
|
||||
self.fail(test, err);
|
||||
});
|
||||
test.run(fn);
|
||||
} catch (err) {
|
||||
fn(err);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Run tests in the given `suite` and invoke
|
||||
* the callback `fn()` when complete.
|
||||
*
|
||||
* @param {Suite} suite
|
||||
* @param {Function} fn
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Runner.prototype.runTests = function(suite, fn){
|
||||
var self = this
|
||||
, tests = suite.tests.slice()
|
||||
, test;
|
||||
|
||||
|
||||
function hookErr(err, errSuite, after) {
|
||||
// before/after Each hook for errSuite failed:
|
||||
var orig = self.suite;
|
||||
|
||||
// for failed 'after each' hook start from errSuite parent,
|
||||
// otherwise start from errSuite itself
|
||||
self.suite = after ? errSuite.parent : errSuite;
|
||||
|
||||
if (self.suite) {
|
||||
// call hookUp afterEach
|
||||
self.hookUp('afterEach', function(err2, errSuite2) {
|
||||
self.suite = orig;
|
||||
// some hooks may fail even now
|
||||
if (err2) return hookErr(err2, errSuite2, true);
|
||||
// report error suite
|
||||
fn(errSuite);
|
||||
});
|
||||
} else {
|
||||
// there is no need calling other 'after each' hooks
|
||||
self.suite = orig;
|
||||
fn(errSuite);
|
||||
}
|
||||
}
|
||||
|
||||
function next(err, errSuite) {
|
||||
// if we bail after first err
|
||||
if (self.failures && suite._bail) return fn();
|
||||
|
||||
if (self._abort) return fn();
|
||||
|
||||
if (err) return hookErr(err, errSuite, true);
|
||||
|
||||
// next test
|
||||
test = tests.shift();
|
||||
|
||||
// all done
|
||||
if (!test) return fn();
|
||||
|
||||
// grep
|
||||
var match = self._grep.test(test.fullTitle());
|
||||
if (self._invert) match = !match;
|
||||
if (!match) return next();
|
||||
|
||||
// pending
|
||||
if (test.pending) {
|
||||
self.emit('pending', test);
|
||||
self.emit('test end', test);
|
||||
return next();
|
||||
}
|
||||
|
||||
// execute test and hook(s)
|
||||
self.emit('test', self.test = test);
|
||||
self.hookDown('beforeEach', function(err, errSuite){
|
||||
|
||||
if (suite.pending) {
|
||||
self.emit('pending', test);
|
||||
self.emit('test end', test);
|
||||
return next();
|
||||
}
|
||||
if (err) return hookErr(err, errSuite, false);
|
||||
|
||||
self.currentRunnable = self.test;
|
||||
self.runTest(function(err){
|
||||
test = self.test;
|
||||
|
||||
if (err) {
|
||||
if (err instanceof Pending) {
|
||||
self.emit('pending', test);
|
||||
} else {
|
||||
self.fail(test, err);
|
||||
}
|
||||
self.emit('test end', test);
|
||||
|
||||
if (err instanceof Pending) {
|
||||
return next();
|
||||
}
|
||||
|
||||
return self.hookUp('afterEach', next);
|
||||
}
|
||||
|
||||
test.state = 'passed';
|
||||
self.emit('pass', test);
|
||||
self.emit('test end', test);
|
||||
self.hookUp('afterEach', next);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
this.next = next;
|
||||
next();
|
||||
};
|
||||
|
||||
/**
|
||||
* Run the given `suite` and invoke the
|
||||
* callback `fn()` when complete.
|
||||
*
|
||||
* @param {Suite} suite
|
||||
* @param {Function} fn
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Runner.prototype.runSuite = function(suite, fn){
|
||||
var total = this.grepTotal(suite)
|
||||
, self = this
|
||||
, i = 0;
|
||||
|
||||
debug('run suite %s', suite.fullTitle());
|
||||
|
||||
if (!total) return fn();
|
||||
|
||||
this.emit('suite', this.suite = suite);
|
||||
|
||||
function next(errSuite) {
|
||||
if (errSuite) {
|
||||
// current suite failed on a hook from errSuite
|
||||
if (errSuite == suite) {
|
||||
// if errSuite is current suite
|
||||
// continue to the next sibling suite
|
||||
return done();
|
||||
} else {
|
||||
// errSuite is among the parents of current suite
|
||||
// stop execution of errSuite and all sub-suites
|
||||
return done(errSuite);
|
||||
}
|
||||
}
|
||||
|
||||
if (self._abort) return done();
|
||||
|
||||
var curr = suite.suites[i++];
|
||||
if (!curr) return done();
|
||||
self.runSuite(curr, next);
|
||||
}
|
||||
|
||||
function done(errSuite) {
|
||||
self.suite = suite;
|
||||
self.hook('afterAll', function(){
|
||||
self.emit('suite end', suite);
|
||||
fn(errSuite);
|
||||
});
|
||||
}
|
||||
|
||||
this.hook('beforeAll', function(err){
|
||||
if (err) return done();
|
||||
self.runTests(suite, next);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Handle uncaught exceptions.
|
||||
*
|
||||
* @param {Error} err
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Runner.prototype.uncaught = function(err){
|
||||
if (err) {
|
||||
debug('uncaught exception %s', err !== function () {
|
||||
return this;
|
||||
}.call(err) ? err : ( err.message || err ));
|
||||
} else {
|
||||
debug('uncaught undefined exception');
|
||||
err = utils.undefinedError();
|
||||
}
|
||||
err.uncaught = true;
|
||||
|
||||
var runnable = this.currentRunnable;
|
||||
if (!runnable) return;
|
||||
|
||||
runnable.clearTimeout();
|
||||
|
||||
// Ignore errors if complete
|
||||
if (runnable.state) return;
|
||||
this.fail(runnable, err);
|
||||
|
||||
// recover from test
|
||||
if ('test' == runnable.type) {
|
||||
this.emit('test end', runnable);
|
||||
this.hookUp('afterEach', this.next);
|
||||
return;
|
||||
}
|
||||
|
||||
// bail on hooks
|
||||
this.emit('end');
|
||||
};
|
||||
|
||||
/**
|
||||
* Run the root suite and invoke `fn(failures)`
|
||||
* on completion.
|
||||
*
|
||||
* @param {Function} fn
|
||||
* @return {Runner} for chaining
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Runner.prototype.run = function(fn){
|
||||
var self = this,
|
||||
rootSuite = this.suite;
|
||||
|
||||
fn = fn || function(){};
|
||||
|
||||
function uncaught(err){
|
||||
self.uncaught(err);
|
||||
}
|
||||
|
||||
function start() {
|
||||
self.emit('start');
|
||||
self.runSuite(rootSuite, function(){
|
||||
debug('finished running');
|
||||
self.emit('end');
|
||||
});
|
||||
}
|
||||
|
||||
debug('start');
|
||||
|
||||
// callback
|
||||
this.on('end', function(){
|
||||
debug('end');
|
||||
process.removeListener('uncaughtException', uncaught);
|
||||
fn(self.failures);
|
||||
});
|
||||
|
||||
// uncaught exception
|
||||
process.on('uncaughtException', uncaught);
|
||||
|
||||
if (this._delay) {
|
||||
// for reporters, I guess.
|
||||
// might be nice to debounce some dots while we wait.
|
||||
this.emit('waiting', rootSuite);
|
||||
rootSuite.once('run', start);
|
||||
}
|
||||
else {
|
||||
start();
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Cleanly abort execution
|
||||
*
|
||||
* @return {Runner} for chaining
|
||||
* @api public
|
||||
*/
|
||||
Runner.prototype.abort = function(){
|
||||
debug('aborting');
|
||||
this._abort = true;
|
||||
};
|
||||
|
||||
/**
|
||||
* Filter leaks with the given globals flagged as `ok`.
|
||||
*
|
||||
* @param {Array} ok
|
||||
* @param {Array} globals
|
||||
* @return {Array}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function filterLeaks(ok, globals) {
|
||||
return filter(globals, function(key){
|
||||
// Firefox and Chrome exposes iframes as index inside the window object
|
||||
if (/^d+/.test(key)) return false;
|
||||
|
||||
// in firefox
|
||||
// if runner runs in an iframe, this iframe's window.getInterface method not init at first
|
||||
// it is assigned in some seconds
|
||||
if (global.navigator && /^getInterface/.test(key)) return false;
|
||||
|
||||
// an iframe could be approached by window[iframeIndex]
|
||||
// in ie6,7,8 and opera, iframeIndex is enumerable, this could cause leak
|
||||
if (global.navigator && /^\d+/.test(key)) return false;
|
||||
|
||||
// Opera and IE expose global variables for HTML element IDs (issue #243)
|
||||
if (/^mocha-/.test(key)) return false;
|
||||
|
||||
var matched = filter(ok, function(ok){
|
||||
if (~ok.indexOf('*')) return 0 == key.indexOf(ok.split('*')[0]);
|
||||
return key == ok;
|
||||
});
|
||||
return matched.length == 0 && (!global.navigator || 'onerror' !== key);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of globals dependent on the environment.
|
||||
*
|
||||
* @return {Array}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function extraGlobals() {
|
||||
if (typeof(process) === 'object' &&
|
||||
typeof(process.version) === 'string') {
|
||||
|
||||
var nodeVersion = process.version.split('.').reduce(function(a, v) {
|
||||
return a << 8 | v;
|
||||
});
|
||||
|
||||
// 'errno' was renamed to process._errno in v0.9.11.
|
||||
|
||||
if (nodeVersion < 0x00090B) {
|
||||
return ['errno'];
|
||||
}
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
355
node_modules/mocha/lib/suite.js
generated
vendored
Normal file
355
node_modules/mocha/lib/suite.js
generated
vendored
Normal file
@ -0,0 +1,355 @@
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var EventEmitter = require('events').EventEmitter
|
||||
, debug = require('debug')('mocha:suite')
|
||||
, milliseconds = require('./ms')
|
||||
, utils = require('./utils')
|
||||
, Hook = require('./hook');
|
||||
|
||||
/**
|
||||
* Expose `Suite`.
|
||||
*/
|
||||
|
||||
exports = module.exports = Suite;
|
||||
|
||||
/**
|
||||
* Create a new `Suite` with the given `title`
|
||||
* and parent `Suite`. When a suite with the
|
||||
* same title is already present, that suite
|
||||
* is returned to provide nicer reporter
|
||||
* and more flexible meta-testing.
|
||||
*
|
||||
* @param {Suite} parent
|
||||
* @param {String} title
|
||||
* @return {Suite}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
exports.create = function(parent, title){
|
||||
var suite = new Suite(title, parent.ctx);
|
||||
suite.parent = parent;
|
||||
if (parent.pending) suite.pending = true;
|
||||
title = suite.fullTitle();
|
||||
parent.addSuite(suite);
|
||||
return suite;
|
||||
};
|
||||
|
||||
/**
|
||||
* Initialize a new `Suite` with the given
|
||||
* `title` and `ctx`.
|
||||
*
|
||||
* @param {String} title
|
||||
* @param {Context} ctx
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function Suite(title, parentContext) {
|
||||
this.title = title;
|
||||
var context = function() {};
|
||||
context.prototype = parentContext;
|
||||
this.ctx = new context();
|
||||
this.suites = [];
|
||||
this.tests = [];
|
||||
this.pending = false;
|
||||
this._beforeEach = [];
|
||||
this._beforeAll = [];
|
||||
this._afterEach = [];
|
||||
this._afterAll = [];
|
||||
this.root = !title;
|
||||
this._timeout = 2000;
|
||||
this._enableTimeouts = true;
|
||||
this._slow = 75;
|
||||
this._bail = false;
|
||||
this.delayed = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Inherit from `EventEmitter.prototype`.
|
||||
*/
|
||||
|
||||
Suite.prototype.__proto__ = EventEmitter.prototype;
|
||||
|
||||
/**
|
||||
* Return a clone of this `Suite`.
|
||||
*
|
||||
* @return {Suite}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Suite.prototype.clone = function(){
|
||||
var suite = new Suite(this.title);
|
||||
debug('clone');
|
||||
suite.ctx = this.ctx;
|
||||
suite.timeout(this.timeout());
|
||||
suite.enableTimeouts(this.enableTimeouts());
|
||||
suite.slow(this.slow());
|
||||
suite.bail(this.bail());
|
||||
return suite;
|
||||
};
|
||||
|
||||
/**
|
||||
* Set timeout `ms` or short-hand such as "2s".
|
||||
*
|
||||
* @param {Number|String} ms
|
||||
* @return {Suite|Number} for chaining
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Suite.prototype.timeout = function(ms){
|
||||
if (0 == arguments.length) return this._timeout;
|
||||
if (ms.toString() === '0') this._enableTimeouts = false;
|
||||
if ('string' == typeof ms) ms = milliseconds(ms);
|
||||
debug('timeout %d', ms);
|
||||
this._timeout = parseInt(ms, 10);
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Set timeout `enabled`.
|
||||
*
|
||||
* @param {Boolean} enabled
|
||||
* @return {Suite|Boolean} self or enabled
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Suite.prototype.enableTimeouts = function(enabled){
|
||||
if (arguments.length === 0) return this._enableTimeouts;
|
||||
debug('enableTimeouts %s', enabled);
|
||||
this._enableTimeouts = enabled;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Set slow `ms` or short-hand such as "2s".
|
||||
*
|
||||
* @param {Number|String} ms
|
||||
* @return {Suite|Number} for chaining
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Suite.prototype.slow = function(ms){
|
||||
if (0 === arguments.length) return this._slow;
|
||||
if ('string' == typeof ms) ms = milliseconds(ms);
|
||||
debug('slow %d', ms);
|
||||
this._slow = ms;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets whether to bail after first error.
|
||||
*
|
||||
* @param {Boolean} bail
|
||||
* @return {Suite|Number} for chaining
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Suite.prototype.bail = function(bail){
|
||||
if (0 == arguments.length) return this._bail;
|
||||
debug('bail %s', bail);
|
||||
this._bail = bail;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Run `fn(test[, done])` before running tests.
|
||||
*
|
||||
* @param {Function} fn
|
||||
* @return {Suite} for chaining
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Suite.prototype.beforeAll = function(title, fn){
|
||||
if (this.pending) return this;
|
||||
if ('function' === typeof title) {
|
||||
fn = title;
|
||||
title = fn.name;
|
||||
}
|
||||
title = '"before all" hook' + (title ? ': ' + title : '');
|
||||
|
||||
var hook = new Hook(title, fn);
|
||||
hook.parent = this;
|
||||
hook.timeout(this.timeout());
|
||||
hook.enableTimeouts(this.enableTimeouts());
|
||||
hook.slow(this.slow());
|
||||
hook.ctx = this.ctx;
|
||||
this._beforeAll.push(hook);
|
||||
this.emit('beforeAll', hook);
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Run `fn(test[, done])` after running tests.
|
||||
*
|
||||
* @param {Function} fn
|
||||
* @return {Suite} for chaining
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Suite.prototype.afterAll = function(title, fn){
|
||||
if (this.pending) return this;
|
||||
if ('function' === typeof title) {
|
||||
fn = title;
|
||||
title = fn.name;
|
||||
}
|
||||
title = '"after all" hook' + (title ? ': ' + title : '');
|
||||
|
||||
var hook = new Hook(title, fn);
|
||||
hook.parent = this;
|
||||
hook.timeout(this.timeout());
|
||||
hook.enableTimeouts(this.enableTimeouts());
|
||||
hook.slow(this.slow());
|
||||
hook.ctx = this.ctx;
|
||||
this._afterAll.push(hook);
|
||||
this.emit('afterAll', hook);
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Run `fn(test[, done])` before each test case.
|
||||
*
|
||||
* @param {Function} fn
|
||||
* @return {Suite} for chaining
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Suite.prototype.beforeEach = function(title, fn){
|
||||
if (this.pending) return this;
|
||||
if ('function' === typeof title) {
|
||||
fn = title;
|
||||
title = fn.name;
|
||||
}
|
||||
title = '"before each" hook' + (title ? ': ' + title : '');
|
||||
|
||||
var hook = new Hook(title, fn);
|
||||
hook.parent = this;
|
||||
hook.timeout(this.timeout());
|
||||
hook.enableTimeouts(this.enableTimeouts());
|
||||
hook.slow(this.slow());
|
||||
hook.ctx = this.ctx;
|
||||
this._beforeEach.push(hook);
|
||||
this.emit('beforeEach', hook);
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Run `fn(test[, done])` after each test case.
|
||||
*
|
||||
* @param {Function} fn
|
||||
* @return {Suite} for chaining
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Suite.prototype.afterEach = function(title, fn){
|
||||
if (this.pending) return this;
|
||||
if ('function' === typeof title) {
|
||||
fn = title;
|
||||
title = fn.name;
|
||||
}
|
||||
title = '"after each" hook' + (title ? ': ' + title : '');
|
||||
|
||||
var hook = new Hook(title, fn);
|
||||
hook.parent = this;
|
||||
hook.timeout(this.timeout());
|
||||
hook.enableTimeouts(this.enableTimeouts());
|
||||
hook.slow(this.slow());
|
||||
hook.ctx = this.ctx;
|
||||
this._afterEach.push(hook);
|
||||
this.emit('afterEach', hook);
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Add a test `suite`.
|
||||
*
|
||||
* @param {Suite} suite
|
||||
* @return {Suite} for chaining
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Suite.prototype.addSuite = function(suite){
|
||||
suite.parent = this;
|
||||
suite.timeout(this.timeout());
|
||||
suite.enableTimeouts(this.enableTimeouts());
|
||||
suite.slow(this.slow());
|
||||
suite.bail(this.bail());
|
||||
this.suites.push(suite);
|
||||
this.emit('suite', suite);
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Add a `test` to this suite.
|
||||
*
|
||||
* @param {Test} test
|
||||
* @return {Suite} for chaining
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Suite.prototype.addTest = function(test){
|
||||
test.parent = this;
|
||||
test.timeout(this.timeout());
|
||||
test.enableTimeouts(this.enableTimeouts());
|
||||
test.slow(this.slow());
|
||||
test.ctx = this.ctx;
|
||||
this.tests.push(test);
|
||||
this.emit('test', test);
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Return the full title generated by recursively
|
||||
* concatenating the parent's full title.
|
||||
*
|
||||
* @return {String}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Suite.prototype.fullTitle = function(){
|
||||
if (this.parent) {
|
||||
var full = this.parent.fullTitle();
|
||||
if (full) return full + ' ' + this.title;
|
||||
}
|
||||
return this.title;
|
||||
};
|
||||
|
||||
/**
|
||||
* Return the total number of tests.
|
||||
*
|
||||
* @return {Number}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Suite.prototype.total = function(){
|
||||
return utils.reduce(this.suites, function(sum, suite){
|
||||
return sum + suite.total();
|
||||
}, 0) + this.tests.length;
|
||||
};
|
||||
|
||||
/**
|
||||
* Iterates through each suite recursively to find
|
||||
* all tests. Applies a function in the format
|
||||
* `fn(test)`.
|
||||
*
|
||||
* @param {Function} fn
|
||||
* @return {Suite}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Suite.prototype.eachTest = function(fn){
|
||||
utils.forEach(this.tests, fn);
|
||||
utils.forEach(this.suites, function(suite){
|
||||
suite.eachTest(fn);
|
||||
});
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* This will run the root suite if we happen to be running in delayed mode.
|
||||
*/
|
||||
Suite.prototype.run = function run() {
|
||||
if (this.root) {
|
||||
this.emit('run');
|
||||
}
|
||||
};
|
18
node_modules/mocha/lib/template.html
generated
vendored
Normal file
18
node_modules/mocha/lib/template.html
generated
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Mocha</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="mocha.css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="mocha"></div>
|
||||
<script src="mocha.js"></script>
|
||||
<script>mocha.setup('bdd')</script>
|
||||
<script src="tests.js"></script>
|
||||
<script>
|
||||
mocha.run();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
31
node_modules/mocha/lib/test.js
generated
vendored
Normal file
31
node_modules/mocha/lib/test.js
generated
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var Runnable = require('./runnable');
|
||||
|
||||
/**
|
||||
* Expose `Test`.
|
||||
*/
|
||||
|
||||
module.exports = Test;
|
||||
|
||||
/**
|
||||
* Initialize a new `Test` with the given `title` and callback `fn`.
|
||||
*
|
||||
* @param {String} title
|
||||
* @param {Function} fn
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function Test(title, fn) {
|
||||
Runnable.call(this, title, fn);
|
||||
this.pending = !fn;
|
||||
this.type = 'test';
|
||||
}
|
||||
|
||||
/**
|
||||
* Inherit from `Runnable.prototype`.
|
||||
*/
|
||||
|
||||
Test.prototype.__proto__ = Runnable.prototype;
|
696
node_modules/mocha/lib/utils.js
generated
vendored
Normal file
696
node_modules/mocha/lib/utils.js
generated
vendored
Normal file
@ -0,0 +1,696 @@
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var fs = require('fs')
|
||||
, path = require('path')
|
||||
, basename = path.basename
|
||||
, exists = fs.existsSync || path.existsSync
|
||||
, glob = require('glob')
|
||||
, join = path.join
|
||||
, debug = require('debug')('mocha:watch');
|
||||
|
||||
/**
|
||||
* Ignored directories.
|
||||
*/
|
||||
|
||||
var ignore = ['node_modules', '.git'];
|
||||
|
||||
/**
|
||||
* Escape special characters in the given string of html.
|
||||
*
|
||||
* @param {String} html
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
exports.escape = function(html){
|
||||
return String(html)
|
||||
.replace(/&/g, '&')
|
||||
.replace(/"/g, '"')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>');
|
||||
};
|
||||
|
||||
/**
|
||||
* Array#forEach (<=IE8)
|
||||
*
|
||||
* @param {Array} array
|
||||
* @param {Function} fn
|
||||
* @param {Object} scope
|
||||
* @api private
|
||||
*/
|
||||
|
||||
exports.forEach = function(arr, fn, scope){
|
||||
for (var i = 0, l = arr.length; i < l; i++)
|
||||
fn.call(scope, arr[i], i);
|
||||
};
|
||||
|
||||
/**
|
||||
* Array#map (<=IE8)
|
||||
*
|
||||
* @param {Array} array
|
||||
* @param {Function} fn
|
||||
* @param {Object} scope
|
||||
* @api private
|
||||
*/
|
||||
|
||||
exports.map = function(arr, fn, scope){
|
||||
var result = [];
|
||||
for (var i = 0, l = arr.length; i < l; i++)
|
||||
result.push(fn.call(scope, arr[i], i, arr));
|
||||
return result;
|
||||
};
|
||||
|
||||
/**
|
||||
* Array#indexOf (<=IE8)
|
||||
*
|
||||
* @parma {Array} arr
|
||||
* @param {Object} obj to find index of
|
||||
* @param {Number} start
|
||||
* @api private
|
||||
*/
|
||||
|
||||
exports.indexOf = function(arr, obj, start){
|
||||
for (var i = start || 0, l = arr.length; i < l; i++) {
|
||||
if (arr[i] === obj)
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
};
|
||||
|
||||
/**
|
||||
* Array#reduce (<=IE8)
|
||||
*
|
||||
* @param {Array} array
|
||||
* @param {Function} fn
|
||||
* @param {Object} initial value
|
||||
* @api private
|
||||
*/
|
||||
|
||||
exports.reduce = function(arr, fn, val){
|
||||
var rval = val;
|
||||
|
||||
for (var i = 0, l = arr.length; i < l; i++) {
|
||||
rval = fn(rval, arr[i], i, arr);
|
||||
}
|
||||
|
||||
return rval;
|
||||
};
|
||||
|
||||
/**
|
||||
* Array#filter (<=IE8)
|
||||
*
|
||||
* @param {Array} array
|
||||
* @param {Function} fn
|
||||
* @api private
|
||||
*/
|
||||
|
||||
exports.filter = function(arr, fn){
|
||||
var ret = [];
|
||||
|
||||
for (var i = 0, l = arr.length; i < l; i++) {
|
||||
var val = arr[i];
|
||||
if (fn(val, i, arr)) ret.push(val);
|
||||
}
|
||||
|
||||
return ret;
|
||||
};
|
||||
|
||||
/**
|
||||
* Object.keys (<=IE8)
|
||||
*
|
||||
* @param {Object} obj
|
||||
* @return {Array} keys
|
||||
* @api private
|
||||
*/
|
||||
|
||||
exports.keys = Object.keys || function(obj) {
|
||||
var keys = []
|
||||
, has = Object.prototype.hasOwnProperty; // for `window` on <=IE8
|
||||
|
||||
for (var key in obj) {
|
||||
if (has.call(obj, key)) {
|
||||
keys.push(key);
|
||||
}
|
||||
}
|
||||
|
||||
return keys;
|
||||
};
|
||||
|
||||
/**
|
||||
* Watch the given `files` for changes
|
||||
* and invoke `fn(file)` on modification.
|
||||
*
|
||||
* @param {Array} files
|
||||
* @param {Function} fn
|
||||
* @api private
|
||||
*/
|
||||
|
||||
exports.watch = function(files, fn){
|
||||
var options = { interval: 100 };
|
||||
files.forEach(function(file){
|
||||
debug('file %s', file);
|
||||
fs.watchFile(file, options, function(curr, prev){
|
||||
if (prev.mtime < curr.mtime) fn(file);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Array.isArray (<=IE8)
|
||||
*
|
||||
* @param {Object} obj
|
||||
* @return {Boolean}
|
||||
* @api private
|
||||
*/
|
||||
var isArray = Array.isArray || function (obj) {
|
||||
return '[object Array]' == {}.toString.call(obj);
|
||||
};
|
||||
|
||||
/**
|
||||
* @description
|
||||
* Buffer.prototype.toJSON polyfill
|
||||
* @type {Function}
|
||||
*/
|
||||
if(typeof Buffer !== 'undefined' && Buffer.prototype) {
|
||||
Buffer.prototype.toJSON = Buffer.prototype.toJSON || function () {
|
||||
return Array.prototype.slice.call(this, 0);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Ignored files.
|
||||
*/
|
||||
|
||||
function ignored(path){
|
||||
return !~ignore.indexOf(path);
|
||||
}
|
||||
|
||||
/**
|
||||
* Lookup files in the given `dir`.
|
||||
*
|
||||
* @return {Array}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
exports.files = function(dir, ext, ret){
|
||||
ret = ret || [];
|
||||
ext = ext || ['js'];
|
||||
|
||||
var re = new RegExp('\\.(' + ext.join('|') + ')$');
|
||||
|
||||
fs.readdirSync(dir)
|
||||
.filter(ignored)
|
||||
.forEach(function(path){
|
||||
path = join(dir, path);
|
||||
if (fs.statSync(path).isDirectory()) {
|
||||
exports.files(path, ext, ret);
|
||||
} else if (path.match(re)) {
|
||||
ret.push(path);
|
||||
}
|
||||
});
|
||||
|
||||
return ret;
|
||||
};
|
||||
|
||||
/**
|
||||
* Compute a slug from the given `str`.
|
||||
*
|
||||
* @param {String} str
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
exports.slug = function(str){
|
||||
return str
|
||||
.toLowerCase()
|
||||
.replace(/ +/g, '-')
|
||||
.replace(/[^-\w]/g, '');
|
||||
};
|
||||
|
||||
/**
|
||||
* Strip the function definition from `str`,
|
||||
* and re-indent for pre whitespace.
|
||||
*/
|
||||
|
||||
exports.clean = function(str) {
|
||||
str = str
|
||||
.replace(/\r\n?|[\n\u2028\u2029]/g, "\n").replace(/^\uFEFF/, '')
|
||||
.replace(/^function *\(.*\)\s*{|\(.*\) *=> *{?/, '')
|
||||
.replace(/\s+\}$/, '');
|
||||
|
||||
var spaces = str.match(/^\n?( *)/)[1].length
|
||||
, tabs = str.match(/^\n?(\t*)/)[1].length
|
||||
, re = new RegExp('^\n?' + (tabs ? '\t' : ' ') + '{' + (tabs ? tabs : spaces) + '}', 'gm');
|
||||
|
||||
str = str.replace(re, '');
|
||||
|
||||
return exports.trim(str);
|
||||
};
|
||||
|
||||
/**
|
||||
* Trim the given `str`.
|
||||
*
|
||||
* @param {String} str
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
exports.trim = function(str){
|
||||
return str.replace(/^\s+|\s+$/g, '');
|
||||
};
|
||||
|
||||
/**
|
||||
* Parse the given `qs`.
|
||||
*
|
||||
* @param {String} qs
|
||||
* @return {Object}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
exports.parseQuery = function(qs){
|
||||
return exports.reduce(qs.replace('?', '').split('&'), function(obj, pair){
|
||||
var i = pair.indexOf('=')
|
||||
, key = pair.slice(0, i)
|
||||
, val = pair.slice(++i);
|
||||
|
||||
obj[key] = decodeURIComponent(val);
|
||||
return obj;
|
||||
}, {});
|
||||
};
|
||||
|
||||
/**
|
||||
* Highlight the given string of `js`.
|
||||
*
|
||||
* @param {String} js
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function highlight(js) {
|
||||
return js
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>')
|
||||
.replace(/\/\/(.*)/gm, '<span class="comment">//$1</span>')
|
||||
.replace(/('.*?')/gm, '<span class="string">$1</span>')
|
||||
.replace(/(\d+\.\d+)/gm, '<span class="number">$1</span>')
|
||||
.replace(/(\d+)/gm, '<span class="number">$1</span>')
|
||||
.replace(/\bnew[ \t]+(\w+)/gm, '<span class="keyword">new</span> <span class="init">$1</span>')
|
||||
.replace(/\b(function|new|throw|return|var|if|else)\b/gm, '<span class="keyword">$1</span>')
|
||||
}
|
||||
|
||||
/**
|
||||
* Highlight the contents of tag `name`.
|
||||
*
|
||||
* @param {String} name
|
||||
* @api private
|
||||
*/
|
||||
|
||||
exports.highlightTags = function(name) {
|
||||
var code = document.getElementById('mocha').getElementsByTagName(name);
|
||||
for (var i = 0, len = code.length; i < len; ++i) {
|
||||
code[i].innerHTML = highlight(code[i].innerHTML);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* If a value could have properties, and has none, this function is called, which returns
|
||||
* a string representation of the empty value.
|
||||
*
|
||||
* Functions w/ no properties return `'[Function]'`
|
||||
* Arrays w/ length === 0 return `'[]'`
|
||||
* Objects w/ no properties return `'{}'`
|
||||
* All else: return result of `value.toString()`
|
||||
*
|
||||
* @param {*} value Value to inspect
|
||||
* @param {string} [type] The type of the value, if known.
|
||||
* @returns {string}
|
||||
*/
|
||||
var emptyRepresentation = function emptyRepresentation(value, type) {
|
||||
type = type || exports.type(value);
|
||||
|
||||
switch(type) {
|
||||
case 'function':
|
||||
return '[Function]';
|
||||
case 'object':
|
||||
return '{}';
|
||||
case 'array':
|
||||
return '[]';
|
||||
default:
|
||||
return value.toString();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Takes some variable and asks `{}.toString()` what it thinks it is.
|
||||
* @param {*} value Anything
|
||||
* @example
|
||||
* type({}) // 'object'
|
||||
* type([]) // 'array'
|
||||
* type(1) // 'number'
|
||||
* type(false) // 'boolean'
|
||||
* type(Infinity) // 'number'
|
||||
* type(null) // 'null'
|
||||
* type(new Date()) // 'date'
|
||||
* type(/foo/) // 'regexp'
|
||||
* type('type') // 'string'
|
||||
* type(global) // 'global'
|
||||
* @api private
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toString
|
||||
* @returns {string}
|
||||
*/
|
||||
exports.type = function type(value) {
|
||||
if (typeof Buffer !== 'undefined' && Buffer.isBuffer(value)) {
|
||||
return 'buffer';
|
||||
}
|
||||
return Object.prototype.toString.call(value)
|
||||
.replace(/^\[.+\s(.+?)\]$/, '$1')
|
||||
.toLowerCase();
|
||||
};
|
||||
|
||||
/**
|
||||
* @summary Stringify `value`.
|
||||
* @description Different behavior depending on type of value.
|
||||
* - If `value` is undefined or null, return `'[undefined]'` or `'[null]'`, respectively.
|
||||
* - If `value` is not an object, function or array, return result of `value.toString()` wrapped in double-quotes.
|
||||
* - If `value` is an *empty* object, function, or array, return result of function
|
||||
* {@link emptyRepresentation}.
|
||||
* - If `value` has properties, call {@link exports.canonicalize} on it, then return result of
|
||||
* JSON.stringify().
|
||||
*
|
||||
* @see exports.type
|
||||
* @param {*} value
|
||||
* @return {string}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
exports.stringify = function(value) {
|
||||
var type = exports.type(value);
|
||||
|
||||
if (!~exports.indexOf(['object', 'array', 'function'], type)) {
|
||||
if(type != 'buffer') {
|
||||
return jsonStringify(value);
|
||||
}
|
||||
var json = value.toJSON();
|
||||
// Based on the toJSON result
|
||||
return jsonStringify(json.data && json.type ? json.data : json, 2)
|
||||
.replace(/,(\n|$)/g, '$1');
|
||||
}
|
||||
|
||||
for (var prop in value) {
|
||||
if (Object.prototype.hasOwnProperty.call(value, prop)) {
|
||||
return jsonStringify(exports.canonicalize(value), 2).replace(/,(\n|$)/g, '$1');
|
||||
}
|
||||
}
|
||||
|
||||
return emptyRepresentation(value, type);
|
||||
};
|
||||
|
||||
/**
|
||||
* @description
|
||||
* like JSON.stringify but more sense.
|
||||
* @param {Object} object
|
||||
* @param {Number=} spaces
|
||||
* @param {number=} depth
|
||||
* @returns {*}
|
||||
* @private
|
||||
*/
|
||||
function jsonStringify(object, spaces, depth) {
|
||||
if(typeof spaces == 'undefined') return _stringify(object); // primitive types
|
||||
|
||||
depth = depth || 1;
|
||||
var space = spaces * depth
|
||||
, str = isArray(object) ? '[' : '{'
|
||||
, end = isArray(object) ? ']' : '}'
|
||||
, length = object.length || exports.keys(object).length
|
||||
, repeat = function(s, n) { return new Array(n).join(s); }; // `.repeat()` polyfill
|
||||
|
||||
function _stringify(val) {
|
||||
switch (exports.type(val)) {
|
||||
case 'null':
|
||||
case 'undefined':
|
||||
val = '[' + val + ']';
|
||||
break;
|
||||
case 'array':
|
||||
case 'object':
|
||||
val = jsonStringify(val, spaces, depth + 1);
|
||||
break;
|
||||
case 'boolean':
|
||||
case 'regexp':
|
||||
case 'number':
|
||||
val = val === 0 && (1/val) === -Infinity // `-0`
|
||||
? '-0'
|
||||
: val.toString();
|
||||
break;
|
||||
case 'date':
|
||||
val = '[Date: ' + val.toISOString() + ']';
|
||||
break;
|
||||
case 'buffer':
|
||||
var json = val.toJSON();
|
||||
// Based on the toJSON result
|
||||
json = json.data && json.type ? json.data : json;
|
||||
val = '[Buffer: ' + jsonStringify(json, 2, depth + 1) + ']';
|
||||
break;
|
||||
default:
|
||||
val = (val == '[Function]' || val == '[Circular]')
|
||||
? val
|
||||
: JSON.stringify(val); //string
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
for(var i in object) {
|
||||
if(!object.hasOwnProperty(i)) continue; // not my business
|
||||
--length;
|
||||
str += '\n ' + repeat(' ', space)
|
||||
+ (isArray(object) ? '' : '"' + i + '": ') // key
|
||||
+ _stringify(object[i]) // value
|
||||
+ (length ? ',' : ''); // comma
|
||||
}
|
||||
|
||||
return str + (str.length != 1 // [], {}
|
||||
? '\n' + repeat(' ', --space) + end
|
||||
: end);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return if obj is a Buffer
|
||||
* @param {Object} arg
|
||||
* @return {Boolean}
|
||||
* @api private
|
||||
*/
|
||||
exports.isBuffer = function (arg) {
|
||||
return typeof Buffer !== 'undefined' && Buffer.isBuffer(arg);
|
||||
};
|
||||
|
||||
/**
|
||||
* @summary Return a new Thing that has the keys in sorted order. Recursive.
|
||||
* @description If the Thing...
|
||||
* - has already been seen, return string `'[Circular]'`
|
||||
* - is `undefined`, return string `'[undefined]'`
|
||||
* - is `null`, return value `null`
|
||||
* - is some other primitive, return the value
|
||||
* - is not a primitive or an `Array`, `Object`, or `Function`, return the value of the Thing's `toString()` method
|
||||
* - is a non-empty `Array`, `Object`, or `Function`, return the result of calling this function again.
|
||||
* - is an empty `Array`, `Object`, or `Function`, return the result of calling `emptyRepresentation()`
|
||||
*
|
||||
* @param {*} value Thing to inspect. May or may not have properties.
|
||||
* @param {Array} [stack=[]] Stack of seen values
|
||||
* @return {(Object|Array|Function|string|undefined)}
|
||||
* @see {@link exports.stringify}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
exports.canonicalize = function(value, stack) {
|
||||
var canonicalizedObj,
|
||||
type = exports.type(value),
|
||||
prop,
|
||||
withStack = function withStack(value, fn) {
|
||||
stack.push(value);
|
||||
fn();
|
||||
stack.pop();
|
||||
};
|
||||
|
||||
stack = stack || [];
|
||||
|
||||
if (exports.indexOf(stack, value) !== -1) {
|
||||
return '[Circular]';
|
||||
}
|
||||
|
||||
switch(type) {
|
||||
case 'undefined':
|
||||
case 'buffer':
|
||||
case 'null':
|
||||
canonicalizedObj = value;
|
||||
break;
|
||||
case 'array':
|
||||
withStack(value, function () {
|
||||
canonicalizedObj = exports.map(value, function (item) {
|
||||
return exports.canonicalize(item, stack);
|
||||
});
|
||||
});
|
||||
break;
|
||||
case 'function':
|
||||
for (prop in value) {
|
||||
canonicalizedObj = {};
|
||||
break;
|
||||
}
|
||||
if (!canonicalizedObj) {
|
||||
canonicalizedObj = emptyRepresentation(value, type);
|
||||
break;
|
||||
}
|
||||
/* falls through */
|
||||
case 'object':
|
||||
canonicalizedObj = canonicalizedObj || {};
|
||||
withStack(value, function () {
|
||||
exports.forEach(exports.keys(value).sort(), function (key) {
|
||||
canonicalizedObj[key] = exports.canonicalize(value[key], stack);
|
||||
});
|
||||
});
|
||||
break;
|
||||
case 'date':
|
||||
case 'number':
|
||||
case 'regexp':
|
||||
case 'boolean':
|
||||
canonicalizedObj = value;
|
||||
break;
|
||||
default:
|
||||
canonicalizedObj = value.toString();
|
||||
}
|
||||
|
||||
return canonicalizedObj;
|
||||
};
|
||||
|
||||
/**
|
||||
* Lookup file names at the given `path`.
|
||||
*/
|
||||
exports.lookupFiles = function lookupFiles(path, extensions, recursive) {
|
||||
var files = [];
|
||||
var re = new RegExp('\\.(' + extensions.join('|') + ')$');
|
||||
|
||||
if (!exists(path)) {
|
||||
if (exists(path + '.js')) {
|
||||
path += '.js';
|
||||
} else {
|
||||
files = glob.sync(path);
|
||||
if (!files.length) throw new Error("cannot resolve path (or pattern) '" + path + "'");
|
||||
return files;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
var stat = fs.statSync(path);
|
||||
if (stat.isFile()) return path;
|
||||
}
|
||||
catch (ignored) {
|
||||
return;
|
||||
}
|
||||
|
||||
fs.readdirSync(path).forEach(function(file) {
|
||||
file = join(path, file);
|
||||
try {
|
||||
var stat = fs.statSync(file);
|
||||
if (stat.isDirectory()) {
|
||||
if (recursive) {
|
||||
files = files.concat(lookupFiles(file, extensions, recursive));
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch (ignored) {
|
||||
return;
|
||||
}
|
||||
if (!stat.isFile() || !re.test(file) || basename(file)[0] === '.') return;
|
||||
files.push(file);
|
||||
});
|
||||
|
||||
return files;
|
||||
};
|
||||
|
||||
/**
|
||||
* Generate an undefined error with a message warning the user.
|
||||
*
|
||||
* @return {Error}
|
||||
*/
|
||||
|
||||
exports.undefinedError = function() {
|
||||
return new Error('Caught undefined error, did you throw without specifying what?');
|
||||
};
|
||||
|
||||
/**
|
||||
* Generate an undefined error if `err` is not defined.
|
||||
*
|
||||
* @param {Error} err
|
||||
* @return {Error}
|
||||
*/
|
||||
|
||||
exports.getError = function(err) {
|
||||
return err || exports.undefinedError();
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @summary
|
||||
* This Filter based on `mocha-clean` module.(see: `github.com/rstacruz/mocha-clean`)
|
||||
* @description
|
||||
* When invoking this function you get a filter function that get the Error.stack as an input,
|
||||
* and return a prettify output.
|
||||
* (i.e: strip Mocha, node_modules, bower and componentJS from stack trace).
|
||||
* @returns {Function}
|
||||
*/
|
||||
|
||||
exports.stackTraceFilter = function() {
|
||||
var slash = '/'
|
||||
, is = typeof document === 'undefined'
|
||||
? { node: true }
|
||||
: { browser: true }
|
||||
, cwd = is.node
|
||||
? process.cwd() + slash
|
||||
: location.href.replace(/\/[^\/]*$/, '/');
|
||||
|
||||
function isNodeModule (line) {
|
||||
return (~line.indexOf('node_modules'));
|
||||
}
|
||||
|
||||
function isMochaInternal (line) {
|
||||
return (~line.indexOf('node_modules' + slash + 'mocha')) ||
|
||||
(~line.indexOf('components' + slash + 'mochajs')) ||
|
||||
(~line.indexOf('components' + slash + 'mocha'));
|
||||
}
|
||||
|
||||
// node_modules, bower, componentJS
|
||||
function isBrowserModule(line) {
|
||||
return (~line.indexOf('node_modules')) ||
|
||||
(~line.indexOf('components'));
|
||||
}
|
||||
|
||||
function isNodeInternal (line) {
|
||||
return (~line.indexOf('(timers.js:')) ||
|
||||
(~line.indexOf('(events.js:')) ||
|
||||
(~line.indexOf('(node.js:')) ||
|
||||
(~line.indexOf('(module.js:')) ||
|
||||
(~line.indexOf('GeneratorFunctionPrototype.next (native)')) ||
|
||||
false
|
||||
}
|
||||
|
||||
return function(stack) {
|
||||
stack = stack.split('\n');
|
||||
|
||||
stack = exports.reduce(stack, function(list, line) {
|
||||
if (is.node && (isNodeModule(line) ||
|
||||
isMochaInternal(line) ||
|
||||
isNodeInternal(line)))
|
||||
return list;
|
||||
|
||||
if (is.browser && (isBrowserModule(line)))
|
||||
return list;
|
||||
|
||||
// Clean up cwd(absolute)
|
||||
list.push(line.replace(cwd, ''));
|
||||
return list;
|
||||
}, []);
|
||||
|
||||
return stack.join('\n');
|
||||
}
|
||||
};
|
270
node_modules/mocha/mocha.css
generated
vendored
Normal file
270
node_modules/mocha/mocha.css
generated
vendored
Normal file
@ -0,0 +1,270 @@
|
||||
@charset "utf-8";
|
||||
|
||||
body {
|
||||
margin:0;
|
||||
}
|
||||
|
||||
#mocha {
|
||||
font: 20px/1.5 "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
margin: 60px 50px;
|
||||
}
|
||||
|
||||
#mocha ul,
|
||||
#mocha li {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#mocha ul {
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
#mocha h1,
|
||||
#mocha h2 {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#mocha h1 {
|
||||
margin-top: 15px;
|
||||
font-size: 1em;
|
||||
font-weight: 200;
|
||||
}
|
||||
|
||||
#mocha h1 a {
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
#mocha h1 a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
#mocha .suite .suite h1 {
|
||||
margin-top: 0;
|
||||
font-size: .8em;
|
||||
}
|
||||
|
||||
#mocha .hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#mocha h2 {
|
||||
font-size: 12px;
|
||||
font-weight: normal;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#mocha .suite {
|
||||
margin-left: 15px;
|
||||
}
|
||||
|
||||
#mocha .test {
|
||||
margin-left: 15px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#mocha .test.pending:hover h2::after {
|
||||
content: '(pending)';
|
||||
font-family: arial, sans-serif;
|
||||
}
|
||||
|
||||
#mocha .test.pass.medium .duration {
|
||||
background: #c09853;
|
||||
}
|
||||
|
||||
#mocha .test.pass.slow .duration {
|
||||
background: #b94a48;
|
||||
}
|
||||
|
||||
#mocha .test.pass::before {
|
||||
content: '✓';
|
||||
font-size: 12px;
|
||||
display: block;
|
||||
float: left;
|
||||
margin-right: 5px;
|
||||
color: #00d6b2;
|
||||
}
|
||||
|
||||
#mocha .test.pass .duration {
|
||||
font-size: 9px;
|
||||
margin-left: 5px;
|
||||
padding: 2px 5px;
|
||||
color: #fff;
|
||||
-webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.2);
|
||||
-moz-box-shadow: inset 0 1px 1px rgba(0,0,0,.2);
|
||||
box-shadow: inset 0 1px 1px rgba(0,0,0,.2);
|
||||
-webkit-border-radius: 5px;
|
||||
-moz-border-radius: 5px;
|
||||
-ms-border-radius: 5px;
|
||||
-o-border-radius: 5px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
#mocha .test.pass.fast .duration {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#mocha .test.pending {
|
||||
color: #0b97c4;
|
||||
}
|
||||
|
||||
#mocha .test.pending::before {
|
||||
content: '◦';
|
||||
color: #0b97c4;
|
||||
}
|
||||
|
||||
#mocha .test.fail {
|
||||
color: #c00;
|
||||
}
|
||||
|
||||
#mocha .test.fail pre {
|
||||
color: black;
|
||||
}
|
||||
|
||||
#mocha .test.fail::before {
|
||||
content: '✖';
|
||||
font-size: 12px;
|
||||
display: block;
|
||||
float: left;
|
||||
margin-right: 5px;
|
||||
color: #c00;
|
||||
}
|
||||
|
||||
#mocha .test pre.error {
|
||||
color: #c00;
|
||||
max-height: 300px;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
/**
|
||||
* (1): approximate for browsers not supporting calc
|
||||
* (2): 42 = 2*15 + 2*10 + 2*1 (padding + margin + border)
|
||||
* ^^ seriously
|
||||
*/
|
||||
#mocha .test pre {
|
||||
display: block;
|
||||
float: left;
|
||||
clear: left;
|
||||
font: 12px/1.5 monaco, monospace;
|
||||
margin: 5px;
|
||||
padding: 15px;
|
||||
border: 1px solid #eee;
|
||||
max-width: 85%; /*(1)*/
|
||||
max-width: calc(100% - 42px); /*(2)*/
|
||||
word-wrap: break-word;
|
||||
border-bottom-color: #ddd;
|
||||
-webkit-border-radius: 3px;
|
||||
-webkit-box-shadow: 0 1px 3px #eee;
|
||||
-moz-border-radius: 3px;
|
||||
-moz-box-shadow: 0 1px 3px #eee;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
#mocha .test h2 {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
#mocha .test a.replay {
|
||||
position: absolute;
|
||||
top: 3px;
|
||||
right: 0;
|
||||
text-decoration: none;
|
||||
vertical-align: middle;
|
||||
display: block;
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
line-height: 15px;
|
||||
text-align: center;
|
||||
background: #eee;
|
||||
font-size: 15px;
|
||||
-moz-border-radius: 15px;
|
||||
border-radius: 15px;
|
||||
-webkit-transition: opacity 200ms;
|
||||
-moz-transition: opacity 200ms;
|
||||
transition: opacity 200ms;
|
||||
opacity: 0.3;
|
||||
color: #888;
|
||||
}
|
||||
|
||||
#mocha .test:hover a.replay {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
#mocha-report.pass .test.fail {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#mocha-report.fail .test.pass {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#mocha-report.pending .test.pass,
|
||||
#mocha-report.pending .test.fail {
|
||||
display: none;
|
||||
}
|
||||
#mocha-report.pending .test.pass.pending {
|
||||
display: block;
|
||||
}
|
||||
|
||||
#mocha-error {
|
||||
color: #c00;
|
||||
font-size: 1.5em;
|
||||
font-weight: 100;
|
||||
letter-spacing: 1px;
|
||||
}
|
||||
|
||||
#mocha-stats {
|
||||
position: fixed;
|
||||
top: 15px;
|
||||
right: 10px;
|
||||
font-size: 12px;
|
||||
margin: 0;
|
||||
color: #888;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
#mocha-stats .progress {
|
||||
float: right;
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
#mocha-stats em {
|
||||
color: black;
|
||||
}
|
||||
|
||||
#mocha-stats a {
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
#mocha-stats a:hover {
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
|
||||
#mocha-stats li {
|
||||
display: inline-block;
|
||||
margin: 0 5px;
|
||||
list-style: none;
|
||||
padding-top: 11px;
|
||||
}
|
||||
|
||||
#mocha-stats canvas {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
#mocha code .comment { color: #ddd; }
|
||||
#mocha code .init { color: #2f6fad; }
|
||||
#mocha code .string { color: #5890ad; }
|
||||
#mocha code .keyword { color: #8a6343; }
|
||||
#mocha code .number { color: #2f6fad; }
|
||||
|
||||
@media screen and (max-device-width: 480px) {
|
||||
#mocha {
|
||||
margin: 60px 0px;
|
||||
}
|
||||
|
||||
#mocha #stats {
|
||||
position: absolute;
|
||||
}
|
||||
}
|
6564
node_modules/mocha/mocha.js
generated
vendored
Normal file
6564
node_modules/mocha/mocha.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
node_modules/mocha/node_modules/.bin/jade
generated
vendored
Symbolic link
1
node_modules/mocha/node_modules/.bin/jade
generated
vendored
Symbolic link
@ -0,0 +1 @@
|
||||
../jade/bin/jade
|
1
node_modules/mocha/node_modules/.bin/supports-color
generated
vendored
Symbolic link
1
node_modules/mocha/node_modules/.bin/supports-color
generated
vendored
Symbolic link
@ -0,0 +1 @@
|
||||
../supports-color/cli.js
|
208
node_modules/mocha/node_modules/commander/Readme.md
generated
vendored
Normal file
208
node_modules/mocha/node_modules/commander/Readme.md
generated
vendored
Normal file
@ -0,0 +1,208 @@
|
||||
# Commander.js
|
||||
|
||||
The complete solution for [node.js](http://nodejs.org) command-line interfaces, inspired by Ruby's [commander](https://github.com/visionmedia/commander).
|
||||
|
||||
[](http://travis-ci.org/visionmedia/commander.js)
|
||||
|
||||
## Installation
|
||||
|
||||
$ npm install commander
|
||||
|
||||
## Option parsing
|
||||
|
||||
Options with commander are defined with the `.option()` method, also serving as documentation for the options. The example below parses args and options from `process.argv`, leaving remaining args as the `program.args` array which were not consumed by options.
|
||||
|
||||
```js
|
||||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var program = require('commander');
|
||||
|
||||
program
|
||||
.version('0.0.1')
|
||||
.option('-p, --peppers', 'Add peppers')
|
||||
.option('-P, --pineapple', 'Add pineapple')
|
||||
.option('-b, --bbq', 'Add bbq sauce')
|
||||
.option('-c, --cheese [type]', 'Add the specified type of cheese [marble]', 'marble')
|
||||
.parse(process.argv);
|
||||
|
||||
console.log('you ordered a pizza with:');
|
||||
if (program.peppers) console.log(' - peppers');
|
||||
if (program.pineapple) console.log(' - pineapple');
|
||||
if (program.bbq) console.log(' - bbq');
|
||||
console.log(' - %s cheese', program.cheese);
|
||||
```
|
||||
|
||||
Short flags may be passed as a single arg, for example `-abc` is equivalent to `-a -b -c`. Multi-word options such as "--template-engine" are camel-cased, becoming `program.templateEngine` etc.
|
||||
|
||||
## Automated --help
|
||||
|
||||
The help information is auto-generated based on the information commander already knows about your program, so the following `--help` info is for free:
|
||||
|
||||
```
|
||||
$ ./examples/pizza --help
|
||||
|
||||
Usage: pizza [options]
|
||||
|
||||
Options:
|
||||
|
||||
-V, --version output the version number
|
||||
-p, --peppers Add peppers
|
||||
-P, --pineapple Add pineapple
|
||||
-b, --bbq Add bbq sauce
|
||||
-c, --cheese <type> Add the specified type of cheese [marble]
|
||||
-h, --help output usage information
|
||||
|
||||
```
|
||||
|
||||
## Coercion
|
||||
|
||||
```js
|
||||
function range(val) {
|
||||
return val.split('..').map(Number);
|
||||
}
|
||||
|
||||
function list(val) {
|
||||
return val.split(',');
|
||||
}
|
||||
|
||||
function collect(val, memo) {
|
||||
memo.push(val);
|
||||
return memo;
|
||||
}
|
||||
|
||||
function increaseVerbosity(v, total) {
|
||||
return total + 1;
|
||||
}
|
||||
|
||||
program
|
||||
.version('0.0.1')
|
||||
.usage('[options] <file ...>')
|
||||
.option('-i, --integer <n>', 'An integer argument', parseInt)
|
||||
.option('-f, --float <n>', 'A float argument', parseFloat)
|
||||
.option('-r, --range <a>..<b>', 'A range', range)
|
||||
.option('-l, --list <items>', 'A list', list)
|
||||
.option('-o, --optional [value]', 'An optional value')
|
||||
.option('-c, --collect [value]', 'A repeatable value', collect, [])
|
||||
.option('-v, --verbose', 'A value that can be increased', increaseVerbosity, 0)
|
||||
.parse(process.argv);
|
||||
|
||||
console.log(' int: %j', program.integer);
|
||||
console.log(' float: %j', program.float);
|
||||
console.log(' optional: %j', program.optional);
|
||||
program.range = program.range || [];
|
||||
console.log(' range: %j..%j', program.range[0], program.range[1]);
|
||||
console.log(' list: %j', program.list);
|
||||
console.log(' collect: %j', program.collect);
|
||||
console.log(' verbosity: %j', program.verbose);
|
||||
console.log(' args: %j', program.args);
|
||||
```
|
||||
|
||||
## Custom help
|
||||
|
||||
You can display arbitrary `-h, --help` information
|
||||
by listening for "--help". Commander will automatically
|
||||
exit once you are done so that the remainder of your program
|
||||
does not execute causing undesired behaviours, for example
|
||||
in the following executable "stuff" will not output when
|
||||
`--help` is used.
|
||||
|
||||
```js
|
||||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var program = require('../');
|
||||
|
||||
function list(val) {
|
||||
return val.split(',').map(Number);
|
||||
}
|
||||
|
||||
program
|
||||
.version('0.0.1')
|
||||
.option('-f, --foo', 'enable some foo')
|
||||
.option('-b, --bar', 'enable some bar')
|
||||
.option('-B, --baz', 'enable some baz');
|
||||
|
||||
// must be before .parse() since
|
||||
// node's emit() is immediate
|
||||
|
||||
program.on('--help', function(){
|
||||
console.log(' Examples:');
|
||||
console.log('');
|
||||
console.log(' $ custom-help --help');
|
||||
console.log(' $ custom-help -h');
|
||||
console.log('');
|
||||
});
|
||||
|
||||
program.parse(process.argv);
|
||||
|
||||
console.log('stuff');
|
||||
```
|
||||
|
||||
yielding the following help output:
|
||||
|
||||
```
|
||||
|
||||
Usage: custom-help [options]
|
||||
|
||||
Options:
|
||||
|
||||
-h, --help output usage information
|
||||
-V, --version output the version number
|
||||
-f, --foo enable some foo
|
||||
-b, --bar enable some bar
|
||||
-B, --baz enable some baz
|
||||
|
||||
Examples:
|
||||
|
||||
$ custom-help --help
|
||||
$ custom-help -h
|
||||
|
||||
```
|
||||
|
||||
## .outputHelp()
|
||||
|
||||
Output help information without exiting.
|
||||
|
||||
## .help()
|
||||
|
||||
Output help information and exit immediately.
|
||||
|
||||
## Links
|
||||
|
||||
- [API documentation](http://visionmedia.github.com/commander.js/)
|
||||
- [ascii tables](https://github.com/LearnBoost/cli-table)
|
||||
- [progress bars](https://github.com/visionmedia/node-progress)
|
||||
- [more progress bars](https://github.com/substack/node-multimeter)
|
||||
- [examples](https://github.com/visionmedia/commander.js/tree/master/examples)
|
||||
|
||||
## License
|
||||
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2011 TJ Holowaychuk <tj@vision-media.ca>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
'Software'), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
876
node_modules/mocha/node_modules/commander/index.js
generated
vendored
Normal file
876
node_modules/mocha/node_modules/commander/index.js
generated
vendored
Normal file
@ -0,0 +1,876 @@
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var EventEmitter = require('events').EventEmitter;
|
||||
var spawn = require('child_process').spawn;
|
||||
var path = require('path');
|
||||
var dirname = path.dirname;
|
||||
var basename = path.basename;
|
||||
|
||||
/**
|
||||
* Expose the root command.
|
||||
*/
|
||||
|
||||
exports = module.exports = new Command;
|
||||
|
||||
/**
|
||||
* Expose `Command`.
|
||||
*/
|
||||
|
||||
exports.Command = Command;
|
||||
|
||||
/**
|
||||
* Expose `Option`.
|
||||
*/
|
||||
|
||||
exports.Option = Option;
|
||||
|
||||
/**
|
||||
* Initialize a new `Option` with the given `flags` and `description`.
|
||||
*
|
||||
* @param {String} flags
|
||||
* @param {String} description
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function Option(flags, description) {
|
||||
this.flags = flags;
|
||||
this.required = ~flags.indexOf('<');
|
||||
this.optional = ~flags.indexOf('[');
|
||||
this.bool = !~flags.indexOf('-no-');
|
||||
flags = flags.split(/[ ,|]+/);
|
||||
if (flags.length > 1 && !/^[[<]/.test(flags[1])) this.short = flags.shift();
|
||||
this.long = flags.shift();
|
||||
this.description = description || '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Return option name.
|
||||
*
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Option.prototype.name = function(){
|
||||
return this.long
|
||||
.replace('--', '')
|
||||
.replace('no-', '');
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if `arg` matches the short or long flag.
|
||||
*
|
||||
* @param {String} arg
|
||||
* @return {Boolean}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Option.prototype.is = function(arg){
|
||||
return arg == this.short
|
||||
|| arg == this.long;
|
||||
};
|
||||
|
||||
/**
|
||||
* Initialize a new `Command`.
|
||||
*
|
||||
* @param {String} name
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function Command(name) {
|
||||
this.commands = [];
|
||||
this.options = [];
|
||||
this._execs = [];
|
||||
this._args = [];
|
||||
this._name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Inherit from `EventEmitter.prototype`.
|
||||
*/
|
||||
|
||||
Command.prototype.__proto__ = EventEmitter.prototype;
|
||||
|
||||
/**
|
||||
* Add command `name`.
|
||||
*
|
||||
* The `.action()` callback is invoked when the
|
||||
* command `name` is specified via __ARGV__,
|
||||
* and the remaining arguments are applied to the
|
||||
* function for access.
|
||||
*
|
||||
* When the `name` is "*" an un-matched command
|
||||
* will be passed as the first arg, followed by
|
||||
* the rest of __ARGV__ remaining.
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* program
|
||||
* .version('0.0.1')
|
||||
* .option('-C, --chdir <path>', 'change the working directory')
|
||||
* .option('-c, --config <path>', 'set config path. defaults to ./deploy.conf')
|
||||
* .option('-T, --no-tests', 'ignore test hook')
|
||||
*
|
||||
* program
|
||||
* .command('setup')
|
||||
* .description('run remote setup commands')
|
||||
* .action(function(){
|
||||
* console.log('setup');
|
||||
* });
|
||||
*
|
||||
* program
|
||||
* .command('exec <cmd>')
|
||||
* .description('run the given remote command')
|
||||
* .action(function(cmd){
|
||||
* console.log('exec "%s"', cmd);
|
||||
* });
|
||||
*
|
||||
* program
|
||||
* .command('*')
|
||||
* .description('deploy the given env')
|
||||
* .action(function(env){
|
||||
* console.log('deploying "%s"', env);
|
||||
* });
|
||||
*
|
||||
* program.parse(process.argv);
|
||||
*
|
||||
* @param {String} name
|
||||
* @param {String} [desc]
|
||||
* @return {Command} the new command
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Command.prototype.command = function(name, desc) {
|
||||
var args = name.split(/ +/);
|
||||
var cmd = new Command(args.shift());
|
||||
if (desc) cmd.description(desc);
|
||||
if (desc) this.executables = true;
|
||||
if (desc) this._execs[cmd._name] = true;
|
||||
this.commands.push(cmd);
|
||||
cmd.parseExpectedArgs(args);
|
||||
cmd.parent = this;
|
||||
if (desc) return this;
|
||||
return cmd;
|
||||
};
|
||||
|
||||
/**
|
||||
* Add an implicit `help [cmd]` subcommand
|
||||
* which invokes `--help` for the given command.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Command.prototype.addImplicitHelpCommand = function() {
|
||||
this.command('help [cmd]', 'display help for [cmd]');
|
||||
};
|
||||
|
||||
/**
|
||||
* Parse expected `args`.
|
||||
*
|
||||
* For example `["[type]"]` becomes `[{ required: false, name: 'type' }]`.
|
||||
*
|
||||
* @param {Array} args
|
||||
* @return {Command} for chaining
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Command.prototype.parseExpectedArgs = function(args){
|
||||
if (!args.length) return;
|
||||
var self = this;
|
||||
args.forEach(function(arg){
|
||||
switch (arg[0]) {
|
||||
case '<':
|
||||
self._args.push({ required: true, name: arg.slice(1, -1) });
|
||||
break;
|
||||
case '[':
|
||||
self._args.push({ required: false, name: arg.slice(1, -1) });
|
||||
break;
|
||||
}
|
||||
});
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Register callback `fn` for the command.
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* program
|
||||
* .command('help')
|
||||
* .description('display verbose help')
|
||||
* .action(function(){
|
||||
* // output help here
|
||||
* });
|
||||
*
|
||||
* @param {Function} fn
|
||||
* @return {Command} for chaining
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Command.prototype.action = function(fn){
|
||||
var self = this;
|
||||
var listener = function(args, unknown){
|
||||
// Parse any so-far unknown options
|
||||
args = args || [];
|
||||
unknown = unknown || [];
|
||||
|
||||
var parsed = self.parseOptions(unknown);
|
||||
|
||||
// Output help if necessary
|
||||
outputHelpIfNecessary(self, parsed.unknown);
|
||||
|
||||
// If there are still any unknown options, then we simply
|
||||
// die, unless someone asked for help, in which case we give it
|
||||
// to them, and then we die.
|
||||
if (parsed.unknown.length > 0) {
|
||||
self.unknownOption(parsed.unknown[0]);
|
||||
}
|
||||
|
||||
// Leftover arguments need to be pushed back. Fixes issue #56
|
||||
if (parsed.args.length) args = parsed.args.concat(args);
|
||||
|
||||
self._args.forEach(function(arg, i){
|
||||
if (arg.required && null == args[i]) {
|
||||
self.missingArgument(arg.name);
|
||||
}
|
||||
});
|
||||
|
||||
// Always append ourselves to the end of the arguments,
|
||||
// to make sure we match the number of arguments the user
|
||||
// expects
|
||||
if (self._args.length) {
|
||||
args[self._args.length] = self;
|
||||
} else {
|
||||
args.push(self);
|
||||
}
|
||||
|
||||
fn.apply(this, args);
|
||||
};
|
||||
this.parent.on(this._name, listener);
|
||||
if (this._alias) this.parent.on(this._alias, listener);
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Define option with `flags`, `description` and optional
|
||||
* coercion `fn`.
|
||||
*
|
||||
* The `flags` string should contain both the short and long flags,
|
||||
* separated by comma, a pipe or space. The following are all valid
|
||||
* all will output this way when `--help` is used.
|
||||
*
|
||||
* "-p, --pepper"
|
||||
* "-p|--pepper"
|
||||
* "-p --pepper"
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* // simple boolean defaulting to false
|
||||
* program.option('-p, --pepper', 'add pepper');
|
||||
*
|
||||
* --pepper
|
||||
* program.pepper
|
||||
* // => Boolean
|
||||
*
|
||||
* // simple boolean defaulting to true
|
||||
* program.option('-C, --no-cheese', 'remove cheese');
|
||||
*
|
||||
* program.cheese
|
||||
* // => true
|
||||
*
|
||||
* --no-cheese
|
||||
* program.cheese
|
||||
* // => false
|
||||
*
|
||||
* // required argument
|
||||
* program.option('-C, --chdir <path>', 'change the working directory');
|
||||
*
|
||||
* --chdir /tmp
|
||||
* program.chdir
|
||||
* // => "/tmp"
|
||||
*
|
||||
* // optional argument
|
||||
* program.option('-c, --cheese [type]', 'add cheese [marble]');
|
||||
*
|
||||
* @param {String} flags
|
||||
* @param {String} description
|
||||
* @param {Function|Mixed} fn or default
|
||||
* @param {Mixed} defaultValue
|
||||
* @return {Command} for chaining
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Command.prototype.option = function(flags, description, fn, defaultValue){
|
||||
var self = this
|
||||
, option = new Option(flags, description)
|
||||
, oname = option.name()
|
||||
, name = camelcase(oname);
|
||||
|
||||
// default as 3rd arg
|
||||
if ('function' != typeof fn) defaultValue = fn, fn = null;
|
||||
|
||||
// preassign default value only for --no-*, [optional], or <required>
|
||||
if (false == option.bool || option.optional || option.required) {
|
||||
// when --no-* we make sure default is true
|
||||
if (false == option.bool) defaultValue = true;
|
||||
// preassign only if we have a default
|
||||
if (undefined !== defaultValue) self[name] = defaultValue;
|
||||
}
|
||||
|
||||
// register the option
|
||||
this.options.push(option);
|
||||
|
||||
// when it's passed assign the value
|
||||
// and conditionally invoke the callback
|
||||
this.on(oname, function(val){
|
||||
// coercion
|
||||
if (null !== val && fn) val = fn(val, undefined === self[name] ? defaultValue : self[name]);
|
||||
|
||||
// unassigned or bool
|
||||
if ('boolean' == typeof self[name] || 'undefined' == typeof self[name]) {
|
||||
// if no value, bool true, and we have a default, then use it!
|
||||
if (null == val) {
|
||||
self[name] = option.bool
|
||||
? defaultValue || true
|
||||
: false;
|
||||
} else {
|
||||
self[name] = val;
|
||||
}
|
||||
} else if (null !== val) {
|
||||
// reassign
|
||||
self[name] = val;
|
||||
}
|
||||
});
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Parse `argv`, settings options and invoking commands when defined.
|
||||
*
|
||||
* @param {Array} argv
|
||||
* @return {Command} for chaining
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Command.prototype.parse = function(argv){
|
||||
// implicit help
|
||||
if (this.executables) this.addImplicitHelpCommand();
|
||||
|
||||
// store raw args
|
||||
this.rawArgs = argv;
|
||||
|
||||
// guess name
|
||||
this._name = this._name || basename(argv[1], '.js');
|
||||
|
||||
// process argv
|
||||
var parsed = this.parseOptions(this.normalize(argv.slice(2)));
|
||||
var args = this.args = parsed.args;
|
||||
|
||||
var result = this.parseArgs(this.args, parsed.unknown);
|
||||
|
||||
// executable sub-commands
|
||||
var name = result.args[0];
|
||||
if (this._execs[name]) return this.executeSubCommand(argv, args, parsed.unknown);
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
/**
|
||||
* Execute a sub-command executable.
|
||||
*
|
||||
* @param {Array} argv
|
||||
* @param {Array} args
|
||||
* @param {Array} unknown
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Command.prototype.executeSubCommand = function(argv, args, unknown) {
|
||||
args = args.concat(unknown);
|
||||
|
||||
if (!args.length) this.help();
|
||||
if ('help' == args[0] && 1 == args.length) this.help();
|
||||
|
||||
// <cmd> --help
|
||||
if ('help' == args[0]) {
|
||||
args[0] = args[1];
|
||||
args[1] = '--help';
|
||||
}
|
||||
|
||||
// executable
|
||||
var dir = dirname(argv[1]);
|
||||
var bin = basename(argv[1], '.js') + '-' + args[0];
|
||||
|
||||
// check for ./<bin> first
|
||||
var local = path.join(dir, bin);
|
||||
|
||||
// run it
|
||||
args = args.slice(1);
|
||||
args.unshift(local);
|
||||
var proc = spawn('node', args, { stdio: 'inherit', customFds: [0, 1, 2] });
|
||||
proc.on('error', function(err){
|
||||
if (err.code == "ENOENT") {
|
||||
console.error('\n %s(1) does not exist, try --help\n', bin);
|
||||
} else if (err.code == "EACCES") {
|
||||
console.error('\n %s(1) not executable. try chmod or run with root\n', bin);
|
||||
}
|
||||
});
|
||||
|
||||
this.runningCommand = proc;
|
||||
};
|
||||
|
||||
/**
|
||||
* Normalize `args`, splitting joined short flags. For example
|
||||
* the arg "-abc" is equivalent to "-a -b -c".
|
||||
* This also normalizes equal sign and splits "--abc=def" into "--abc def".
|
||||
*
|
||||
* @param {Array} args
|
||||
* @return {Array}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Command.prototype.normalize = function(args){
|
||||
var ret = []
|
||||
, arg
|
||||
, lastOpt
|
||||
, index;
|
||||
|
||||
for (var i = 0, len = args.length; i < len; ++i) {
|
||||
arg = args[i];
|
||||
i > 0 && (lastOpt = this.optionFor(args[i-1]));
|
||||
|
||||
if (lastOpt && lastOpt.required) {
|
||||
ret.push(arg);
|
||||
} else if (arg.length > 1 && '-' == arg[0] && '-' != arg[1]) {
|
||||
arg.slice(1).split('').forEach(function(c){
|
||||
ret.push('-' + c);
|
||||
});
|
||||
} else if (/^--/.test(arg) && ~(index = arg.indexOf('='))) {
|
||||
ret.push(arg.slice(0, index), arg.slice(index + 1));
|
||||
} else {
|
||||
ret.push(arg);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
};
|
||||
|
||||
/**
|
||||
* Parse command `args`.
|
||||
*
|
||||
* When listener(s) are available those
|
||||
* callbacks are invoked, otherwise the "*"
|
||||
* event is emitted and those actions are invoked.
|
||||
*
|
||||
* @param {Array} args
|
||||
* @return {Command} for chaining
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Command.prototype.parseArgs = function(args, unknown){
|
||||
var cmds = this.commands
|
||||
, len = cmds.length
|
||||
, name;
|
||||
|
||||
if (args.length) {
|
||||
name = args[0];
|
||||
if (this.listeners(name).length) {
|
||||
this.emit(args.shift(), args, unknown);
|
||||
} else {
|
||||
this.emit('*', args);
|
||||
}
|
||||
} else {
|
||||
outputHelpIfNecessary(this, unknown);
|
||||
|
||||
// If there were no args and we have unknown options,
|
||||
// then they are extraneous and we need to error.
|
||||
if (unknown.length > 0) {
|
||||
this.unknownOption(unknown[0]);
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Return an option matching `arg` if any.
|
||||
*
|
||||
* @param {String} arg
|
||||
* @return {Option}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Command.prototype.optionFor = function(arg){
|
||||
for (var i = 0, len = this.options.length; i < len; ++i) {
|
||||
if (this.options[i].is(arg)) {
|
||||
return this.options[i];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Parse options from `argv` returning `argv`
|
||||
* void of these options.
|
||||
*
|
||||
* @param {Array} argv
|
||||
* @return {Array}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Command.prototype.parseOptions = function(argv){
|
||||
var args = []
|
||||
, len = argv.length
|
||||
, literal
|
||||
, option
|
||||
, arg;
|
||||
|
||||
var unknownOptions = [];
|
||||
|
||||
// parse options
|
||||
for (var i = 0; i < len; ++i) {
|
||||
arg = argv[i];
|
||||
|
||||
// literal args after --
|
||||
if ('--' == arg) {
|
||||
literal = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (literal) {
|
||||
args.push(arg);
|
||||
continue;
|
||||
}
|
||||
|
||||
// find matching Option
|
||||
option = this.optionFor(arg);
|
||||
|
||||
// option is defined
|
||||
if (option) {
|
||||
// requires arg
|
||||
if (option.required) {
|
||||
arg = argv[++i];
|
||||
if (null == arg) return this.optionMissingArgument(option);
|
||||
this.emit(option.name(), arg);
|
||||
// optional arg
|
||||
} else if (option.optional) {
|
||||
arg = argv[i+1];
|
||||
if (null == arg || ('-' == arg[0] && '-' != arg)) {
|
||||
arg = null;
|
||||
} else {
|
||||
++i;
|
||||
}
|
||||
this.emit(option.name(), arg);
|
||||
// bool
|
||||
} else {
|
||||
this.emit(option.name());
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
// looks like an option
|
||||
if (arg.length > 1 && '-' == arg[0]) {
|
||||
unknownOptions.push(arg);
|
||||
|
||||
// If the next argument looks like it might be
|
||||
// an argument for this option, we pass it on.
|
||||
// If it isn't, then it'll simply be ignored
|
||||
if (argv[i+1] && '-' != argv[i+1][0]) {
|
||||
unknownOptions.push(argv[++i]);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
// arg
|
||||
args.push(arg);
|
||||
}
|
||||
|
||||
return { args: args, unknown: unknownOptions };
|
||||
};
|
||||
|
||||
/**
|
||||
* Argument `name` is missing.
|
||||
*
|
||||
* @param {String} name
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Command.prototype.missingArgument = function(name){
|
||||
console.error();
|
||||
console.error(" error: missing required argument `%s'", name);
|
||||
console.error();
|
||||
process.exit(1);
|
||||
};
|
||||
|
||||
/**
|
||||
* `Option` is missing an argument, but received `flag` or nothing.
|
||||
*
|
||||
* @param {String} option
|
||||
* @param {String} flag
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Command.prototype.optionMissingArgument = function(option, flag){
|
||||
console.error();
|
||||
if (flag) {
|
||||
console.error(" error: option `%s' argument missing, got `%s'", option.flags, flag);
|
||||
} else {
|
||||
console.error(" error: option `%s' argument missing", option.flags);
|
||||
}
|
||||
console.error();
|
||||
process.exit(1);
|
||||
};
|
||||
|
||||
/**
|
||||
* Unknown option `flag`.
|
||||
*
|
||||
* @param {String} flag
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Command.prototype.unknownOption = function(flag){
|
||||
console.error();
|
||||
console.error(" error: unknown option `%s'", flag);
|
||||
console.error();
|
||||
process.exit(1);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Set the program version to `str`.
|
||||
*
|
||||
* This method auto-registers the "-V, --version" flag
|
||||
* which will print the version number when passed.
|
||||
*
|
||||
* @param {String} str
|
||||
* @param {String} flags
|
||||
* @return {Command} for chaining
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Command.prototype.version = function(str, flags){
|
||||
if (0 == arguments.length) return this._version;
|
||||
this._version = str;
|
||||
flags = flags || '-V, --version';
|
||||
this.option(flags, 'output the version number');
|
||||
this.on('version', function(){
|
||||
console.log(str);
|
||||
process.exit(0);
|
||||
});
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Set the description `str`.
|
||||
*
|
||||
* @param {String} str
|
||||
* @return {String|Command}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Command.prototype.description = function(str){
|
||||
if (0 == arguments.length) return this._description;
|
||||
this._description = str;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Set an alias for the command
|
||||
*
|
||||
* @param {String} alias
|
||||
* @return {String|Command}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Command.prototype.alias = function(alias){
|
||||
if (0 == arguments.length) return this._alias;
|
||||
this._alias = alias;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Set / get the command usage `str`.
|
||||
*
|
||||
* @param {String} str
|
||||
* @return {String|Command}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Command.prototype.usage = function(str){
|
||||
var args = this._args.map(function(arg){
|
||||
return arg.required
|
||||
? '<' + arg.name + '>'
|
||||
: '[' + arg.name + ']';
|
||||
});
|
||||
|
||||
var usage = '[options'
|
||||
+ (this.commands.length ? '] [command' : '')
|
||||
+ ']'
|
||||
+ (this._args.length ? ' ' + args : '');
|
||||
|
||||
if (0 == arguments.length) return this._usage || usage;
|
||||
this._usage = str;
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Return the largest option length.
|
||||
*
|
||||
* @return {Number}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Command.prototype.largestOptionLength = function(){
|
||||
return this.options.reduce(function(max, option){
|
||||
return Math.max(max, option.flags.length);
|
||||
}, 0);
|
||||
};
|
||||
|
||||
/**
|
||||
* Return help for options.
|
||||
*
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Command.prototype.optionHelp = function(){
|
||||
var width = this.largestOptionLength();
|
||||
|
||||
// Prepend the help information
|
||||
return [pad('-h, --help', width) + ' ' + 'output usage information']
|
||||
.concat(this.options.map(function(option){
|
||||
return pad(option.flags, width)
|
||||
+ ' ' + option.description;
|
||||
}))
|
||||
.join('\n');
|
||||
};
|
||||
|
||||
/**
|
||||
* Return command help documentation.
|
||||
*
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Command.prototype.commandHelp = function(){
|
||||
if (!this.commands.length) return '';
|
||||
return [
|
||||
''
|
||||
, ' Commands:'
|
||||
, ''
|
||||
, this.commands.map(function(cmd){
|
||||
var args = cmd._args.map(function(arg){
|
||||
return arg.required
|
||||
? '<' + arg.name + '>'
|
||||
: '[' + arg.name + ']';
|
||||
}).join(' ');
|
||||
|
||||
return cmd._name
|
||||
+ (cmd._alias
|
||||
? '|' + cmd._alias
|
||||
: '')
|
||||
+ (cmd.options.length
|
||||
? ' [options]'
|
||||
: '') + ' ' + args
|
||||
+ (cmd.description()
|
||||
? '\n ' + cmd.description()
|
||||
: '')
|
||||
+ '\n';
|
||||
}).join('\n').replace(/^/gm, ' ')
|
||||
, ''
|
||||
].join('\n');
|
||||
};
|
||||
|
||||
/**
|
||||
* Return program help documentation.
|
||||
*
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Command.prototype.helpInformation = function(){
|
||||
return [
|
||||
''
|
||||
, ' Usage: ' + this._name
|
||||
+ (this._alias
|
||||
? '|' + this._alias
|
||||
: '')
|
||||
+ ' ' + this.usage()
|
||||
, '' + this.commandHelp()
|
||||
, ' Options:'
|
||||
, ''
|
||||
, '' + this.optionHelp().replace(/^/gm, ' ')
|
||||
, ''
|
||||
, ''
|
||||
].join('\n');
|
||||
};
|
||||
|
||||
/**
|
||||
* Output help information for this command
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Command.prototype.outputHelp = function(){
|
||||
process.stdout.write(this.helpInformation());
|
||||
this.emit('--help');
|
||||
};
|
||||
|
||||
/**
|
||||
* Output help information and exit.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Command.prototype.help = function(){
|
||||
this.outputHelp();
|
||||
process.exit();
|
||||
};
|
||||
|
||||
/**
|
||||
* Camel-case the given `flag`
|
||||
*
|
||||
* @param {String} flag
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function camelcase(flag) {
|
||||
return flag.split('-').reduce(function(str, word){
|
||||
return str + word[0].toUpperCase() + word.slice(1);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Pad `str` to `width`.
|
||||
*
|
||||
* @param {String} str
|
||||
* @param {Number} width
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function pad(str, width) {
|
||||
var len = Math.max(0, width - str.length);
|
||||
return str + Array(len + 1).join(' ');
|
||||
}
|
||||
|
||||
/**
|
||||
* Output help information if necessary
|
||||
*
|
||||
* @param {Command} command to output help for
|
||||
* @param {Array} array of options to search for -h or --help
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function outputHelpIfNecessary(cmd, options) {
|
||||
options = options || [];
|
||||
for (var i = 0; i < options.length; i++) {
|
||||
if (options[i] == '--help' || options[i] == '-h') {
|
||||
cmd.outputHelp();
|
||||
process.exit(0);
|
||||
}
|
||||
}
|
||||
}
|
71
node_modules/mocha/node_modules/commander/package.json
generated
vendored
Normal file
71
node_modules/mocha/node_modules/commander/package.json
generated
vendored
Normal file
@ -0,0 +1,71 @@
|
||||
{
|
||||
"name": "commander",
|
||||
"version": "2.3.0",
|
||||
"description": "the complete solution for node.js command-line programs",
|
||||
"keywords": [
|
||||
"command",
|
||||
"option",
|
||||
"parser",
|
||||
"prompt",
|
||||
"stdin"
|
||||
],
|
||||
"author": {
|
||||
"name": "TJ Holowaychuk",
|
||||
"email": "tj@vision-media.ca"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/visionmedia/commander.js.git"
|
||||
},
|
||||
"devDependencies": {
|
||||
"should": ">= 0.0.1"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "make test"
|
||||
},
|
||||
"main": "index",
|
||||
"engines": {
|
||||
"node": ">= 0.6.x"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"gitHead": "7e9f407ec03d4371a478c2fe417db4998ecb6169",
|
||||
"bugs": {
|
||||
"url": "https://github.com/visionmedia/commander.js/issues"
|
||||
},
|
||||
"homepage": "https://github.com/visionmedia/commander.js",
|
||||
"_id": "commander@2.3.0",
|
||||
"_shasum": "fd430e889832ec353b9acd1de217c11cb3eef873",
|
||||
"_from": "commander@2.3.0",
|
||||
"_npmVersion": "1.4.21",
|
||||
"_npmUser": {
|
||||
"name": "somekittens",
|
||||
"email": "rkoutnik@gmail.com"
|
||||
},
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "tjholowaychuk",
|
||||
"email": "tj@vision-media.ca"
|
||||
},
|
||||
{
|
||||
"name": "somekittens",
|
||||
"email": "rkoutnik@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "zhiyelee",
|
||||
"email": "zhiyelee@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "thethomaseffect",
|
||||
"email": "thethomaseffect@gmail.com"
|
||||
}
|
||||
],
|
||||
"dist": {
|
||||
"shasum": "fd430e889832ec353b9acd1de217c11cb3eef873",
|
||||
"tarball": "http://registry.npmjs.org/commander/-/commander-2.3.0.tgz"
|
||||
},
|
||||
"directories": {},
|
||||
"_resolved": "https://registry.npmjs.org/commander/-/commander-2.3.0.tgz",
|
||||
"readme": "ERROR: No README data found!"
|
||||
}
|
3
node_modules/mocha/node_modules/debug/.jshintrc
generated
vendored
Normal file
3
node_modules/mocha/node_modules/debug/.jshintrc
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"laxbreak": true
|
||||
}
|
6
node_modules/mocha/node_modules/debug/.npmignore
generated
vendored
Normal file
6
node_modules/mocha/node_modules/debug/.npmignore
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
support
|
||||
test
|
||||
examples
|
||||
example
|
||||
*.sock
|
||||
dist
|
150
node_modules/mocha/node_modules/debug/History.md
generated
vendored
Normal file
150
node_modules/mocha/node_modules/debug/History.md
generated
vendored
Normal file
@ -0,0 +1,150 @@
|
||||
|
||||
2.0.0 / 2014-09-01
|
||||
==================
|
||||
|
||||
* package: update "browserify" to v5.11.0
|
||||
* node: use stderr rather than stdout for logging (#29, @stephenmathieson)
|
||||
|
||||
1.0.4 / 2014-07-15
|
||||
==================
|
||||
|
||||
* dist: recompile
|
||||
* example: remove `console.info()` log usage
|
||||
* example: add "Content-Type" UTF-8 header to browser example
|
||||
* browser: place %c marker after the space character
|
||||
* browser: reset the "content" color via `color: inherit`
|
||||
* browser: add colors support for Firefox >= v31
|
||||
* debug: prefer an instance `log()` function over the global one (#119)
|
||||
* Readme: update documentation about styled console logs for FF v31 (#116, @wryk)
|
||||
|
||||
1.0.3 / 2014-07-09
|
||||
==================
|
||||
|
||||
* Add support for multiple wildcards in namespaces (#122, @seegno)
|
||||
* browser: fix lint
|
||||
|
||||
1.0.2 / 2014-06-10
|
||||
==================
|
||||
|
||||
* browser: update color palette (#113, @gscottolson)
|
||||
* common: make console logging function configurable (#108, @timoxley)
|
||||
* node: fix %o colors on old node <= 0.8.x
|
||||
* Makefile: find node path using shell/which (#109, @timoxley)
|
||||
|
||||
1.0.1 / 2014-06-06
|
||||
==================
|
||||
|
||||
* browser: use `removeItem()` to clear localStorage
|
||||
* browser, node: don't set DEBUG if namespaces is undefined (#107, @leedm777)
|
||||
* package: add "contributors" section
|
||||
* node: fix comment typo
|
||||
* README: list authors
|
||||
|
||||
1.0.0 / 2014-06-04
|
||||
==================
|
||||
|
||||
* make ms diff be global, not be scope
|
||||
* debug: ignore empty strings in enable()
|
||||
* node: make DEBUG_COLORS able to disable coloring
|
||||
* *: export the `colors` array
|
||||
* npmignore: don't publish the `dist` dir
|
||||
* Makefile: refactor to use browserify
|
||||
* package: add "browserify" as a dev dependency
|
||||
* Readme: add Web Inspector Colors section
|
||||
* node: reset terminal color for the debug content
|
||||
* node: map "%o" to `util.inspect()`
|
||||
* browser: map "%j" to `JSON.stringify()`
|
||||
* debug: add custom "formatters"
|
||||
* debug: use "ms" module for humanizing the diff
|
||||
* Readme: add "bash" syntax highlighting
|
||||
* browser: add Firebug color support
|
||||
* browser: add colors for WebKit browsers
|
||||
* node: apply log to `console`
|
||||
* rewrite: abstract common logic for Node & browsers
|
||||
* add .jshintrc file
|
||||
|
||||
0.8.1 / 2014-04-14
|
||||
==================
|
||||
|
||||
* package: re-add the "component" section
|
||||
|
||||
0.8.0 / 2014-03-30
|
||||
==================
|
||||
|
||||
* add `enable()` method for nodejs. Closes #27
|
||||
* change from stderr to stdout
|
||||
* remove unnecessary index.js file
|
||||
|
||||
0.7.4 / 2013-11-13
|
||||
==================
|
||||
|
||||
* remove "browserify" key from package.json (fixes something in browserify)
|
||||
|
||||
0.7.3 / 2013-10-30
|
||||
==================
|
||||
|
||||
* fix: catch localStorage security error when cookies are blocked (Chrome)
|
||||
* add debug(err) support. Closes #46
|
||||
* add .browser prop to package.json. Closes #42
|
||||
|
||||
0.7.2 / 2013-02-06
|
||||
==================
|
||||
|
||||
* fix package.json
|
||||
* fix: Mobile Safari (private mode) is broken with debug
|
||||
* fix: Use unicode to send escape character to shell instead of octal to work with strict mode javascript
|
||||
|
||||
0.7.1 / 2013-02-05
|
||||
==================
|
||||
|
||||
* add repository URL to package.json
|
||||
* add DEBUG_COLORED to force colored output
|
||||
* add browserify support
|
||||
* fix component. Closes #24
|
||||
|
||||
0.7.0 / 2012-05-04
|
||||
==================
|
||||
|
||||
* Added .component to package.json
|
||||
* Added debug.component.js build
|
||||
|
||||
0.6.0 / 2012-03-16
|
||||
==================
|
||||
|
||||
* Added support for "-" prefix in DEBUG [Vinay Pulim]
|
||||
* Added `.enabled` flag to the node version [TooTallNate]
|
||||
|
||||
0.5.0 / 2012-02-02
|
||||
==================
|
||||
|
||||
* Added: humanize diffs. Closes #8
|
||||
* Added `debug.disable()` to the CS variant
|
||||
* Removed padding. Closes #10
|
||||
* Fixed: persist client-side variant again. Closes #9
|
||||
|
||||
0.4.0 / 2012-02-01
|
||||
==================
|
||||
|
||||
* Added browser variant support for older browsers [TooTallNate]
|
||||
* Added `debug.enable('project:*')` to browser variant [TooTallNate]
|
||||
* Added padding to diff (moved it to the right)
|
||||
|
||||
0.3.0 / 2012-01-26
|
||||
==================
|
||||
|
||||
* Added millisecond diff when isatty, otherwise UTC string
|
||||
|
||||
0.2.0 / 2012-01-22
|
||||
==================
|
||||
|
||||
* Added wildcard support
|
||||
|
||||
0.1.0 / 2011-12-02
|
||||
==================
|
||||
|
||||
* Added: remove colors unless stderr isatty [TooTallNate]
|
||||
|
||||
0.0.1 / 2010-01-03
|
||||
==================
|
||||
|
||||
* Initial release
|
33
node_modules/mocha/node_modules/debug/Makefile
generated
vendored
Normal file
33
node_modules/mocha/node_modules/debug/Makefile
generated
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
|
||||
# get Makefile directory name: http://stackoverflow.com/a/5982798/376773
|
||||
THIS_MAKEFILE_PATH:=$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
|
||||
THIS_DIR:=$(shell cd $(dir $(THIS_MAKEFILE_PATH));pwd)
|
||||
|
||||
# BIN directory
|
||||
BIN := $(THIS_DIR)/node_modules/.bin
|
||||
|
||||
# applications
|
||||
NODE ?= $(shell which node)
|
||||
NPM ?= $(NODE) $(shell which npm)
|
||||
BROWSERIFY ?= $(NODE) $(BIN)/browserify
|
||||
|
||||
all: dist/debug.js
|
||||
|
||||
install: node_modules
|
||||
|
||||
clean:
|
||||
@rm -rf node_modules dist
|
||||
|
||||
dist:
|
||||
@mkdir -p $@
|
||||
|
||||
dist/debug.js: node_modules browser.js debug.js dist
|
||||
@$(BROWSERIFY) \
|
||||
--standalone debug \
|
||||
. > $@
|
||||
|
||||
node_modules: package.json
|
||||
@NODE_ENV= $(NPM) install
|
||||
@touch node_modules
|
||||
|
||||
.PHONY: all install clean
|
156
node_modules/mocha/node_modules/debug/Readme.md
generated
vendored
Normal file
156
node_modules/mocha/node_modules/debug/Readme.md
generated
vendored
Normal file
@ -0,0 +1,156 @@
|
||||
# debug
|
||||
|
||||
tiny node.js debugging utility modelled after node core's debugging technique.
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
$ npm install debug
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
With `debug` you simply invoke the exported function to generate your debug function, passing it a name which will determine if a noop function is returned, or a decorated `console.error`, so all of the `console` format string goodies you're used to work fine. A unique color is selected per-function for visibility.
|
||||
|
||||
Example _app.js_:
|
||||
|
||||
```js
|
||||
var debug = require('debug')('http')
|
||||
, http = require('http')
|
||||
, name = 'My App';
|
||||
|
||||
// fake app
|
||||
|
||||
debug('booting %s', name);
|
||||
|
||||
http.createServer(function(req, res){
|
||||
debug(req.method + ' ' + req.url);
|
||||
res.end('hello\n');
|
||||
}).listen(3000, function(){
|
||||
debug('listening');
|
||||
});
|
||||
|
||||
// fake worker of some kind
|
||||
|
||||
require('./worker');
|
||||
```
|
||||
|
||||
Example _worker.js_:
|
||||
|
||||
```js
|
||||
var debug = require('debug')('worker');
|
||||
|
||||
setInterval(function(){
|
||||
debug('doing some work');
|
||||
}, 1000);
|
||||
```
|
||||
|
||||
The __DEBUG__ environment variable is then used to enable these based on space or comma-delimited names. Here are some examples:
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
## Millisecond diff
|
||||
|
||||
When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls.
|
||||
|
||||

|
||||
|
||||
When stdout is not a TTY, `Date#toUTCString()` is used, making it more useful for logging the debug information as shown below:
|
||||
|
||||

|
||||
|
||||
## Conventions
|
||||
|
||||
If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser".
|
||||
|
||||
## Wildcards
|
||||
|
||||
The `*` character may be used as a wildcard. Suppose for example your library has debuggers named "connect:bodyParser", "connect:compress", "connect:session", instead of listing all three with `DEBUG=connect:bodyParser,connect.compress,connect:session`, you may simply do `DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`.
|
||||
|
||||
You can also exclude specific debuggers by prefixing them with a "-" character. For example, `DEBUG=*,-connect:*` would include all debuggers except those starting with "connect:".
|
||||
|
||||
## Browser support
|
||||
|
||||
Debug works in the browser as well, currently persisted by `localStorage`. For example if you have `worker:a` and `worker:b` as shown below, and wish to debug both type `debug.enable('worker:*')` in the console and refresh the page, this will remain until you disable with `debug.disable()`.
|
||||
|
||||
```js
|
||||
a = debug('worker:a');
|
||||
b = debug('worker:b');
|
||||
|
||||
setInterval(function(){
|
||||
a('doing some work');
|
||||
}, 1000);
|
||||
|
||||
setInterval(function(){
|
||||
b('doing some work');
|
||||
}, 1200);
|
||||
```
|
||||
|
||||
#### Web Inspector Colors
|
||||
|
||||
Colors are also enabled on "Web Inspectors" that understand the `%c` formatting
|
||||
option. These are WebKit web inspectors, Firefox ([since version
|
||||
31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/))
|
||||
and the Firebug plugin for Firefox (any version).
|
||||
|
||||
Colored output looks something like:
|
||||
|
||||

|
||||
|
||||
### stderr vs stdout
|
||||
|
||||
You can set an alternative logging method per-namespace by overriding the `log` method on a per-namespace or globally:
|
||||
|
||||
Example _stderr.js_:
|
||||
|
||||
```js
|
||||
var debug = require('../');
|
||||
var log = debug('app:log');
|
||||
|
||||
// by default console.log is used
|
||||
log('goes to stdout!');
|
||||
|
||||
var error = debug('app:error');
|
||||
// set this namespace to log via console.error
|
||||
error.log = console.error.bind(console); // don't forget to bind to console!
|
||||
error('goes to stderr');
|
||||
log('still goes to stdout!');
|
||||
|
||||
// set all output to go via console.warn
|
||||
// overrides all per-namespace log settings
|
||||
debug.log = console.warn.bind(console);
|
||||
log('now goes to stderr via console.warn');
|
||||
error('still goes to stderr, but via console.warn now');
|
||||
```
|
||||
|
||||
## Authors
|
||||
|
||||
- TJ Holowaychuk
|
||||
- Nathan Rajlich
|
||||
|
||||
## License
|
||||
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2014 TJ Holowaychuk <tj@vision-media.ca>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
'Software'), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
147
node_modules/mocha/node_modules/debug/browser.js
generated
vendored
Normal file
147
node_modules/mocha/node_modules/debug/browser.js
generated
vendored
Normal file
@ -0,0 +1,147 @@
|
||||
|
||||
/**
|
||||
* This is the web browser implementation of `debug()`.
|
||||
*
|
||||
* Expose `debug()` as the module.
|
||||
*/
|
||||
|
||||
exports = module.exports = require('./debug');
|
||||
exports.log = log;
|
||||
exports.formatArgs = formatArgs;
|
||||
exports.save = save;
|
||||
exports.load = load;
|
||||
exports.useColors = useColors;
|
||||
|
||||
/**
|
||||
* Colors.
|
||||
*/
|
||||
|
||||
exports.colors = [
|
||||
'lightseagreen',
|
||||
'forestgreen',
|
||||
'goldenrod',
|
||||
'dodgerblue',
|
||||
'darkorchid',
|
||||
'crimson'
|
||||
];
|
||||
|
||||
/**
|
||||
* Currently only WebKit-based Web Inspectors, Firefox >= v31,
|
||||
* and the Firebug extension (any Firefox version) are known
|
||||
* to support "%c" CSS customizations.
|
||||
*
|
||||
* TODO: add a `localStorage` variable to explicitly enable/disable colors
|
||||
*/
|
||||
|
||||
function useColors() {
|
||||
// is webkit? http://stackoverflow.com/a/16459606/376773
|
||||
return ('WebkitAppearance' in document.documentElement.style) ||
|
||||
// is firebug? http://stackoverflow.com/a/398120/376773
|
||||
(window.console && (console.firebug || (console.exception && console.table))) ||
|
||||
// is firefox >= v31?
|
||||
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
|
||||
(navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31);
|
||||
}
|
||||
|
||||
/**
|
||||
* Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
|
||||
*/
|
||||
|
||||
exports.formatters.j = function(v) {
|
||||
return JSON.stringify(v);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Colorize log arguments if enabled.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function formatArgs() {
|
||||
var args = arguments;
|
||||
var useColors = this.useColors;
|
||||
|
||||
args[0] = (useColors ? '%c' : '')
|
||||
+ this.namespace
|
||||
+ (useColors ? ' %c' : ' ')
|
||||
+ args[0]
|
||||
+ (useColors ? '%c ' : ' ')
|
||||
+ '+' + exports.humanize(this.diff);
|
||||
|
||||
if (!useColors) return args;
|
||||
|
||||
var c = 'color: ' + this.color;
|
||||
args = [args[0], c, 'color: inherit'].concat(Array.prototype.slice.call(args, 1));
|
||||
|
||||
// the final "%c" is somewhat tricky, because there could be other
|
||||
// arguments passed either before or after the %c, so we need to
|
||||
// figure out the correct index to insert the CSS into
|
||||
var index = 0;
|
||||
var lastC = 0;
|
||||
args[0].replace(/%[a-z%]/g, function(match) {
|
||||
if ('%%' === match) return;
|
||||
index++;
|
||||
if ('%c' === match) {
|
||||
// we only are interested in the *last* %c
|
||||
// (the user may have provided their own)
|
||||
lastC = index;
|
||||
}
|
||||
});
|
||||
|
||||
args.splice(lastC, 0, c);
|
||||
return args;
|
||||
}
|
||||
|
||||
/**
|
||||
* Invokes `console.log()` when available.
|
||||
* No-op when `console.log` is not a "function".
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function log() {
|
||||
// This hackery is required for IE8,
|
||||
// where the `console.log` function doesn't have 'apply'
|
||||
return 'object' == typeof console
|
||||
&& 'function' == typeof console.log
|
||||
&& Function.prototype.apply.call(console.log, console, arguments);
|
||||
}
|
||||
|
||||
/**
|
||||
* Save `namespaces`.
|
||||
*
|
||||
* @param {String} namespaces
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function save(namespaces) {
|
||||
try {
|
||||
if (null == namespaces) {
|
||||
localStorage.removeItem('debug');
|
||||
} else {
|
||||
localStorage.debug = namespaces;
|
||||
}
|
||||
} catch(e) {}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load `namespaces`.
|
||||
*
|
||||
* @return {String} returns the previously persisted debug modes
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function load() {
|
||||
var r;
|
||||
try {
|
||||
r = localStorage.debug;
|
||||
} catch(e) {}
|
||||
return r;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable namespaces listed in `localStorage.debug` initially.
|
||||
*/
|
||||
|
||||
exports.enable(load());
|
19
node_modules/mocha/node_modules/debug/component.json
generated
vendored
Normal file
19
node_modules/mocha/node_modules/debug/component.json
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"name": "debug",
|
||||
"repo": "visionmedia/debug",
|
||||
"description": "small debugging utility",
|
||||
"version": "2.0.0",
|
||||
"keywords": [
|
||||
"debug",
|
||||
"log",
|
||||
"debugger"
|
||||
],
|
||||
"main": "browser.js",
|
||||
"scripts": [
|
||||
"browser.js",
|
||||
"debug.js"
|
||||
],
|
||||
"dependencies": {
|
||||
"guille/ms.js": "0.6.1"
|
||||
}
|
||||
}
|
197
node_modules/mocha/node_modules/debug/debug.js
generated
vendored
Normal file
197
node_modules/mocha/node_modules/debug/debug.js
generated
vendored
Normal file
@ -0,0 +1,197 @@
|
||||
|
||||
/**
|
||||
* This is the common logic for both the Node.js and web browser
|
||||
* implementations of `debug()`.
|
||||
*
|
||||
* Expose `debug()` as the module.
|
||||
*/
|
||||
|
||||
exports = module.exports = debug;
|
||||
exports.coerce = coerce;
|
||||
exports.disable = disable;
|
||||
exports.enable = enable;
|
||||
exports.enabled = enabled;
|
||||
exports.humanize = require('ms');
|
||||
|
||||
/**
|
||||
* The currently active debug mode names, and names to skip.
|
||||
*/
|
||||
|
||||
exports.names = [];
|
||||
exports.skips = [];
|
||||
|
||||
/**
|
||||
* Map of special "%n" handling functions, for the debug "format" argument.
|
||||
*
|
||||
* Valid key names are a single, lowercased letter, i.e. "n".
|
||||
*/
|
||||
|
||||
exports.formatters = {};
|
||||
|
||||
/**
|
||||
* Previously assigned color.
|
||||
*/
|
||||
|
||||
var prevColor = 0;
|
||||
|
||||
/**
|
||||
* Previous log timestamp.
|
||||
*/
|
||||
|
||||
var prevTime;
|
||||
|
||||
/**
|
||||
* Select a color.
|
||||
*
|
||||
* @return {Number}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function selectColor() {
|
||||
return exports.colors[prevColor++ % exports.colors.length];
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a debugger with the given `namespace`.
|
||||
*
|
||||
* @param {String} namespace
|
||||
* @return {Function}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function debug(namespace) {
|
||||
|
||||
// define the `disabled` version
|
||||
function disabled() {
|
||||
}
|
||||
disabled.enabled = false;
|
||||
|
||||
// define the `enabled` version
|
||||
function enabled() {
|
||||
|
||||
var self = enabled;
|
||||
|
||||
// set `diff` timestamp
|
||||
var curr = +new Date();
|
||||
var ms = curr - (prevTime || curr);
|
||||
self.diff = ms;
|
||||
self.prev = prevTime;
|
||||
self.curr = curr;
|
||||
prevTime = curr;
|
||||
|
||||
// add the `color` if not set
|
||||
if (null == self.useColors) self.useColors = exports.useColors();
|
||||
if (null == self.color && self.useColors) self.color = selectColor();
|
||||
|
||||
var args = Array.prototype.slice.call(arguments);
|
||||
|
||||
args[0] = exports.coerce(args[0]);
|
||||
|
||||
if ('string' !== typeof args[0]) {
|
||||
// anything else let's inspect with %o
|
||||
args = ['%o'].concat(args);
|
||||
}
|
||||
|
||||
// apply any `formatters` transformations
|
||||
var index = 0;
|
||||
args[0] = args[0].replace(/%([a-z%])/g, function(match, format) {
|
||||
// if we encounter an escaped % then don't increase the array index
|
||||
if (match === '%%') return match;
|
||||
index++;
|
||||
var formatter = exports.formatters[format];
|
||||
if ('function' === typeof formatter) {
|
||||
var val = args[index];
|
||||
match = formatter.call(self, val);
|
||||
|
||||
// now we need to remove `args[index]` since it's inlined in the `format`
|
||||
args.splice(index, 1);
|
||||
index--;
|
||||
}
|
||||
return match;
|
||||
});
|
||||
|
||||
if ('function' === typeof exports.formatArgs) {
|
||||
args = exports.formatArgs.apply(self, args);
|
||||
}
|
||||
var logFn = enabled.log || exports.log || console.log.bind(console);
|
||||
logFn.apply(self, args);
|
||||
}
|
||||
enabled.enabled = true;
|
||||
|
||||
var fn = exports.enabled(namespace) ? enabled : disabled;
|
||||
|
||||
fn.namespace = namespace;
|
||||
|
||||
return fn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables a debug mode by namespaces. This can include modes
|
||||
* separated by a colon and wildcards.
|
||||
*
|
||||
* @param {String} namespaces
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function enable(namespaces) {
|
||||
exports.save(namespaces);
|
||||
|
||||
var split = (namespaces || '').split(/[\s,]+/);
|
||||
var len = split.length;
|
||||
|
||||
for (var i = 0; i < len; i++) {
|
||||
if (!split[i]) continue; // ignore empty strings
|
||||
namespaces = split[i].replace(/\*/g, '.*?');
|
||||
if (namespaces[0] === '-') {
|
||||
exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
|
||||
} else {
|
||||
exports.names.push(new RegExp('^' + namespaces + '$'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable debug output.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function disable() {
|
||||
exports.enable('');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the given mode name is enabled, false otherwise.
|
||||
*
|
||||
* @param {String} name
|
||||
* @return {Boolean}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function enabled(name) {
|
||||
var i, len;
|
||||
for (i = 0, len = exports.skips.length; i < len; i++) {
|
||||
if (exports.skips[i].test(name)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
for (i = 0, len = exports.names.length; i < len; i++) {
|
||||
if (exports.names[i].test(name)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Coerce `val`.
|
||||
*
|
||||
* @param {Mixed} val
|
||||
* @return {Mixed}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function coerce(val) {
|
||||
if (val instanceof Error) return val.stack || val.message;
|
||||
return val;
|
||||
}
|
129
node_modules/mocha/node_modules/debug/node.js
generated
vendored
Normal file
129
node_modules/mocha/node_modules/debug/node.js
generated
vendored
Normal file
@ -0,0 +1,129 @@
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var tty = require('tty');
|
||||
var util = require('util');
|
||||
|
||||
/**
|
||||
* This is the Node.js implementation of `debug()`.
|
||||
*
|
||||
* Expose `debug()` as the module.
|
||||
*/
|
||||
|
||||
exports = module.exports = require('./debug');
|
||||
exports.log = log;
|
||||
exports.formatArgs = formatArgs;
|
||||
exports.save = save;
|
||||
exports.load = load;
|
||||
exports.useColors = useColors;
|
||||
|
||||
/**
|
||||
* Colors.
|
||||
*/
|
||||
|
||||
exports.colors = [6, 2, 3, 4, 5, 1];
|
||||
|
||||
/**
|
||||
* Is stdout a TTY? Colored output is enabled when `true`.
|
||||
*/
|
||||
|
||||
function useColors() {
|
||||
var debugColors = (process.env.DEBUG_COLORS || '').trim().toLowerCase();
|
||||
if (0 === debugColors.length) {
|
||||
return tty.isatty(1);
|
||||
} else {
|
||||
return '0' !== debugColors
|
||||
&& 'no' !== debugColors
|
||||
&& 'false' !== debugColors
|
||||
&& 'disabled' !== debugColors;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Map %o to `util.inspect()`, since Node doesn't do that out of the box.
|
||||
*/
|
||||
|
||||
var inspect = (4 === util.inspect.length ?
|
||||
// node <= 0.8.x
|
||||
function (v, colors) {
|
||||
return util.inspect(v, void 0, void 0, colors);
|
||||
} :
|
||||
// node > 0.8.x
|
||||
function (v, colors) {
|
||||
return util.inspect(v, { colors: colors });
|
||||
}
|
||||
);
|
||||
|
||||
exports.formatters.o = function(v) {
|
||||
return inspect(v, this.useColors)
|
||||
.replace(/\s*\n\s*/g, ' ');
|
||||
};
|
||||
|
||||
/**
|
||||
* Adds ANSI color escape codes if enabled.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function formatArgs() {
|
||||
var args = arguments;
|
||||
var useColors = this.useColors;
|
||||
var name = this.namespace;
|
||||
|
||||
if (useColors) {
|
||||
var c = this.color;
|
||||
|
||||
args[0] = ' \u001b[9' + c + 'm' + name + ' '
|
||||
+ '\u001b[0m'
|
||||
+ args[0] + '\u001b[3' + c + 'm'
|
||||
+ ' +' + exports.humanize(this.diff) + '\u001b[0m';
|
||||
} else {
|
||||
args[0] = new Date().toUTCString()
|
||||
+ ' ' + name + ' ' + args[0];
|
||||
}
|
||||
return args;
|
||||
}
|
||||
|
||||
/**
|
||||
* Invokes `console.error()` with the specified arguments.
|
||||
*/
|
||||
|
||||
function log() {
|
||||
return console.error.apply(console, arguments);
|
||||
}
|
||||
|
||||
/**
|
||||
* Save `namespaces`.
|
||||
*
|
||||
* @param {String} namespaces
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function save(namespaces) {
|
||||
if (null == namespaces) {
|
||||
// If you set a process.env field to null or undefined, it gets cast to the
|
||||
// string 'null' or 'undefined'. Just delete instead.
|
||||
delete process.env.DEBUG;
|
||||
} else {
|
||||
process.env.DEBUG = namespaces;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load `namespaces`.
|
||||
*
|
||||
* @return {String} returns the previously persisted debug modes
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function load() {
|
||||
return process.env.DEBUG;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable namespaces listed in `process.env.DEBUG` initially.
|
||||
*/
|
||||
|
||||
exports.enable(load());
|
71
node_modules/mocha/node_modules/debug/package.json
generated
vendored
Normal file
71
node_modules/mocha/node_modules/debug/package.json
generated
vendored
Normal file
@ -0,0 +1,71 @@
|
||||
{
|
||||
"name": "debug",
|
||||
"version": "2.0.0",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/visionmedia/debug.git"
|
||||
},
|
||||
"description": "small debugging utility",
|
||||
"keywords": [
|
||||
"debug",
|
||||
"log",
|
||||
"debugger"
|
||||
],
|
||||
"author": {
|
||||
"name": "TJ Holowaychuk",
|
||||
"email": "tj@vision-media.ca"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Nathan Rajlich",
|
||||
"email": "nathan@tootallnate.net",
|
||||
"url": "http://n8.io"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"ms": "0.6.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"browserify": "5.11.0",
|
||||
"mocha": "*"
|
||||
},
|
||||
"main": "./node.js",
|
||||
"browser": "./browser.js",
|
||||
"component": {
|
||||
"scripts": {
|
||||
"debug/index.js": "browser.js",
|
||||
"debug/debug.js": "debug.js"
|
||||
}
|
||||
},
|
||||
"gitHead": "c61ae82bde19c6fdedfc6684817ff7eb541ff029",
|
||||
"bugs": {
|
||||
"url": "https://github.com/visionmedia/debug/issues"
|
||||
},
|
||||
"homepage": "https://github.com/visionmedia/debug",
|
||||
"_id": "debug@2.0.0",
|
||||
"scripts": {},
|
||||
"_shasum": "89bd9df6732b51256bc6705342bba02ed12131ef",
|
||||
"_from": "debug@2.0.0",
|
||||
"_npmVersion": "1.4.21",
|
||||
"_npmUser": {
|
||||
"name": "tootallnate",
|
||||
"email": "nathan@tootallnate.net"
|
||||
},
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "tjholowaychuk",
|
||||
"email": "tj@vision-media.ca"
|
||||
},
|
||||
{
|
||||
"name": "tootallnate",
|
||||
"email": "nathan@tootallnate.net"
|
||||
}
|
||||
],
|
||||
"dist": {
|
||||
"shasum": "89bd9df6732b51256bc6705342bba02ed12131ef",
|
||||
"tarball": "http://registry.npmjs.org/debug/-/debug-2.0.0.tgz"
|
||||
},
|
||||
"directories": {},
|
||||
"_resolved": "https://registry.npmjs.org/debug/-/debug-2.0.0.tgz",
|
||||
"readme": "ERROR: No README data found!"
|
||||
}
|
154
node_modules/mocha/node_modules/diff/README.md
generated
vendored
Normal file
154
node_modules/mocha/node_modules/diff/README.md
generated
vendored
Normal file
@ -0,0 +1,154 @@
|
||||
# jsdiff
|
||||
|
||||
[](http://travis-ci.org/kpdecker/jsdiff)
|
||||
|
||||
A javascript text differencing implementation.
|
||||
|
||||
Based on the algorithm proposed in
|
||||
["An O(ND) Difference Algorithm and its Variations" (Myers, 1986)](http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.4.6927).
|
||||
|
||||
## Installation
|
||||
|
||||
npm install diff
|
||||
|
||||
or
|
||||
|
||||
git clone git://github.com/kpdecker/jsdiff.git
|
||||
|
||||
## API
|
||||
|
||||
* `JsDiff.diffChars(oldStr, newStr)` - diffs two blocks of text, comparing character by character.
|
||||
|
||||
Returns a list of change objects (See below).
|
||||
|
||||
* `JsDiff.diffWords(oldStr, newStr)` - diffs two blocks of text, comparing word by word.
|
||||
|
||||
Returns a list of change objects (See below).
|
||||
|
||||
* `JsDiff.diffLines(oldStr, newStr)` - diffs two blocks of text, comparing line by line.
|
||||
|
||||
Returns a list of change objects (See below).
|
||||
|
||||
* `JsDiff.diffCss(oldStr, newStr)` - diffs two blocks of text, comparing CSS tokens.
|
||||
|
||||
Returns a list of change objects (See below).
|
||||
|
||||
* `JsDiff.createPatch(fileName, oldStr, newStr, oldHeader, newHeader)` - creates a unified diff patch.
|
||||
|
||||
Parameters:
|
||||
* `fileName` : String to be output in the filename sections of the patch
|
||||
* `oldStr` : Original string value
|
||||
* `newStr` : New string value
|
||||
* `oldHeader` : Additional information to include in the old file header
|
||||
* `newHeader` : Additional information to include in thew new file header
|
||||
|
||||
* `JsDiff.applyPatch(oldStr, diffStr)` - applies a unified diff patch.
|
||||
|
||||
Return a string containing new version of provided data.
|
||||
|
||||
* `convertChangesToXML(changes)` - converts a list of changes to a serialized XML format
|
||||
|
||||
### Change Objects
|
||||
Many of the methods above return change objects. These objects are consist of the following fields:
|
||||
|
||||
* `value`: Text content
|
||||
* `added`: True if the value was inserted into the new string
|
||||
* `removed`: True of the value was removed from the old string
|
||||
|
||||
Note that some cases may omit a particular flag field. Comparison on the flag fields should always be done in a truthy or falsy manner.
|
||||
|
||||
## Examples
|
||||
|
||||
Basic example in Node
|
||||
|
||||
```js
|
||||
require('colors')
|
||||
var jsdiff = require('diff');
|
||||
|
||||
var one = 'beep boop';
|
||||
var other = 'beep boob blah';
|
||||
|
||||
var diff = jsdiff.diffChars(one, other);
|
||||
|
||||
diff.forEach(function(part){
|
||||
// green for additions, red for deletions
|
||||
// grey for common parts
|
||||
var color = part.added ? 'green' :
|
||||
part.removed ? 'red' : 'grey';
|
||||
process.stderr.write(part.value[color]);
|
||||
});
|
||||
|
||||
console.log()
|
||||
```
|
||||
Running the above program should yield
|
||||
|
||||
<img src="images/node_example.png" alt="Node Example">
|
||||
|
||||
Basic example in a web page
|
||||
|
||||
```html
|
||||
<pre id="display"></pre>
|
||||
<script src="diff.js"></script>
|
||||
<script>
|
||||
var one = 'beep boop';
|
||||
var other = 'beep boob blah';
|
||||
|
||||
var diff = JsDiff.diffChars(one, other);
|
||||
|
||||
diff.forEach(function(part){
|
||||
// green for additions, red for deletions
|
||||
// grey for common parts
|
||||
var color = part.added ? 'green' :
|
||||
part.removed ? 'red' : 'grey';
|
||||
var span = document.createElement('span');
|
||||
span.style.color = color;
|
||||
span.appendChild(document
|
||||
.createTextNode(part.value));
|
||||
display.appendChild(span);
|
||||
});
|
||||
</script>
|
||||
```
|
||||
|
||||
Open the above .html file in a browser and you should see
|
||||
|
||||
<img src="images/web_example.png" alt="Node Example">
|
||||
|
||||
**[Full online demo](http://kpdecker.github.com/jsdiff)**
|
||||
|
||||
## License
|
||||
|
||||
Software License Agreement (BSD License)
|
||||
|
||||
Copyright (c) 2009-2011, Kevin Decker kpdecker@gmail.com
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of Kevin Decker nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
[](https://bitdeli.com/free "Bitdeli Badge")
|
||||
|
369
node_modules/mocha/node_modules/diff/diff.js
generated
vendored
Normal file
369
node_modules/mocha/node_modules/diff/diff.js
generated
vendored
Normal file
@ -0,0 +1,369 @@
|
||||
/* See LICENSE file for terms of use */
|
||||
|
||||
/*
|
||||
* Text diff implementation.
|
||||
*
|
||||
* This library supports the following APIS:
|
||||
* JsDiff.diffChars: Character by character diff
|
||||
* JsDiff.diffWords: Word (as defined by \b regex) diff which ignores whitespace
|
||||
* JsDiff.diffLines: Line based diff
|
||||
*
|
||||
* JsDiff.diffCss: Diff targeted at CSS content
|
||||
*
|
||||
* These methods are based on the implementation proposed in
|
||||
* "An O(ND) Difference Algorithm and its Variations" (Myers, 1986).
|
||||
* http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.4.6927
|
||||
*/
|
||||
var JsDiff = (function() {
|
||||
/*jshint maxparams: 5*/
|
||||
function clonePath(path) {
|
||||
return { newPos: path.newPos, components: path.components.slice(0) };
|
||||
}
|
||||
function removeEmpty(array) {
|
||||
var ret = [];
|
||||
for (var i = 0; i < array.length; i++) {
|
||||
if (array[i]) {
|
||||
ret.push(array[i]);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
function escapeHTML(s) {
|
||||
var n = s;
|
||||
n = n.replace(/&/g, '&');
|
||||
n = n.replace(/</g, '<');
|
||||
n = n.replace(/>/g, '>');
|
||||
n = n.replace(/"/g, '"');
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
var Diff = function(ignoreWhitespace) {
|
||||
this.ignoreWhitespace = ignoreWhitespace;
|
||||
};
|
||||
Diff.prototype = {
|
||||
diff: function(oldString, newString) {
|
||||
// Handle the identity case (this is due to unrolling editLength == 0
|
||||
if (newString === oldString) {
|
||||
return [{ value: newString }];
|
||||
}
|
||||
if (!newString) {
|
||||
return [{ value: oldString, removed: true }];
|
||||
}
|
||||
if (!oldString) {
|
||||
return [{ value: newString, added: true }];
|
||||
}
|
||||
|
||||
newString = this.tokenize(newString);
|
||||
oldString = this.tokenize(oldString);
|
||||
|
||||
var newLen = newString.length, oldLen = oldString.length;
|
||||
var maxEditLength = newLen + oldLen;
|
||||
var bestPath = [{ newPos: -1, components: [] }];
|
||||
|
||||
// Seed editLength = 0
|
||||
var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0);
|
||||
if (bestPath[0].newPos+1 >= newLen && oldPos+1 >= oldLen) {
|
||||
return bestPath[0].components;
|
||||
}
|
||||
|
||||
for (var editLength = 1; editLength <= maxEditLength; editLength++) {
|
||||
for (var diagonalPath = -1*editLength; diagonalPath <= editLength; diagonalPath+=2) {
|
||||
var basePath;
|
||||
var addPath = bestPath[diagonalPath-1],
|
||||
removePath = bestPath[diagonalPath+1];
|
||||
oldPos = (removePath ? removePath.newPos : 0) - diagonalPath;
|
||||
if (addPath) {
|
||||
// No one else is going to attempt to use this value, clear it
|
||||
bestPath[diagonalPath-1] = undefined;
|
||||
}
|
||||
|
||||
var canAdd = addPath && addPath.newPos+1 < newLen;
|
||||
var canRemove = removePath && 0 <= oldPos && oldPos < oldLen;
|
||||
if (!canAdd && !canRemove) {
|
||||
bestPath[diagonalPath] = undefined;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Select the diagonal that we want to branch from. We select the prior
|
||||
// path whose position in the new string is the farthest from the origin
|
||||
// and does not pass the bounds of the diff graph
|
||||
if (!canAdd || (canRemove && addPath.newPos < removePath.newPos)) {
|
||||
basePath = clonePath(removePath);
|
||||
this.pushComponent(basePath.components, oldString[oldPos], undefined, true);
|
||||
} else {
|
||||
basePath = clonePath(addPath);
|
||||
basePath.newPos++;
|
||||
this.pushComponent(basePath.components, newString[basePath.newPos], true, undefined);
|
||||
}
|
||||
|
||||
var oldPos = this.extractCommon(basePath, newString, oldString, diagonalPath);
|
||||
|
||||
if (basePath.newPos+1 >= newLen && oldPos+1 >= oldLen) {
|
||||
return basePath.components;
|
||||
} else {
|
||||
bestPath[diagonalPath] = basePath;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
pushComponent: function(components, value, added, removed) {
|
||||
var last = components[components.length-1];
|
||||
if (last && last.added === added && last.removed === removed) {
|
||||
// We need to clone here as the component clone operation is just
|
||||
// as shallow array clone
|
||||
components[components.length-1] =
|
||||
{value: this.join(last.value, value), added: added, removed: removed };
|
||||
} else {
|
||||
components.push({value: value, added: added, removed: removed });
|
||||
}
|
||||
},
|
||||
extractCommon: function(basePath, newString, oldString, diagonalPath) {
|
||||
var newLen = newString.length,
|
||||
oldLen = oldString.length,
|
||||
newPos = basePath.newPos,
|
||||
oldPos = newPos - diagonalPath;
|
||||
while (newPos+1 < newLen && oldPos+1 < oldLen && this.equals(newString[newPos+1], oldString[oldPos+1])) {
|
||||
newPos++;
|
||||
oldPos++;
|
||||
|
||||
this.pushComponent(basePath.components, newString[newPos], undefined, undefined);
|
||||
}
|
||||
basePath.newPos = newPos;
|
||||
return oldPos;
|
||||
},
|
||||
|
||||
equals: function(left, right) {
|
||||
var reWhitespace = /\S/;
|
||||
if (this.ignoreWhitespace && !reWhitespace.test(left) && !reWhitespace.test(right)) {
|
||||
return true;
|
||||
} else {
|
||||
return left === right;
|
||||
}
|
||||
},
|
||||
join: function(left, right) {
|
||||
return left + right;
|
||||
},
|
||||
tokenize: function(value) {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
var CharDiff = new Diff();
|
||||
|
||||
var WordDiff = new Diff(true);
|
||||
var WordWithSpaceDiff = new Diff();
|
||||
WordDiff.tokenize = WordWithSpaceDiff.tokenize = function(value) {
|
||||
return removeEmpty(value.split(/(\s+|\b)/));
|
||||
};
|
||||
|
||||
var CssDiff = new Diff(true);
|
||||
CssDiff.tokenize = function(value) {
|
||||
return removeEmpty(value.split(/([{}:;,]|\s+)/));
|
||||
};
|
||||
|
||||
var LineDiff = new Diff();
|
||||
LineDiff.tokenize = function(value) {
|
||||
var retLines = [],
|
||||
lines = value.split(/^/m);
|
||||
|
||||
for(var i = 0; i < lines.length; i++) {
|
||||
var line = lines[i],
|
||||
lastLine = lines[i - 1];
|
||||
|
||||
// Merge lines that may contain windows new lines
|
||||
if (line == '\n' && lastLine && lastLine[lastLine.length - 1] === '\r') {
|
||||
retLines[retLines.length - 1] += '\n';
|
||||
} else if (line) {
|
||||
retLines.push(line);
|
||||
}
|
||||
}
|
||||
|
||||
return retLines;
|
||||
};
|
||||
|
||||
return {
|
||||
Diff: Diff,
|
||||
|
||||
diffChars: function(oldStr, newStr) { return CharDiff.diff(oldStr, newStr); },
|
||||
diffWords: function(oldStr, newStr) { return WordDiff.diff(oldStr, newStr); },
|
||||
diffWordsWithSpace: function(oldStr, newStr) { return WordWithSpaceDiff.diff(oldStr, newStr); },
|
||||
diffLines: function(oldStr, newStr) { return LineDiff.diff(oldStr, newStr); },
|
||||
|
||||
diffCss: function(oldStr, newStr) { return CssDiff.diff(oldStr, newStr); },
|
||||
|
||||
createPatch: function(fileName, oldStr, newStr, oldHeader, newHeader) {
|
||||
var ret = [];
|
||||
|
||||
ret.push('Index: ' + fileName);
|
||||
ret.push('===================================================================');
|
||||
ret.push('--- ' + fileName + (typeof oldHeader === 'undefined' ? '' : '\t' + oldHeader));
|
||||
ret.push('+++ ' + fileName + (typeof newHeader === 'undefined' ? '' : '\t' + newHeader));
|
||||
|
||||
var diff = LineDiff.diff(oldStr, newStr);
|
||||
if (!diff[diff.length-1].value) {
|
||||
diff.pop(); // Remove trailing newline add
|
||||
}
|
||||
diff.push({value: '', lines: []}); // Append an empty value to make cleanup easier
|
||||
|
||||
function contextLines(lines) {
|
||||
return lines.map(function(entry) { return ' ' + entry; });
|
||||
}
|
||||
function eofNL(curRange, i, current) {
|
||||
var last = diff[diff.length-2],
|
||||
isLast = i === diff.length-2,
|
||||
isLastOfType = i === diff.length-3 && (current.added !== last.added || current.removed !== last.removed);
|
||||
|
||||
// Figure out if this is the last line for the given file and missing NL
|
||||
if (!/\n$/.test(current.value) && (isLast || isLastOfType)) {
|
||||
curRange.push('\\ No newline at end of file');
|
||||
}
|
||||
}
|
||||
|
||||
var oldRangeStart = 0, newRangeStart = 0, curRange = [],
|
||||
oldLine = 1, newLine = 1;
|
||||
for (var i = 0; i < diff.length; i++) {
|
||||
var current = diff[i],
|
||||
lines = current.lines || current.value.replace(/\n$/, '').split('\n');
|
||||
current.lines = lines;
|
||||
|
||||
if (current.added || current.removed) {
|
||||
if (!oldRangeStart) {
|
||||
var prev = diff[i-1];
|
||||
oldRangeStart = oldLine;
|
||||
newRangeStart = newLine;
|
||||
|
||||
if (prev) {
|
||||
curRange = contextLines(prev.lines.slice(-4));
|
||||
oldRangeStart -= curRange.length;
|
||||
newRangeStart -= curRange.length;
|
||||
}
|
||||
}
|
||||
curRange.push.apply(curRange, lines.map(function(entry) { return (current.added?'+':'-') + entry; }));
|
||||
eofNL(curRange, i, current);
|
||||
|
||||
if (current.added) {
|
||||
newLine += lines.length;
|
||||
} else {
|
||||
oldLine += lines.length;
|
||||
}
|
||||
} else {
|
||||
if (oldRangeStart) {
|
||||
// Close out any changes that have been output (or join overlapping)
|
||||
if (lines.length <= 8 && i < diff.length-2) {
|
||||
// Overlapping
|
||||
curRange.push.apply(curRange, contextLines(lines));
|
||||
} else {
|
||||
// end the range and output
|
||||
var contextSize = Math.min(lines.length, 4);
|
||||
ret.push(
|
||||
'@@ -' + oldRangeStart + ',' + (oldLine-oldRangeStart+contextSize)
|
||||
+ ' +' + newRangeStart + ',' + (newLine-newRangeStart+contextSize)
|
||||
+ ' @@');
|
||||
ret.push.apply(ret, curRange);
|
||||
ret.push.apply(ret, contextLines(lines.slice(0, contextSize)));
|
||||
if (lines.length <= 4) {
|
||||
eofNL(ret, i, current);
|
||||
}
|
||||
|
||||
oldRangeStart = 0; newRangeStart = 0; curRange = [];
|
||||
}
|
||||
}
|
||||
oldLine += lines.length;
|
||||
newLine += lines.length;
|
||||
}
|
||||
}
|
||||
|
||||
return ret.join('\n') + '\n';
|
||||
},
|
||||
|
||||
applyPatch: function(oldStr, uniDiff) {
|
||||
var diffstr = uniDiff.split('\n');
|
||||
var diff = [];
|
||||
var remEOFNL = false,
|
||||
addEOFNL = false;
|
||||
|
||||
for (var i = (diffstr[0][0]==='I'?4:0); i < diffstr.length; i++) {
|
||||
if(diffstr[i][0] === '@') {
|
||||
var meh = diffstr[i].split(/@@ -(\d+),(\d+) \+(\d+),(\d+) @@/);
|
||||
diff.unshift({
|
||||
start:meh[3],
|
||||
oldlength:meh[2],
|
||||
oldlines:[],
|
||||
newlength:meh[4],
|
||||
newlines:[]
|
||||
});
|
||||
} else if(diffstr[i][0] === '+') {
|
||||
diff[0].newlines.push(diffstr[i].substr(1));
|
||||
} else if(diffstr[i][0] === '-') {
|
||||
diff[0].oldlines.push(diffstr[i].substr(1));
|
||||
} else if(diffstr[i][0] === ' ') {
|
||||
diff[0].newlines.push(diffstr[i].substr(1));
|
||||
diff[0].oldlines.push(diffstr[i].substr(1));
|
||||
} else if(diffstr[i][0] === '\\') {
|
||||
if (diffstr[i-1][0] === '+') {
|
||||
remEOFNL = true;
|
||||
} else if(diffstr[i-1][0] === '-') {
|
||||
addEOFNL = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var str = oldStr.split('\n');
|
||||
for (var i = diff.length - 1; i >= 0; i--) {
|
||||
var d = diff[i];
|
||||
for (var j = 0; j < d.oldlength; j++) {
|
||||
if(str[d.start-1+j] !== d.oldlines[j]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Array.prototype.splice.apply(str,[d.start-1,+d.oldlength].concat(d.newlines));
|
||||
}
|
||||
|
||||
if (remEOFNL) {
|
||||
while (!str[str.length-1]) {
|
||||
str.pop();
|
||||
}
|
||||
} else if (addEOFNL) {
|
||||
str.push('');
|
||||
}
|
||||
return str.join('\n');
|
||||
},
|
||||
|
||||
convertChangesToXML: function(changes){
|
||||
var ret = [];
|
||||
for ( var i = 0; i < changes.length; i++) {
|
||||
var change = changes[i];
|
||||
if (change.added) {
|
||||
ret.push('<ins>');
|
||||
} else if (change.removed) {
|
||||
ret.push('<del>');
|
||||
}
|
||||
|
||||
ret.push(escapeHTML(change.value));
|
||||
|
||||
if (change.added) {
|
||||
ret.push('</ins>');
|
||||
} else if (change.removed) {
|
||||
ret.push('</del>');
|
||||
}
|
||||
}
|
||||
return ret.join('');
|
||||
},
|
||||
|
||||
// See: http://code.google.com/p/google-diff-match-patch/wiki/API
|
||||
convertChangesToDMP: function(changes){
|
||||
var ret = [], change;
|
||||
for ( var i = 0; i < changes.length; i++) {
|
||||
change = changes[i];
|
||||
ret.push([(change.added ? 1 : change.removed ? -1 : 0), change.value]);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
if (typeof module !== 'undefined') {
|
||||
module.exports = JsDiff;
|
||||
}
|
62
node_modules/mocha/node_modules/diff/package.json
generated
vendored
Normal file
62
node_modules/mocha/node_modules/diff/package.json
generated
vendored
Normal file
@ -0,0 +1,62 @@
|
||||
{
|
||||
"name": "diff",
|
||||
"version": "1.0.8",
|
||||
"description": "A javascript text diff implementation.",
|
||||
"keywords": [
|
||||
"diff",
|
||||
"javascript"
|
||||
],
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "kpdecker",
|
||||
"email": "kpdecker@gmail.com"
|
||||
}
|
||||
],
|
||||
"bugs": {
|
||||
"url": "http://github.com/kpdecker/jsdiff/issues",
|
||||
"email": "kpdecker@gmail.com"
|
||||
},
|
||||
"licenses": [
|
||||
{
|
||||
"type": "BSD",
|
||||
"url": "http://github.com/kpdecker/jsdiff/blob/master/LICENSE"
|
||||
}
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/kpdecker/jsdiff.git"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.3.1"
|
||||
},
|
||||
"main": "./diff",
|
||||
"scripts": {
|
||||
"test": "mocha test/*.js"
|
||||
},
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"mocha": "~1.6",
|
||||
"should": "~1.2",
|
||||
"colors": "~0.6.2"
|
||||
},
|
||||
"optionalDependencies": {},
|
||||
"files": [
|
||||
"diff.js"
|
||||
],
|
||||
"_id": "diff@1.0.8",
|
||||
"dist": {
|
||||
"shasum": "343276308ec991b7bc82267ed55bc1411f971666",
|
||||
"tarball": "http://registry.npmjs.org/diff/-/diff-1.0.8.tgz"
|
||||
},
|
||||
"_from": "diff@1.0.8",
|
||||
"_npmVersion": "1.3.11",
|
||||
"_npmUser": {
|
||||
"name": "kpdecker",
|
||||
"email": "kpdecker@gmail.com"
|
||||
},
|
||||
"directories": {},
|
||||
"_shasum": "343276308ec991b7bc82267ed55bc1411f971666",
|
||||
"_resolved": "https://registry.npmjs.org/diff/-/diff-1.0.8.tgz",
|
||||
"readme": "ERROR: No README data found!",
|
||||
"homepage": "https://github.com/kpdecker/jsdiff"
|
||||
}
|
11
node_modules/mocha/node_modules/escape-string-regexp/index.js
generated
vendored
Normal file
11
node_modules/mocha/node_modules/escape-string-regexp/index.js
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
'use strict';
|
||||
|
||||
var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
|
||||
|
||||
module.exports = function (str) {
|
||||
if (typeof str !== 'string') {
|
||||
throw new TypeError('Expected a string');
|
||||
}
|
||||
|
||||
return str.replace(matchOperatorsRe, '\\$&');
|
||||
};
|
69
node_modules/mocha/node_modules/escape-string-regexp/package.json
generated
vendored
Normal file
69
node_modules/mocha/node_modules/escape-string-regexp/package.json
generated
vendored
Normal file
@ -0,0 +1,69 @@
|
||||
{
|
||||
"name": "escape-string-regexp",
|
||||
"version": "1.0.2",
|
||||
"description": "Escape RegExp special characters",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sindresorhus/escape-string-regexp"
|
||||
},
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "http://sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.8.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"regex",
|
||||
"regexp",
|
||||
"re",
|
||||
"regular",
|
||||
"expression",
|
||||
"escape",
|
||||
"string",
|
||||
"str",
|
||||
"special",
|
||||
"characters"
|
||||
],
|
||||
"devDependencies": {
|
||||
"mocha": "*"
|
||||
},
|
||||
"gitHead": "0587ee0ee03ea3fcbfa3c15cf67b47f214e20987",
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/escape-string-regexp/issues"
|
||||
},
|
||||
"homepage": "https://github.com/sindresorhus/escape-string-regexp",
|
||||
"_id": "escape-string-regexp@1.0.2",
|
||||
"_shasum": "4dbc2fe674e71949caf3fb2695ce7f2dc1d9a8d1",
|
||||
"_from": "escape-string-regexp@1.0.2",
|
||||
"_npmVersion": "1.4.23",
|
||||
"_npmUser": {
|
||||
"name": "jbnicolai",
|
||||
"email": "jappelman@xebia.com"
|
||||
},
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "sindresorhus",
|
||||
"email": "sindresorhus@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "jbnicolai",
|
||||
"email": "jappelman@xebia.com"
|
||||
}
|
||||
],
|
||||
"dist": {
|
||||
"shasum": "4dbc2fe674e71949caf3fb2695ce7f2dc1d9a8d1",
|
||||
"tarball": "http://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.2.tgz"
|
||||
},
|
||||
"directories": {},
|
||||
"_resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.2.tgz",
|
||||
"readme": "ERROR: No README data found!"
|
||||
}
|
27
node_modules/mocha/node_modules/escape-string-regexp/readme.md
generated
vendored
Normal file
27
node_modules/mocha/node_modules/escape-string-regexp/readme.md
generated
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
# escape-string-regexp [](https://travis-ci.org/sindresorhus/escape-string-regexp)
|
||||
|
||||
> Escape RegExp special characters
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```sh
|
||||
$ npm install --save escape-string-regexp
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var escapeStringRegexp = require('escape-string-regexp');
|
||||
|
||||
var escapedString = escapeStringRegexp('how much $ for a unicorn?');
|
||||
//=> how much \$ for a unicorn\?
|
||||
|
||||
new RegExp(escapedString);
|
||||
```
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](http://sindresorhus.com)
|
2
node_modules/mocha/node_modules/glob/.npmignore
generated
vendored
Normal file
2
node_modules/mocha/node_modules/glob/.npmignore
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
.*.swp
|
||||
test/a/
|
3
node_modules/mocha/node_modules/glob/.travis.yml
generated
vendored
Normal file
3
node_modules/mocha/node_modules/glob/.travis.yml
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- 0.8
|
27
node_modules/mocha/node_modules/glob/LICENSE
generated
vendored
Normal file
27
node_modules/mocha/node_modules/glob/LICENSE
generated
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
Copyright (c) Isaac Z. Schlueter ("Author")
|
||||
All rights reserved.
|
||||
|
||||
The BSD License
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
|
||||
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
250
node_modules/mocha/node_modules/glob/README.md
generated
vendored
Normal file
250
node_modules/mocha/node_modules/glob/README.md
generated
vendored
Normal file
@ -0,0 +1,250 @@
|
||||
# Glob
|
||||
|
||||
Match files using the patterns the shell uses, like stars and stuff.
|
||||
|
||||
This is a glob implementation in JavaScript. It uses the `minimatch`
|
||||
library to do its matching.
|
||||
|
||||
## Attention: node-glob users!
|
||||
|
||||
The API has changed dramatically between 2.x and 3.x. This library is
|
||||
now 100% JavaScript, and the integer flags have been replaced with an
|
||||
options object.
|
||||
|
||||
Also, there's an event emitter class, proper tests, and all the other
|
||||
things you've come to expect from node modules.
|
||||
|
||||
And best of all, no compilation!
|
||||
|
||||
## Usage
|
||||
|
||||
```javascript
|
||||
var glob = require("glob")
|
||||
|
||||
// options is optional
|
||||
glob("**/*.js", options, function (er, files) {
|
||||
// files is an array of filenames.
|
||||
// If the `nonull` option is set, and nothing
|
||||
// was found, then files is ["**/*.js"]
|
||||
// er is an error object or null.
|
||||
})
|
||||
```
|
||||
|
||||
## Features
|
||||
|
||||
Please see the [minimatch
|
||||
documentation](https://github.com/isaacs/minimatch) for more details.
|
||||
|
||||
Supports these glob features:
|
||||
|
||||
* Brace Expansion
|
||||
* Extended glob matching
|
||||
* "Globstar" `**` matching
|
||||
|
||||
See:
|
||||
|
||||
* `man sh`
|
||||
* `man bash`
|
||||
* `man 3 fnmatch`
|
||||
* `man 5 gitignore`
|
||||
* [minimatch documentation](https://github.com/isaacs/minimatch)
|
||||
|
||||
## glob(pattern, [options], cb)
|
||||
|
||||
* `pattern` {String} Pattern to be matched
|
||||
* `options` {Object}
|
||||
* `cb` {Function}
|
||||
* `err` {Error | null}
|
||||
* `matches` {Array<String>} filenames found matching the pattern
|
||||
|
||||
Perform an asynchronous glob search.
|
||||
|
||||
## glob.sync(pattern, [options])
|
||||
|
||||
* `pattern` {String} Pattern to be matched
|
||||
* `options` {Object}
|
||||
* return: {Array<String>} filenames found matching the pattern
|
||||
|
||||
Perform a synchronous glob search.
|
||||
|
||||
## Class: glob.Glob
|
||||
|
||||
Create a Glob object by instanting the `glob.Glob` class.
|
||||
|
||||
```javascript
|
||||
var Glob = require("glob").Glob
|
||||
var mg = new Glob(pattern, options, cb)
|
||||
```
|
||||
|
||||
It's an EventEmitter, and starts walking the filesystem to find matches
|
||||
immediately.
|
||||
|
||||
### new glob.Glob(pattern, [options], [cb])
|
||||
|
||||
* `pattern` {String} pattern to search for
|
||||
* `options` {Object}
|
||||
* `cb` {Function} Called when an error occurs, or matches are found
|
||||
* `err` {Error | null}
|
||||
* `matches` {Array<String>} filenames found matching the pattern
|
||||
|
||||
Note that if the `sync` flag is set in the options, then matches will
|
||||
be immediately available on the `g.found` member.
|
||||
|
||||
### Properties
|
||||
|
||||
* `minimatch` The minimatch object that the glob uses.
|
||||
* `options` The options object passed in.
|
||||
* `error` The error encountered. When an error is encountered, the
|
||||
glob object is in an undefined state, and should be discarded.
|
||||
* `aborted` Boolean which is set to true when calling `abort()`. There
|
||||
is no way at this time to continue a glob search after aborting, but
|
||||
you can re-use the statCache to avoid having to duplicate syscalls.
|
||||
* `statCache` Collection of all the stat results the glob search
|
||||
performed.
|
||||
* `cache` Convenience object. Each field has the following possible
|
||||
values:
|
||||
* `false` - Path does not exist
|
||||
* `true` - Path exists
|
||||
* `1` - Path exists, and is not a directory
|
||||
* `2` - Path exists, and is a directory
|
||||
* `[file, entries, ...]` - Path exists, is a directory, and the
|
||||
array value is the results of `fs.readdir`
|
||||
|
||||
### Events
|
||||
|
||||
* `end` When the matching is finished, this is emitted with all the
|
||||
matches found. If the `nonull` option is set, and no match was found,
|
||||
then the `matches` list contains the original pattern. The matches
|
||||
are sorted, unless the `nosort` flag is set.
|
||||
* `match` Every time a match is found, this is emitted with the matched.
|
||||
* `error` Emitted when an unexpected error is encountered, or whenever
|
||||
any fs error occurs if `options.strict` is set.
|
||||
* `abort` When `abort()` is called, this event is raised.
|
||||
|
||||
### Methods
|
||||
|
||||
* `abort` Stop the search.
|
||||
|
||||
### Options
|
||||
|
||||
All the options that can be passed to Minimatch can also be passed to
|
||||
Glob to change pattern matching behavior. Also, some have been added,
|
||||
or have glob-specific ramifications.
|
||||
|
||||
All options are false by default, unless otherwise noted.
|
||||
|
||||
All options are added to the glob object, as well.
|
||||
|
||||
* `cwd` The current working directory in which to search. Defaults
|
||||
to `process.cwd()`.
|
||||
* `root` The place where patterns starting with `/` will be mounted
|
||||
onto. Defaults to `path.resolve(options.cwd, "/")` (`/` on Unix
|
||||
systems, and `C:\` or some such on Windows.)
|
||||
* `dot` Include `.dot` files in normal matches and `globstar` matches.
|
||||
Note that an explicit dot in a portion of the pattern will always
|
||||
match dot files.
|
||||
* `nomount` By default, a pattern starting with a forward-slash will be
|
||||
"mounted" onto the root setting, so that a valid filesystem path is
|
||||
returned. Set this flag to disable that behavior.
|
||||
* `mark` Add a `/` character to directory matches. Note that this
|
||||
requires additional stat calls.
|
||||
* `nosort` Don't sort the results.
|
||||
* `stat` Set to true to stat *all* results. This reduces performance
|
||||
somewhat, and is completely unnecessary, unless `readdir` is presumed
|
||||
to be an untrustworthy indicator of file existence. It will cause
|
||||
ELOOP to be triggered one level sooner in the case of cyclical
|
||||
symbolic links.
|
||||
* `silent` When an unusual error is encountered
|
||||
when attempting to read a directory, a warning will be printed to
|
||||
stderr. Set the `silent` option to true to suppress these warnings.
|
||||
* `strict` When an unusual error is encountered
|
||||
when attempting to read a directory, the process will just continue on
|
||||
in search of other matches. Set the `strict` option to raise an error
|
||||
in these cases.
|
||||
* `cache` See `cache` property above. Pass in a previously generated
|
||||
cache object to save some fs calls.
|
||||
* `statCache` A cache of results of filesystem information, to prevent
|
||||
unnecessary stat calls. While it should not normally be necessary to
|
||||
set this, you may pass the statCache from one glob() call to the
|
||||
options object of another, if you know that the filesystem will not
|
||||
change between calls. (See "Race Conditions" below.)
|
||||
* `sync` Perform a synchronous glob search.
|
||||
* `nounique` In some cases, brace-expanded patterns can result in the
|
||||
same file showing up multiple times in the result set. By default,
|
||||
this implementation prevents duplicates in the result set.
|
||||
Set this flag to disable that behavior.
|
||||
* `nonull` Set to never return an empty set, instead returning a set
|
||||
containing the pattern itself. This is the default in glob(3).
|
||||
* `nocase` Perform a case-insensitive match. Note that case-insensitive
|
||||
filesystems will sometimes result in glob returning results that are
|
||||
case-insensitively matched anyway, since readdir and stat will not
|
||||
raise an error.
|
||||
* `debug` Set to enable debug logging in minimatch and glob.
|
||||
* `globDebug` Set to enable debug logging in glob, but not minimatch.
|
||||
|
||||
## Comparisons to other fnmatch/glob implementations
|
||||
|
||||
While strict compliance with the existing standards is a worthwhile
|
||||
goal, some discrepancies exist between node-glob and other
|
||||
implementations, and are intentional.
|
||||
|
||||
If the pattern starts with a `!` character, then it is negated. Set the
|
||||
`nonegate` flag to suppress this behavior, and treat leading `!`
|
||||
characters normally. This is perhaps relevant if you wish to start the
|
||||
pattern with a negative extglob pattern like `!(a|B)`. Multiple `!`
|
||||
characters at the start of a pattern will negate the pattern multiple
|
||||
times.
|
||||
|
||||
If a pattern starts with `#`, then it is treated as a comment, and
|
||||
will not match anything. Use `\#` to match a literal `#` at the
|
||||
start of a line, or set the `nocomment` flag to suppress this behavior.
|
||||
|
||||
The double-star character `**` is supported by default, unless the
|
||||
`noglobstar` flag is set. This is supported in the manner of bsdglob
|
||||
and bash 4.1, where `**` only has special significance if it is the only
|
||||
thing in a path part. That is, `a/**/b` will match `a/x/y/b`, but
|
||||
`a/**b` will not.
|
||||
|
||||
If an escaped pattern has no matches, and the `nonull` flag is set,
|
||||
then glob returns the pattern as-provided, rather than
|
||||
interpreting the character escapes. For example,
|
||||
`glob.match([], "\\*a\\?")` will return `"\\*a\\?"` rather than
|
||||
`"*a?"`. This is akin to setting the `nullglob` option in bash, except
|
||||
that it does not resolve escaped pattern characters.
|
||||
|
||||
If brace expansion is not disabled, then it is performed before any
|
||||
other interpretation of the glob pattern. Thus, a pattern like
|
||||
`+(a|{b),c)}`, which would not be valid in bash or zsh, is expanded
|
||||
**first** into the set of `+(a|b)` and `+(a|c)`, and those patterns are
|
||||
checked for validity. Since those two are valid, matching proceeds.
|
||||
|
||||
## Windows
|
||||
|
||||
**Please only use forward-slashes in glob expressions.**
|
||||
|
||||
Though windows uses either `/` or `\` as its path separator, only `/`
|
||||
characters are used by this glob implementation. You must use
|
||||
forward-slashes **only** in glob expressions. Back-slashes will always
|
||||
be interpreted as escape characters, not path separators.
|
||||
|
||||
Results from absolute patterns such as `/foo/*` are mounted onto the
|
||||
root setting using `path.join`. On windows, this will by default result
|
||||
in `/foo/*` matching `C:\foo\bar.txt`.
|
||||
|
||||
## Race Conditions
|
||||
|
||||
Glob searching, by its very nature, is susceptible to race conditions,
|
||||
since it relies on directory walking and such.
|
||||
|
||||
As a result, it is possible that a file that exists when glob looks for
|
||||
it may have been deleted or modified by the time it returns the result.
|
||||
|
||||
As part of its internal implementation, this program caches all stat
|
||||
and readdir calls that it makes, in order to cut down on system
|
||||
overhead. However, this also makes it even more susceptible to races,
|
||||
especially if the cache or statCache objects are reused between glob
|
||||
calls.
|
||||
|
||||
Users are thus advised not to use a glob result as a guarantee of
|
||||
filesystem state in the face of rapid changes. For the vast majority
|
||||
of operations, this is never a problem.
|
9
node_modules/mocha/node_modules/glob/examples/g.js
generated
vendored
Normal file
9
node_modules/mocha/node_modules/glob/examples/g.js
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
var Glob = require("../").Glob
|
||||
|
||||
var pattern = "test/a/**/[cg]/../[cg]"
|
||||
console.log(pattern)
|
||||
|
||||
var mg = new Glob(pattern, {mark: true, sync:true}, function (er, matches) {
|
||||
console.log("matches", matches)
|
||||
})
|
||||
console.log("after")
|
9
node_modules/mocha/node_modules/glob/examples/usr-local.js
generated
vendored
Normal file
9
node_modules/mocha/node_modules/glob/examples/usr-local.js
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
var Glob = require("../").Glob
|
||||
|
||||
var pattern = "{./*/*,/*,/usr/local/*}"
|
||||
console.log(pattern)
|
||||
|
||||
var mg = new Glob(pattern, {mark: true}, function (er, matches) {
|
||||
console.log("matches", matches)
|
||||
})
|
||||
console.log("after")
|
675
node_modules/mocha/node_modules/glob/glob.js
generated
vendored
Normal file
675
node_modules/mocha/node_modules/glob/glob.js
generated
vendored
Normal file
@ -0,0 +1,675 @@
|
||||
// Approach:
|
||||
//
|
||||
// 1. Get the minimatch set
|
||||
// 2. For each pattern in the set, PROCESS(pattern)
|
||||
// 3. Store matches per-set, then uniq them
|
||||
//
|
||||
// PROCESS(pattern)
|
||||
// Get the first [n] items from pattern that are all strings
|
||||
// Join these together. This is PREFIX.
|
||||
// If there is no more remaining, then stat(PREFIX) and
|
||||
// add to matches if it succeeds. END.
|
||||
// readdir(PREFIX) as ENTRIES
|
||||
// If fails, END
|
||||
// If pattern[n] is GLOBSTAR
|
||||
// // handle the case where the globstar match is empty
|
||||
// // by pruning it out, and testing the resulting pattern
|
||||
// PROCESS(pattern[0..n] + pattern[n+1 .. $])
|
||||
// // handle other cases.
|
||||
// for ENTRY in ENTRIES (not dotfiles)
|
||||
// // attach globstar + tail onto the entry
|
||||
// PROCESS(pattern[0..n] + ENTRY + pattern[n .. $])
|
||||
//
|
||||
// else // not globstar
|
||||
// for ENTRY in ENTRIES (not dotfiles, unless pattern[n] is dot)
|
||||
// Test ENTRY against pattern[n]
|
||||
// If fails, continue
|
||||
// If passes, PROCESS(pattern[0..n] + item + pattern[n+1 .. $])
|
||||
//
|
||||
// Caveat:
|
||||
// Cache all stats and readdirs results to minimize syscall. Since all
|
||||
// we ever care about is existence and directory-ness, we can just keep
|
||||
// `true` for files, and [children,...] for directories, or `false` for
|
||||
// things that don't exist.
|
||||
|
||||
|
||||
|
||||
module.exports = glob
|
||||
|
||||
var fs = require("graceful-fs")
|
||||
, minimatch = require("minimatch")
|
||||
, Minimatch = minimatch.Minimatch
|
||||
, inherits = require("inherits")
|
||||
, EE = require("events").EventEmitter
|
||||
, path = require("path")
|
||||
, isDir = {}
|
||||
, assert = require("assert").ok
|
||||
|
||||
function glob (pattern, options, cb) {
|
||||
if (typeof options === "function") cb = options, options = {}
|
||||
if (!options) options = {}
|
||||
|
||||
if (typeof options === "number") {
|
||||
deprecated()
|
||||
return
|
||||
}
|
||||
|
||||
var g = new Glob(pattern, options, cb)
|
||||
return g.sync ? g.found : g
|
||||
}
|
||||
|
||||
glob.fnmatch = deprecated
|
||||
|
||||
function deprecated () {
|
||||
throw new Error("glob's interface has changed. Please see the docs.")
|
||||
}
|
||||
|
||||
glob.sync = globSync
|
||||
function globSync (pattern, options) {
|
||||
if (typeof options === "number") {
|
||||
deprecated()
|
||||
return
|
||||
}
|
||||
|
||||
options = options || {}
|
||||
options.sync = true
|
||||
return glob(pattern, options)
|
||||
}
|
||||
|
||||
|
||||
glob.Glob = Glob
|
||||
inherits(Glob, EE)
|
||||
function Glob (pattern, options, cb) {
|
||||
if (!(this instanceof Glob)) {
|
||||
return new Glob(pattern, options, cb)
|
||||
}
|
||||
|
||||
if (typeof cb === "function") {
|
||||
this.on("error", cb)
|
||||
this.on("end", function (matches) {
|
||||
cb(null, matches)
|
||||
})
|
||||
}
|
||||
|
||||
options = options || {}
|
||||
|
||||
this.EOF = {}
|
||||
this._emitQueue = []
|
||||
|
||||
this.maxDepth = options.maxDepth || 1000
|
||||
this.maxLength = options.maxLength || Infinity
|
||||
this.cache = options.cache || {}
|
||||
this.statCache = options.statCache || {}
|
||||
|
||||
this.changedCwd = false
|
||||
var cwd = process.cwd()
|
||||
if (!options.hasOwnProperty("cwd")) this.cwd = cwd
|
||||
else {
|
||||
this.cwd = options.cwd
|
||||
this.changedCwd = path.resolve(options.cwd) !== cwd
|
||||
}
|
||||
|
||||
this.root = options.root || path.resolve(this.cwd, "/")
|
||||
this.root = path.resolve(this.root)
|
||||
if (process.platform === "win32")
|
||||
this.root = this.root.replace(/\\/g, "/")
|
||||
|
||||
this.nomount = !!options.nomount
|
||||
|
||||
if (!pattern) {
|
||||
throw new Error("must provide pattern")
|
||||
}
|
||||
|
||||
// base-matching: just use globstar for that.
|
||||
if (options.matchBase && -1 === pattern.indexOf("/")) {
|
||||
if (options.noglobstar) {
|
||||
throw new Error("base matching requires globstar")
|
||||
}
|
||||
pattern = "**/" + pattern
|
||||
}
|
||||
|
||||
this.strict = options.strict !== false
|
||||
this.dot = !!options.dot
|
||||
this.mark = !!options.mark
|
||||
this.sync = !!options.sync
|
||||
this.nounique = !!options.nounique
|
||||
this.nonull = !!options.nonull
|
||||
this.nosort = !!options.nosort
|
||||
this.nocase = !!options.nocase
|
||||
this.stat = !!options.stat
|
||||
|
||||
this.debug = !!options.debug || !!options.globDebug
|
||||
if (this.debug)
|
||||
this.log = console.error
|
||||
|
||||
this.silent = !!options.silent
|
||||
|
||||
var mm = this.minimatch = new Minimatch(pattern, options)
|
||||
this.options = mm.options
|
||||
pattern = this.pattern = mm.pattern
|
||||
|
||||
this.error = null
|
||||
this.aborted = false
|
||||
|
||||
// list of all the patterns that ** has resolved do, so
|
||||
// we can avoid visiting multiple times.
|
||||
this._globstars = {}
|
||||
|
||||
EE.call(this)
|
||||
|
||||
// process each pattern in the minimatch set
|
||||
var n = this.minimatch.set.length
|
||||
|
||||
// The matches are stored as {<filename>: true,...} so that
|
||||
// duplicates are automagically pruned.
|
||||
// Later, we do an Object.keys() on these.
|
||||
// Keep them as a list so we can fill in when nonull is set.
|
||||
this.matches = new Array(n)
|
||||
|
||||
this.minimatch.set.forEach(iterator.bind(this))
|
||||
function iterator (pattern, i, set) {
|
||||
this._process(pattern, 0, i, function (er) {
|
||||
if (er) this.emit("error", er)
|
||||
if (-- n <= 0) this._finish()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Glob.prototype.log = function () {}
|
||||
|
||||
Glob.prototype._finish = function () {
|
||||
assert(this instanceof Glob)
|
||||
|
||||
var nou = this.nounique
|
||||
, all = nou ? [] : {}
|
||||
|
||||
for (var i = 0, l = this.matches.length; i < l; i ++) {
|
||||
var matches = this.matches[i]
|
||||
this.log("matches[%d] =", i, matches)
|
||||
// do like the shell, and spit out the literal glob
|
||||
if (!matches) {
|
||||
if (this.nonull) {
|
||||
var literal = this.minimatch.globSet[i]
|
||||
if (nou) all.push(literal)
|
||||
else all[literal] = true
|
||||
}
|
||||
} else {
|
||||
// had matches
|
||||
var m = Object.keys(matches)
|
||||
if (nou) all.push.apply(all, m)
|
||||
else m.forEach(function (m) {
|
||||
all[m] = true
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
if (!nou) all = Object.keys(all)
|
||||
|
||||
if (!this.nosort) {
|
||||
all = all.sort(this.nocase ? alphasorti : alphasort)
|
||||
}
|
||||
|
||||
if (this.mark) {
|
||||
// at *some* point we statted all of these
|
||||
all = all.map(function (m) {
|
||||
var sc = this.cache[m]
|
||||
if (!sc)
|
||||
return m
|
||||
var isDir = (Array.isArray(sc) || sc === 2)
|
||||
if (isDir && m.slice(-1) !== "/") {
|
||||
return m + "/"
|
||||
}
|
||||
if (!isDir && m.slice(-1) === "/") {
|
||||
return m.replace(/\/+$/, "")
|
||||
}
|
||||
return m
|
||||
}, this)
|
||||
}
|
||||
|
||||
this.log("emitting end", all)
|
||||
|
||||
this.EOF = this.found = all
|
||||
this.emitMatch(this.EOF)
|
||||
}
|
||||
|
||||
function alphasorti (a, b) {
|
||||
a = a.toLowerCase()
|
||||
b = b.toLowerCase()
|
||||
return alphasort(a, b)
|
||||
}
|
||||
|
||||
function alphasort (a, b) {
|
||||
return a > b ? 1 : a < b ? -1 : 0
|
||||
}
|
||||
|
||||
Glob.prototype.abort = function () {
|
||||
this.aborted = true
|
||||
this.emit("abort")
|
||||
}
|
||||
|
||||
Glob.prototype.pause = function () {
|
||||
if (this.paused) return
|
||||
if (this.sync)
|
||||
this.emit("error", new Error("Can't pause/resume sync glob"))
|
||||
this.paused = true
|
||||
this.emit("pause")
|
||||
}
|
||||
|
||||
Glob.prototype.resume = function () {
|
||||
if (!this.paused) return
|
||||
if (this.sync)
|
||||
this.emit("error", new Error("Can't pause/resume sync glob"))
|
||||
this.paused = false
|
||||
this.emit("resume")
|
||||
this._processEmitQueue()
|
||||
//process.nextTick(this.emit.bind(this, "resume"))
|
||||
}
|
||||
|
||||
Glob.prototype.emitMatch = function (m) {
|
||||
if (!this.stat || this.statCache[m] || m === this.EOF) {
|
||||
this._emitQueue.push(m)
|
||||
this._processEmitQueue()
|
||||
} else {
|
||||
this._stat(m, function(exists, isDir) {
|
||||
if (exists) {
|
||||
this._emitQueue.push(m)
|
||||
this._processEmitQueue()
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Glob.prototype._processEmitQueue = function (m) {
|
||||
while (!this._processingEmitQueue &&
|
||||
!this.paused) {
|
||||
this._processingEmitQueue = true
|
||||
var m = this._emitQueue.shift()
|
||||
if (!m) {
|
||||
this._processingEmitQueue = false
|
||||
break
|
||||
}
|
||||
|
||||
this.log('emit!', m === this.EOF ? "end" : "match")
|
||||
|
||||
this.emit(m === this.EOF ? "end" : "match", m)
|
||||
this._processingEmitQueue = false
|
||||
}
|
||||
}
|
||||
|
||||
Glob.prototype._process = function (pattern, depth, index, cb_) {
|
||||
assert(this instanceof Glob)
|
||||
|
||||
var cb = function cb (er, res) {
|
||||
assert(this instanceof Glob)
|
||||
if (this.paused) {
|
||||
if (!this._processQueue) {
|
||||
this._processQueue = []
|
||||
this.once("resume", function () {
|
||||
var q = this._processQueue
|
||||
this._processQueue = null
|
||||
q.forEach(function (cb) { cb() })
|
||||
})
|
||||
}
|
||||
this._processQueue.push(cb_.bind(this, er, res))
|
||||
} else {
|
||||
cb_.call(this, er, res)
|
||||
}
|
||||
}.bind(this)
|
||||
|
||||
if (this.aborted) return cb()
|
||||
|
||||
if (depth > this.maxDepth) return cb()
|
||||
|
||||
// Get the first [n] parts of pattern that are all strings.
|
||||
var n = 0
|
||||
while (typeof pattern[n] === "string") {
|
||||
n ++
|
||||
}
|
||||
// now n is the index of the first one that is *not* a string.
|
||||
|
||||
// see if there's anything else
|
||||
var prefix
|
||||
switch (n) {
|
||||
// if not, then this is rather simple
|
||||
case pattern.length:
|
||||
prefix = pattern.join("/")
|
||||
this._stat(prefix, function (exists, isDir) {
|
||||
// either it's there, or it isn't.
|
||||
// nothing more to do, either way.
|
||||
if (exists) {
|
||||
if (prefix && isAbsolute(prefix) && !this.nomount) {
|
||||
if (prefix.charAt(0) === "/") {
|
||||
prefix = path.join(this.root, prefix)
|
||||
} else {
|
||||
prefix = path.resolve(this.root, prefix)
|
||||
}
|
||||
}
|
||||
|
||||
if (process.platform === "win32")
|
||||
prefix = prefix.replace(/\\/g, "/")
|
||||
|
||||
this.matches[index] = this.matches[index] || {}
|
||||
this.matches[index][prefix] = true
|
||||
this.emitMatch(prefix)
|
||||
}
|
||||
return cb()
|
||||
})
|
||||
return
|
||||
|
||||
case 0:
|
||||
// pattern *starts* with some non-trivial item.
|
||||
// going to readdir(cwd), but not include the prefix in matches.
|
||||
prefix = null
|
||||
break
|
||||
|
||||
default:
|
||||
// pattern has some string bits in the front.
|
||||
// whatever it starts with, whether that's "absolute" like /foo/bar,
|
||||
// or "relative" like "../baz"
|
||||
prefix = pattern.slice(0, n)
|
||||
prefix = prefix.join("/")
|
||||
break
|
||||
}
|
||||
|
||||
// get the list of entries.
|
||||
var read
|
||||
if (prefix === null) read = "."
|
||||
else if (isAbsolute(prefix) || isAbsolute(pattern.join("/"))) {
|
||||
if (!prefix || !isAbsolute(prefix)) {
|
||||
prefix = path.join("/", prefix)
|
||||
}
|
||||
read = prefix = path.resolve(prefix)
|
||||
|
||||
// if (process.platform === "win32")
|
||||
// read = prefix = prefix.replace(/^[a-zA-Z]:|\\/g, "/")
|
||||
|
||||
this.log('absolute: ', prefix, this.root, pattern, read)
|
||||
} else {
|
||||
read = prefix
|
||||
}
|
||||
|
||||
this.log('readdir(%j)', read, this.cwd, this.root)
|
||||
|
||||
return this._readdir(read, function (er, entries) {
|
||||
if (er) {
|
||||
// not a directory!
|
||||
// this means that, whatever else comes after this, it can never match
|
||||
return cb()
|
||||
}
|
||||
|
||||
// globstar is special
|
||||
if (pattern[n] === minimatch.GLOBSTAR) {
|
||||
// test without the globstar, and with every child both below
|
||||
// and replacing the globstar.
|
||||
var s = [ pattern.slice(0, n).concat(pattern.slice(n + 1)) ]
|
||||
entries.forEach(function (e) {
|
||||
if (e.charAt(0) === "." && !this.dot) return
|
||||
// instead of the globstar
|
||||
s.push(pattern.slice(0, n).concat(e).concat(pattern.slice(n + 1)))
|
||||
// below the globstar
|
||||
s.push(pattern.slice(0, n).concat(e).concat(pattern.slice(n)))
|
||||
}, this)
|
||||
|
||||
s = s.filter(function (pattern) {
|
||||
var key = gsKey(pattern)
|
||||
var seen = !this._globstars[key]
|
||||
this._globstars[key] = true
|
||||
return seen
|
||||
}, this)
|
||||
|
||||
if (!s.length)
|
||||
return cb()
|
||||
|
||||
// now asyncForEach over this
|
||||
var l = s.length
|
||||
, errState = null
|
||||
s.forEach(function (gsPattern) {
|
||||
this._process(gsPattern, depth + 1, index, function (er) {
|
||||
if (errState) return
|
||||
if (er) return cb(errState = er)
|
||||
if (--l <= 0) return cb()
|
||||
})
|
||||
}, this)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// not a globstar
|
||||
// It will only match dot entries if it starts with a dot, or if
|
||||
// dot is set. Stuff like @(.foo|.bar) isn't allowed.
|
||||
var pn = pattern[n]
|
||||
var rawGlob = pattern[n]._glob
|
||||
, dotOk = this.dot || rawGlob.charAt(0) === "."
|
||||
|
||||
entries = entries.filter(function (e) {
|
||||
return (e.charAt(0) !== "." || dotOk) &&
|
||||
e.match(pattern[n])
|
||||
})
|
||||
|
||||
// If n === pattern.length - 1, then there's no need for the extra stat
|
||||
// *unless* the user has specified "mark" or "stat" explicitly.
|
||||
// We know that they exist, since the readdir returned them.
|
||||
if (n === pattern.length - 1 &&
|
||||
!this.mark &&
|
||||
!this.stat) {
|
||||
entries.forEach(function (e) {
|
||||
if (prefix) {
|
||||
if (prefix !== "/") e = prefix + "/" + e
|
||||
else e = prefix + e
|
||||
}
|
||||
if (e.charAt(0) === "/" && !this.nomount) {
|
||||
e = path.join(this.root, e)
|
||||
}
|
||||
|
||||
if (process.platform === "win32")
|
||||
e = e.replace(/\\/g, "/")
|
||||
|
||||
this.matches[index] = this.matches[index] || {}
|
||||
this.matches[index][e] = true
|
||||
this.emitMatch(e)
|
||||
}, this)
|
||||
return cb.call(this)
|
||||
}
|
||||
|
||||
|
||||
// now test all the remaining entries as stand-ins for that part
|
||||
// of the pattern.
|
||||
var l = entries.length
|
||||
, errState = null
|
||||
if (l === 0) return cb() // no matches possible
|
||||
entries.forEach(function (e) {
|
||||
var p = pattern.slice(0, n).concat(e).concat(pattern.slice(n + 1))
|
||||
this._process(p, depth + 1, index, function (er) {
|
||||
if (errState) return
|
||||
if (er) return cb(errState = er)
|
||||
if (--l === 0) return cb.call(this)
|
||||
})
|
||||
}, this)
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
function gsKey (pattern) {
|
||||
return '**' + pattern.map(function (p) {
|
||||
return (p === minimatch.GLOBSTAR) ? '**' : (''+p)
|
||||
}).join('/')
|
||||
}
|
||||
|
||||
Glob.prototype._stat = function (f, cb) {
|
||||
assert(this instanceof Glob)
|
||||
var abs = f
|
||||
if (f.charAt(0) === "/") {
|
||||
abs = path.join(this.root, f)
|
||||
} else if (this.changedCwd) {
|
||||
abs = path.resolve(this.cwd, f)
|
||||
}
|
||||
|
||||
if (f.length > this.maxLength) {
|
||||
var er = new Error("Path name too long")
|
||||
er.code = "ENAMETOOLONG"
|
||||
er.path = f
|
||||
return this._afterStat(f, abs, cb, er)
|
||||
}
|
||||
|
||||
this.log('stat', [this.cwd, f, '=', abs])
|
||||
|
||||
if (!this.stat && this.cache.hasOwnProperty(f)) {
|
||||
var exists = this.cache[f]
|
||||
, isDir = exists && (Array.isArray(exists) || exists === 2)
|
||||
if (this.sync) return cb.call(this, !!exists, isDir)
|
||||
return process.nextTick(cb.bind(this, !!exists, isDir))
|
||||
}
|
||||
|
||||
var stat = this.statCache[abs]
|
||||
if (this.sync || stat) {
|
||||
var er
|
||||
try {
|
||||
stat = fs.statSync(abs)
|
||||
} catch (e) {
|
||||
er = e
|
||||
}
|
||||
this._afterStat(f, abs, cb, er, stat)
|
||||
} else {
|
||||
fs.stat(abs, this._afterStat.bind(this, f, abs, cb))
|
||||
}
|
||||
}
|
||||
|
||||
Glob.prototype._afterStat = function (f, abs, cb, er, stat) {
|
||||
var exists
|
||||
assert(this instanceof Glob)
|
||||
|
||||
if (abs.slice(-1) === "/" && stat && !stat.isDirectory()) {
|
||||
this.log("should be ENOTDIR, fake it")
|
||||
|
||||
er = new Error("ENOTDIR, not a directory '" + abs + "'")
|
||||
er.path = abs
|
||||
er.code = "ENOTDIR"
|
||||
stat = null
|
||||
}
|
||||
|
||||
var emit = !this.statCache[abs]
|
||||
this.statCache[abs] = stat
|
||||
|
||||
if (er || !stat) {
|
||||
exists = false
|
||||
} else {
|
||||
exists = stat.isDirectory() ? 2 : 1
|
||||
if (emit)
|
||||
this.emit('stat', f, stat)
|
||||
}
|
||||
this.cache[f] = this.cache[f] || exists
|
||||
cb.call(this, !!exists, exists === 2)
|
||||
}
|
||||
|
||||
Glob.prototype._readdir = function (f, cb) {
|
||||
assert(this instanceof Glob)
|
||||
var abs = f
|
||||
if (f.charAt(0) === "/") {
|
||||
abs = path.join(this.root, f)
|
||||
} else if (isAbsolute(f)) {
|
||||
abs = f
|
||||
} else if (this.changedCwd) {
|
||||
abs = path.resolve(this.cwd, f)
|
||||
}
|
||||
|
||||
if (f.length > this.maxLength) {
|
||||
var er = new Error("Path name too long")
|
||||
er.code = "ENAMETOOLONG"
|
||||
er.path = f
|
||||
return this._afterReaddir(f, abs, cb, er)
|
||||
}
|
||||
|
||||
this.log('readdir', [this.cwd, f, abs])
|
||||
if (this.cache.hasOwnProperty(f)) {
|
||||
var c = this.cache[f]
|
||||
if (Array.isArray(c)) {
|
||||
if (this.sync) return cb.call(this, null, c)
|
||||
return process.nextTick(cb.bind(this, null, c))
|
||||
}
|
||||
|
||||
if (!c || c === 1) {
|
||||
// either ENOENT or ENOTDIR
|
||||
var code = c ? "ENOTDIR" : "ENOENT"
|
||||
, er = new Error((c ? "Not a directory" : "Not found") + ": " + f)
|
||||
er.path = f
|
||||
er.code = code
|
||||
this.log(f, er)
|
||||
if (this.sync) return cb.call(this, er)
|
||||
return process.nextTick(cb.bind(this, er))
|
||||
}
|
||||
|
||||
// at this point, c === 2, meaning it's a dir, but we haven't
|
||||
// had to read it yet, or c === true, meaning it's *something*
|
||||
// but we don't have any idea what. Need to read it, either way.
|
||||
}
|
||||
|
||||
if (this.sync) {
|
||||
var er, entries
|
||||
try {
|
||||
entries = fs.readdirSync(abs)
|
||||
} catch (e) {
|
||||
er = e
|
||||
}
|
||||
return this._afterReaddir(f, abs, cb, er, entries)
|
||||
}
|
||||
|
||||
fs.readdir(abs, this._afterReaddir.bind(this, f, abs, cb))
|
||||
}
|
||||
|
||||
Glob.prototype._afterReaddir = function (f, abs, cb, er, entries) {
|
||||
assert(this instanceof Glob)
|
||||
if (entries && !er) {
|
||||
this.cache[f] = entries
|
||||
// if we haven't asked to stat everything for suresies, then just
|
||||
// assume that everything in there exists, so we can avoid
|
||||
// having to stat it a second time. This also gets us one step
|
||||
// further into ELOOP territory.
|
||||
if (!this.mark && !this.stat) {
|
||||
entries.forEach(function (e) {
|
||||
if (f === "/") e = f + e
|
||||
else e = f + "/" + e
|
||||
this.cache[e] = true
|
||||
}, this)
|
||||
}
|
||||
|
||||
return cb.call(this, er, entries)
|
||||
}
|
||||
|
||||
// now handle errors, and cache the information
|
||||
if (er) switch (er.code) {
|
||||
case "ENOTDIR": // totally normal. means it *does* exist.
|
||||
this.cache[f] = 1
|
||||
return cb.call(this, er)
|
||||
case "ENOENT": // not terribly unusual
|
||||
case "ELOOP":
|
||||
case "ENAMETOOLONG":
|
||||
case "UNKNOWN":
|
||||
this.cache[f] = false
|
||||
return cb.call(this, er)
|
||||
default: // some unusual error. Treat as failure.
|
||||
this.cache[f] = false
|
||||
if (this.strict) this.emit("error", er)
|
||||
if (!this.silent) console.error("glob error", er)
|
||||
return cb.call(this, er)
|
||||
}
|
||||
}
|
||||
|
||||
var isAbsolute = process.platform === "win32" ? absWin : absUnix
|
||||
|
||||
function absWin (p) {
|
||||
if (absUnix(p)) return true
|
||||
// pull off the device/UNC bit from a windows path.
|
||||
// from node's lib/path.js
|
||||
var splitDeviceRe =
|
||||
/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/
|
||||
, result = splitDeviceRe.exec(p)
|
||||
, device = result[1] || ''
|
||||
, isUnc = device && device.charAt(1) !== ':'
|
||||
, isAbsolute = !!result[2] || isUnc // UNC paths are always absolute
|
||||
|
||||
return isAbsolute
|
||||
}
|
||||
|
||||
function absUnix (p) {
|
||||
return p.charAt(0) === "/" || p === ""
|
||||
}
|
57
node_modules/mocha/node_modules/glob/package.json
generated
vendored
Normal file
57
node_modules/mocha/node_modules/glob/package.json
generated
vendored
Normal file
@ -0,0 +1,57 @@
|
||||
{
|
||||
"author": {
|
||||
"name": "Isaac Z. Schlueter",
|
||||
"email": "i@izs.me",
|
||||
"url": "http://blog.izs.me/"
|
||||
},
|
||||
"name": "glob",
|
||||
"description": "a little globber",
|
||||
"version": "3.2.3",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/isaacs/node-glob.git"
|
||||
},
|
||||
"main": "glob.js",
|
||||
"engines": {
|
||||
"node": "*"
|
||||
},
|
||||
"dependencies": {
|
||||
"minimatch": "~0.2.11",
|
||||
"graceful-fs": "~2.0.0",
|
||||
"inherits": "2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"tap": "~0.4.0",
|
||||
"mkdirp": "0",
|
||||
"rimraf": "1"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tap test/*.js"
|
||||
},
|
||||
"license": "BSD",
|
||||
"bugs": {
|
||||
"url": "https://github.com/isaacs/node-glob/issues"
|
||||
},
|
||||
"_id": "glob@3.2.3",
|
||||
"dist": {
|
||||
"shasum": "e313eeb249c7affaa5c475286b0e115b59839467",
|
||||
"tarball": "http://registry.npmjs.org/glob/-/glob-3.2.3.tgz"
|
||||
},
|
||||
"_from": "glob@3.2.3",
|
||||
"_npmVersion": "1.3.2",
|
||||
"_npmUser": {
|
||||
"name": "isaacs",
|
||||
"email": "i@izs.me"
|
||||
},
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "isaacs",
|
||||
"email": "i@izs.me"
|
||||
}
|
||||
],
|
||||
"directories": {},
|
||||
"_shasum": "e313eeb249c7affaa5c475286b0e115b59839467",
|
||||
"_resolved": "https://registry.npmjs.org/glob/-/glob-3.2.3.tgz",
|
||||
"readme": "ERROR: No README data found!",
|
||||
"homepage": "https://github.com/isaacs/node-glob"
|
||||
}
|
176
node_modules/mocha/node_modules/glob/test/00-setup.js
generated
vendored
Normal file
176
node_modules/mocha/node_modules/glob/test/00-setup.js
generated
vendored
Normal file
@ -0,0 +1,176 @@
|
||||
// just a little pre-run script to set up the fixtures.
|
||||
// zz-finish cleans it up
|
||||
|
||||
var mkdirp = require("mkdirp")
|
||||
var path = require("path")
|
||||
var i = 0
|
||||
var tap = require("tap")
|
||||
var fs = require("fs")
|
||||
var rimraf = require("rimraf")
|
||||
|
||||
var files =
|
||||
[ "a/.abcdef/x/y/z/a"
|
||||
, "a/abcdef/g/h"
|
||||
, "a/abcfed/g/h"
|
||||
, "a/b/c/d"
|
||||
, "a/bc/e/f"
|
||||
, "a/c/d/c/b"
|
||||
, "a/cb/e/f"
|
||||
]
|
||||
|
||||
var symlinkTo = path.resolve(__dirname, "a/symlink/a/b/c")
|
||||
var symlinkFrom = "../.."
|
||||
|
||||
files = files.map(function (f) {
|
||||
return path.resolve(__dirname, f)
|
||||
})
|
||||
|
||||
tap.test("remove fixtures", function (t) {
|
||||
rimraf(path.resolve(__dirname, "a"), function (er) {
|
||||
t.ifError(er, "remove fixtures")
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
files.forEach(function (f) {
|
||||
tap.test(f, function (t) {
|
||||
var d = path.dirname(f)
|
||||
mkdirp(d, 0755, function (er) {
|
||||
if (er) {
|
||||
t.fail(er)
|
||||
return t.bailout()
|
||||
}
|
||||
fs.writeFile(f, "i like tests", function (er) {
|
||||
t.ifError(er, "make file")
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
if (process.platform !== "win32") {
|
||||
tap.test("symlinky", function (t) {
|
||||
var d = path.dirname(symlinkTo)
|
||||
console.error("mkdirp", d)
|
||||
mkdirp(d, 0755, function (er) {
|
||||
t.ifError(er)
|
||||
fs.symlink(symlinkFrom, symlinkTo, "dir", function (er) {
|
||||
t.ifError(er, "make symlink")
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
;["foo","bar","baz","asdf","quux","qwer","rewq"].forEach(function (w) {
|
||||
w = "/tmp/glob-test/" + w
|
||||
tap.test("create " + w, function (t) {
|
||||
mkdirp(w, function (er) {
|
||||
if (er)
|
||||
throw er
|
||||
t.pass(w)
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
// generate the bash pattern test-fixtures if possible
|
||||
if (process.platform === "win32" || !process.env.TEST_REGEN) {
|
||||
console.error("Windows, or TEST_REGEN unset. Using cached fixtures.")
|
||||
return
|
||||
}
|
||||
|
||||
var spawn = require("child_process").spawn;
|
||||
var globs =
|
||||
// put more patterns here.
|
||||
// anything that would be directly in / should be in /tmp/glob-test
|
||||
["test/a/*/+(c|g)/./d"
|
||||
,"test/a/**/[cg]/../[cg]"
|
||||
,"test/a/{b,c,d,e,f}/**/g"
|
||||
,"test/a/b/**"
|
||||
,"test/**/g"
|
||||
,"test/a/abc{fed,def}/g/h"
|
||||
,"test/a/abc{fed/g,def}/**/"
|
||||
,"test/a/abc{fed/g,def}/**///**/"
|
||||
,"test/**/a/**/"
|
||||
,"test/+(a|b|c)/a{/,bc*}/**"
|
||||
,"test/*/*/*/f"
|
||||
,"test/**/f"
|
||||
,"test/a/symlink/a/b/c/a/b/c/a/b/c//a/b/c////a/b/c/**/b/c/**"
|
||||
,"{./*/*,/tmp/glob-test/*}"
|
||||
,"{/tmp/glob-test/*,*}" // evil owl face! how you taunt me!
|
||||
,"test/a/!(symlink)/**"
|
||||
]
|
||||
var bashOutput = {}
|
||||
var fs = require("fs")
|
||||
|
||||
globs.forEach(function (pattern) {
|
||||
tap.test("generate fixture " + pattern, function (t) {
|
||||
var cmd = "shopt -s globstar && " +
|
||||
"shopt -s extglob && " +
|
||||
"shopt -s nullglob && " +
|
||||
// "shopt >&2; " +
|
||||
"eval \'for i in " + pattern + "; do echo $i; done\'"
|
||||
var cp = spawn("bash", ["-c", cmd], { cwd: path.dirname(__dirname) })
|
||||
var out = []
|
||||
cp.stdout.on("data", function (c) {
|
||||
out.push(c)
|
||||
})
|
||||
cp.stderr.pipe(process.stderr)
|
||||
cp.on("close", function (code) {
|
||||
out = flatten(out)
|
||||
if (!out)
|
||||
out = []
|
||||
else
|
||||
out = cleanResults(out.split(/\r*\n/))
|
||||
|
||||
bashOutput[pattern] = out
|
||||
t.notOk(code, "bash test should finish nicely")
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
tap.test("save fixtures", function (t) {
|
||||
var fname = path.resolve(__dirname, "bash-results.json")
|
||||
var data = JSON.stringify(bashOutput, null, 2) + "\n"
|
||||
fs.writeFile(fname, data, function (er) {
|
||||
t.ifError(er)
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
function cleanResults (m) {
|
||||
// normalize discrepancies in ordering, duplication,
|
||||
// and ending slashes.
|
||||
return m.map(function (m) {
|
||||
return m.replace(/\/+/g, "/").replace(/\/$/, "")
|
||||
}).sort(alphasort).reduce(function (set, f) {
|
||||
if (f !== set[set.length - 1]) set.push(f)
|
||||
return set
|
||||
}, []).sort(alphasort).map(function (f) {
|
||||
// de-windows
|
||||
return (process.platform !== 'win32') ? f
|
||||
: f.replace(/^[a-zA-Z]:\\\\/, '/').replace(/\\/g, '/')
|
||||
})
|
||||
}
|
||||
|
||||
function flatten (chunks) {
|
||||
var s = 0
|
||||
chunks.forEach(function (c) { s += c.length })
|
||||
var out = new Buffer(s)
|
||||
s = 0
|
||||
chunks.forEach(function (c) {
|
||||
c.copy(out, s)
|
||||
s += c.length
|
||||
})
|
||||
|
||||
return out.toString().trim()
|
||||
}
|
||||
|
||||
function alphasort (a, b) {
|
||||
a = a.toLowerCase()
|
||||
b = b.toLowerCase()
|
||||
return a > b ? 1 : a < b ? -1 : 0
|
||||
}
|
63
node_modules/mocha/node_modules/glob/test/bash-comparison.js
generated
vendored
Normal file
63
node_modules/mocha/node_modules/glob/test/bash-comparison.js
generated
vendored
Normal file
@ -0,0 +1,63 @@
|
||||
// basic test
|
||||
// show that it does the same thing by default as the shell.
|
||||
var tap = require("tap")
|
||||
, child_process = require("child_process")
|
||||
, bashResults = require("./bash-results.json")
|
||||
, globs = Object.keys(bashResults)
|
||||
, glob = require("../")
|
||||
, path = require("path")
|
||||
|
||||
// run from the root of the project
|
||||
// this is usually where you're at anyway, but be sure.
|
||||
process.chdir(path.resolve(__dirname, ".."))
|
||||
|
||||
function alphasort (a, b) {
|
||||
a = a.toLowerCase()
|
||||
b = b.toLowerCase()
|
||||
return a > b ? 1 : a < b ? -1 : 0
|
||||
}
|
||||
|
||||
globs.forEach(function (pattern) {
|
||||
var expect = bashResults[pattern]
|
||||
// anything regarding the symlink thing will fail on windows, so just skip it
|
||||
if (process.platform === "win32" &&
|
||||
expect.some(function (m) {
|
||||
return /\/symlink\//.test(m)
|
||||
}))
|
||||
return
|
||||
|
||||
tap.test(pattern, function (t) {
|
||||
glob(pattern, function (er, matches) {
|
||||
if (er)
|
||||
throw er
|
||||
|
||||
// sort and unmark, just to match the shell results
|
||||
matches = cleanResults(matches)
|
||||
|
||||
t.deepEqual(matches, expect, pattern)
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
tap.test(pattern + " sync", function (t) {
|
||||
var matches = cleanResults(glob.sync(pattern))
|
||||
|
||||
t.deepEqual(matches, expect, "should match shell")
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
function cleanResults (m) {
|
||||
// normalize discrepancies in ordering, duplication,
|
||||
// and ending slashes.
|
||||
return m.map(function (m) {
|
||||
return m.replace(/\/+/g, "/").replace(/\/$/, "")
|
||||
}).sort(alphasort).reduce(function (set, f) {
|
||||
if (f !== set[set.length - 1]) set.push(f)
|
||||
return set
|
||||
}, []).sort(alphasort).map(function (f) {
|
||||
// de-windows
|
||||
return (process.platform !== 'win32') ? f
|
||||
: f.replace(/^[a-zA-Z]:[\/\\]+/, '/').replace(/[\\\/]+/g, '/')
|
||||
})
|
||||
}
|
350
node_modules/mocha/node_modules/glob/test/bash-results.json
generated
vendored
Normal file
350
node_modules/mocha/node_modules/glob/test/bash-results.json
generated
vendored
Normal file
@ -0,0 +1,350 @@
|
||||
{
|
||||
"test/a/*/+(c|g)/./d": [
|
||||
"test/a/b/c/./d"
|
||||
],
|
||||
"test/a/**/[cg]/../[cg]": [
|
||||
"test/a/abcdef/g/../g",
|
||||
"test/a/abcfed/g/../g",
|
||||
"test/a/b/c/../c",
|
||||
"test/a/c/../c",
|
||||
"test/a/c/d/c/../c",
|
||||
"test/a/symlink/a/b/c/../c",
|
||||
"test/a/symlink/a/b/c/a/b/c/../c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/../c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/../c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c"
|
||||
],
|
||||
"test/a/{b,c,d,e,f}/**/g": [],
|
||||
"test/a/b/**": [
|
||||
"test/a/b",
|
||||
"test/a/b/c",
|
||||
"test/a/b/c/d"
|
||||
],
|
||||
"test/**/g": [
|
||||
"test/a/abcdef/g",
|
||||
"test/a/abcfed/g"
|
||||
],
|
||||
"test/a/abc{fed,def}/g/h": [
|
||||
"test/a/abcdef/g/h",
|
||||
"test/a/abcfed/g/h"
|
||||
],
|
||||
"test/a/abc{fed/g,def}/**/": [
|
||||
"test/a/abcdef",
|
||||
"test/a/abcdef/g",
|
||||
"test/a/abcfed/g"
|
||||
],
|
||||
"test/a/abc{fed/g,def}/**///**/": [
|
||||
"test/a/abcdef",
|
||||
"test/a/abcdef/g",
|
||||
"test/a/abcfed/g"
|
||||
],
|
||||
"test/**/a/**/": [
|
||||
"test/a",
|
||||
"test/a/abcdef",
|
||||
"test/a/abcdef/g",
|
||||
"test/a/abcfed",
|
||||
"test/a/abcfed/g",
|
||||
"test/a/b",
|
||||
"test/a/b/c",
|
||||
"test/a/bc",
|
||||
"test/a/bc/e",
|
||||
"test/a/c",
|
||||
"test/a/c/d",
|
||||
"test/a/c/d/c",
|
||||
"test/a/cb",
|
||||
"test/a/cb/e",
|
||||
"test/a/symlink",
|
||||
"test/a/symlink/a",
|
||||
"test/a/symlink/a/b",
|
||||
"test/a/symlink/a/b/c",
|
||||
"test/a/symlink/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b"
|
||||
],
|
||||
"test/+(a|b|c)/a{/,bc*}/**": [
|
||||
"test/a/abcdef",
|
||||
"test/a/abcdef/g",
|
||||
"test/a/abcdef/g/h",
|
||||
"test/a/abcfed",
|
||||
"test/a/abcfed/g",
|
||||
"test/a/abcfed/g/h"
|
||||
],
|
||||
"test/*/*/*/f": [
|
||||
"test/a/bc/e/f",
|
||||
"test/a/cb/e/f"
|
||||
],
|
||||
"test/**/f": [
|
||||
"test/a/bc/e/f",
|
||||
"test/a/cb/e/f"
|
||||
],
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c//a/b/c////a/b/c/**/b/c/**": [
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c"
|
||||
],
|
||||
"{./*/*,/tmp/glob-test/*}": [
|
||||
"./examples/g.js",
|
||||
"./examples/usr-local.js",
|
||||
"./node_modules/graceful-fs",
|
||||
"./node_modules/inherits",
|
||||
"./node_modules/minimatch",
|
||||
"./node_modules/mkdirp",
|
||||
"./node_modules/rimraf",
|
||||
"./node_modules/tap",
|
||||
"./test/00-setup.js",
|
||||
"./test/a",
|
||||
"./test/bash-comparison.js",
|
||||
"./test/bash-results.json",
|
||||
"./test/cwd-test.js",
|
||||
"./test/globstar-match.js",
|
||||
"./test/mark.js",
|
||||
"./test/nocase-nomagic.js",
|
||||
"./test/pause-resume.js",
|
||||
"./test/root-nomount.js",
|
||||
"./test/root.js",
|
||||
"./test/stat.js",
|
||||
"./test/zz-cleanup.js",
|
||||
"/tmp/glob-test/asdf",
|
||||
"/tmp/glob-test/bar",
|
||||
"/tmp/glob-test/baz",
|
||||
"/tmp/glob-test/foo",
|
||||
"/tmp/glob-test/quux",
|
||||
"/tmp/glob-test/qwer",
|
||||
"/tmp/glob-test/rewq"
|
||||
],
|
||||
"{/tmp/glob-test/*,*}": [
|
||||
"/tmp/glob-test/asdf",
|
||||
"/tmp/glob-test/bar",
|
||||
"/tmp/glob-test/baz",
|
||||
"/tmp/glob-test/foo",
|
||||
"/tmp/glob-test/quux",
|
||||
"/tmp/glob-test/qwer",
|
||||
"/tmp/glob-test/rewq",
|
||||
"examples",
|
||||
"glob.js",
|
||||
"LICENSE",
|
||||
"node_modules",
|
||||
"package.json",
|
||||
"README.md",
|
||||
"test"
|
||||
],
|
||||
"test/a/!(symlink)/**": [
|
||||
"test/a/abcdef",
|
||||
"test/a/abcdef/g",
|
||||
"test/a/abcdef/g/h",
|
||||
"test/a/abcfed",
|
||||
"test/a/abcfed/g",
|
||||
"test/a/abcfed/g/h",
|
||||
"test/a/b",
|
||||
"test/a/b/c",
|
||||
"test/a/b/c/d",
|
||||
"test/a/bc",
|
||||
"test/a/bc/e",
|
||||
"test/a/bc/e/f",
|
||||
"test/a/c",
|
||||
"test/a/c/d",
|
||||
"test/a/c/d/c",
|
||||
"test/a/c/d/c/b",
|
||||
"test/a/cb",
|
||||
"test/a/cb/e",
|
||||
"test/a/cb/e/f"
|
||||
]
|
||||
}
|
55
node_modules/mocha/node_modules/glob/test/cwd-test.js
generated
vendored
Normal file
55
node_modules/mocha/node_modules/glob/test/cwd-test.js
generated
vendored
Normal file
@ -0,0 +1,55 @@
|
||||
var tap = require("tap")
|
||||
|
||||
var origCwd = process.cwd()
|
||||
process.chdir(__dirname)
|
||||
|
||||
tap.test("changing cwd and searching for **/d", function (t) {
|
||||
var glob = require('../')
|
||||
var path = require('path')
|
||||
t.test('.', function (t) {
|
||||
glob('**/d', function (er, matches) {
|
||||
t.ifError(er)
|
||||
t.like(matches, [ 'a/b/c/d', 'a/c/d' ])
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
t.test('a', function (t) {
|
||||
glob('**/d', {cwd:path.resolve('a')}, function (er, matches) {
|
||||
t.ifError(er)
|
||||
t.like(matches, [ 'b/c/d', 'c/d' ])
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
t.test('a/b', function (t) {
|
||||
glob('**/d', {cwd:path.resolve('a/b')}, function (er, matches) {
|
||||
t.ifError(er)
|
||||
t.like(matches, [ 'c/d' ])
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
t.test('a/b/', function (t) {
|
||||
glob('**/d', {cwd:path.resolve('a/b/')}, function (er, matches) {
|
||||
t.ifError(er)
|
||||
t.like(matches, [ 'c/d' ])
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
t.test('.', function (t) {
|
||||
glob('**/d', {cwd: process.cwd()}, function (er, matches) {
|
||||
t.ifError(er)
|
||||
t.like(matches, [ 'a/b/c/d', 'a/c/d' ])
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
t.test('cd -', function (t) {
|
||||
process.chdir(origCwd)
|
||||
t.end()
|
||||
})
|
||||
|
||||
t.end()
|
||||
})
|
19
node_modules/mocha/node_modules/glob/test/globstar-match.js
generated
vendored
Normal file
19
node_modules/mocha/node_modules/glob/test/globstar-match.js
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
var Glob = require("../glob.js").Glob
|
||||
var test = require('tap').test
|
||||
|
||||
test('globstar should not have dupe matches', function(t) {
|
||||
var pattern = 'a/**/[gh]'
|
||||
var g = new Glob(pattern, { cwd: __dirname })
|
||||
var matches = []
|
||||
g.on('match', function(m) {
|
||||
console.error('match %j', m)
|
||||
matches.push(m)
|
||||
})
|
||||
g.on('end', function(set) {
|
||||
console.error('set', set)
|
||||
matches = matches.sort()
|
||||
set = set.sort()
|
||||
t.same(matches, set, 'should have same set of matches')
|
||||
t.end()
|
||||
})
|
||||
})
|
74
node_modules/mocha/node_modules/glob/test/mark.js
generated
vendored
Normal file
74
node_modules/mocha/node_modules/glob/test/mark.js
generated
vendored
Normal file
@ -0,0 +1,74 @@
|
||||
var test = require("tap").test
|
||||
var glob = require('../')
|
||||
process.chdir(__dirname)
|
||||
|
||||
test("mark, no / on pattern", function (t) {
|
||||
glob("a/*", {mark: true}, function (er, results) {
|
||||
if (er)
|
||||
throw er
|
||||
var expect = [ 'a/abcdef/',
|
||||
'a/abcfed/',
|
||||
'a/b/',
|
||||
'a/bc/',
|
||||
'a/c/',
|
||||
'a/cb/' ]
|
||||
|
||||
if (process.platform !== "win32")
|
||||
expect.push('a/symlink/')
|
||||
|
||||
t.same(results, expect)
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
test("mark=false, no / on pattern", function (t) {
|
||||
glob("a/*", function (er, results) {
|
||||
if (er)
|
||||
throw er
|
||||
var expect = [ 'a/abcdef',
|
||||
'a/abcfed',
|
||||
'a/b',
|
||||
'a/bc',
|
||||
'a/c',
|
||||
'a/cb' ]
|
||||
|
||||
if (process.platform !== "win32")
|
||||
expect.push('a/symlink')
|
||||
t.same(results, expect)
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
test("mark=true, / on pattern", function (t) {
|
||||
glob("a/*/", {mark: true}, function (er, results) {
|
||||
if (er)
|
||||
throw er
|
||||
var expect = [ 'a/abcdef/',
|
||||
'a/abcfed/',
|
||||
'a/b/',
|
||||
'a/bc/',
|
||||
'a/c/',
|
||||
'a/cb/' ]
|
||||
if (process.platform !== "win32")
|
||||
expect.push('a/symlink/')
|
||||
t.same(results, expect)
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
test("mark=false, / on pattern", function (t) {
|
||||
glob("a/*/", function (er, results) {
|
||||
if (er)
|
||||
throw er
|
||||
var expect = [ 'a/abcdef/',
|
||||
'a/abcfed/',
|
||||
'a/b/',
|
||||
'a/bc/',
|
||||
'a/c/',
|
||||
'a/cb/' ]
|
||||
if (process.platform !== "win32")
|
||||
expect.push('a/symlink/')
|
||||
t.same(results, expect)
|
||||
t.end()
|
||||
})
|
||||
})
|
113
node_modules/mocha/node_modules/glob/test/nocase-nomagic.js
generated
vendored
Normal file
113
node_modules/mocha/node_modules/glob/test/nocase-nomagic.js
generated
vendored
Normal file
@ -0,0 +1,113 @@
|
||||
var fs = require('graceful-fs');
|
||||
var test = require('tap').test;
|
||||
var glob = require('../');
|
||||
|
||||
test('mock fs', function(t) {
|
||||
var stat = fs.stat
|
||||
var statSync = fs.statSync
|
||||
var readdir = fs.readdir
|
||||
var readdirSync = fs.readdirSync
|
||||
|
||||
function fakeStat(path) {
|
||||
var ret
|
||||
switch (path.toLowerCase()) {
|
||||
case '/tmp': case '/tmp/':
|
||||
ret = { isDirectory: function() { return true } }
|
||||
break
|
||||
case '/tmp/a':
|
||||
ret = { isDirectory: function() { return false } }
|
||||
break
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
fs.stat = function(path, cb) {
|
||||
var f = fakeStat(path);
|
||||
if (f) {
|
||||
process.nextTick(function() {
|
||||
cb(null, f)
|
||||
})
|
||||
} else {
|
||||
stat.call(fs, path, cb)
|
||||
}
|
||||
}
|
||||
|
||||
fs.statSync = function(path) {
|
||||
return fakeStat(path) || statSync.call(fs, path)
|
||||
}
|
||||
|
||||
function fakeReaddir(path) {
|
||||
var ret
|
||||
switch (path.toLowerCase()) {
|
||||
case '/tmp': case '/tmp/':
|
||||
ret = [ 'a', 'A' ]
|
||||
break
|
||||
case '/':
|
||||
ret = ['tmp', 'tMp', 'tMP', 'TMP']
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
fs.readdir = function(path, cb) {
|
||||
var f = fakeReaddir(path)
|
||||
if (f)
|
||||
process.nextTick(function() {
|
||||
cb(null, f)
|
||||
})
|
||||
else
|
||||
readdir.call(fs, path, cb)
|
||||
}
|
||||
|
||||
fs.readdirSync = function(path) {
|
||||
return fakeReaddir(path) || readdirSync.call(fs, path)
|
||||
}
|
||||
|
||||
t.pass('mocked')
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('nocase, nomagic', function(t) {
|
||||
var n = 2
|
||||
var want = [ '/TMP/A',
|
||||
'/TMP/a',
|
||||
'/tMP/A',
|
||||
'/tMP/a',
|
||||
'/tMp/A',
|
||||
'/tMp/a',
|
||||
'/tmp/A',
|
||||
'/tmp/a' ]
|
||||
glob('/tmp/a', { nocase: true }, function(er, res) {
|
||||
if (er)
|
||||
throw er
|
||||
t.same(res.sort(), want)
|
||||
if (--n === 0) t.end()
|
||||
})
|
||||
glob('/tmp/A', { nocase: true }, function(er, res) {
|
||||
if (er)
|
||||
throw er
|
||||
t.same(res.sort(), want)
|
||||
if (--n === 0) t.end()
|
||||
})
|
||||
})
|
||||
|
||||
test('nocase, with some magic', function(t) {
|
||||
t.plan(2)
|
||||
var want = [ '/TMP/A',
|
||||
'/TMP/a',
|
||||
'/tMP/A',
|
||||
'/tMP/a',
|
||||
'/tMp/A',
|
||||
'/tMp/a',
|
||||
'/tmp/A',
|
||||
'/tmp/a' ]
|
||||
glob('/tmp/*', { nocase: true }, function(er, res) {
|
||||
if (er)
|
||||
throw er
|
||||
t.same(res.sort(), want)
|
||||
})
|
||||
glob('/tmp/*', { nocase: true }, function(er, res) {
|
||||
if (er)
|
||||
throw er
|
||||
t.same(res.sort(), want)
|
||||
})
|
||||
})
|
73
node_modules/mocha/node_modules/glob/test/pause-resume.js
generated
vendored
Normal file
73
node_modules/mocha/node_modules/glob/test/pause-resume.js
generated
vendored
Normal file
@ -0,0 +1,73 @@
|
||||
// show that no match events happen while paused.
|
||||
var tap = require("tap")
|
||||
, child_process = require("child_process")
|
||||
// just some gnarly pattern with lots of matches
|
||||
, pattern = "test/a/!(symlink)/**"
|
||||
, bashResults = require("./bash-results.json")
|
||||
, patterns = Object.keys(bashResults)
|
||||
, glob = require("../")
|
||||
, Glob = glob.Glob
|
||||
, path = require("path")
|
||||
|
||||
// run from the root of the project
|
||||
// this is usually where you're at anyway, but be sure.
|
||||
process.chdir(path.resolve(__dirname, ".."))
|
||||
|
||||
function alphasort (a, b) {
|
||||
a = a.toLowerCase()
|
||||
b = b.toLowerCase()
|
||||
return a > b ? 1 : a < b ? -1 : 0
|
||||
}
|
||||
|
||||
function cleanResults (m) {
|
||||
// normalize discrepancies in ordering, duplication,
|
||||
// and ending slashes.
|
||||
return m.map(function (m) {
|
||||
return m.replace(/\/+/g, "/").replace(/\/$/, "")
|
||||
}).sort(alphasort).reduce(function (set, f) {
|
||||
if (f !== set[set.length - 1]) set.push(f)
|
||||
return set
|
||||
}, []).sort(alphasort).map(function (f) {
|
||||
// de-windows
|
||||
return (process.platform !== 'win32') ? f
|
||||
: f.replace(/^[a-zA-Z]:\\\\/, '/').replace(/\\/g, '/')
|
||||
})
|
||||
}
|
||||
|
||||
var globResults = []
|
||||
tap.test("use a Glob object, and pause/resume it", function (t) {
|
||||
var g = new Glob(pattern)
|
||||
, paused = false
|
||||
, res = []
|
||||
, expect = bashResults[pattern]
|
||||
|
||||
g.on("pause", function () {
|
||||
console.error("pause")
|
||||
})
|
||||
|
||||
g.on("resume", function () {
|
||||
console.error("resume")
|
||||
})
|
||||
|
||||
g.on("match", function (m) {
|
||||
t.notOk(g.paused, "must not be paused")
|
||||
globResults.push(m)
|
||||
g.pause()
|
||||
t.ok(g.paused, "must be paused")
|
||||
setTimeout(g.resume.bind(g), 10)
|
||||
})
|
||||
|
||||
g.on("end", function (matches) {
|
||||
t.pass("reached glob end")
|
||||
globResults = cleanResults(globResults)
|
||||
matches = cleanResults(matches)
|
||||
t.deepEqual(matches, globResults,
|
||||
"end event matches should be the same as match events")
|
||||
|
||||
t.deepEqual(matches, expect,
|
||||
"glob matches should be the same as bash results")
|
||||
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
39
node_modules/mocha/node_modules/glob/test/root-nomount.js
generated
vendored
Normal file
39
node_modules/mocha/node_modules/glob/test/root-nomount.js
generated
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
var tap = require("tap")
|
||||
|
||||
var origCwd = process.cwd()
|
||||
process.chdir(__dirname)
|
||||
|
||||
tap.test("changing root and searching for /b*/**", function (t) {
|
||||
var glob = require('../')
|
||||
var path = require('path')
|
||||
t.test('.', function (t) {
|
||||
glob('/b*/**', { globDebug: true, root: '.', nomount: true }, function (er, matches) {
|
||||
t.ifError(er)
|
||||
t.like(matches, [])
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
t.test('a', function (t) {
|
||||
glob('/b*/**', { globDebug: true, root: path.resolve('a'), nomount: true }, function (er, matches) {
|
||||
t.ifError(er)
|
||||
t.like(matches, [ '/b', '/b/c', '/b/c/d', '/bc', '/bc/e', '/bc/e/f' ])
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
t.test('root=a, cwd=a/b', function (t) {
|
||||
glob('/b*/**', { globDebug: true, root: 'a', cwd: path.resolve('a/b'), nomount: true }, function (er, matches) {
|
||||
t.ifError(er)
|
||||
t.like(matches, [ '/b', '/b/c', '/b/c/d', '/bc', '/bc/e', '/bc/e/f' ])
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
t.test('cd -', function (t) {
|
||||
process.chdir(origCwd)
|
||||
t.end()
|
||||
})
|
||||
|
||||
t.end()
|
||||
})
|
46
node_modules/mocha/node_modules/glob/test/root.js
generated
vendored
Normal file
46
node_modules/mocha/node_modules/glob/test/root.js
generated
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
var t = require("tap")
|
||||
|
||||
var origCwd = process.cwd()
|
||||
process.chdir(__dirname)
|
||||
|
||||
var glob = require('../')
|
||||
var path = require('path')
|
||||
|
||||
t.test('.', function (t) {
|
||||
glob('/b*/**', { globDebug: true, root: '.' }, function (er, matches) {
|
||||
t.ifError(er)
|
||||
t.like(matches, [])
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
t.test('a', function (t) {
|
||||
console.error("root=" + path.resolve('a'))
|
||||
glob('/b*/**', { globDebug: true, root: path.resolve('a') }, function (er, matches) {
|
||||
t.ifError(er)
|
||||
var wanted = [
|
||||
'/b', '/b/c', '/b/c/d', '/bc', '/bc/e', '/bc/e/f'
|
||||
].map(function (m) {
|
||||
return path.join(path.resolve('a'), m).replace(/\\/g, '/')
|
||||
})
|
||||
|
||||
t.like(matches, wanted)
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
t.test('root=a, cwd=a/b', function (t) {
|
||||
glob('/b*/**', { globDebug: true, root: 'a', cwd: path.resolve('a/b') }, function (er, matches) {
|
||||
t.ifError(er)
|
||||
t.like(matches, [ '/b', '/b/c', '/b/c/d', '/bc', '/bc/e', '/bc/e/f' ].map(function (m) {
|
||||
return path.join(path.resolve('a'), m).replace(/\\/g, '/')
|
||||
}))
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
t.test('cd -', function (t) {
|
||||
process.chdir(origCwd)
|
||||
t.end()
|
||||
})
|
32
node_modules/mocha/node_modules/glob/test/stat.js
generated
vendored
Normal file
32
node_modules/mocha/node_modules/glob/test/stat.js
generated
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
var glob = require('../')
|
||||
var test = require('tap').test
|
||||
var path = require('path')
|
||||
|
||||
test('stat all the things', function(t) {
|
||||
var g = new glob.Glob('a/*abc*/**', { stat: true, cwd: __dirname })
|
||||
var matches = []
|
||||
g.on('match', function(m) {
|
||||
matches.push(m)
|
||||
})
|
||||
var stats = []
|
||||
g.on('stat', function(m) {
|
||||
stats.push(m)
|
||||
})
|
||||
g.on('end', function(eof) {
|
||||
stats = stats.sort()
|
||||
matches = matches.sort()
|
||||
eof = eof.sort()
|
||||
t.same(stats, matches)
|
||||
t.same(eof, matches)
|
||||
var cache = Object.keys(this.statCache)
|
||||
t.same(cache.map(function (f) {
|
||||
return path.relative(__dirname, f)
|
||||
}).sort(), matches)
|
||||
|
||||
cache.forEach(function(c) {
|
||||
t.equal(typeof this.statCache[c], 'object')
|
||||
}, this)
|
||||
|
||||
t.end()
|
||||
})
|
||||
})
|
11
node_modules/mocha/node_modules/glob/test/zz-cleanup.js
generated
vendored
Normal file
11
node_modules/mocha/node_modules/glob/test/zz-cleanup.js
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
// remove the fixtures
|
||||
var tap = require("tap")
|
||||
, rimraf = require("rimraf")
|
||||
, path = require("path")
|
||||
|
||||
tap.test("cleanup fixtures", function (t) {
|
||||
rimraf(path.resolve(__dirname, "a"), function (er) {
|
||||
t.ifError(er, "removed")
|
||||
t.end()
|
||||
})
|
||||
})
|
63
node_modules/mocha/node_modules/growl/History.md
generated
vendored
Normal file
63
node_modules/mocha/node_modules/growl/History.md
generated
vendored
Normal file
@ -0,0 +1,63 @@
|
||||
|
||||
1.7.0 / 2012-12-30
|
||||
==================
|
||||
|
||||
* support transient notifications in Gnome
|
||||
|
||||
1.6.1 / 2012-09-25
|
||||
==================
|
||||
|
||||
* restore compatibility with node < 0.8 [fgnass]
|
||||
|
||||
1.6.0 / 2012-09-06
|
||||
==================
|
||||
|
||||
* add notification center support [drudge]
|
||||
|
||||
1.5.1 / 2012-04-08
|
||||
==================
|
||||
|
||||
* Merge pull request #16 from KyleAMathews/patch-1
|
||||
* Fixes #15
|
||||
|
||||
1.5.0 / 2012-02-08
|
||||
==================
|
||||
|
||||
* Added windows support [perfusorius]
|
||||
|
||||
1.4.1 / 2011-12-28
|
||||
==================
|
||||
|
||||
* Fixed: dont exit(). Closes #9
|
||||
|
||||
1.4.0 / 2011-12-17
|
||||
==================
|
||||
|
||||
* Changed API: `growl.notify()` -> `growl()`
|
||||
|
||||
1.3.0 / 2011-12-17
|
||||
==================
|
||||
|
||||
* Added support for Ubuntu/Debian/Linux users [niftylettuce]
|
||||
* Fixed: send notifications even if title not specified [alessioalex]
|
||||
|
||||
1.2.0 / 2011-10-06
|
||||
==================
|
||||
|
||||
* Add support for priority.
|
||||
|
||||
1.1.0 / 2011-03-15
|
||||
==================
|
||||
|
||||
* Added optional callbacks
|
||||
* Added parsing of version
|
||||
|
||||
1.0.1 / 2010-03-26
|
||||
==================
|
||||
|
||||
* Fixed; sys.exec -> child_process.exec to support latest node
|
||||
|
||||
1.0.0 / 2010-03-19
|
||||
==================
|
||||
|
||||
* Initial release
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user