Initial
This commit is contained in:
1837
Client/node_modules/mocha/CHANGELOG.md
generated
vendored
Executable file
1837
Client/node_modules/mocha/CHANGELOG.md
generated
vendored
Executable file
File diff suppressed because it is too large
Load Diff
22
Client/node_modules/mocha/LICENSE
generated
vendored
Executable file
22
Client/node_modules/mocha/LICENSE
generated
vendored
Executable file
@@ -0,0 +1,22 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2011-2017 JS Foundation and contributors, https://js.foundation
|
||||
|
||||
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.
|
||||
124
Client/node_modules/mocha/README.md
generated
vendored
Executable file
124
Client/node_modules/mocha/README.md
generated
vendored
Executable file
@@ -0,0 +1,124 @@
|
||||
# Mocha needs YOU!
|
||||
|
||||
*Did you know* Mocha [is a dependency of over 100,000 projects](https://libraries.io/npm/mocha) published to npm alone?
|
||||
|
||||
**Despite this, we're currently unable to merge most pull requests due to lack of maintenance resources.**
|
||||
|
||||
**Are you interested in triaging issues or reviewing open PRs? Have some time to hack on its codebase?** If you would like to help maintain Mocha, please contact `@boneskull` on [Gitter](https://gitter.im/mochajs/mocha).
|
||||
|
||||
*Thank you* :kissing_heart: to all of you interested in helping. These are Mocha's immediate needs:
|
||||
|
||||
1. Increase test coverage on Node.js and browser
|
||||
- Increase integration coverage for all reporters
|
||||
- `html` reporter must be tested in browser
|
||||
- ~~Basic console reporters (*not* `nyan`, `landing`, etc.) must be tested in **both** browser and Node.js contexts; PhantomJS can consume all console reporters~~
|
||||
- ~~Filesystem-based reporters must be tested in Node.js context~~
|
||||
- **UPDATE - May 24 2017**: Thanks to [community contributions](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md#mag-coverage), the coverage on most reporters has increased dramatically! The `html` reporter is still in [dire need of coverage](https://coveralls.io/builds/11674428/source?filename=lib%2Freporters%2Fhtml.js).
|
||||
- Increase coverage against all interfaces (`exports` in particular). Ideally this becomes a "matrix" where we repeat sets of integration tests across all interfaces.
|
||||
- Refactor non-Node.js-specific tests to allow them to run in a browser context. Node.js-specific tests include those which *require* the CLI or filesystem. Most everything else is fair game.
|
||||
2. Review current open pull requests
|
||||
- We need individuals familiar with Mocha's codebase. Got questions? Ask them in [our chat room](https://gitter.im/mochajs/mocha).
|
||||
- Pull requests **must** have supporting tests. The only exceptions are pure cosmetic or non-functional changes.
|
||||
- Pull request contributors must sign [the CLA](https://cla.js.foundation/mochajs/mocha).
|
||||
3. Close old, inactive issues and pull requests
|
||||
- ~~A bot should do this. We need a bot. Got a bot?~~ We now use GitHub's own [probot-stale](https://www.npmjs.com/package/probot-stale).
|
||||
4. Triage issues
|
||||
- If we run into "critical" bugs, they need fixing.
|
||||
- "Critical" means Mocha is broken w/o workarounds for a *large percentage* of users
|
||||
- Otherwise: respond to issues, close new dupe issues, confirm bugs, ask for more info, etc.
|
||||
|
||||
Once we gain ground on the above items, we can work together formalize our contribution guidelines and governance. For further info & ideas, please see our [projects](https://github.com/mochajs/mocha/projects/).
|
||||
|
||||
*You needn't be a maintainer to submit a pull request for test coverage!*
|
||||
|
||||
-- @boneskull, *Jan 17 2016*
|
||||
|
||||
<br><br>
|
||||
<p align="center">
|
||||
<img src="https://cldup.com/xFVFxOioAU.svg" alt="Mocha test framework"/>
|
||||
</p>
|
||||
|
||||
[](http://travis-ci.org/mochajs/mocha)
|
||||
[](https://coveralls.io/github/mochajs/mocha)
|
||||
[](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fmochajs%2Fmocha?ref=badge_shield)
|
||||
[](https://gitter.im/mochajs/mocha?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
[](#backers)
|
||||
[](#sponsors)
|
||||
<br><img alt="Mocha Browser Support h/t SauceLabs" src="https://saucelabs.com/browser-matrix/mochajs.svg" width="354">
|
||||
|
||||
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
|
||||
|
||||
- [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md)
|
||||
- [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)
|
||||
|
||||
|
||||
## Backers
|
||||
|
||||
[Become a backer]((https://opencollective.com/mochajs#backer)) and show your support to our open source project.
|
||||
|
||||
<a href="https://opencollective.com/mochajs/backer/0/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/0/avatar"></a>
|
||||
<a href="https://opencollective.com/mochajs/backer/1/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/1/avatar"></a>
|
||||
<a href="https://opencollective.com/mochajs/backer/2/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/2/avatar"></a>
|
||||
<a href="https://opencollective.com/mochajs/backer/3/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/3/avatar"></a>
|
||||
<a href="https://opencollective.com/mochajs/backer/4/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/4/avatar"></a>
|
||||
<a href="https://opencollective.com/mochajs/backer/5/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/5/avatar"></a>
|
||||
<a href="https://opencollective.com/mochajs/backer/6/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/6/avatar"></a>
|
||||
<a href="https://opencollective.com/mochajs/backer/7/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/7/avatar"></a>
|
||||
<a href="https://opencollective.com/mochajs/backer/8/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/8/avatar"></a>
|
||||
<a href="https://opencollective.com/mochajs/backer/9/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/9/avatar"></a>
|
||||
<a href="https://opencollective.com/mochajs/backer/10/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/10/avatar"></a>
|
||||
<a href="https://opencollective.com/mochajs/backer/11/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/11/avatar"></a>
|
||||
<a href="https://opencollective.com/mochajs/backer/12/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/12/avatar"></a>
|
||||
<a href="https://opencollective.com/mochajs/backer/13/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/13/avatar"></a>
|
||||
<a href="https://opencollective.com/mochajs/backer/14/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/14/avatar"></a>
|
||||
<a href="https://opencollective.com/mochajs/backer/15/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/15/avatar"></a>
|
||||
<a href="https://opencollective.com/mochajs/backer/16/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/16/avatar"></a>
|
||||
<a href="https://opencollective.com/mochajs/backer/17/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/17/avatar"></a>
|
||||
<a href="https://opencollective.com/mochajs/backer/18/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/18/avatar"></a>
|
||||
<a href="https://opencollective.com/mochajs/backer/19/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/19/avatar"></a>
|
||||
<a href="https://opencollective.com/mochajs/backer/20/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/20/avatar"></a>
|
||||
<a href="https://opencollective.com/mochajs/backer/21/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/21/avatar"></a>
|
||||
<a href="https://opencollective.com/mochajs/backer/22/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/22/avatar"></a>
|
||||
<a href="https://opencollective.com/mochajs/backer/23/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/23/avatar"></a>
|
||||
<a href="https://opencollective.com/mochajs/backer/24/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/24/avatar"></a>
|
||||
<a href="https://opencollective.com/mochajs/backer/25/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/25/avatar"></a>
|
||||
<a href="https://opencollective.com/mochajs/backer/26/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/26/avatar"></a>
|
||||
<a href="https://opencollective.com/mochajs/backer/27/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/27/avatar"></a>
|
||||
<a href="https://opencollective.com/mochajs/backer/28/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/28/avatar"></a>
|
||||
<a href="https://opencollective.com/mochajs/backer/29/website" target="_blank"><img src="https://opencollective.com/mochajs/backer/29/avatar"></a>
|
||||
|
||||
|
||||
## Sponsors
|
||||
|
||||
Does your company use Mocha? Ask your manager or marketing team if your company would be interested in supporting our project. Support will allow the maintainers to dedicate more time for maintenance and new features for everyone. Also, your company's logo will show [on GitHub](https://github.com/mochajs/mocha#readme) and on [our site](https://mochajs.org)--who doesn't want a little extra exposure? [Here's the info](https://opencollective.com/mochajs#sponsor).
|
||||
|
||||
<a href="https://opencollective.com/mochajs/sponsor/0/website" target="_blank"><img src="https://opencollective.com/mochajs/sponsor/0/avatar"></a>
|
||||
<a href="https://opencollective.com/mochajs/sponsor/1/website" target="_blank"><img src="https://opencollective.com/mochajs/sponsor/1/avatar"></a>
|
||||
<a href="https://opencollective.com/mochajs/sponsor/2/website" target="_blank"><img src="https://opencollective.com/mochajs/sponsor/2/avatar"></a>
|
||||
<a href="https://opencollective.com/mochajs/sponsor/3/website" target="_blank"><img src="https://opencollective.com/mochajs/sponsor/3/avatar"></a>
|
||||
<a href="https://opencollective.com/mochajs/sponsor/4/website" target="_blank"><img src="https://opencollective.com/mochajs/sponsor/4/avatar"></a>
|
||||
<a href="https://opencollective.com/mochajs/sponsor/5/website" target="_blank"><img src="https://opencollective.com/mochajs/sponsor/5/avatar"></a>
|
||||
<a href="https://opencollective.com/mochajs/sponsor/6/website" target="_blank"><img src="https://opencollective.com/mochajs/sponsor/6/avatar"></a>
|
||||
<a href="https://opencollective.com/mochajs/sponsor/7/website" target="_blank"><img src="https://opencollective.com/mochajs/sponsor/7/avatar"></a>
|
||||
<a href="https://opencollective.com/mochajs/sponsor/8/website" target="_blank"><img src="https://opencollective.com/mochajs/sponsor/8/avatar"></a>
|
||||
<a href="https://opencollective.com/mochajs/sponsor/9/website" target="_blank"><img src="https://opencollective.com/mochajs/sponsor/9/avatar"></a>
|
||||
<a href="https://opencollective.com/mochajs/sponsor/10/website" target="_blank"><img src="https://opencollective.com/mochajs/sponsor/10/avatar"></a>
|
||||
<a href="https://opencollective.com/mochajs/sponsor/11/website" target="_blank"><img src="https://opencollective.com/mochajs/sponsor/11/avatar"></a>
|
||||
<a href="https://opencollective.com/mochajs/sponsor/12/website" target="_blank"><img src="https://opencollective.com/mochajs/sponsor/12/avatar"></a>
|
||||
<a href="https://opencollective.com/mochajs/sponsor/13/website" target="_blank"><img src="https://opencollective.com/mochajs/sponsor/13/avatar"></a>
|
||||
<a href="https://opencollective.com/mochajs/sponsor/14/website" target="_blank"><img src="https://opencollective.com/mochajs/sponsor/14/avatar"></a>
|
||||
<a href="https://opencollective.com/mochajs/sponsor/15/website" target="_blank"><img src="https://opencollective.com/mochajs/sponsor/15/avatar"></a>
|
||||
<a href="https://opencollective.com/mochajs/sponsor/16/website" target="_blank"><img src="https://opencollective.com/mochajs/sponsor/16/avatar"></a>
|
||||
<a href="https://opencollective.com/mochajs/sponsor/17/website" target="_blank"><img src="https://opencollective.com/mochajs/sponsor/17/avatar"></a>
|
||||
<a href="https://opencollective.com/mochajs/sponsor/18/website" target="_blank"><img src="https://opencollective.com/mochajs/sponsor/18/avatar"></a>
|
||||
<a href="https://opencollective.com/mochajs/sponsor/19/website" target="_blank"><img src="https://opencollective.com/mochajs/sponsor/19/avatar"></a>
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
||||
|
||||
[](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fmochajs%2Fmocha?ref=badge_large)
|
||||
3
Client/node_modules/mocha/bin/.eslintrc.yml
generated
vendored
Executable file
3
Client/node_modules/mocha/bin/.eslintrc.yml
generated
vendored
Executable file
@@ -0,0 +1,3 @@
|
||||
env:
|
||||
es6: true
|
||||
browser: false
|
||||
583
Client/node_modules/mocha/bin/_mocha
generated
vendored
Executable file
583
Client/node_modules/mocha/bin/_mocha
generated
vendored
Executable file
@@ -0,0 +1,583 @@
|
||||
#!/usr/bin/env node
|
||||
'use strict';
|
||||
|
||||
/* eslint no-unused-vars: off */
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
const program = require('commander');
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const resolve = path.resolve;
|
||||
const exists = fs.existsSync;
|
||||
const Mocha = require('../');
|
||||
const utils = Mocha.utils;
|
||||
const interfaceNames = Object.keys(Mocha.interfaces);
|
||||
const join = path.join;
|
||||
const cwd = process.cwd();
|
||||
const getOptions = require('./options');
|
||||
const mocha = new Mocha();
|
||||
|
||||
/**
|
||||
* Save timer references to avoid Sinon interfering (see GH-237).
|
||||
*/
|
||||
|
||||
const Date = global.Date;
|
||||
const setTimeout = global.setTimeout;
|
||||
const setInterval = global.setInterval;
|
||||
const clearTimeout = global.clearTimeout;
|
||||
const clearInterval = global.clearInterval;
|
||||
|
||||
/**
|
||||
* Exits Mocha when tests + code under test has finished execution (default)
|
||||
* @param {number} code - Exit code; typically # of failures
|
||||
*/
|
||||
const exitLater = code => {
|
||||
process.on('exit', () => {
|
||||
process.exit(Math.min(code, 255));
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Exits Mocha when Mocha itself has finished execution, regardless of
|
||||
* what the tests or code under test is doing.
|
||||
* @param {number} code - Exit code; typically # of failures
|
||||
*/
|
||||
const exit = code => {
|
||||
const clampedCode = Math.min(code, 255);
|
||||
let draining = 0;
|
||||
|
||||
// Eagerly set the process's exit code in case stream.write doesn't
|
||||
// execute its callback before the process terminates.
|
||||
process.exitCode = clampedCode;
|
||||
|
||||
// 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
|
||||
const done = () => {
|
||||
if (!(draining--)) {
|
||||
process.exit(clampedCode);
|
||||
}
|
||||
};
|
||||
|
||||
const streams = [process.stdout, process.stderr];
|
||||
|
||||
streams.forEach(stream => {
|
||||
// submit empty write request and wait for completion
|
||||
draining += 1;
|
||||
stream.write('', done);
|
||||
});
|
||||
|
||||
done();
|
||||
};
|
||||
|
||||
/**
|
||||
* Parse list.
|
||||
*/
|
||||
const list = str => str.split(/ *, */);
|
||||
|
||||
/**
|
||||
* Hide the cursor.
|
||||
*/
|
||||
const hideCursor = () => {
|
||||
process.stdout.write('\u001b[?25l');
|
||||
};
|
||||
|
||||
/**
|
||||
* Show the cursor.
|
||||
*/
|
||||
const showCursor = () => {
|
||||
process.stdout.write('\u001b[?25h');
|
||||
};
|
||||
|
||||
/**
|
||||
* Stop play()ing.
|
||||
*/
|
||||
const stop = () => {
|
||||
process.stdout.write('\u001b[2K');
|
||||
clearInterval(play.timer);
|
||||
};
|
||||
|
||||
/**
|
||||
* Play the given array of strings.
|
||||
*/
|
||||
const play = (arr, interval) => {
|
||||
const len = arr.length;
|
||||
interval = interval || 100;
|
||||
let i = 0;
|
||||
|
||||
play.timer = setInterval(() => {
|
||||
const str = arr[i++ % len];
|
||||
process.stdout.write(`\u001b[0G${str}`);
|
||||
}, interval);
|
||||
};
|
||||
|
||||
/**
|
||||
* Files.
|
||||
*/
|
||||
|
||||
let files = [];
|
||||
|
||||
/**
|
||||
* Globals.
|
||||
*/
|
||||
|
||||
let globals = [];
|
||||
|
||||
/**
|
||||
* Requires.
|
||||
*/
|
||||
|
||||
const requires = [];
|
||||
|
||||
/**
|
||||
* Images.
|
||||
*/
|
||||
|
||||
const images = {
|
||||
fail: path.join(__dirname, '..', 'images', 'error.png'),
|
||||
pass: path.join(__dirname, '..', 'images', 'ok.png')
|
||||
};
|
||||
|
||||
// options
|
||||
|
||||
program
|
||||
.version(JSON.parse(fs.readFileSync(path.join(__dirname, '..', 'package.json'), 'utf8')).version)
|
||||
.usage('[debug] [options] [files]')
|
||||
.option('-A, --async-only', 'force all tests to take a callback (async) or return a promise')
|
||||
.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 (${interfaceNames.join('|')})`, '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('--es_staging', 'enable all staged features')
|
||||
.option('--harmony<_classes,_generators,...>', 'all node --harmony* flags are available')
|
||||
.option('--preserve-symlinks', 'Instructs the module loader to preserve symbolic links when resolving and caching modules')
|
||||
.option('--icu-data-dir', 'include ICU data')
|
||||
.option('--inline-diffs', 'display actual/expected differences inline within each string')
|
||||
.option('--no-diff', 'do not show a diff on failure')
|
||||
.option('--inspect', 'activate devtools in chrome')
|
||||
.option('--inspect-brk', 'activate devtools in chrome and break on the first line')
|
||||
.option('--interfaces', 'display available interfaces')
|
||||
.option('--no-deprecation', 'silence deprecation warnings')
|
||||
.option('--exit', 'force shutdown of the event loop after test run: mocha will call process.exit')
|
||||
.option('--no-timeouts', 'disables timeouts, given implicitly with --debug')
|
||||
.option('--no-warnings', 'silence all node process warnings')
|
||||
.option('--opts <path>', 'specify opts path', 'test/mocha.opts')
|
||||
.option('--perf-basic-prof', 'enable perf linux profiler (basic support)')
|
||||
.option('--napi-modules', 'enable experimental NAPI modules')
|
||||
.option('--prof', 'log statistical profiling information')
|
||||
.option('--log-timer-events', 'Time events including external callbacks')
|
||||
.option('--recursive', 'include sub directories')
|
||||
.option('--reporters', 'display available reporters')
|
||||
.option('--retries <times>', 'set numbers of time to retry a failed test case')
|
||||
.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('--trace-warnings', 'show stack traces on node process warnings')
|
||||
.option('--use_strict', 'enforce strict mode')
|
||||
.option('--watch-extensions <ext>,...', 'additional extensions to monitor with --watch', list, [])
|
||||
.option('--delay', 'wait for async suite definition')
|
||||
.option('--allow-uncaught', 'enable uncaught errors to propagate')
|
||||
.option('--forbid-only', 'causes test marked with only to fail the suite')
|
||||
.option('--forbid-pending', 'causes pending tests and test marked with skip to fail the suite');
|
||||
|
||||
program._name = 'mocha';
|
||||
|
||||
// init command
|
||||
|
||||
program
|
||||
.command('init <path>')
|
||||
.description('initialize a client-side mocha setup at <path>')
|
||||
.action(path => {
|
||||
const mkdir = require('mkdirp');
|
||||
mkdir.sync(path);
|
||||
const css = fs.readFileSync(join(__dirname, '..', 'mocha.css'));
|
||||
const js = fs.readFileSync(join(__dirname, '..', 'mocha.js'));
|
||||
const 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('option:globals', val => {
|
||||
globals = globals.concat(list(val));
|
||||
});
|
||||
|
||||
// --reporters
|
||||
|
||||
program.on('option:reporters', () => {
|
||||
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(' 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('option:interfaces', () => {
|
||||
console.log('');
|
||||
interfaceNames.forEach(interfaceName => {
|
||||
console.log(` ${interfaceName}`);
|
||||
});
|
||||
console.log('');
|
||||
process.exit();
|
||||
});
|
||||
|
||||
// -r, --require
|
||||
|
||||
module.paths.push(cwd, join(cwd, 'node_modules'));
|
||||
|
||||
program.on('option:require', mod => {
|
||||
const abs = exists(mod) || exists(`${mod}.js`);
|
||||
if (abs) {
|
||||
mod = resolve(mod);
|
||||
}
|
||||
requires.push(mod);
|
||||
});
|
||||
|
||||
// If not already done, load mocha.opts
|
||||
if (!process.env.LOADED_MOCHA_OPTS) {
|
||||
getOptions();
|
||||
}
|
||||
|
||||
// parse args
|
||||
|
||||
program.parse(process.argv);
|
||||
|
||||
// infinite stack traces
|
||||
|
||||
Error.stackTraceLimit = Infinity; // TODO: config
|
||||
|
||||
// reporter options
|
||||
|
||||
const reporterOptions = {};
|
||||
if (program.reporterOptions !== undefined) {
|
||||
program.reporterOptions.split(',').forEach(opt => {
|
||||
const L = opt.split('=');
|
||||
if (L.length > 2 || L.length === 0) {
|
||||
throw new Error(`invalid reporter option '${opt}'`);
|
||||
} else if (L.length === 2) {
|
||||
reporterOptions[L[0]] = L[1];
|
||||
} else {
|
||||
reporterOptions[L[0]] = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// reporter
|
||||
|
||||
mocha.reporter(program.reporter, reporterOptions);
|
||||
|
||||
// load reporter
|
||||
|
||||
let Reporter = null;
|
||||
try {
|
||||
Reporter = require(`../lib/reporters/${program.reporter}`);
|
||||
} catch (err) {
|
||||
try {
|
||||
Reporter = require(program.reporter);
|
||||
} catch (err2) {
|
||||
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);
|
||||
}
|
||||
|
||||
// --no-diff
|
||||
|
||||
if (process.argv.indexOf('--no-diff') !== -1) {
|
||||
mocha.hideDiff(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(program.grep);
|
||||
}
|
||||
|
||||
// --fgrep
|
||||
|
||||
if (program.fgrep) {
|
||||
mocha.fgrep(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();
|
||||
}
|
||||
|
||||
// --allow-uncaught
|
||||
|
||||
if (program.allowUncaught) {
|
||||
mocha.allowUncaught();
|
||||
}
|
||||
|
||||
// --globals
|
||||
|
||||
mocha.globals(globals);
|
||||
|
||||
// --retries
|
||||
|
||||
if (program.retries) {
|
||||
mocha.suite.retries(program.retries);
|
||||
}
|
||||
|
||||
// --forbid-only
|
||||
|
||||
if (program.forbidOnly) mocha.forbidOnly();
|
||||
|
||||
// --forbid-pending
|
||||
|
||||
if (program.forbidPending) mocha.forbidPending();
|
||||
|
||||
// custom compiler support
|
||||
|
||||
if (program.compilers.length > 0) {
|
||||
require('util').deprecate(() => {},
|
||||
'"--compilers" will be removed in a future version of Mocha; see https://git.io/vdcSr for more info')();
|
||||
}
|
||||
const extensions = ['js'];
|
||||
program.compilers.forEach(c => {
|
||||
const idx = c.indexOf(':');
|
||||
const ext = c.slice(0, idx);
|
||||
let mod = c.slice(idx + 1);
|
||||
|
||||
if (mod[0] === '.') {
|
||||
mod = join(process.cwd(), mod);
|
||||
}
|
||||
require(mod);
|
||||
extensions.push(ext);
|
||||
program.watchExtensions.push(ext);
|
||||
});
|
||||
|
||||
// requires
|
||||
|
||||
requires.forEach(mod => {
|
||||
require(mod);
|
||||
});
|
||||
|
||||
// interface
|
||||
|
||||
mocha.ui(program.ui);
|
||||
|
||||
// args
|
||||
|
||||
const args = program.args;
|
||||
|
||||
// default files to test/*.{js,coffee}
|
||||
|
||||
if (!args.length) {
|
||||
args.push('test');
|
||||
}
|
||||
|
||||
args.forEach(arg => {
|
||||
let newFiles;
|
||||
try {
|
||||
newFiles = utils.lookupFiles(arg, extensions, program.recursive);
|
||||
} catch (err) {
|
||||
if (err.message.indexOf('cannot resolve path') === 0) {
|
||||
console.error(`Warning: Could not find any test files matching pattern: ${arg}`);
|
||||
return;
|
||||
}
|
||||
|
||||
throw err;
|
||||
}
|
||||
|
||||
files = files.concat(newFiles);
|
||||
});
|
||||
|
||||
if (!files.length) {
|
||||
console.error('No test files found');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// resolve
|
||||
|
||||
files = files.map(path => resolve(path));
|
||||
|
||||
if (program.sort) {
|
||||
files.sort();
|
||||
}
|
||||
|
||||
// --watch
|
||||
|
||||
let runner;
|
||||
let loadAndRun;
|
||||
let purge;
|
||||
let rerun;
|
||||
|
||||
if (program.watch) {
|
||||
console.log();
|
||||
hideCursor();
|
||||
process.on('SIGINT', () => {
|
||||
showCursor();
|
||||
console.log('\n');
|
||||
process.exit(130);
|
||||
});
|
||||
|
||||
const watchFiles = utils.files(cwd, [ 'js' ].concat(program.watchExtensions));
|
||||
let runAgain = false;
|
||||
|
||||
loadAndRun = () => {
|
||||
try {
|
||||
mocha.files = files;
|
||||
runAgain = false;
|
||||
runner = mocha.run(() => {
|
||||
runner = null;
|
||||
if (runAgain) {
|
||||
rerun();
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
console.log(e.stack);
|
||||
}
|
||||
};
|
||||
|
||||
purge = () => {
|
||||
watchFiles.forEach(file => {
|
||||
delete require.cache[file];
|
||||
});
|
||||
};
|
||||
|
||||
loadAndRun();
|
||||
|
||||
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, () => {
|
||||
runAgain = true;
|
||||
if (runner) {
|
||||
runner.abort();
|
||||
} else {
|
||||
rerun();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// load
|
||||
|
||||
mocha.files = files;
|
||||
runner = mocha.run(program.exit ? exit : exitLater);
|
||||
}
|
||||
|
||||
process.on('SIGINT', () => {
|
||||
runner.abort();
|
||||
|
||||
// This is a hack:
|
||||
// Instead of `process.exit(130)`, set runner.failures to 130 (exit code for SIGINT)
|
||||
// The amount of failures will be emitted as error code later
|
||||
runner.failures = 130;
|
||||
});
|
||||
89
Client/node_modules/mocha/bin/mocha
generated
vendored
Executable file
89
Client/node_modules/mocha/bin/mocha
generated
vendored
Executable file
@@ -0,0 +1,89 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* This tiny wrapper file checks for known node flags and appends them
|
||||
* when found, before invoking the "real" _mocha(1) executable.
|
||||
*/
|
||||
|
||||
const spawn = require('child_process').spawn;
|
||||
const path = require('path');
|
||||
const getOptions = require('./options');
|
||||
const args = [path.join(__dirname, '_mocha')];
|
||||
|
||||
// Load mocha.opts into process.argv
|
||||
// Must be loaded here to handle node-specific options
|
||||
getOptions();
|
||||
|
||||
process.argv.slice(2).forEach(arg => {
|
||||
const flag = arg.split('=')[0];
|
||||
|
||||
switch (flag) {
|
||||
case '-d':
|
||||
args.unshift('--debug');
|
||||
args.push('--no-timeouts');
|
||||
break;
|
||||
case 'debug':
|
||||
case '--debug':
|
||||
case '--debug-brk':
|
||||
case '--inspect':
|
||||
case '--inspect-brk':
|
||||
args.unshift(arg);
|
||||
args.push('--no-timeouts');
|
||||
break;
|
||||
case '-gc':
|
||||
case '--expose-gc':
|
||||
args.unshift('--expose-gc');
|
||||
break;
|
||||
case '--gc-global':
|
||||
case '--es_staging':
|
||||
case '--no-deprecation':
|
||||
case '--no-warnings':
|
||||
case '--prof':
|
||||
case '--log-timer-events':
|
||||
case '--throw-deprecation':
|
||||
case '--trace-deprecation':
|
||||
case '--trace-warnings':
|
||||
case '--use_strict':
|
||||
case '--allow-natives-syntax':
|
||||
case '--perf-basic-prof':
|
||||
case '--napi-modules':
|
||||
args.unshift(arg);
|
||||
break;
|
||||
default:
|
||||
if (arg.indexOf('--harmony') === 0) {
|
||||
args.unshift(arg);
|
||||
} else if (arg.indexOf('--trace') === 0) {
|
||||
args.unshift(arg);
|
||||
} else if (arg.indexOf('--icu-data-dir') === 0) {
|
||||
args.unshift(arg);
|
||||
} else if (arg.indexOf('--max-old-space-size') === 0) {
|
||||
args.unshift(arg);
|
||||
} else if (arg.indexOf('--preserve-symlinks') === 0) {
|
||||
args.unshift(arg);
|
||||
} else {
|
||||
args.push(arg);
|
||||
}
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
const proc = spawn(process.execPath, args, {
|
||||
stdio: 'inherit'
|
||||
});
|
||||
proc.on('exit', (code, signal) => {
|
||||
process.on('exit', () => {
|
||||
if (signal) {
|
||||
process.kill(process.pid, signal);
|
||||
} else {
|
||||
process.exit(code);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// terminate children.
|
||||
process.on('SIGINT', () => {
|
||||
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.
|
||||
});
|
||||
43
Client/node_modules/mocha/bin/options.js
generated
vendored
Executable file
43
Client/node_modules/mocha/bin/options.js
generated
vendored
Executable file
@@ -0,0 +1,43 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Dependencies.
|
||||
*/
|
||||
|
||||
const fs = require('fs');
|
||||
|
||||
/**
|
||||
* Export `getOptions`.
|
||||
*/
|
||||
|
||||
module.exports = getOptions;
|
||||
|
||||
/**
|
||||
* Get options.
|
||||
*/
|
||||
|
||||
function getOptions () {
|
||||
if (process.argv.length === 3 && (process.argv[2] === '-h' || process.argv[2] === '--help')) {
|
||||
return;
|
||||
}
|
||||
|
||||
const optsPath = process.argv.indexOf('--opts') === -1
|
||||
? 'test/mocha.opts'
|
||||
: process.argv[process.argv.indexOf('--opts') + 1];
|
||||
|
||||
try {
|
||||
const opts = fs.readFileSync(optsPath, 'utf8')
|
||||
.replace(/\\\s/g, '%20')
|
||||
.split(/\s/)
|
||||
.filter(Boolean)
|
||||
.map(value => value.replace(/%20/g, ' '));
|
||||
|
||||
process.argv = process.argv
|
||||
.slice(0, 2)
|
||||
.concat(opts.concat(process.argv.slice(2)));
|
||||
} catch (err) {
|
||||
// ignore
|
||||
}
|
||||
|
||||
process.env.LOADED_MOCHA_OPTS = true;
|
||||
}
|
||||
187
Client/node_modules/mocha/browser-entry.js
generated
vendored
Executable file
187
Client/node_modules/mocha/browser-entry.js
generated
vendored
Executable file
@@ -0,0 +1,187 @@
|
||||
'use strict';
|
||||
|
||||
/* eslint no-unused-vars: off */
|
||||
/* eslint-env commonjs */
|
||||
|
||||
/**
|
||||
* Shim process.stdout.
|
||||
*/
|
||||
|
||||
process.stdout = require('browser-stdout')({level: false});
|
||||
|
||||
var Mocha = require('./lib/mocha');
|
||||
|
||||
/**
|
||||
* Create a Mocha instance.
|
||||
*
|
||||
* @return {undefined}
|
||||
*/
|
||||
|
||||
var mocha = new Mocha({ reporter: 'html' });
|
||||
|
||||
/**
|
||||
* Save timer references to avoid Sinon interfering (see GH-237).
|
||||
*/
|
||||
|
||||
var Date = global.Date;
|
||||
var setTimeout = global.setTimeout;
|
||||
var setInterval = global.setInterval;
|
||||
var clearTimeout = global.clearTimeout;
|
||||
var clearInterval = global.clearInterval;
|
||||
|
||||
var uncaughtExceptionHandlers = [];
|
||||
|
||||
var originalOnerrorHandler = global.onerror;
|
||||
|
||||
/**
|
||||
* Remove uncaughtException listener.
|
||||
* Revert to original onerror handler if previously defined.
|
||||
*/
|
||||
|
||||
process.removeListener = function (e, fn) {
|
||||
if (e === 'uncaughtException') {
|
||||
if (originalOnerrorHandler) {
|
||||
global.onerror = originalOnerrorHandler;
|
||||
} else {
|
||||
global.onerror = function () {};
|
||||
}
|
||||
var i = uncaughtExceptionHandlers.indexOf(fn);
|
||||
if (i !== -1) {
|
||||
uncaughtExceptionHandlers.splice(i, 1);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Implements uncaughtException listener.
|
||||
*/
|
||||
|
||||
process.on = function (e, fn) {
|
||||
if (e === 'uncaughtException') {
|
||||
global.onerror = function (err, url, line) {
|
||||
fn(new Error(err + ' (' + url + ':' + line + ')'));
|
||||
return !mocha.allowUncaught;
|
||||
};
|
||||
uncaughtExceptionHandlers.push(fn);
|
||||
}
|
||||
};
|
||||
|
||||
// The BDD UI is registered by default, but no UI will be functional in the
|
||||
// browser without an explicit call to the overridden `mocha.ui` (see below).
|
||||
// Ensure that this default UI does not expose its methods to the global scope.
|
||||
mocha.suite.removeAllListeners('pre-require');
|
||||
|
||||
var immediateQueue = [];
|
||||
var immediateTimeout;
|
||||
|
||||
function timeslice () {
|
||||
var immediateStart = new Date().getTime();
|
||||
while (immediateQueue.length && (new Date().getTime() - immediateStart) < 100) {
|
||||
immediateQueue.shift()();
|
||||
}
|
||||
if (immediateQueue.length) {
|
||||
immediateTimeout = setTimeout(timeslice, 0);
|
||||
} else {
|
||||
immediateTimeout = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* High-performance override of Runner.immediately.
|
||||
*/
|
||||
|
||||
Mocha.Runner.immediately = function (callback) {
|
||||
immediateQueue.push(callback);
|
||||
if (!immediateTimeout) {
|
||||
immediateTimeout = setTimeout(timeslice, 0);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Function to allow assertion libraries to throw errors directly into mocha.
|
||||
* This is useful when running tests in a browser because window.onerror will
|
||||
* only receive the 'message' attribute of the Error.
|
||||
*/
|
||||
mocha.throwError = function (err) {
|
||||
uncaughtExceptionHandlers.forEach(function (fn) {
|
||||
fn(err);
|
||||
});
|
||||
throw err;
|
||||
};
|
||||
|
||||
/**
|
||||
* Override ui to ensure that the ui functions are initialized.
|
||||
* Normally this would happen in Mocha.prototype.loadFiles.
|
||||
*/
|
||||
|
||||
mocha.ui = function (ui) {
|
||||
Mocha.prototype.ui.call(this, ui);
|
||||
this.suite.emit('pre-require', global, null, this);
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Setup mocha with the given setting options.
|
||||
*/
|
||||
|
||||
mocha.setup = function (opts) {
|
||||
if (typeof opts === 'string') {
|
||||
opts = { ui: opts };
|
||||
}
|
||||
for (var opt in opts) {
|
||||
if (opts.hasOwnProperty(opt)) {
|
||||
this[opt](opts[opt]);
|
||||
}
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Run mocha, returning the Runner.
|
||||
*/
|
||||
|
||||
mocha.run = function (fn) {
|
||||
var options = mocha.options;
|
||||
mocha.globals('location');
|
||||
|
||||
var query = Mocha.utils.parseQuery(global.location.search || '');
|
||||
if (query.grep) {
|
||||
mocha.grep(query.grep);
|
||||
}
|
||||
if (query.fgrep) {
|
||||
mocha.fgrep(query.fgrep);
|
||||
}
|
||||
if (query.invert) {
|
||||
mocha.invert();
|
||||
}
|
||||
|
||||
return Mocha.prototype.run.call(mocha, function (err) {
|
||||
// The DOM Document is not available in Web Workers.
|
||||
var document = global.document;
|
||||
if (document && document.getElementById('mocha') && options.noHighlighting !== true) {
|
||||
Mocha.utils.highlightTags('code');
|
||||
}
|
||||
if (fn) {
|
||||
fn(err);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Expose the process shim.
|
||||
* https://github.com/mochajs/mocha/pull/916
|
||||
*/
|
||||
|
||||
Mocha.process = process;
|
||||
|
||||
/**
|
||||
* Expose mocha.
|
||||
*/
|
||||
|
||||
global.Mocha = Mocha;
|
||||
global.mocha = mocha;
|
||||
|
||||
// this allows test/acceptance/required-tokens.js to pass; thus,
|
||||
// you can now do `const describe = require('mocha').describe` in a
|
||||
// browser context (assuming browserification). should fix #880
|
||||
module.exports = global;
|
||||
BIN
Client/node_modules/mocha/images/error.png
generated
vendored
Executable file
BIN
Client/node_modules/mocha/images/error.png
generated
vendored
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 412 B |
BIN
Client/node_modules/mocha/images/ok.png
generated
vendored
Executable file
BIN
Client/node_modules/mocha/images/ok.png
generated
vendored
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 388 B |
3
Client/node_modules/mocha/index.js
generated
vendored
Executable file
3
Client/node_modules/mocha/index.js
generated
vendored
Executable file
@@ -0,0 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = require('./lib/mocha');
|
||||
4
Client/node_modules/mocha/lib/browser/.eslintrc.yml
generated
vendored
Executable file
4
Client/node_modules/mocha/lib/browser/.eslintrc.yml
generated
vendored
Executable file
@@ -0,0 +1,4 @@
|
||||
env:
|
||||
node: false
|
||||
browser: false
|
||||
commonjs: true
|
||||
5
Client/node_modules/mocha/lib/browser/growl.js
generated
vendored
Executable file
5
Client/node_modules/mocha/lib/browser/growl.js
generated
vendored
Executable file
@@ -0,0 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
// just stub out growl
|
||||
|
||||
module.exports = require('../utils').noop;
|
||||
119
Client/node_modules/mocha/lib/browser/progress.js
generated
vendored
Executable file
119
Client/node_modules/mocha/lib/browser/progress.js
generated
vendored
Executable file
@@ -0,0 +1,119 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* 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 `size`.
|
||||
*
|
||||
* @api public
|
||||
* @param {number} size
|
||||
* @return {Progress} Progress instance.
|
||||
*/
|
||||
Progress.prototype.size = function (size) {
|
||||
this._size = size;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Set text to `text`.
|
||||
*
|
||||
* @api public
|
||||
* @param {string} text
|
||||
* @return {Progress} Progress instance.
|
||||
*/
|
||||
Progress.prototype.text = function (text) {
|
||||
this._text = text;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Set font size to `size`.
|
||||
*
|
||||
* @api public
|
||||
* @param {number} size
|
||||
* @return {Progress} Progress instance.
|
||||
*/
|
||||
Progress.prototype.fontSize = function (size) {
|
||||
this._fontSize = size;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Set font to `family`.
|
||||
*
|
||||
* @param {string} family
|
||||
* @return {Progress} Progress instance.
|
||||
*/
|
||||
Progress.prototype.font = function (family) {
|
||||
this._font = family;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Update percentage to `n`.
|
||||
*
|
||||
* @param {number} n
|
||||
* @return {Progress} Progress instance.
|
||||
*/
|
||||
Progress.prototype.update = function (n) {
|
||||
this.percent = n;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Draw on `ctx`.
|
||||
*
|
||||
* @param {CanvasRenderingContext2d} ctx
|
||||
* @return {Progress} Progress instance.
|
||||
*/
|
||||
Progress.prototype.draw = function (ctx) {
|
||||
try {
|
||||
var percent = Math.min(this.percent, 100);
|
||||
var size = this._size;
|
||||
var half = size / 2;
|
||||
var x = half;
|
||||
var y = half;
|
||||
var rad = half - 1;
|
||||
var 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) + '%';
|
||||
var w = ctx.measureText(text).width;
|
||||
|
||||
ctx.fillText(text, x - w / 2 + 1, y + fontSize / 2 - 1);
|
||||
} catch (err) {
|
||||
// don't fail if we can't render progress
|
||||
}
|
||||
return this;
|
||||
};
|
||||
13
Client/node_modules/mocha/lib/browser/tty.js
generated
vendored
Executable file
13
Client/node_modules/mocha/lib/browser/tty.js
generated
vendored
Executable file
@@ -0,0 +1,13 @@
|
||||
'use strict';
|
||||
|
||||
exports.isatty = function isatty () {
|
||||
return true;
|
||||
};
|
||||
|
||||
exports.getWindowSize = function getWindowSize () {
|
||||
if ('innerHeight' in global) {
|
||||
return [global.innerHeight, global.innerWidth];
|
||||
}
|
||||
// In a Web Worker, the DOM Window is not available.
|
||||
return [640, 480];
|
||||
};
|
||||
99
Client/node_modules/mocha/lib/context.js
generated
vendored
Executable file
99
Client/node_modules/mocha/lib/context.js
generated
vendored
Executable file
@@ -0,0 +1,99 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Expose `Context`.
|
||||
*/
|
||||
|
||||
module.exports = Context;
|
||||
|
||||
/**
|
||||
* Initialize a new `Context`.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
function Context () {}
|
||||
|
||||
/**
|
||||
* Set or get the context `Runnable` to `runnable`.
|
||||
*
|
||||
* @api private
|
||||
* @param {Runnable} runnable
|
||||
* @return {Context}
|
||||
*/
|
||||
Context.prototype.runnable = function (runnable) {
|
||||
if (!arguments.length) {
|
||||
return this._runnable;
|
||||
}
|
||||
this.test = this._runnable = runnable;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Set or get test timeout `ms`.
|
||||
*
|
||||
* @api private
|
||||
* @param {number} ms
|
||||
* @return {Context} self
|
||||
*/
|
||||
Context.prototype.timeout = function (ms) {
|
||||
if (!arguments.length) {
|
||||
return this.runnable().timeout();
|
||||
}
|
||||
this.runnable().timeout(ms);
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Set test timeout `enabled`.
|
||||
*
|
||||
* @api private
|
||||
* @param {boolean} enabled
|
||||
* @return {Context} self
|
||||
*/
|
||||
Context.prototype.enableTimeouts = function (enabled) {
|
||||
if (!arguments.length) {
|
||||
return this.runnable().enableTimeouts();
|
||||
}
|
||||
this.runnable().enableTimeouts(enabled);
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Set or get test slowness threshold `ms`.
|
||||
*
|
||||
* @api private
|
||||
* @param {number} ms
|
||||
* @return {Context} self
|
||||
*/
|
||||
Context.prototype.slow = function (ms) {
|
||||
if (!arguments.length) {
|
||||
return this.runnable().slow();
|
||||
}
|
||||
this.runnable().slow(ms);
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Mark a test as skipped.
|
||||
*
|
||||
* @api private
|
||||
* @throws Pending
|
||||
*/
|
||||
Context.prototype.skip = function () {
|
||||
this.runnable().skip();
|
||||
};
|
||||
|
||||
/**
|
||||
* Set or get a number of allowed retries on failed tests
|
||||
*
|
||||
* @api private
|
||||
* @param {number} n
|
||||
* @return {Context} self
|
||||
*/
|
||||
Context.prototype.retries = function (n) {
|
||||
if (!arguments.length) {
|
||||
return this.runnable().retries();
|
||||
}
|
||||
this.runnable().retries(n);
|
||||
return this;
|
||||
};
|
||||
48
Client/node_modules/mocha/lib/hook.js
generated
vendored
Executable file
48
Client/node_modules/mocha/lib/hook.js
generated
vendored
Executable file
@@ -0,0 +1,48 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var Runnable = require('./runnable');
|
||||
var inherits = require('./utils').inherits;
|
||||
|
||||
/**
|
||||
* 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`.
|
||||
*/
|
||||
inherits(Hook, Runnable);
|
||||
|
||||
/**
|
||||
* Get or set the test `err`.
|
||||
*
|
||||
* @param {Error} err
|
||||
* @return {Error}
|
||||
* @api public
|
||||
*/
|
||||
Hook.prototype.error = function (err) {
|
||||
if (!arguments.length) {
|
||||
err = this._error;
|
||||
this._error = null;
|
||||
return err;
|
||||
}
|
||||
|
||||
this._error = err;
|
||||
};
|
||||
115
Client/node_modules/mocha/lib/interfaces/bdd.js
generated
vendored
Executable file
115
Client/node_modules/mocha/lib/interfaces/bdd.js
generated
vendored
Executable file
@@ -0,0 +1,115 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var Test = require('../test');
|
||||
|
||||
/**
|
||||
* 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() {
|
||||
* // ...
|
||||
* });
|
||||
* });
|
||||
* });
|
||||
*
|
||||
* @param {Suite} suite Root suite.
|
||||
*/
|
||||
module.exports = function (suite) {
|
||||
var suites = [suite];
|
||||
|
||||
suite.on('pre-require', function (context, file, mocha) {
|
||||
var common = require('./common')(suites, context, mocha);
|
||||
|
||||
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) {
|
||||
return common.suite.create({
|
||||
title: title,
|
||||
file: file,
|
||||
fn: fn
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Pending describe.
|
||||
*/
|
||||
|
||||
context.xdescribe = context.xcontext = context.describe.skip = function (title, fn) {
|
||||
return common.suite.skip({
|
||||
title: title,
|
||||
file: file,
|
||||
fn: fn
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Exclusive suite.
|
||||
*/
|
||||
|
||||
context.describe.only = function (title, fn) {
|
||||
return common.suite.only({
|
||||
title: title,
|
||||
file: file,
|
||||
fn: fn
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 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.isPending()) {
|
||||
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) {
|
||||
return common.test.only(mocha, context.it(title, fn));
|
||||
};
|
||||
|
||||
/**
|
||||
* Pending test case.
|
||||
*/
|
||||
|
||||
context.xit = context.xspecify = context.it.skip = function (title) {
|
||||
return context.it(title);
|
||||
};
|
||||
|
||||
/**
|
||||
* Number of attempts to retry.
|
||||
*/
|
||||
context.it.retries = function (n) {
|
||||
context.retries(n);
|
||||
};
|
||||
});
|
||||
};
|
||||
155
Client/node_modules/mocha/lib/interfaces/common.js
generated
vendored
Executable file
155
Client/node_modules/mocha/lib/interfaces/common.js
generated
vendored
Executable file
@@ -0,0 +1,155 @@
|
||||
'use strict';
|
||||
|
||||
var Suite = require('../suite');
|
||||
|
||||
/**
|
||||
* Functions common to more than one interface.
|
||||
*
|
||||
* @param {Suite[]} suites
|
||||
* @param {Context} context
|
||||
* @param {Mocha} mocha
|
||||
* @return {Object} An object containing common functions.
|
||||
*/
|
||||
module.exports = function (suites, context, mocha) {
|
||||
return {
|
||||
/**
|
||||
* This is only present if flag --delay is passed into Mocha. It triggers
|
||||
* root suite execution.
|
||||
*
|
||||
* @param {Suite} suite The root suite.
|
||||
* @return {Function} A function which runs the root suite
|
||||
*/
|
||||
runWithSuite: function runWithSuite (suite) {
|
||||
return function run () {
|
||||
suite.run();
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* Execute before running tests.
|
||||
*
|
||||
* @param {string} name
|
||||
* @param {Function} fn
|
||||
*/
|
||||
before: function (name, fn) {
|
||||
suites[0].beforeAll(name, fn);
|
||||
},
|
||||
|
||||
/**
|
||||
* Execute after running tests.
|
||||
*
|
||||
* @param {string} name
|
||||
* @param {Function} fn
|
||||
*/
|
||||
after: function (name, fn) {
|
||||
suites[0].afterAll(name, fn);
|
||||
},
|
||||
|
||||
/**
|
||||
* Execute before each test case.
|
||||
*
|
||||
* @param {string} name
|
||||
* @param {Function} fn
|
||||
*/
|
||||
beforeEach: function (name, fn) {
|
||||
suites[0].beforeEach(name, fn);
|
||||
},
|
||||
|
||||
/**
|
||||
* Execute after each test case.
|
||||
*
|
||||
* @param {string} name
|
||||
* @param {Function} fn
|
||||
*/
|
||||
afterEach: function (name, fn) {
|
||||
suites[0].afterEach(name, fn);
|
||||
},
|
||||
|
||||
suite: {
|
||||
/**
|
||||
* Create an exclusive Suite; convenience function
|
||||
* See docstring for create() below.
|
||||
*
|
||||
* @param {Object} opts
|
||||
* @returns {Suite}
|
||||
*/
|
||||
only: function only (opts) {
|
||||
opts.isOnly = true;
|
||||
return this.create(opts);
|
||||
},
|
||||
|
||||
/**
|
||||
* Create a Suite, but skip it; convenience function
|
||||
* See docstring for create() below.
|
||||
*
|
||||
* @param {Object} opts
|
||||
* @returns {Suite}
|
||||
*/
|
||||
skip: function skip (opts) {
|
||||
opts.pending = true;
|
||||
return this.create(opts);
|
||||
},
|
||||
|
||||
/**
|
||||
* Creates a suite.
|
||||
* @param {Object} opts Options
|
||||
* @param {string} opts.title Title of Suite
|
||||
* @param {Function} [opts.fn] Suite Function (not always applicable)
|
||||
* @param {boolean} [opts.pending] Is Suite pending?
|
||||
* @param {string} [opts.file] Filepath where this Suite resides
|
||||
* @param {boolean} [opts.isOnly] Is Suite exclusive?
|
||||
* @returns {Suite}
|
||||
*/
|
||||
create: function create (opts) {
|
||||
var suite = Suite.create(suites[0], opts.title);
|
||||
suite.pending = Boolean(opts.pending);
|
||||
suite.file = opts.file;
|
||||
suites.unshift(suite);
|
||||
if (opts.isOnly) {
|
||||
suite.parent._onlySuites = suite.parent._onlySuites.concat(suite);
|
||||
}
|
||||
if (typeof opts.fn === 'function') {
|
||||
opts.fn.call(suite);
|
||||
suites.shift();
|
||||
} else if (typeof opts.fn === 'undefined' && !suite.pending) {
|
||||
throw new Error('Suite "' + suite.fullTitle() + '" was defined but no callback was supplied. Supply a callback or explicitly skip the suite.');
|
||||
}
|
||||
|
||||
return suite;
|
||||
}
|
||||
},
|
||||
|
||||
test: {
|
||||
|
||||
/**
|
||||
* Exclusive test-case.
|
||||
*
|
||||
* @param {Object} mocha
|
||||
* @param {Function} test
|
||||
* @returns {*}
|
||||
*/
|
||||
only: function (mocha, test) {
|
||||
test.parent._onlyTests = test.parent._onlyTests.concat(test);
|
||||
return test;
|
||||
},
|
||||
|
||||
/**
|
||||
* Pending test case.
|
||||
*
|
||||
* @param {string} title
|
||||
*/
|
||||
skip: function (title) {
|
||||
context.test(title);
|
||||
},
|
||||
|
||||
/**
|
||||
* Number of retry attempts
|
||||
*
|
||||
* @param {number} n
|
||||
*/
|
||||
retries: function (n) {
|
||||
context.retries(n);
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
63
Client/node_modules/mocha/lib/interfaces/exports.js
generated
vendored
Executable file
63
Client/node_modules/mocha/lib/interfaces/exports.js
generated
vendored
Executable file
@@ -0,0 +1,63 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var Suite = require('../suite');
|
||||
var Test = require('../test');
|
||||
|
||||
/**
|
||||
* Exports-style (as Node.js module) 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() {
|
||||
*
|
||||
* }
|
||||
* }
|
||||
* };
|
||||
*
|
||||
* @param {Suite} suite Root suite.
|
||||
*/
|
||||
module.exports = function (suite) {
|
||||
var suites = [suite];
|
||||
|
||||
suite.on('require', visit);
|
||||
|
||||
function visit (obj, file) {
|
||||
var suite;
|
||||
for (var key in obj) {
|
||||
if (typeof obj[key] === 'function') {
|
||||
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], file);
|
||||
suites.shift();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
6
Client/node_modules/mocha/lib/interfaces/index.js
generated
vendored
Executable file
6
Client/node_modules/mocha/lib/interfaces/index.js
generated
vendored
Executable file
@@ -0,0 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
exports.bdd = require('./bdd');
|
||||
exports.tdd = require('./tdd');
|
||||
exports.qunit = require('./qunit');
|
||||
exports.exports = require('./exports');
|
||||
99
Client/node_modules/mocha/lib/interfaces/qunit.js
generated
vendored
Executable file
99
Client/node_modules/mocha/lib/interfaces/qunit.js
generated
vendored
Executable file
@@ -0,0 +1,99 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var Test = require('../test');
|
||||
|
||||
/**
|
||||
* 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);
|
||||
* });
|
||||
*
|
||||
* @param {Suite} suite Root suite.
|
||||
*/
|
||||
module.exports = function (suite) {
|
||||
var suites = [suite];
|
||||
|
||||
suite.on('pre-require', function (context, file, mocha) {
|
||||
var common = require('./common')(suites, context, mocha);
|
||||
|
||||
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();
|
||||
}
|
||||
return common.suite.create({
|
||||
title: title,
|
||||
file: file,
|
||||
fn: false
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Exclusive Suite.
|
||||
*/
|
||||
|
||||
context.suite.only = function (title) {
|
||||
if (suites.length > 1) {
|
||||
suites.shift();
|
||||
}
|
||||
return common.suite.only({
|
||||
title: title,
|
||||
file: file,
|
||||
fn: false
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
return common.test.only(mocha, context.test(title, fn));
|
||||
};
|
||||
|
||||
context.test.skip = common.test.skip;
|
||||
context.test.retries = common.test.retries;
|
||||
});
|
||||
};
|
||||
106
Client/node_modules/mocha/lib/interfaces/tdd.js
generated
vendored
Executable file
106
Client/node_modules/mocha/lib/interfaces/tdd.js
generated
vendored
Executable file
@@ -0,0 +1,106 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var Test = require('../test');
|
||||
|
||||
/**
|
||||
* 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() {
|
||||
*
|
||||
* });
|
||||
* });
|
||||
* });
|
||||
*
|
||||
* @param {Suite} suite Root suite.
|
||||
*/
|
||||
module.exports = function (suite) {
|
||||
var suites = [suite];
|
||||
|
||||
suite.on('pre-require', function (context, file, mocha) {
|
||||
var common = require('./common')(suites, context, mocha);
|
||||
|
||||
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) {
|
||||
return common.suite.create({
|
||||
title: title,
|
||||
file: file,
|
||||
fn: fn
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Pending suite.
|
||||
*/
|
||||
context.suite.skip = function (title, fn) {
|
||||
return common.suite.skip({
|
||||
title: title,
|
||||
file: file,
|
||||
fn: fn
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Exclusive test-case.
|
||||
*/
|
||||
context.suite.only = function (title, fn) {
|
||||
return common.suite.only({
|
||||
title: title,
|
||||
file: file,
|
||||
fn: fn
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 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.isPending()) {
|
||||
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) {
|
||||
return common.test.only(mocha, context.test(title, fn));
|
||||
};
|
||||
|
||||
context.test.skip = common.test.skip;
|
||||
context.test.retries = common.test.retries;
|
||||
});
|
||||
};
|
||||
573
Client/node_modules/mocha/lib/mocha.js
generated
vendored
Executable file
573
Client/node_modules/mocha/lib/mocha.js
generated
vendored
Executable file
@@ -0,0 +1,573 @@
|
||||
'use strict';
|
||||
|
||||
/*!
|
||||
* mocha
|
||||
* Copyright(c) 2011 TJ Holowaychuk <tj@vision-media.ca>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var escapeRe = require('escape-string-regexp');
|
||||
var path = require('path');
|
||||
var reporters = require('./reporters');
|
||||
var utils = require('./utils');
|
||||
|
||||
/**
|
||||
* Expose `Mocha`.
|
||||
*/
|
||||
|
||||
exports = module.exports = Mocha;
|
||||
|
||||
/**
|
||||
* To require local UIs and reporters when running in node.
|
||||
*/
|
||||
|
||||
if (!process.browser) {
|
||||
var cwd = process.cwd();
|
||||
module.paths.push(cwd, path.join(cwd, 'node_modules'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Expose internals.
|
||||
*/
|
||||
|
||||
exports.utils = utils;
|
||||
exports.interfaces = require('./interfaces');
|
||||
exports.reporters = 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.
|
||||
*
|
||||
* @api private
|
||||
* @param {string} name
|
||||
* @return {string}
|
||||
*/
|
||||
function image (name) {
|
||||
return path.join(__dirname, '../images', name + '.png');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set up 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
|
||||
* - `retries` number of times to retry failed tests
|
||||
* - `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.fgrep(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 (typeof options.timeout !== 'undefined' && options.timeout !== null) {
|
||||
this.timeout(options.timeout);
|
||||
}
|
||||
if (typeof options.retries !== 'undefined' && options.retries !== null) {
|
||||
this.retries(options.retries);
|
||||
}
|
||||
this.useColors(options.useColors);
|
||||
if (options.enableTimeouts !== null) {
|
||||
this.enableTimeouts(options.enableTimeouts);
|
||||
}
|
||||
if (options.slow) {
|
||||
this.slow(options.slow);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable or disable bailing on the first failure.
|
||||
*
|
||||
* @api public
|
||||
* @param {boolean} [bail]
|
||||
*/
|
||||
Mocha.prototype.bail = function (bail) {
|
||||
if (!arguments.length) {
|
||||
bail = true;
|
||||
}
|
||||
this.suite.bail(bail);
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Add test `file`.
|
||||
*
|
||||
* @api public
|
||||
* @param {string} file
|
||||
*/
|
||||
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
|
||||
* @param {string|Function} reporter name or constructor
|
||||
* @param {Object} reporterOptions optional options
|
||||
*/
|
||||
Mocha.prototype.reporter = function (reporter, reporterOptions) {
|
||||
if (typeof reporter === 'function') {
|
||||
this._reporter = reporter;
|
||||
} else {
|
||||
reporter = reporter || 'spec';
|
||||
var _reporter;
|
||||
// Try to load a built-in reporter.
|
||||
if (reporters[reporter]) {
|
||||
_reporter = reporters[reporter];
|
||||
}
|
||||
// Try to load reporters from process.cwd() and node_modules
|
||||
if (!_reporter) {
|
||||
try {
|
||||
_reporter = require(reporter);
|
||||
} catch (err) {
|
||||
if (err.message.indexOf('Cannot find module') !== -1) {
|
||||
// Try to load reporters from a path (absolute or relative)
|
||||
try {
|
||||
_reporter = require(path.resolve(process.cwd(), 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);
|
||||
}
|
||||
} else {
|
||||
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".
|
||||
*
|
||||
* @api public
|
||||
* @param {string} bdd
|
||||
*/
|
||||
Mocha.prototype.ui = function (name) {
|
||||
name = name || 'bdd';
|
||||
this._ui = exports.interfaces[name];
|
||||
if (!this._ui) {
|
||||
try {
|
||||
this._ui = require(name);
|
||||
} catch (err) {
|
||||
throw new Error('invalid interface "' + name + '"');
|
||||
}
|
||||
}
|
||||
this._ui = this._ui(this.suite);
|
||||
|
||||
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.xit = context.xit || context.test.skip;
|
||||
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;
|
||||
});
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Load registered files.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
Mocha.prototype.loadFiles = function (fn) {
|
||||
var self = this;
|
||||
var suite = this.suite;
|
||||
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);
|
||||
});
|
||||
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')
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Escape string and add it to grep as a regexp.
|
||||
*
|
||||
* @api public
|
||||
* @param str
|
||||
* @returns {Mocha}
|
||||
*/
|
||||
Mocha.prototype.fgrep = function (str) {
|
||||
return this.grep(new RegExp(escapeRe(str)));
|
||||
};
|
||||
|
||||
/**
|
||||
* Add regexp to grep, if `re` is a string it is escaped.
|
||||
*
|
||||
* @param {RegExp|String} re
|
||||
* @return {Mocha}
|
||||
* @api public
|
||||
* @param {RegExp|string} re
|
||||
* @return {Mocha}
|
||||
*/
|
||||
Mocha.prototype.grep = function (re) {
|
||||
if (utils.isString(re)) {
|
||||
// extract args if it's regex-like, i.e: [string, pattern, flag]
|
||||
var arg = re.match(/^\/(.*)\/(g|i|)$|.*/);
|
||||
this.options.grep = new RegExp(arg[1] || arg[0], arg[2]);
|
||||
} else {
|
||||
this.options.grep = 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
|
||||
* @param {boolean} ignore
|
||||
* @return {Mocha}
|
||||
*/
|
||||
Mocha.prototype.ignoreLeaks = function (ignore) {
|
||||
this.options.ignoreLeaks = Boolean(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
|
||||
* @param {Array|string} globals
|
||||
* @return {Mocha}
|
||||
*/
|
||||
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
|
||||
* @param {boolean} colors
|
||||
* @return {Mocha}
|
||||
*/
|
||||
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
|
||||
* @param {boolean} inlineDiffs
|
||||
* @return {Mocha}
|
||||
*/
|
||||
Mocha.prototype.useInlineDiffs = function (inlineDiffs) {
|
||||
this.options.useInlineDiffs = inlineDiffs !== undefined && inlineDiffs;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Do not show diffs at all.
|
||||
*
|
||||
* @param {Boolean} hideDiff
|
||||
* @return {Mocha}
|
||||
* @api public
|
||||
* @param {boolean} hideDiff
|
||||
* @return {Mocha}
|
||||
*/
|
||||
Mocha.prototype.hideDiff = function (hideDiff) {
|
||||
this.options.hideDiff = hideDiff !== undefined && hideDiff;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Set the timeout in milliseconds.
|
||||
*
|
||||
* @param {Number} timeout
|
||||
* @return {Mocha}
|
||||
* @api public
|
||||
* @param {number} timeout
|
||||
* @return {Mocha}
|
||||
*/
|
||||
Mocha.prototype.timeout = function (timeout) {
|
||||
this.suite.timeout(timeout);
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Set the number of times to retry failed tests.
|
||||
*
|
||||
* @param {Number} retry times
|
||||
* @return {Mocha}
|
||||
* @api public
|
||||
*/
|
||||
Mocha.prototype.retries = function (n) {
|
||||
this.suite.retries(n);
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Set slowness threshold in milliseconds.
|
||||
*
|
||||
* @param {Number} slow
|
||||
* @return {Mocha}
|
||||
* @api public
|
||||
* @param {number} slow
|
||||
* @return {Mocha}
|
||||
*/
|
||||
Mocha.prototype.slow = function (slow) {
|
||||
this.suite.slow(slow);
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Enable timeouts.
|
||||
*
|
||||
* @param {Boolean} enabled
|
||||
* @return {Mocha}
|
||||
* @api public
|
||||
* @param {boolean} enabled
|
||||
* @return {Mocha}
|
||||
*/
|
||||
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).
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
Mocha.prototype.noHighlighting = function () {
|
||||
this.options.noHighlighting = true;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Enable uncaught errors to propagate (in browser).
|
||||
*
|
||||
* @return {Mocha}
|
||||
* @api public
|
||||
*/
|
||||
Mocha.prototype.allowUncaught = function () {
|
||||
this.options.allowUncaught = true;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Delay root suite execution.
|
||||
* @returns {Mocha}
|
||||
*/
|
||||
Mocha.prototype.delay = function delay () {
|
||||
this.options.delay = true;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Tests marked only fail the suite
|
||||
* @returns {Mocha}
|
||||
*/
|
||||
Mocha.prototype.forbidOnly = function () {
|
||||
this.options.forbidOnly = true;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Pending tests and tests marked skip fail the suite
|
||||
* @returns {Mocha}
|
||||
*/
|
||||
Mocha.prototype.forbidPending = function () {
|
||||
this.options.forbidPending = true;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Run tests and invoke `fn()` when complete.
|
||||
*
|
||||
* Note that `loadFiles` relies on Node's `require` to execute
|
||||
* the test interface functions and will be subject to the
|
||||
* cache - if the files are already in the `require` cache,
|
||||
* they will effectively be skipped. Therefore, to run tests
|
||||
* multiple times or to run tests in files that are already
|
||||
* in the `require` cache, make sure to clear them from the
|
||||
* cache first in whichever manner best suits your needs.
|
||||
*
|
||||
* @api public
|
||||
* @param {Function} fn
|
||||
* @return {Runner}
|
||||
*/
|
||||
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 = options.ignoreLeaks !== false;
|
||||
runner.fullStackTrace = options.fullStackTrace;
|
||||
runner.asyncOnly = options.asyncOnly;
|
||||
runner.allowUncaught = options.allowUncaught;
|
||||
runner.forbidOnly = options.forbidOnly;
|
||||
runner.forbidPending = options.forbidPending;
|
||||
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;
|
||||
exports.reporters.Base.hideDiff = options.hideDiff;
|
||||
|
||||
function done (failures) {
|
||||
if (reporter.done) {
|
||||
reporter.done(failures, fn);
|
||||
} else {
|
||||
fn && fn(failures);
|
||||
}
|
||||
}
|
||||
|
||||
return runner.run(done);
|
||||
};
|
||||
90
Client/node_modules/mocha/lib/ms.js
generated
vendored
Executable file
90
Client/node_modules/mocha/lib/ms.js
generated
vendored
Executable file
@@ -0,0 +1,90 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* 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`.
|
||||
*
|
||||
* @api public
|
||||
* @param {string|number} val
|
||||
* @return {string|number}
|
||||
*/
|
||||
module.exports = function (val) {
|
||||
if (typeof val === 'string') {
|
||||
return parse(val);
|
||||
}
|
||||
return format(val);
|
||||
};
|
||||
|
||||
/**
|
||||
* Parse the given `str` and return milliseconds.
|
||||
*
|
||||
* @api private
|
||||
* @param {string} str
|
||||
* @return {number}
|
||||
*/
|
||||
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;
|
||||
default:
|
||||
// No default case
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Format for `ms`.
|
||||
*
|
||||
* @api private
|
||||
* @param {number} ms
|
||||
* @return {string}
|
||||
*/
|
||||
function format (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';
|
||||
}
|
||||
16
Client/node_modules/mocha/lib/pending.js
generated
vendored
Executable file
16
Client/node_modules/mocha/lib/pending.js
generated
vendored
Executable file
@@ -0,0 +1,16 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Expose `Pending`.
|
||||
*/
|
||||
|
||||
module.exports = Pending;
|
||||
|
||||
/**
|
||||
* Initialize a new `Pending` error with the given message.
|
||||
*
|
||||
* @param {string} message
|
||||
*/
|
||||
function Pending (message) {
|
||||
this.message = message;
|
||||
}
|
||||
487
Client/node_modules/mocha/lib/reporters/base.js
generated
vendored
Executable file
487
Client/node_modules/mocha/lib/reporters/base.js
generated
vendored
Executable file
@@ -0,0 +1,487 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var tty = require('tty');
|
||||
var diff = require('diff');
|
||||
var ms = require('../ms');
|
||||
var utils = require('../utils');
|
||||
var supportsColor = process.browser ? null : require('supports-color');
|
||||
|
||||
/**
|
||||
* Expose `Base`.
|
||||
*/
|
||||
|
||||
exports = module.exports = Base;
|
||||
|
||||
/**
|
||||
* Save timer references to avoid Sinon interfering.
|
||||
* See: https://github.com/mochajs/mocha/issues/237
|
||||
*/
|
||||
|
||||
/* eslint-disable no-unused-vars, no-native-reassign */
|
||||
var Date = global.Date;
|
||||
var setTimeout = global.setTimeout;
|
||||
var setInterval = global.setInterval;
|
||||
var clearTimeout = global.clearTimeout;
|
||||
var clearInterval = global.clearInterval;
|
||||
/* eslint-enable no-unused-vars, no-native-reassign */
|
||||
|
||||
/**
|
||||
* Check if both stdio streams are associated with a tty.
|
||||
*/
|
||||
|
||||
var isatty = tty.isatty(1) && tty.isatty(2);
|
||||
|
||||
/**
|
||||
* Enable coloring by default, except in the browser interface.
|
||||
*/
|
||||
|
||||
exports.useColors = !process.browser && (supportsColor || (process.env.MOCHA_COLORS !== undefined));
|
||||
|
||||
/**
|
||||
* 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': 32,
|
||||
'diff removed': 31
|
||||
};
|
||||
|
||||
/**
|
||||
* Default symbol map.
|
||||
*/
|
||||
|
||||
exports.symbols = {
|
||||
ok: '✓',
|
||||
err: '✖',
|
||||
dot: '․',
|
||||
comma: ',',
|
||||
bang: '!'
|
||||
};
|
||||
|
||||
// With node.js on Windows: use symbols available in terminal default fonts
|
||||
if (process.platform === 'win32') {
|
||||
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: 75
|
||||
};
|
||||
|
||||
if (isatty) {
|
||||
exports.window.width = process.stdout.getWindowSize
|
||||
? process.stdout.getWindowSize(1)[0]
|
||||
: tty.getWindowSize()[1];
|
||||
}
|
||||
|
||||
/**
|
||||
* 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');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function showDiff (err) {
|
||||
return err && err.showDiff !== false && sameType(err.actual, err.expected) && err.expected !== undefined;
|
||||
}
|
||||
|
||||
function stringifyDiffObjs (err) {
|
||||
if (!utils.isString(err.actual) || !utils.isString(err.expected)) {
|
||||
err.actual = utils.stringify(err.actual);
|
||||
err.expected = utils.stringify(err.expected);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Output 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 msg;
|
||||
var err = test.err;
|
||||
var message;
|
||||
if (err.message && typeof err.message.toString === 'function') {
|
||||
message = err.message + '';
|
||||
} else if (typeof err.inspect === 'function') {
|
||||
message = err.inspect() + '';
|
||||
} else {
|
||||
message = '';
|
||||
}
|
||||
var stack = err.stack || message;
|
||||
var index = message ? stack.indexOf(message) : -1;
|
||||
|
||||
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 (!exports.hideDiff && showDiff(err)) {
|
||||
stringifyDiffObjs(err);
|
||||
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);
|
||||
} else {
|
||||
msg += unifiedDiff(err);
|
||||
}
|
||||
}
|
||||
|
||||
// indent stack trace
|
||||
stack = stack.replace(/^/gm, ' ');
|
||||
|
||||
// indented test title
|
||||
var testTitle = '';
|
||||
test.titlePath().forEach(function (str, index) {
|
||||
if (index !== 0) {
|
||||
testTitle += '\n ';
|
||||
}
|
||||
for (var i = 0; i < index; i++) {
|
||||
testTitle += ' ';
|
||||
}
|
||||
testTitle += str;
|
||||
});
|
||||
|
||||
console.log(fmt, (i + 1), testTitle, 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 stats = this.stats = { suites: 0, tests: 0, passes: 0, pending: 0, failures: 0 };
|
||||
var 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 () {
|
||||
stats.tests = stats.tests || 0;
|
||||
stats.tests++;
|
||||
});
|
||||
|
||||
runner.on('pass', function (test) {
|
||||
stats.passes = stats.passes || 0;
|
||||
|
||||
if (test.duration > test.slow()) {
|
||||
test.speed = 'slow';
|
||||
} else if (test.duration > test.slow() / 2) {
|
||||
test.speed = 'medium';
|
||||
} else {
|
||||
test.speed = 'fast';
|
||||
}
|
||||
|
||||
stats.passes++;
|
||||
});
|
||||
|
||||
runner.on('fail', function (test, err) {
|
||||
stats.failures = stats.failures || 0;
|
||||
stats.failures++;
|
||||
if (showDiff(err)) {
|
||||
stringifyDiffObjs(err);
|
||||
}
|
||||
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 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`.
|
||||
*
|
||||
* @api private
|
||||
* @param {string} str
|
||||
* @param {string} len
|
||||
* @return {string}
|
||||
*/
|
||||
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
|
||||
*
|
||||
* @api private
|
||||
* @param {Error} err with actual/expected
|
||||
* @return {string} Diff
|
||||
*/
|
||||
function inlineDiff (err) {
|
||||
var msg = errorDiff(err);
|
||||
|
||||
// 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 two strings.
|
||||
*
|
||||
* @api private
|
||||
* @param {Error} err with actual/expected
|
||||
* @return {string} The diff.
|
||||
*/
|
||||
function unifiedDiff (err) {
|
||||
var indent = ' ';
|
||||
function cleanUp (line) {
|
||||
if (line[0] === '+') {
|
||||
return indent + colorLines('diff added', line);
|
||||
}
|
||||
if (line[0] === '-') {
|
||||
return indent + colorLines('diff removed', line);
|
||||
}
|
||||
if (line.match(/@@/)) {
|
||||
return '--';
|
||||
}
|
||||
if (line.match(/\\ No newline/)) {
|
||||
return null;
|
||||
}
|
||||
return indent + line;
|
||||
}
|
||||
function notBlank (line) {
|
||||
return typeof line !== 'undefined' && line !== null;
|
||||
}
|
||||
var msg = diff.createPatch('string', err.actual, err.expected);
|
||||
var lines = msg.split('\n').splice(5);
|
||||
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`.
|
||||
*
|
||||
* @api private
|
||||
* @param {Error} err
|
||||
* @return {string}
|
||||
*/
|
||||
function errorDiff (err) {
|
||||
return diff.diffWordsWithSpace(err.actual, err.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('');
|
||||
}
|
||||
|
||||
/**
|
||||
* Color lines for `str`, using the color `name`.
|
||||
*
|
||||
* @api private
|
||||
* @param {string} name
|
||||
* @param {string} str
|
||||
* @return {string}
|
||||
*/
|
||||
function colorLines (name, str) {
|
||||
return str.split('\n').map(function (str) {
|
||||
return color(name, str);
|
||||
}).join('\n');
|
||||
}
|
||||
|
||||
/**
|
||||
* Object#toString reference.
|
||||
*/
|
||||
var objToString = Object.prototype.toString;
|
||||
|
||||
/**
|
||||
* Check that a / b have the same type.
|
||||
*
|
||||
* @api private
|
||||
* @param {Object} a
|
||||
* @param {Object} b
|
||||
* @return {boolean}
|
||||
*/
|
||||
function sameType (a, b) {
|
||||
return objToString.call(a) === objToString.call(b);
|
||||
}
|
||||
498
Client/node_modules/mocha/lib/reporters/base.js.orig
generated
vendored
Executable file
498
Client/node_modules/mocha/lib/reporters/base.js.orig
generated
vendored
Executable file
@@ -0,0 +1,498 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var tty = require('tty');
|
||||
var diff = require('diff');
|
||||
var ms = require('../ms');
|
||||
var utils = require('../utils');
|
||||
var supportsColor = process.browser ? null : require('supports-color');
|
||||
|
||||
/**
|
||||
* Expose `Base`.
|
||||
*/
|
||||
|
||||
exports = module.exports = Base;
|
||||
|
||||
/**
|
||||
* Save timer references to avoid Sinon interfering.
|
||||
* See: https://github.com/mochajs/mocha/issues/237
|
||||
*/
|
||||
|
||||
/* eslint-disable no-unused-vars, no-native-reassign */
|
||||
var Date = global.Date;
|
||||
var setTimeout = global.setTimeout;
|
||||
var setInterval = global.setInterval;
|
||||
var clearTimeout = global.clearTimeout;
|
||||
var clearInterval = global.clearInterval;
|
||||
/* eslint-enable no-unused-vars, no-native-reassign */
|
||||
|
||||
/**
|
||||
* Check if both stdio streams are associated with a tty.
|
||||
*/
|
||||
|
||||
var isatty = tty.isatty(1) && tty.isatty(2);
|
||||
|
||||
/**
|
||||
* Enable coloring by default, except in the browser interface.
|
||||
*/
|
||||
|
||||
exports.useColors = !process.browser && (supportsColor || (process.env.MOCHA_COLORS !== undefined));
|
||||
|
||||
/**
|
||||
* 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': 32,
|
||||
'diff removed': 31
|
||||
};
|
||||
|
||||
/**
|
||||
* Default symbol map.
|
||||
*/
|
||||
|
||||
exports.symbols = {
|
||||
ok: '✓',
|
||||
err: '✖',
|
||||
dot: '․',
|
||||
comma: ',',
|
||||
bang: '!'
|
||||
};
|
||||
|
||||
// With node.js on Windows: use symbols available in terminal default fonts
|
||||
if (process.platform === 'win32') {
|
||||
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: 75
|
||||
};
|
||||
|
||||
if (isatty) {
|
||||
exports.window.width = process.stdout.getWindowSize
|
||||
? process.stdout.getWindowSize(1)[0]
|
||||
: tty.getWindowSize()[1];
|
||||
}
|
||||
|
||||
/**
|
||||
* 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');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function showDiff (err) {
|
||||
return err && err.showDiff !== false && sameType(err.actual, err.expected) && err.expected !== undefined;
|
||||
}
|
||||
|
||||
function stringifyDiffObjs (err) {
|
||||
if (!utils.isString(err.actual) || !utils.isString(err.expected)) {
|
||||
err.actual = utils.stringify(err.actual);
|
||||
err.expected = utils.stringify(err.expected);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Output 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 msg;
|
||||
var err = test.err;
|
||||
var message;
|
||||
if (err.message && typeof err.message.toString === 'function') {
|
||||
message = err.message + '';
|
||||
} else if (typeof err.inspect === 'function') {
|
||||
message = err.inspect() + '';
|
||||
} else {
|
||||
message = '';
|
||||
}
|
||||
var stack = err.stack || message;
|
||||
var index = message ? stack.indexOf(message) : -1;
|
||||
|
||||
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
|
||||
<<<<<<< HEAD
|
||||
if (showDiff(err)) {
|
||||
stringifyDiffObjs(err);
|
||||
=======
|
||||
if (exports.hideDiff !== true && err.showDiff !== false && sameType(actual, expected) && expected !== undefined) {
|
||||
escape = false;
|
||||
if (!(utils.isString(actual) && utils.isString(expected))) {
|
||||
err.actual = actual = utils.stringify(actual);
|
||||
err.expected = expected = utils.stringify(expected);
|
||||
}
|
||||
|
||||
>>>>>>> Add --no-diff option (fixes mochajs/mocha#2514)
|
||||
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);
|
||||
} else {
|
||||
msg += unifiedDiff(err);
|
||||
}
|
||||
}
|
||||
|
||||
// indent stack trace
|
||||
stack = stack.replace(/^/gm, ' ');
|
||||
|
||||
// indented test title
|
||||
var testTitle = '';
|
||||
test.titlePath().forEach(function (str, index) {
|
||||
if (index !== 0) {
|
||||
testTitle += '\n ';
|
||||
}
|
||||
for (var i = 0; i < index; i++) {
|
||||
testTitle += ' ';
|
||||
}
|
||||
testTitle += str;
|
||||
});
|
||||
|
||||
console.log(fmt, (i + 1), testTitle, 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 stats = this.stats = { suites: 0, tests: 0, passes: 0, pending: 0, failures: 0 };
|
||||
var 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 () {
|
||||
stats.tests = stats.tests || 0;
|
||||
stats.tests++;
|
||||
});
|
||||
|
||||
runner.on('pass', function (test) {
|
||||
stats.passes = stats.passes || 0;
|
||||
|
||||
if (test.duration > test.slow()) {
|
||||
test.speed = 'slow';
|
||||
} else if (test.duration > test.slow() / 2) {
|
||||
test.speed = 'medium';
|
||||
} else {
|
||||
test.speed = 'fast';
|
||||
}
|
||||
|
||||
stats.passes++;
|
||||
});
|
||||
|
||||
runner.on('fail', function (test, err) {
|
||||
stats.failures = stats.failures || 0;
|
||||
stats.failures++;
|
||||
if (showDiff(err)) {
|
||||
stringifyDiffObjs(err);
|
||||
}
|
||||
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 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`.
|
||||
*
|
||||
* @api private
|
||||
* @param {string} str
|
||||
* @param {string} len
|
||||
* @return {string}
|
||||
*/
|
||||
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
|
||||
*
|
||||
* @api private
|
||||
* @param {Error} err with actual/expected
|
||||
* @return {string} Diff
|
||||
*/
|
||||
function inlineDiff (err) {
|
||||
var msg = errorDiff(err);
|
||||
|
||||
// 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 two strings.
|
||||
*
|
||||
* @api private
|
||||
* @param {Error} err with actual/expected
|
||||
* @return {string} The diff.
|
||||
*/
|
||||
function unifiedDiff (err) {
|
||||
var indent = ' ';
|
||||
function cleanUp (line) {
|
||||
if (line[0] === '+') {
|
||||
return indent + colorLines('diff added', line);
|
||||
}
|
||||
if (line[0] === '-') {
|
||||
return indent + colorLines('diff removed', line);
|
||||
}
|
||||
if (line.match(/@@/)) {
|
||||
return '--';
|
||||
}
|
||||
if (line.match(/\\ No newline/)) {
|
||||
return null;
|
||||
}
|
||||
return indent + line;
|
||||
}
|
||||
function notBlank (line) {
|
||||
return typeof line !== 'undefined' && line !== null;
|
||||
}
|
||||
var msg = diff.createPatch('string', err.actual, err.expected);
|
||||
var lines = msg.split('\n').splice(5);
|
||||
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`.
|
||||
*
|
||||
* @api private
|
||||
* @param {Error} err
|
||||
* @return {string}
|
||||
*/
|
||||
function errorDiff (err) {
|
||||
return diff.diffWordsWithSpace(err.actual, err.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('');
|
||||
}
|
||||
|
||||
/**
|
||||
* Color lines for `str`, using the color `name`.
|
||||
*
|
||||
* @api private
|
||||
* @param {string} name
|
||||
* @param {string} str
|
||||
* @return {string}
|
||||
*/
|
||||
function colorLines (name, str) {
|
||||
return str.split('\n').map(function (str) {
|
||||
return color(name, str);
|
||||
}).join('\n');
|
||||
}
|
||||
|
||||
/**
|
||||
* Object#toString reference.
|
||||
*/
|
||||
var objToString = Object.prototype.toString;
|
||||
|
||||
/**
|
||||
* Check that a / b have the same type.
|
||||
*
|
||||
* @api private
|
||||
* @param {Object} a
|
||||
* @param {Object} b
|
||||
* @return {boolean}
|
||||
*/
|
||||
function sameType (a, b) {
|
||||
return objToString.call(a) === objToString.call(b);
|
||||
}
|
||||
64
Client/node_modules/mocha/lib/reporters/doc.js
generated
vendored
Executable file
64
Client/node_modules/mocha/lib/reporters/doc.js
generated
vendored
Executable file
@@ -0,0 +1,64 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var Base = require('./base');
|
||||
var 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 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.body));
|
||||
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.body));
|
||||
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));
|
||||
});
|
||||
}
|
||||
68
Client/node_modules/mocha/lib/reporters/dot.js
generated
vendored
Executable file
68
Client/node_modules/mocha/lib/reporters/dot.js
generated
vendored
Executable file
@@ -0,0 +1,68 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var Base = require('./base');
|
||||
var inherits = require('../utils').inherits;
|
||||
var color = Base.color;
|
||||
|
||||
/**
|
||||
* Expose `Dot`.
|
||||
*/
|
||||
|
||||
exports = module.exports = Dot;
|
||||
|
||||
/**
|
||||
* Initialize a new `Dot` matrix test reporter.
|
||||
*
|
||||
* @api public
|
||||
* @param {Runner} runner
|
||||
*/
|
||||
function Dot (runner) {
|
||||
Base.call(this, runner);
|
||||
|
||||
var self = this;
|
||||
var width = Base.window.width * 0.75 | 0;
|
||||
var n = -1;
|
||||
|
||||
runner.on('start', function () {
|
||||
process.stdout.write('\n');
|
||||
});
|
||||
|
||||
runner.on('pending', function () {
|
||||
if (++n % width === 0) {
|
||||
process.stdout.write('\n ');
|
||||
}
|
||||
process.stdout.write(color('pending', Base.symbols.comma));
|
||||
});
|
||||
|
||||
runner.on('pass', function (test) {
|
||||
if (++n % width === 0) {
|
||||
process.stdout.write('\n ');
|
||||
}
|
||||
if (test.speed === 'slow') {
|
||||
process.stdout.write(color('bright yellow', Base.symbols.dot));
|
||||
} else {
|
||||
process.stdout.write(color(test.speed, Base.symbols.dot));
|
||||
}
|
||||
});
|
||||
|
||||
runner.on('fail', function () {
|
||||
if (++n % width === 0) {
|
||||
process.stdout.write('\n ');
|
||||
}
|
||||
process.stdout.write(color('fail', Base.symbols.bang));
|
||||
});
|
||||
|
||||
runner.on('end', function () {
|
||||
console.log();
|
||||
self.epilogue();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Inherit from `Base.prototype`.
|
||||
*/
|
||||
inherits(Dot, Base);
|
||||
348
Client/node_modules/mocha/lib/reporters/html.js
generated
vendored
Executable file
348
Client/node_modules/mocha/lib/reporters/html.js
generated
vendored
Executable file
@@ -0,0 +1,348 @@
|
||||
'use strict';
|
||||
|
||||
/* eslint-env browser */
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var Base = require('./base');
|
||||
var utils = require('../utils');
|
||||
var Progress = require('../browser/progress');
|
||||
var escapeRe = require('escape-string-regexp');
|
||||
var escape = utils.escape;
|
||||
|
||||
/**
|
||||
* Save timer references to avoid Sinon interfering (see GH-237).
|
||||
*/
|
||||
|
||||
/* eslint-disable no-unused-vars, no-native-reassign */
|
||||
var Date = global.Date;
|
||||
var setTimeout = global.setTimeout;
|
||||
var setInterval = global.setInterval;
|
||||
var clearTimeout = global.clearTimeout;
|
||||
var clearInterval = global.clearInterval;
|
||||
/* eslint-enable no-unused-vars, no-native-reassign */
|
||||
|
||||
/**
|
||||
* 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="javascript:void(0);">passes:</a> <em>0</em></li>' +
|
||||
'<li class="failures"><a href="javascript:void(0);">failures:</a> <em>0</em></li>' +
|
||||
'<li class="duration">duration: <em>0</em>s</li>' +
|
||||
'</ul>';
|
||||
|
||||
var playIcon = '‣';
|
||||
|
||||
/**
|
||||
* Initialize a new `HTML` reporter.
|
||||
*
|
||||
* @api public
|
||||
* @param {Runner} runner
|
||||
*/
|
||||
function HTML (runner) {
|
||||
Base.call(this, runner);
|
||||
|
||||
var self = this;
|
||||
var stats = this.stats;
|
||||
var stat = fragment(statsTemplate);
|
||||
var items = stat.getElementsByTagName('li');
|
||||
var passes = items[1].getElementsByTagName('em')[0];
|
||||
var passesLink = items[1].getElementsByTagName('a')[0];
|
||||
var failures = items[2].getElementsByTagName('em')[0];
|
||||
var failuresLink = items[2].getElementsByTagName('a')[0];
|
||||
var duration = items[3].getElementsByTagName('em')[0];
|
||||
var canvas = stat.getElementsByTagName('canvas')[0];
|
||||
var report = fragment('<ul id="mocha-report"></ul>');
|
||||
var stack = [report];
|
||||
var progress;
|
||||
var ctx;
|
||||
var 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 (evt) {
|
||||
evt.preventDefault();
|
||||
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 (evt) {
|
||||
evt.preventDefault();
|
||||
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) {
|
||||
updateStats();
|
||||
return;
|
||||
}
|
||||
stack.shift();
|
||||
});
|
||||
|
||||
runner.on('pass', function (test) {
|
||||
var url = self.testURL(test);
|
||||
var markup = '<li class="test pass %e"><h2>%e<span class="duration">%ems</span> ' +
|
||||
'<a href="%s" class="replay">' + playIcon + '</a></h2></li>';
|
||||
var el = fragment(markup, test.speed, test.title, test.duration, url);
|
||||
self.addCodeToggle(el, test.body);
|
||||
appendToStack(el);
|
||||
updateStats();
|
||||
});
|
||||
|
||||
runner.on('fail', function (test) {
|
||||
var el = fragment('<li class="test fail"><h2>%e <a href="%e" class="replay">' + playIcon + '</a></h2></li>',
|
||||
test.title, self.testURL(test));
|
||||
var stackString; // Note: Includes leading newline
|
||||
var message = test.err.toString();
|
||||
|
||||
// <=IE7 stringifies to [Object Error]. Since it can be overloaded, we
|
||||
// check for the result of the stringifying.
|
||||
if (message === '[object Error]') {
|
||||
message = test.err.message;
|
||||
}
|
||||
|
||||
if (test.err.stack) {
|
||||
var indexOfMessage = test.err.stack.indexOf(test.err.message);
|
||||
if (indexOfMessage === -1) {
|
||||
stackString = test.err.stack;
|
||||
} else {
|
||||
stackString = test.err.stack.substr(test.err.message.length + indexOfMessage);
|
||||
}
|
||||
} else if (test.err.sourceURL && test.err.line !== undefined) {
|
||||
// Safari doesn't give you a stack. Let's at least provide a source line.
|
||||
stackString = '\n(' + test.err.sourceURL + ':' + test.err.line + ')';
|
||||
}
|
||||
|
||||
stackString = stackString || '';
|
||||
|
||||
if (test.err.htmlMessage && stackString) {
|
||||
el.appendChild(fragment('<div class="html-error">%s\n<pre class="error">%e</pre></div>',
|
||||
test.err.htmlMessage, stackString));
|
||||
} else if (test.err.htmlMessage) {
|
||||
el.appendChild(fragment('<div class="html-error">%s</div>', test.err.htmlMessage));
|
||||
} else {
|
||||
el.appendChild(fragment('<pre class="error">%e%e</pre>', message, stackString));
|
||||
}
|
||||
|
||||
self.addCodeToggle(el, test.body);
|
||||
appendToStack(el);
|
||||
updateStats();
|
||||
});
|
||||
|
||||
runner.on('pending', function (test) {
|
||||
var el = fragment('<li class="test pass pending"><h2>%e</h2></li>', test.title);
|
||||
appendToStack(el);
|
||||
updateStats();
|
||||
});
|
||||
|
||||
function appendToStack (el) {
|
||||
// Don't call .appendChild if #mocha-report was already .shift()'ed off the stack.
|
||||
if (stack[0]) {
|
||||
stack[0].appendChild(el);
|
||||
}
|
||||
}
|
||||
|
||||
function updateStats () {
|
||||
// TODO: add to stats
|
||||
var percent = stats.tests / runner.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));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes a URL, preserving querystring ("search") parameters.
|
||||
*
|
||||
* @param {string} s
|
||||
* @return {string} A new URL.
|
||||
*/
|
||||
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(escapeRe(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());
|
||||
};
|
||||
|
||||
/**
|
||||
* Adds code toggle functionality for the provided test's list element.
|
||||
*
|
||||
* @param {HTMLLIElement} el
|
||||
* @param {string} contents
|
||||
*/
|
||||
HTML.prototype.addCodeToggle = function (el, contents) {
|
||||
var h2 = el.getElementsByTagName('h2')[0];
|
||||
|
||||
on(h2, 'click', function () {
|
||||
pre.style.display = pre.style.display === 'none' ? 'block' : 'none';
|
||||
});
|
||||
|
||||
var pre = fragment('<pre><code>%e</code></pre>', utils.clean(contents));
|
||||
el.appendChild(pre);
|
||||
pre.style.display = 'none';
|
||||
};
|
||||
|
||||
/**
|
||||
* Display error `msg`.
|
||||
*
|
||||
* @param {string} msg
|
||||
*/
|
||||
function error (msg) {
|
||||
document.body.appendChild(fragment('<div id="mocha-error">%s</div>', msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a DOM fragment from `html`.
|
||||
*
|
||||
* @param {string} html
|
||||
*/
|
||||
function fragment (html) {
|
||||
var args = arguments;
|
||||
var div = document.createElement('div');
|
||||
var i = 1;
|
||||
|
||||
div.innerHTML = html.replace(/%([se])/g, function (_, type) {
|
||||
switch (type) {
|
||||
case 's': return String(args[i++]);
|
||||
case 'e': return escape(args[i++]);
|
||||
// no default
|
||||
}
|
||||
});
|
||||
|
||||
return div.firstChild;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for suites that do not have elements
|
||||
* with `classname`, and hide them.
|
||||
*
|
||||
* @param {text} classname
|
||||
*/
|
||||
function hideSuitesWithout (classname) {
|
||||
var suites = document.getElementsByClassName('suite');
|
||||
for (var i = 0; i < suites.length; i++) {
|
||||
var els = suites[i].getElementsByClassName(classname);
|
||||
if (!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 an element's text contents.
|
||||
*
|
||||
* @param {HTMLElement} el
|
||||
* @param {string} contents
|
||||
*/
|
||||
function text (el, contents) {
|
||||
if (el.textContent) {
|
||||
el.textContent = contents;
|
||||
} else {
|
||||
el.innerText = contents;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
}
|
||||
19
Client/node_modules/mocha/lib/reporters/index.js
generated
vendored
Executable file
19
Client/node_modules/mocha/lib/reporters/index.js
generated
vendored
Executable file
@@ -0,0 +1,19 @@
|
||||
'use strict';
|
||||
|
||||
// Alias exports to a their normalized format Mocha#reporter to prevent a need
|
||||
// for dynamic (try/catch) requires, which Browserify doesn't handle.
|
||||
exports.Base = exports.base = require('./base');
|
||||
exports.Dot = exports.dot = require('./dot');
|
||||
exports.Doc = exports.doc = require('./doc');
|
||||
exports.TAP = exports.tap = require('./tap');
|
||||
exports.JSON = exports.json = require('./json');
|
||||
exports.HTML = exports.html = require('./html');
|
||||
exports.List = exports.list = require('./list');
|
||||
exports.Min = exports.min = require('./min');
|
||||
exports.Spec = exports.spec = require('./spec');
|
||||
exports.Nyan = exports.nyan = require('./nyan');
|
||||
exports.XUnit = exports.xunit = require('./xunit');
|
||||
exports.Markdown = exports.markdown = require('./markdown');
|
||||
exports.Progress = exports.progress = require('./progress');
|
||||
exports.Landing = exports.landing = require('./landing');
|
||||
exports.JSONStream = exports['json-stream'] = require('./json-stream');
|
||||
62
Client/node_modules/mocha/lib/reporters/json-stream.js
generated
vendored
Executable file
62
Client/node_modules/mocha/lib/reporters/json-stream.js
generated
vendored
Executable file
@@ -0,0 +1,62 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var Base = require('./base');
|
||||
|
||||
/**
|
||||
* Expose `List`.
|
||||
*/
|
||||
|
||||
exports = module.exports = List;
|
||||
|
||||
/**
|
||||
* Initialize a new `List` test reporter.
|
||||
*
|
||||
* @api public
|
||||
* @param {Runner} runner
|
||||
*/
|
||||
function List (runner) {
|
||||
Base.call(this, runner);
|
||||
|
||||
var self = this;
|
||||
var 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;
|
||||
test.stack = err.stack || null;
|
||||
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.
|
||||
*
|
||||
* @api private
|
||||
* @param {Object} test
|
||||
* @return {Object}
|
||||
*/
|
||||
function clean (test) {
|
||||
return {
|
||||
title: test.title,
|
||||
fullTitle: test.fullTitle(),
|
||||
duration: test.duration,
|
||||
currentRetry: test.currentRetry()
|
||||
};
|
||||
}
|
||||
92
Client/node_modules/mocha/lib/reporters/json.js
generated
vendored
Executable file
92
Client/node_modules/mocha/lib/reporters/json.js
generated
vendored
Executable file
@@ -0,0 +1,92 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var Base = require('./base');
|
||||
|
||||
/**
|
||||
* Expose `JSON`.
|
||||
*/
|
||||
|
||||
exports = module.exports = JSONReporter;
|
||||
|
||||
/**
|
||||
* Initialize a new `JSON` reporter.
|
||||
*
|
||||
* @api public
|
||||
* @param {Runner} runner
|
||||
*/
|
||||
function JSONReporter (runner) {
|
||||
Base.call(this, runner);
|
||||
|
||||
var self = this;
|
||||
var tests = [];
|
||||
var pending = [];
|
||||
var failures = [];
|
||||
var 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.
|
||||
*
|
||||
* @api private
|
||||
* @param {Object} test
|
||||
* @return {Object}
|
||||
*/
|
||||
function clean (test) {
|
||||
return {
|
||||
title: test.title,
|
||||
fullTitle: test.fullTitle(),
|
||||
duration: test.duration,
|
||||
currentRetry: test.currentRetry(),
|
||||
err: errorJSON(test.err || {})
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Transform `error` into a JSON object.
|
||||
*
|
||||
* @api private
|
||||
* @param {Error} err
|
||||
* @return {Object}
|
||||
*/
|
||||
function errorJSON (err) {
|
||||
var res = {};
|
||||
Object.getOwnPropertyNames(err).forEach(function (key) {
|
||||
res[key] = err[key];
|
||||
}, err);
|
||||
return res;
|
||||
}
|
||||
94
Client/node_modules/mocha/lib/reporters/landing.js
generated
vendored
Executable file
94
Client/node_modules/mocha/lib/reporters/landing.js
generated
vendored
Executable file
@@ -0,0 +1,94 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var Base = require('./base');
|
||||
var inherits = require('../utils').inherits;
|
||||
var cursor = Base.cursor;
|
||||
var 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.
|
||||
*
|
||||
* @api public
|
||||
* @param {Runner} runner
|
||||
*/
|
||||
function Landing (runner) {
|
||||
Base.call(this, runner);
|
||||
|
||||
var self = this;
|
||||
var width = Base.window.width * 0.75 | 0;
|
||||
var total = runner.total;
|
||||
var stream = process.stdout;
|
||||
var plane = color('plane', '✈');
|
||||
var crashed = -1;
|
||||
var 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 = crashed === -1 ? width * ++n / total | 0 : crashed;
|
||||
|
||||
// show the crash
|
||||
if (test.state === 'failed') {
|
||||
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`.
|
||||
*/
|
||||
inherits(Landing, Base);
|
||||
63
Client/node_modules/mocha/lib/reporters/list.js
generated
vendored
Executable file
63
Client/node_modules/mocha/lib/reporters/list.js
generated
vendored
Executable file
@@ -0,0 +1,63 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var Base = require('./base');
|
||||
var inherits = require('../utils').inherits;
|
||||
var color = Base.color;
|
||||
var cursor = Base.cursor;
|
||||
|
||||
/**
|
||||
* Expose `List`.
|
||||
*/
|
||||
|
||||
exports = module.exports = List;
|
||||
|
||||
/**
|
||||
* Initialize a new `List` test reporter.
|
||||
*
|
||||
* @api public
|
||||
* @param {Runner} runner
|
||||
*/
|
||||
function List (runner) {
|
||||
Base.call(this, runner);
|
||||
|
||||
var self = this;
|
||||
var 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.ok) +
|
||||
color('pass', ' %s: ') +
|
||||
color(test.speed, '%dms');
|
||||
cursor.CR();
|
||||
console.log(fmt, test.fullTitle(), test.duration);
|
||||
});
|
||||
|
||||
runner.on('fail', function (test) {
|
||||
cursor.CR();
|
||||
console.log(color('fail', ' %d) %s'), ++n, test.fullTitle());
|
||||
});
|
||||
|
||||
runner.on('end', self.epilogue.bind(self));
|
||||
}
|
||||
|
||||
/**
|
||||
* Inherit from `Base.prototype`.
|
||||
*/
|
||||
inherits(List, Base);
|
||||
99
Client/node_modules/mocha/lib/reporters/markdown.js
generated
vendored
Executable file
99
Client/node_modules/mocha/lib/reporters/markdown.js
generated
vendored
Executable file
@@ -0,0 +1,99 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var Base = require('./base');
|
||||
var utils = require('../utils');
|
||||
|
||||
/**
|
||||
* Constants
|
||||
*/
|
||||
|
||||
var SUITE_PREFIX = '$';
|
||||
|
||||
/**
|
||||
* Expose `Markdown`.
|
||||
*/
|
||||
|
||||
exports = module.exports = Markdown;
|
||||
|
||||
/**
|
||||
* Initialize a new `Markdown` reporter.
|
||||
*
|
||||
* @api public
|
||||
* @param {Runner} runner
|
||||
*/
|
||||
function Markdown (runner) {
|
||||
Base.call(this, runner);
|
||||
|
||||
var level = 0;
|
||||
var buf = '';
|
||||
|
||||
function title (str) {
|
||||
return Array(level).join('#') + ' ' + str;
|
||||
}
|
||||
|
||||
function mapTOC (suite, obj) {
|
||||
var ret = obj;
|
||||
var 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 (key === 'suite') {
|
||||
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 () {
|
||||
--level;
|
||||
});
|
||||
|
||||
runner.on('pass', function (test) {
|
||||
var code = utils.clean(test.body);
|
||||
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);
|
||||
});
|
||||
}
|
||||
38
Client/node_modules/mocha/lib/reporters/min.js
generated
vendored
Executable file
38
Client/node_modules/mocha/lib/reporters/min.js
generated
vendored
Executable file
@@ -0,0 +1,38 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var Base = require('./base');
|
||||
var inherits = require('../utils').inherits;
|
||||
|
||||
/**
|
||||
* Expose `Min`.
|
||||
*/
|
||||
|
||||
exports = module.exports = Min;
|
||||
|
||||
/**
|
||||
* Initialize a new `Min` minimal test reporter (best used with --watch).
|
||||
*
|
||||
* @api public
|
||||
* @param {Runner} runner
|
||||
*/
|
||||
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`.
|
||||
*/
|
||||
inherits(Min, Base);
|
||||
263
Client/node_modules/mocha/lib/reporters/nyan.js
generated
vendored
Executable file
263
Client/node_modules/mocha/lib/reporters/nyan.js
generated
vendored
Executable file
@@ -0,0 +1,263 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var Base = require('./base');
|
||||
var inherits = require('../utils').inherits;
|
||||
|
||||
/**
|
||||
* 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;
|
||||
var width = Base.window.width * 0.75 | 0;
|
||||
var nyanCatWidth = this.nyanCatWidth = 11;
|
||||
|
||||
this.colorIndex = 0;
|
||||
this.numberOfLines = 4;
|
||||
this.rainbowColors = self.generateColors();
|
||||
this.scoreboardWidth = 5;
|
||||
this.tick = 0;
|
||||
this.trajectories = [[], [], [], []];
|
||||
this.trajectoryWidthMax = (width - nyanCatWidth);
|
||||
|
||||
runner.on('start', function () {
|
||||
Base.cursor.hide();
|
||||
self.draw();
|
||||
});
|
||||
|
||||
runner.on('pending', function () {
|
||||
self.draw();
|
||||
});
|
||||
|
||||
runner.on('pass', function () {
|
||||
self.draw();
|
||||
});
|
||||
|
||||
runner.on('fail', function () {
|
||||
self.draw();
|
||||
});
|
||||
|
||||
runner.on('end', function () {
|
||||
Base.cursor.show();
|
||||
for (var i = 0; i < self.numberOfLines; i++) {
|
||||
write('\n');
|
||||
}
|
||||
self.epilogue();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Inherit from `Base.prototype`.
|
||||
*/
|
||||
inherits(NyanCat, Base);
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
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 ? '~' : '^';
|
||||
write(tail + '|' + padding + this.face() + ' ');
|
||||
write('\n');
|
||||
|
||||
write(dist);
|
||||
padding = self.tick ? ' ' : ' ';
|
||||
write(padding + '"" "" ');
|
||||
write('\n');
|
||||
|
||||
this.cursorUp(this.numberOfLines);
|
||||
};
|
||||
|
||||
/**
|
||||
* Draw nyan cat face.
|
||||
*
|
||||
* @api private
|
||||
* @return {string}
|
||||
*/
|
||||
|
||||
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 '( ^ .^)';
|
||||
}
|
||||
return '( - .-)';
|
||||
};
|
||||
|
||||
/**
|
||||
* Move cursor up `n`.
|
||||
*
|
||||
* @api private
|
||||
* @param {number} n
|
||||
*/
|
||||
|
||||
NyanCat.prototype.cursorUp = function (n) {
|
||||
write('\u001b[' + n + 'A');
|
||||
};
|
||||
|
||||
/**
|
||||
* Move cursor down `n`.
|
||||
*
|
||||
* @api private
|
||||
* @param {number} n
|
||||
*/
|
||||
|
||||
NyanCat.prototype.cursorDown = function (n) {
|
||||
write('\u001b[' + n + 'B');
|
||||
};
|
||||
|
||||
/**
|
||||
* Generate rainbow colors.
|
||||
*
|
||||
* @api private
|
||||
* @return {Array}
|
||||
*/
|
||||
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`.
|
||||
*
|
||||
* @api private
|
||||
* @param {string} str
|
||||
* @return {string}
|
||||
*/
|
||||
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.
|
||||
*
|
||||
* @param {string} string A message to write to stdout.
|
||||
*/
|
||||
function write (string) {
|
||||
process.stdout.write(string);
|
||||
}
|
||||
93
Client/node_modules/mocha/lib/reporters/progress.js
generated
vendored
Executable file
93
Client/node_modules/mocha/lib/reporters/progress.js
generated
vendored
Executable file
@@ -0,0 +1,93 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var Base = require('./base');
|
||||
var inherits = require('../utils').inherits;
|
||||
var color = Base.color;
|
||||
var cursor = Base.cursor;
|
||||
|
||||
/**
|
||||
* Expose `Progress`.
|
||||
*/
|
||||
|
||||
exports = module.exports = Progress;
|
||||
|
||||
/**
|
||||
* General progress bar color.
|
||||
*/
|
||||
|
||||
Base.colors.progress = 90;
|
||||
|
||||
/**
|
||||
* Initialize a new `Progress` bar test reporter.
|
||||
*
|
||||
* @api public
|
||||
* @param {Runner} runner
|
||||
* @param {Object} options
|
||||
*/
|
||||
function Progress (runner, options) {
|
||||
Base.call(this, runner);
|
||||
|
||||
var self = this;
|
||||
var width = Base.window.width * 0.50 | 0;
|
||||
var total = runner.total;
|
||||
var complete = 0;
|
||||
var lastN = -1;
|
||||
|
||||
// default chars
|
||||
options = options || {};
|
||||
var reporterOptions = options.reporterOptions || {};
|
||||
|
||||
options.open = reporterOptions.open || '[';
|
||||
options.complete = reporterOptions.complete || '▬';
|
||||
options.incomplete = reporterOptions.incomplete || Base.symbols.dot;
|
||||
options.close = reporterOptions.close || ']';
|
||||
options.verbose = reporterOptions.verbose || false;
|
||||
|
||||
// tests started
|
||||
runner.on('start', function () {
|
||||
console.log();
|
||||
cursor.hide();
|
||||
});
|
||||
|
||||
// tests complete
|
||||
runner.on('test end', function () {
|
||||
complete++;
|
||||
|
||||
var percent = complete / total;
|
||||
var n = width * percent | 0;
|
||||
var i = width - n;
|
||||
|
||||
if (n === lastN && !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`.
|
||||
*/
|
||||
inherits(Progress, Base);
|
||||
81
Client/node_modules/mocha/lib/reporters/spec.js
generated
vendored
Executable file
81
Client/node_modules/mocha/lib/reporters/spec.js
generated
vendored
Executable file
@@ -0,0 +1,81 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var Base = require('./base');
|
||||
var inherits = require('../utils').inherits;
|
||||
var color = Base.color;
|
||||
|
||||
/**
|
||||
* Expose `Spec`.
|
||||
*/
|
||||
|
||||
exports = module.exports = Spec;
|
||||
|
||||
/**
|
||||
* Initialize a new `Spec` test reporter.
|
||||
*
|
||||
* @api public
|
||||
* @param {Runner} runner
|
||||
*/
|
||||
function Spec (runner) {
|
||||
Base.call(this, runner);
|
||||
|
||||
var self = this;
|
||||
var indents = 0;
|
||||
var 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 () {
|
||||
--indents;
|
||||
if (indents === 1) {
|
||||
console.log();
|
||||
}
|
||||
});
|
||||
|
||||
runner.on('pending', function (test) {
|
||||
var fmt = indent() + color('pending', ' - %s');
|
||||
console.log(fmt, test.title);
|
||||
});
|
||||
|
||||
runner.on('pass', function (test) {
|
||||
var fmt;
|
||||
if (test.speed === 'fast') {
|
||||
fmt = indent() +
|
||||
color('checkmark', ' ' + Base.symbols.ok) +
|
||||
color('pass', ' %s');
|
||||
console.log(fmt, test.title);
|
||||
} else {
|
||||
fmt = indent() +
|
||||
color('checkmark', ' ' + Base.symbols.ok) +
|
||||
color('pass', ' %s') +
|
||||
color(test.speed, ' (%dms)');
|
||||
console.log(fmt, test.title, test.duration);
|
||||
}
|
||||
});
|
||||
|
||||
runner.on('fail', function (test) {
|
||||
console.log(indent() + color('fail', ' %d) %s'), ++n, test.title);
|
||||
});
|
||||
|
||||
runner.on('end', self.epilogue.bind(self));
|
||||
}
|
||||
|
||||
/**
|
||||
* Inherit from `Base.prototype`.
|
||||
*/
|
||||
inherits(Spec, Base);
|
||||
70
Client/node_modules/mocha/lib/reporters/tap.js
generated
vendored
Executable file
70
Client/node_modules/mocha/lib/reporters/tap.js
generated
vendored
Executable file
@@ -0,0 +1,70 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var Base = require('./base');
|
||||
|
||||
/**
|
||||
* Expose `TAP`.
|
||||
*/
|
||||
|
||||
exports = module.exports = TAP;
|
||||
|
||||
/**
|
||||
* Initialize a new `TAP` reporter.
|
||||
*
|
||||
* @api public
|
||||
* @param {Runner} runner
|
||||
*/
|
||||
function TAP (runner) {
|
||||
Base.call(this, runner);
|
||||
|
||||
var n = 1;
|
||||
var passes = 0;
|
||||
var 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`
|
||||
*
|
||||
* @api private
|
||||
* @param {Object} test
|
||||
* @return {String}
|
||||
*/
|
||||
function title (test) {
|
||||
return test.fullTitle().replace(/#/g, '');
|
||||
}
|
||||
183
Client/node_modules/mocha/lib/reporters/xunit.js
generated
vendored
Executable file
183
Client/node_modules/mocha/lib/reporters/xunit.js
generated
vendored
Executable file
@@ -0,0 +1,183 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var Base = require('./base');
|
||||
var utils = require('../utils');
|
||||
var inherits = utils.inherits;
|
||||
var fs = require('fs');
|
||||
var escape = utils.escape;
|
||||
var mkdirp = require('mkdirp');
|
||||
var path = require('path');
|
||||
|
||||
/**
|
||||
* Save timer references to avoid Sinon interfering (see GH-237).
|
||||
*/
|
||||
|
||||
/* eslint-disable no-unused-vars, no-native-reassign */
|
||||
var Date = global.Date;
|
||||
var setTimeout = global.setTimeout;
|
||||
var setInterval = global.setInterval;
|
||||
var clearTimeout = global.clearTimeout;
|
||||
var clearInterval = global.clearInterval;
|
||||
/* eslint-enable no-unused-vars, no-native-reassign */
|
||||
|
||||
/**
|
||||
* Expose `XUnit`.
|
||||
*/
|
||||
|
||||
exports = module.exports = XUnit;
|
||||
|
||||
/**
|
||||
* Initialize a new `XUnit` reporter.
|
||||
*
|
||||
* @api public
|
||||
* @param {Runner} runner
|
||||
*/
|
||||
function XUnit (runner, options) {
|
||||
Base.call(this, runner);
|
||||
|
||||
var stats = this.stats;
|
||||
var tests = [];
|
||||
var self = this;
|
||||
|
||||
// the name of the test suite, as it will appear in the resulting XML file
|
||||
var suiteName;
|
||||
|
||||
// the default name of the test suite if none is provided
|
||||
var DEFAULT_SUITE_NAME = 'Mocha Tests';
|
||||
|
||||
if (options && options.reporterOptions) {
|
||||
if (options.reporterOptions.output) {
|
||||
if (!fs.createWriteStream) {
|
||||
throw new Error('file output not supported in browser');
|
||||
}
|
||||
|
||||
mkdirp.sync(path.dirname(options.reporterOptions.output));
|
||||
self.fileStream = fs.createWriteStream(options.reporterOptions.output);
|
||||
}
|
||||
|
||||
// get the suite name from the reporter options (if provided)
|
||||
suiteName = options.reporterOptions.suiteName;
|
||||
}
|
||||
|
||||
// fall back to the default suite name
|
||||
suiteName = suiteName || DEFAULT_SUITE_NAME;
|
||||
|
||||
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: suiteName,
|
||||
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>');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Inherit from `Base.prototype`.
|
||||
*/
|
||||
inherits(XUnit, Base);
|
||||
|
||||
/**
|
||||
* Override done to close the stream (if it's a file).
|
||||
*
|
||||
* @param failures
|
||||
* @param {Function} fn
|
||||
*/
|
||||
XUnit.prototype.done = function (failures, fn) {
|
||||
if (this.fileStream) {
|
||||
this.fileStream.end(function () {
|
||||
fn(failures);
|
||||
});
|
||||
} else {
|
||||
fn(failures);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Write out the given line.
|
||||
*
|
||||
* @param {string} line
|
||||
*/
|
||||
XUnit.prototype.write = function (line) {
|
||||
if (this.fileStream) {
|
||||
this.fileStream.write(line + '\n');
|
||||
} else if (typeof process === 'object' && process.stdout) {
|
||||
process.stdout.write(line + '\n');
|
||||
} else {
|
||||
console.log(line);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Output tag for the given `test.`
|
||||
*
|
||||
* @param {Test} test
|
||||
*/
|
||||
XUnit.prototype.test = function (test) {
|
||||
var attrs = {
|
||||
classname: test.parent.fullTitle(),
|
||||
name: test.title,
|
||||
time: (test.duration / 1000) || 0
|
||||
};
|
||||
|
||||
if (test.state === 'failed') {
|
||||
var err = test.err;
|
||||
this.write(tag('testcase', attrs, false, tag('failure', {}, false, escape(err.message) + '\n' + escape(err.stack))));
|
||||
} else if (test.isPending()) {
|
||||
this.write(tag('testcase', attrs, false, tag('skipped', {}, true)));
|
||||
} else {
|
||||
this.write(tag('testcase', attrs, true));
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* HTML tag helper.
|
||||
*
|
||||
* @param name
|
||||
* @param attrs
|
||||
* @param close
|
||||
* @param content
|
||||
* @return {string}
|
||||
*/
|
||||
function tag (name, attrs, close, content) {
|
||||
var end = close ? '/>' : '>';
|
||||
var pairs = [];
|
||||
var tag;
|
||||
|
||||
for (var key in attrs) {
|
||||
if (Object.prototype.hasOwnProperty.call(attrs, key)) {
|
||||
pairs.push(key + '="' + escape(attrs[key]) + '"');
|
||||
}
|
||||
}
|
||||
|
||||
tag = '<' + name + (pairs.length ? ' ' + pairs.join(' ') : '') + end;
|
||||
if (content) {
|
||||
tag += content + '</' + name + end;
|
||||
}
|
||||
return tag;
|
||||
}
|
||||
395
Client/node_modules/mocha/lib/runnable.js
generated
vendored
Executable file
395
Client/node_modules/mocha/lib/runnable.js
generated
vendored
Executable file
@@ -0,0 +1,395 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var EventEmitter = require('events').EventEmitter;
|
||||
var Pending = require('./pending');
|
||||
var debug = require('debug')('mocha:runnable');
|
||||
var milliseconds = require('./ms');
|
||||
var utils = require('./utils');
|
||||
|
||||
/**
|
||||
* Save timer references to avoid Sinon interfering (see GH-237).
|
||||
*/
|
||||
|
||||
/* eslint-disable no-unused-vars, no-native-reassign */
|
||||
var Date = global.Date;
|
||||
var setTimeout = global.setTimeout;
|
||||
var setInterval = global.setInterval;
|
||||
var clearTimeout = global.clearTimeout;
|
||||
var clearInterval = global.clearInterval;
|
||||
/* eslint-enable no-unused-vars, no-native-reassign */
|
||||
|
||||
/**
|
||||
* 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
|
||||
* @param {string} title
|
||||
* @param {Function} fn
|
||||
*/
|
||||
function Runnable (title, fn) {
|
||||
this.title = title;
|
||||
this.fn = fn;
|
||||
this.body = (fn || '').toString();
|
||||
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');
|
||||
this._retries = -1;
|
||||
this._currentRetry = 0;
|
||||
this.pending = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Inherit from `EventEmitter.prototype`.
|
||||
*/
|
||||
utils.inherits(Runnable, EventEmitter);
|
||||
|
||||
/**
|
||||
* Set & get timeout `ms`.
|
||||
*
|
||||
* @api private
|
||||
* @param {number|string} ms
|
||||
* @return {Runnable|number} ms or Runnable instance.
|
||||
*/
|
||||
Runnable.prototype.timeout = function (ms) {
|
||||
if (!arguments.length) {
|
||||
return this._timeout;
|
||||
}
|
||||
// see #1652 for reasoning
|
||||
if (ms === 0 || ms > Math.pow(2, 31)) {
|
||||
this._enableTimeouts = false;
|
||||
}
|
||||
if (typeof ms === 'string') {
|
||||
ms = milliseconds(ms);
|
||||
}
|
||||
debug('timeout %d', ms);
|
||||
this._timeout = ms;
|
||||
if (this.timer) {
|
||||
this.resetTimeout();
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Set or get slow `ms`.
|
||||
*
|
||||
* @api private
|
||||
* @param {number|string} ms
|
||||
* @return {Runnable|number} ms or Runnable instance.
|
||||
*/
|
||||
Runnable.prototype.slow = function (ms) {
|
||||
if (!arguments.length || typeof ms === 'undefined') {
|
||||
return this._slow;
|
||||
}
|
||||
if (typeof ms === 'string') {
|
||||
ms = milliseconds(ms);
|
||||
}
|
||||
debug('timeout %d', ms);
|
||||
this._slow = ms;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Set and get whether timeout is `enabled`.
|
||||
*
|
||||
* @api private
|
||||
* @param {boolean} enabled
|
||||
* @return {Runnable|boolean} enabled or Runnable instance.
|
||||
*/
|
||||
Runnable.prototype.enableTimeouts = function (enabled) {
|
||||
if (!arguments.length) {
|
||||
return this._enableTimeouts;
|
||||
}
|
||||
debug('enableTimeouts %s', enabled);
|
||||
this._enableTimeouts = enabled;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Halt and mark as pending.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
Runnable.prototype.skip = function () {
|
||||
throw new Pending('sync skip');
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if this runnable or its parent suite is marked as pending.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
Runnable.prototype.isPending = function () {
|
||||
return this.pending || (this.parent && this.parent.isPending());
|
||||
};
|
||||
|
||||
/**
|
||||
* Set or get number of retries.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
Runnable.prototype.retries = function (n) {
|
||||
if (!arguments.length) {
|
||||
return this._retries;
|
||||
}
|
||||
this._retries = n;
|
||||
};
|
||||
|
||||
/**
|
||||
* Set or get current retry
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
Runnable.prototype.currentRetry = function (n) {
|
||||
if (!arguments.length) {
|
||||
return this._currentRetry;
|
||||
}
|
||||
this._currentRetry = n;
|
||||
};
|
||||
|
||||
/**
|
||||
* Return the full title generated by recursively concatenating the parent's
|
||||
* full title.
|
||||
*
|
||||
* @api public
|
||||
* @return {string}
|
||||
*/
|
||||
Runnable.prototype.fullTitle = function () {
|
||||
return this.titlePath().join(' ');
|
||||
};
|
||||
|
||||
/**
|
||||
* Return the title path generated by concatenating the parent's title path with the title.
|
||||
*
|
||||
* @api public
|
||||
* @return {string}
|
||||
*/
|
||||
Runnable.prototype.titlePath = function () {
|
||||
return this.parent.titlePath().concat([this.title]);
|
||||
};
|
||||
|
||||
/**
|
||||
* Clear the timeout.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
Runnable.prototype.clearTimeout = function () {
|
||||
clearTimeout(this.timer);
|
||||
};
|
||||
|
||||
/**
|
||||
* Inspect the runnable void of private properties.
|
||||
*
|
||||
* @api private
|
||||
* @return {string}
|
||||
*/
|
||||
Runnable.prototype.inspect = function () {
|
||||
return JSON.stringify(this, function (key, val) {
|
||||
if (key[0] === '_') {
|
||||
return;
|
||||
}
|
||||
if (key === 'parent') {
|
||||
return '#<Suite>';
|
||||
}
|
||||
if (key === 'ctx') {
|
||||
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. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.'));
|
||||
self.timedOut = true;
|
||||
}, ms);
|
||||
};
|
||||
|
||||
/**
|
||||
* Set or get a list of whitelisted globals for this test run.
|
||||
*
|
||||
* @api private
|
||||
* @param {string[]} globals
|
||||
*/
|
||||
Runnable.prototype.globals = function (globals) {
|
||||
if (!arguments.length) {
|
||||
return this._allowedGlobals;
|
||||
}
|
||||
this._allowedGlobals = globals;
|
||||
};
|
||||
|
||||
/**
|
||||
* Run the test and invoke `fn(err)`.
|
||||
*
|
||||
* @param {Function} fn
|
||||
* @api private
|
||||
*/
|
||||
Runnable.prototype.run = function (fn) {
|
||||
var self = this;
|
||||
var start = new Date();
|
||||
var ctx = this.ctx;
|
||||
var finished;
|
||||
var emitted;
|
||||
|
||||
// Sometimes 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);
|
||||
}
|
||||
|
||||
self.clearTimeout();
|
||||
self.duration = new Date() - start;
|
||||
finished = true;
|
||||
if (!err && self.duration > ms && self._enableTimeouts) {
|
||||
err = new Error('Timeout of ' + ms +
|
||||
'ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.');
|
||||
}
|
||||
fn(err);
|
||||
}
|
||||
|
||||
// for .resetTimeout()
|
||||
this.callback = done;
|
||||
|
||||
// explicit async with `done` argument
|
||||
if (this.async) {
|
||||
this.resetTimeout();
|
||||
|
||||
// allows skip() to be used in an explicit async context
|
||||
this.skip = function asyncSkip () {
|
||||
done(new Pending('async skip call'));
|
||||
// halt execution. the Runnable will be marked pending
|
||||
// by the previous call, and the uncaught handler will ignore
|
||||
// the failure.
|
||||
throw new Pending('async skip; aborting execution');
|
||||
};
|
||||
|
||||
if (this.allowUncaught) {
|
||||
return callFnAsync(this.fn);
|
||||
}
|
||||
try {
|
||||
callFnAsync(this.fn);
|
||||
} catch (err) {
|
||||
emitted = true;
|
||||
done(utils.getError(err));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.allowUncaught) {
|
||||
if (this.isPending()) {
|
||||
done();
|
||||
} else {
|
||||
callFn(this.fn);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// sync or promise-returning
|
||||
try {
|
||||
if (this.isPending()) {
|
||||
done();
|
||||
} else {
|
||||
callFn(this.fn);
|
||||
}
|
||||
} catch (err) {
|
||||
emitted = true;
|
||||
done(utils.getError(err));
|
||||
}
|
||||
|
||||
function callFn (fn) {
|
||||
var result = fn.call(ctx);
|
||||
if (result && typeof result.then === 'function') {
|
||||
self.resetTimeout();
|
||||
result
|
||||
.then(function () {
|
||||
done();
|
||||
// Return null so libraries like bluebird do not warn about
|
||||
// subsequently constructed Promises.
|
||||
return null;
|
||||
},
|
||||
function (reason) {
|
||||
done(reason || new Error('Promise rejected with no or falsy reason'));
|
||||
});
|
||||
} else {
|
||||
if (self.asyncOnly) {
|
||||
return done(new Error('--async-only option in use without declaring `done()` or returning a promise'));
|
||||
}
|
||||
|
||||
done();
|
||||
}
|
||||
}
|
||||
|
||||
function callFnAsync (fn) {
|
||||
var result = fn.call(ctx, function (err) {
|
||||
if (err instanceof Error || toString.call(err) === '[object Error]') {
|
||||
return done(err);
|
||||
}
|
||||
if (err) {
|
||||
if (Object.prototype.toString.call(err) === '[object Object]') {
|
||||
return done(new Error('done() invoked with non-Error: ' +
|
||||
JSON.stringify(err)));
|
||||
}
|
||||
return done(new Error('done() invoked with non-Error: ' + err));
|
||||
}
|
||||
if (result && utils.isPromise(result)) {
|
||||
return done(new Error('Resolution method is overspecified. Specify a callback *or* return a Promise; not both.'));
|
||||
}
|
||||
|
||||
done();
|
||||
});
|
||||
}
|
||||
};
|
||||
979
Client/node_modules/mocha/lib/runner.js
generated
vendored
Executable file
979
Client/node_modules/mocha/lib/runner.js
generated
vendored
Executable file
@@ -0,0 +1,979 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var EventEmitter = require('events').EventEmitter;
|
||||
var Pending = require('./pending');
|
||||
var utils = require('./utils');
|
||||
var inherits = utils.inherits;
|
||||
var debug = require('debug')('mocha:runner');
|
||||
var Runnable = require('./runnable');
|
||||
var stackFilter = utils.stackTraceFilter();
|
||||
var stringify = utils.stringify;
|
||||
var type = utils.type;
|
||||
var undefinedError = utils.undefinedError;
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
* @api public
|
||||
* @param {Suite} suite Root suite
|
||||
* @param {boolean} [delay] Whether or not to delay execution of root suite
|
||||
* until ready.
|
||||
*/
|
||||
function Runner (suite, delay) {
|
||||
var self = this;
|
||||
this._globals = [];
|
||||
this._abort = false;
|
||||
this._delay = delay;
|
||||
this.suite = suite;
|
||||
this.started = false;
|
||||
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._defaultGrep = /.*/;
|
||||
this.grep(this._defaultGrep);
|
||||
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`.
|
||||
*/
|
||||
inherits(Runner, EventEmitter);
|
||||
|
||||
/**
|
||||
* 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
|
||||
* @param {RegExp} re
|
||||
* @param {boolean} invert
|
||||
* @return {Runner} Runner instance.
|
||||
*/
|
||||
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
|
||||
* @param {Suite} suite
|
||||
* @return {number}
|
||||
*/
|
||||
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 = Object.keys(global);
|
||||
|
||||
// non-enumerables
|
||||
for (var i = 0; i < globals.length; ++i) {
|
||||
if (~props.indexOf(globals[i])) {
|
||||
continue;
|
||||
}
|
||||
props.push(globals[i]);
|
||||
}
|
||||
|
||||
return props;
|
||||
};
|
||||
|
||||
/**
|
||||
* Allow the given `arr` of globals.
|
||||
*
|
||||
* @param {Array} arr
|
||||
* @return {Runner} for chaining
|
||||
* @api public
|
||||
* @param {Array} arr
|
||||
* @return {Runner} Runner instance.
|
||||
*/
|
||||
Runner.prototype.globals = function (arr) {
|
||||
if (!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`.
|
||||
*
|
||||
* @api private
|
||||
* @param {Test} test
|
||||
* @param {Error} err
|
||||
*/
|
||||
Runner.prototype.fail = function (test, err) {
|
||||
if (test.isPending()) {
|
||||
return;
|
||||
}
|
||||
|
||||
++this.failures;
|
||||
test.state = 'failed';
|
||||
|
||||
if (!(err instanceof Error || (err && typeof err.message === 'string'))) {
|
||||
err = new Error('the ' + type(err) + ' ' + stringify(err) + ' was thrown, throw an Error :)');
|
||||
}
|
||||
|
||||
try {
|
||||
err.stack = (this.fullStackTrace || !err.stack)
|
||||
? err.stack
|
||||
: stackFilter(err.stack);
|
||||
} catch (ignored) {
|
||||
// some environments do not take kindly to monkeying with the 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
|
||||
*
|
||||
* @api private
|
||||
* @param {Hook} hook
|
||||
* @param {Error} err
|
||||
*/
|
||||
Runner.prototype.failHook = function (hook, err) {
|
||||
if (hook.ctx && hook.ctx.currentTest) {
|
||||
hook.originalTitle = hook.originalTitle || hook.title;
|
||||
hook.title = hook.originalTitle + ' for "' + hook.ctx.currentTest.title + '"';
|
||||
}
|
||||
|
||||
this.fail(hook, err);
|
||||
if (this.suite.bail()) {
|
||||
this.emit('end');
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Run hook `name` callbacks and then invoke `fn()`.
|
||||
*
|
||||
* @api private
|
||||
* @param {string} name
|
||||
* @param {Function} fn
|
||||
*/
|
||||
|
||||
Runner.prototype.hook = function (name, fn) {
|
||||
var suite = this.suite;
|
||||
var hooks = suite['_' + name];
|
||||
var self = this;
|
||||
|
||||
function next (i) {
|
||||
var hook = hooks[i];
|
||||
if (!hook) {
|
||||
return fn();
|
||||
}
|
||||
self.currentRunnable = hook;
|
||||
|
||||
hook.ctx.currentTest = self.test;
|
||||
|
||||
self.emit('hook', hook);
|
||||
|
||||
if (!hook.listeners('error').length) {
|
||||
hook.on('error', function (err) {
|
||||
self.failHook(hook, err);
|
||||
});
|
||||
}
|
||||
|
||||
hook.run(function (err) {
|
||||
var testError = hook.error();
|
||||
if (testError) {
|
||||
self.fail(self.test, testError);
|
||||
}
|
||||
if (err) {
|
||||
if (err instanceof Pending) {
|
||||
if (name === 'beforeEach' || name === 'afterEach') {
|
||||
self.test.pending = true;
|
||||
} else {
|
||||
suite.tests.forEach(function (test) {
|
||||
test.pending = true;
|
||||
});
|
||||
// a pending hook won't be executed twice.
|
||||
hook.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)`.
|
||||
*
|
||||
* @api private
|
||||
* @param {string} name
|
||||
* @param {Array} suites
|
||||
* @param {Function} fn
|
||||
*/
|
||||
Runner.prototype.hooks = function (name, suites, fn) {
|
||||
var self = this;
|
||||
var 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;
|
||||
var suites = [];
|
||||
while (suite.parent) {
|
||||
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 self = this;
|
||||
var test = this.test;
|
||||
|
||||
if (!test) {
|
||||
return;
|
||||
}
|
||||
if (this.forbidOnly && hasOnly(this.parents().reverse()[0] || this.suite)) {
|
||||
fn(new Error('`.only` forbidden'));
|
||||
return;
|
||||
}
|
||||
if (this.asyncOnly) {
|
||||
test.asyncOnly = true;
|
||||
}
|
||||
test.on('error', function (err) {
|
||||
self.fail(test, err);
|
||||
});
|
||||
if (this.allowUncaught) {
|
||||
test.allowUncaught = true;
|
||||
return test.run(fn);
|
||||
}
|
||||
try {
|
||||
test.run(fn);
|
||||
} catch (err) {
|
||||
fn(err);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Run tests in the given `suite` and invoke the callback `fn()` when complete.
|
||||
*
|
||||
* @api private
|
||||
* @param {Suite} suite
|
||||
* @param {Function} fn
|
||||
*/
|
||||
Runner.prototype.runTests = function (suite, fn) {
|
||||
var self = this;
|
||||
var tests = suite.tests.slice();
|
||||
var test;
|
||||
|
||||
function hookErr (_, 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) {
|
||||
// Run immediately only if we have defined a grep. When we
|
||||
// define a grep — It can cause maximum callstack error if
|
||||
// the grep is doing a large recursive loop by neglecting
|
||||
// all tests. The run immediately function also comes with
|
||||
// a performance cost. So we don't want to run immediately
|
||||
// if we run the whole test suite, because running the whole
|
||||
// test suite don't do any immediate recursive loops. Thus,
|
||||
// allowing a JS runtime to breathe.
|
||||
if (self._grep !== self._defaultGrep) {
|
||||
Runner.immediately(next);
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (test.isPending()) {
|
||||
if (self.forbidPending) {
|
||||
test.isPending = alwaysFalse;
|
||||
self.fail(test, new Error('Pending test forbidden'));
|
||||
delete test.isPending;
|
||||
} else {
|
||||
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 (test.isPending()) {
|
||||
if (self.forbidPending) {
|
||||
test.isPending = alwaysFalse;
|
||||
self.fail(test, new Error('Pending test forbidden'));
|
||||
delete test.isPending;
|
||||
} else {
|
||||
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) {
|
||||
var retry = test.currentRetry();
|
||||
if (err instanceof Pending && self.forbidPending) {
|
||||
self.fail(test, new Error('Pending test forbidden'));
|
||||
} else if (err instanceof Pending) {
|
||||
test.pending = true;
|
||||
self.emit('pending', test);
|
||||
} else if (retry < test.retries()) {
|
||||
var clonedTest = test.clone();
|
||||
clonedTest.currentRetry(retry + 1);
|
||||
tests.unshift(clonedTest);
|
||||
|
||||
// Early return + hook trigger so that it doesn't
|
||||
// increment the count wrong
|
||||
return self.hookUp('afterEach', next);
|
||||
} 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;
|
||||
this.hookErr = hookErr;
|
||||
next();
|
||||
};
|
||||
|
||||
function alwaysFalse () {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the given `suite` and invoke the callback `fn()` when complete.
|
||||
*
|
||||
* @api private
|
||||
* @param {Suite} suite
|
||||
* @param {Function} fn
|
||||
*/
|
||||
Runner.prototype.runSuite = function (suite, fn) {
|
||||
var i = 0;
|
||||
var self = this;
|
||||
var total = this.grepTotal(suite);
|
||||
var afterAllHookCalled = false;
|
||||
|
||||
debug('run suite %s', suite.fullTitle());
|
||||
|
||||
if (!total || (self.failures && suite._bail)) {
|
||||
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();
|
||||
}
|
||||
// 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();
|
||||
}
|
||||
|
||||
// Avoid grep neglecting large number of tests causing a
|
||||
// huge recursive loop and thus a maximum call stack error.
|
||||
// See comment in `this.runTests()` for more information.
|
||||
if (self._grep !== self._defaultGrep) {
|
||||
Runner.immediately(function () {
|
||||
self.runSuite(curr, next);
|
||||
});
|
||||
} else {
|
||||
self.runSuite(curr, next);
|
||||
}
|
||||
}
|
||||
|
||||
function done (errSuite) {
|
||||
self.suite = suite;
|
||||
self.nextSuite = next;
|
||||
|
||||
if (afterAllHookCalled) {
|
||||
fn(errSuite);
|
||||
} else {
|
||||
// mark that the afterAll block has been called once
|
||||
// and so can be skipped if there is an error in it.
|
||||
afterAllHookCalled = true;
|
||||
|
||||
// remove reference to test
|
||||
delete self.test;
|
||||
|
||||
self.hook('afterAll', function () {
|
||||
self.emit('suite end', suite);
|
||||
fn(errSuite);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
this.nextSuite = next;
|
||||
|
||||
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.message || err) : err);
|
||||
} else {
|
||||
debug('uncaught undefined exception');
|
||||
err = undefinedError();
|
||||
}
|
||||
err.uncaught = true;
|
||||
|
||||
var runnable = this.currentRunnable;
|
||||
|
||||
if (!runnable) {
|
||||
runnable = new Runnable('Uncaught error outside test suite');
|
||||
runnable.parent = this.suite;
|
||||
|
||||
if (this.started) {
|
||||
this.fail(runnable, err);
|
||||
} else {
|
||||
// Can't recover from this failure
|
||||
this.emit('start');
|
||||
this.fail(runnable, err);
|
||||
this.emit('end');
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
runnable.clearTimeout();
|
||||
|
||||
// Ignore errors if complete or pending
|
||||
if (runnable.state || runnable.isPending()) {
|
||||
return;
|
||||
}
|
||||
this.fail(runnable, err);
|
||||
|
||||
// recover from test
|
||||
if (runnable.type === 'test') {
|
||||
this.emit('test end', runnable);
|
||||
this.hookUp('afterEach', this.next);
|
||||
return;
|
||||
}
|
||||
|
||||
// recover from hooks
|
||||
if (runnable.type === 'hook') {
|
||||
var errSuite = this.suite;
|
||||
// if hook failure is in afterEach block
|
||||
if (runnable.fullTitle().indexOf('after each') > -1) {
|
||||
return this.hookErr(err, errSuite, true);
|
||||
}
|
||||
// if hook failure is in beforeEach block
|
||||
if (runnable.fullTitle().indexOf('before each') > -1) {
|
||||
return this.hookErr(err, errSuite, false);
|
||||
}
|
||||
// if hook failure is in after or before blocks
|
||||
return this.nextSuite(errSuite);
|
||||
}
|
||||
|
||||
// bail
|
||||
this.emit('end');
|
||||
};
|
||||
|
||||
/**
|
||||
* Cleans up the references to all the deferred functions
|
||||
* (before/after/beforeEach/afterEach) and tests of a Suite.
|
||||
* These must be deleted otherwise a memory leak can happen,
|
||||
* as those functions may reference variables from closures,
|
||||
* thus those variables can never be garbage collected as long
|
||||
* as the deferred functions exist.
|
||||
*
|
||||
* @param {Suite} suite
|
||||
*/
|
||||
function cleanSuiteReferences (suite) {
|
||||
function cleanArrReferences (arr) {
|
||||
for (var i = 0; i < arr.length; i++) {
|
||||
delete arr[i].fn;
|
||||
}
|
||||
}
|
||||
|
||||
if (Array.isArray(suite._beforeAll)) {
|
||||
cleanArrReferences(suite._beforeAll);
|
||||
}
|
||||
|
||||
if (Array.isArray(suite._beforeEach)) {
|
||||
cleanArrReferences(suite._beforeEach);
|
||||
}
|
||||
|
||||
if (Array.isArray(suite._afterAll)) {
|
||||
cleanArrReferences(suite._afterAll);
|
||||
}
|
||||
|
||||
if (Array.isArray(suite._afterEach)) {
|
||||
cleanArrReferences(suite._afterEach);
|
||||
}
|
||||
|
||||
for (var i = 0; i < suite.tests.length; i++) {
|
||||
delete suite.tests[i].fn;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the root suite and invoke `fn(failures)`
|
||||
* on completion.
|
||||
*
|
||||
* @param {Function} fn
|
||||
* @return {Runner} for chaining
|
||||
* @api public
|
||||
* @param {Function} fn
|
||||
* @return {Runner} Runner instance.
|
||||
*/
|
||||
Runner.prototype.run = function (fn) {
|
||||
var self = this;
|
||||
var rootSuite = this.suite;
|
||||
|
||||
// If there is an `only` filter
|
||||
if (hasOnly(rootSuite)) {
|
||||
filterOnly(rootSuite);
|
||||
}
|
||||
|
||||
fn = fn || function () {};
|
||||
|
||||
function uncaught (err) {
|
||||
self.uncaught(err);
|
||||
}
|
||||
|
||||
function start () {
|
||||
self.started = true;
|
||||
self.emit('start');
|
||||
self.runSuite(rootSuite, function () {
|
||||
debug('finished running');
|
||||
self.emit('end');
|
||||
});
|
||||
}
|
||||
|
||||
debug('start');
|
||||
|
||||
// references cleanup to avoid memory leaks
|
||||
this.on('suite end', cleanSuiteReferences);
|
||||
|
||||
// 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.
|
||||
*
|
||||
* @api public
|
||||
* @return {Runner} Runner instance.
|
||||
*/
|
||||
Runner.prototype.abort = function () {
|
||||
debug('aborting');
|
||||
this._abort = true;
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Filter suites based on `isOnly` logic.
|
||||
*
|
||||
* @param {Array} suite
|
||||
* @returns {Boolean}
|
||||
* @api private
|
||||
*/
|
||||
function filterOnly (suite) {
|
||||
if (suite._onlyTests.length) {
|
||||
// If the suite contains `only` tests, run those and ignore any nested suites.
|
||||
suite.tests = suite._onlyTests;
|
||||
suite.suites = [];
|
||||
} else {
|
||||
// Otherwise, do not run any of the tests in this suite.
|
||||
suite.tests = [];
|
||||
suite._onlySuites.forEach(function (onlySuite) {
|
||||
// If there are other `only` tests/suites nested in the current `only` suite, then filter that `only` suite.
|
||||
// Otherwise, all of the tests on this `only` suite should be run, so don't filter it.
|
||||
if (hasOnly(onlySuite)) {
|
||||
filterOnly(onlySuite);
|
||||
}
|
||||
});
|
||||
// Run the `only` suites, as well as any other suites that have `only` tests/suites as descendants.
|
||||
suite.suites = suite.suites.filter(function (childSuite) {
|
||||
return suite._onlySuites.indexOf(childSuite) !== -1 || filterOnly(childSuite);
|
||||
});
|
||||
}
|
||||
// Keep the suite only if there is something to run
|
||||
return suite.tests.length || suite.suites.length;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether a suite has an `only` test or suite as a descendant.
|
||||
*
|
||||
* @param {Array} suite
|
||||
* @returns {Boolean}
|
||||
* @api private
|
||||
*/
|
||||
function hasOnly (suite) {
|
||||
return suite._onlyTests.length || suite._onlySuites.length || suite.suites.some(hasOnly);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter leaks with the given globals flagged as `ok`.
|
||||
*
|
||||
* @api private
|
||||
* @param {Array} ok
|
||||
* @param {Array} globals
|
||||
* @return {Array}
|
||||
*/
|
||||
function filterLeaks (ok, globals) {
|
||||
return globals.filter(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 = ok.filter(function (ok) {
|
||||
if (~ok.indexOf('*')) {
|
||||
return key.indexOf(ok.split('*')[0]) === 0;
|
||||
}
|
||||
return key === ok;
|
||||
});
|
||||
return !matched.length && (!global.navigator || key !== 'onerror');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of globals dependent on the environment.
|
||||
*
|
||||
* @return {Array}
|
||||
* @api private
|
||||
*/
|
||||
function extraGlobals () {
|
||||
if (typeof process === 'object' && typeof process.version === 'string') {
|
||||
var parts = process.version.split('.');
|
||||
var nodeVersion = parts.reduce(function (a, v) {
|
||||
return a << 8 | v;
|
||||
});
|
||||
|
||||
// 'errno' was renamed to process._errno in v0.9.11.
|
||||
|
||||
if (nodeVersion < 0x00090B) {
|
||||
return ['errno'];
|
||||
}
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
414
Client/node_modules/mocha/lib/suite.js
generated
vendored
Executable file
414
Client/node_modules/mocha/lib/suite.js
generated
vendored
Executable file
@@ -0,0 +1,414 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var EventEmitter = require('events').EventEmitter;
|
||||
var Hook = require('./hook');
|
||||
var utils = require('./utils');
|
||||
var inherits = utils.inherits;
|
||||
var debug = require('debug')('mocha:suite');
|
||||
var milliseconds = require('./ms');
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @api public
|
||||
* @param {Suite} parent
|
||||
* @param {string} title
|
||||
* @return {Suite}
|
||||
*/
|
||||
exports.create = function (parent, title) {
|
||||
var suite = new Suite(title, parent.ctx);
|
||||
suite.parent = parent;
|
||||
title = suite.fullTitle();
|
||||
parent.addSuite(suite);
|
||||
return suite;
|
||||
};
|
||||
|
||||
/**
|
||||
* Initialize a new `Suite` with the given `title` and `ctx`.
|
||||
*
|
||||
* @api private
|
||||
* @param {string} title
|
||||
* @param {Context} parentContext
|
||||
*/
|
||||
function Suite (title, parentContext) {
|
||||
if (!utils.isString(title)) {
|
||||
throw new Error('Suite `title` should be a "string" but "' + typeof title + '" was given instead.');
|
||||
}
|
||||
this.title = title;
|
||||
function Context () {}
|
||||
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._retries = -1;
|
||||
this._onlyTests = [];
|
||||
this._onlySuites = [];
|
||||
this.delayed = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Inherit from `EventEmitter.prototype`.
|
||||
*/
|
||||
inherits(Suite, EventEmitter);
|
||||
|
||||
/**
|
||||
* Return a clone of this `Suite`.
|
||||
*
|
||||
* @api private
|
||||
* @return {Suite}
|
||||
*/
|
||||
Suite.prototype.clone = function () {
|
||||
var suite = new Suite(this.title);
|
||||
debug('clone');
|
||||
suite.ctx = this.ctx;
|
||||
suite.timeout(this.timeout());
|
||||
suite.retries(this.retries());
|
||||
suite.enableTimeouts(this.enableTimeouts());
|
||||
suite.slow(this.slow());
|
||||
suite.bail(this.bail());
|
||||
return suite;
|
||||
};
|
||||
|
||||
/**
|
||||
* Set or get timeout `ms` or short-hand such as "2s".
|
||||
*
|
||||
* @api private
|
||||
* @param {number|string} ms
|
||||
* @return {Suite|number} for chaining
|
||||
*/
|
||||
Suite.prototype.timeout = function (ms) {
|
||||
if (!arguments.length) {
|
||||
return this._timeout;
|
||||
}
|
||||
if (ms.toString() === '0') {
|
||||
this._enableTimeouts = false;
|
||||
}
|
||||
if (typeof ms === 'string') {
|
||||
ms = milliseconds(ms);
|
||||
}
|
||||
debug('timeout %d', ms);
|
||||
this._timeout = parseInt(ms, 10);
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Set or get number of times to retry a failed test.
|
||||
*
|
||||
* @api private
|
||||
* @param {number|string} n
|
||||
* @return {Suite|number} for chaining
|
||||
*/
|
||||
Suite.prototype.retries = function (n) {
|
||||
if (!arguments.length) {
|
||||
return this._retries;
|
||||
}
|
||||
debug('retries %d', n);
|
||||
this._retries = parseInt(n, 10) || 0;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Set or get timeout to `enabled`.
|
||||
*
|
||||
* @api private
|
||||
* @param {boolean} enabled
|
||||
* @return {Suite|boolean} self or enabled
|
||||
*/
|
||||
Suite.prototype.enableTimeouts = function (enabled) {
|
||||
if (!arguments.length) {
|
||||
return this._enableTimeouts;
|
||||
}
|
||||
debug('enableTimeouts %s', enabled);
|
||||
this._enableTimeouts = enabled;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Set or get slow `ms` or short-hand such as "2s".
|
||||
*
|
||||
* @api private
|
||||
* @param {number|string} ms
|
||||
* @return {Suite|number} for chaining
|
||||
*/
|
||||
Suite.prototype.slow = function (ms) {
|
||||
if (!arguments.length) {
|
||||
return this._slow;
|
||||
}
|
||||
if (typeof ms === 'string') {
|
||||
ms = milliseconds(ms);
|
||||
}
|
||||
debug('slow %d', ms);
|
||||
this._slow = ms;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Set or get whether to bail after first error.
|
||||
*
|
||||
* @api private
|
||||
* @param {boolean} bail
|
||||
* @return {Suite|number} for chaining
|
||||
*/
|
||||
Suite.prototype.bail = function (bail) {
|
||||
if (!arguments.length) {
|
||||
return this._bail;
|
||||
}
|
||||
debug('bail %s', bail);
|
||||
this._bail = bail;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if this suite or its parent suite is marked as pending.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
Suite.prototype.isPending = function () {
|
||||
return this.pending || (this.parent && this.parent.isPending());
|
||||
};
|
||||
|
||||
/**
|
||||
* Run `fn(test[, done])` before running tests.
|
||||
*
|
||||
* @api private
|
||||
* @param {string} title
|
||||
* @param {Function} fn
|
||||
* @return {Suite} for chaining
|
||||
*/
|
||||
Suite.prototype.beforeAll = function (title, fn) {
|
||||
if (this.isPending()) {
|
||||
return this;
|
||||
}
|
||||
if (typeof title === 'function') {
|
||||
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.retries(this.retries());
|
||||
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.
|
||||
*
|
||||
* @api private
|
||||
* @param {string} title
|
||||
* @param {Function} fn
|
||||
* @return {Suite} for chaining
|
||||
*/
|
||||
Suite.prototype.afterAll = function (title, fn) {
|
||||
if (this.isPending()) {
|
||||
return this;
|
||||
}
|
||||
if (typeof title === 'function') {
|
||||
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.retries(this.retries());
|
||||
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.
|
||||
*
|
||||
* @api private
|
||||
* @param {string} title
|
||||
* @param {Function} fn
|
||||
* @return {Suite} for chaining
|
||||
*/
|
||||
Suite.prototype.beforeEach = function (title, fn) {
|
||||
if (this.isPending()) {
|
||||
return this;
|
||||
}
|
||||
if (typeof title === 'function') {
|
||||
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.retries(this.retries());
|
||||
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.
|
||||
*
|
||||
* @api private
|
||||
* @param {string} title
|
||||
* @param {Function} fn
|
||||
* @return {Suite} for chaining
|
||||
*/
|
||||
Suite.prototype.afterEach = function (title, fn) {
|
||||
if (this.isPending()) {
|
||||
return this;
|
||||
}
|
||||
if (typeof title === 'function') {
|
||||
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.retries(this.retries());
|
||||
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`.
|
||||
*
|
||||
* @api private
|
||||
* @param {Suite} suite
|
||||
* @return {Suite} for chaining
|
||||
*/
|
||||
Suite.prototype.addSuite = function (suite) {
|
||||
suite.parent = this;
|
||||
suite.timeout(this.timeout());
|
||||
suite.retries(this.retries());
|
||||
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.
|
||||
*
|
||||
* @api private
|
||||
* @param {Test} test
|
||||
* @return {Suite} for chaining
|
||||
*/
|
||||
Suite.prototype.addTest = function (test) {
|
||||
test.parent = this;
|
||||
test.timeout(this.timeout());
|
||||
test.retries(this.retries());
|
||||
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.
|
||||
*
|
||||
* @api public
|
||||
* @return {string}
|
||||
*/
|
||||
Suite.prototype.fullTitle = function () {
|
||||
return this.titlePath().join(' ');
|
||||
};
|
||||
|
||||
/**
|
||||
* Return the title path generated by recursively concatenating the parent's
|
||||
* title path.
|
||||
*
|
||||
* @api public
|
||||
* @return {string}
|
||||
*/
|
||||
Suite.prototype.titlePath = function () {
|
||||
var result = [];
|
||||
if (this.parent) {
|
||||
result = result.concat(this.parent.titlePath());
|
||||
}
|
||||
if (!this.root) {
|
||||
result.push(this.title);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
/**
|
||||
* Return the total number of tests.
|
||||
*
|
||||
* @api public
|
||||
* @return {number}
|
||||
*/
|
||||
Suite.prototype.total = function () {
|
||||
return this.suites.reduce(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)`.
|
||||
*
|
||||
* @api private
|
||||
* @param {Function} fn
|
||||
* @return {Suite}
|
||||
*/
|
||||
Suite.prototype.eachTest = function (fn) {
|
||||
this.tests.forEach(fn);
|
||||
this.suites.forEach(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
Client/node_modules/mocha/lib/template.html
generated
vendored
Executable file
18
Client/node_modules/mocha/lib/template.html
generated
vendored
Executable 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>
|
||||
50
Client/node_modules/mocha/lib/test.js
generated
vendored
Executable file
50
Client/node_modules/mocha/lib/test.js
generated
vendored
Executable file
@@ -0,0 +1,50 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var Runnable = require('./runnable');
|
||||
var utils = require('./utils');
|
||||
var isString = utils.isString;
|
||||
|
||||
/**
|
||||
* Expose `Test`.
|
||||
*/
|
||||
|
||||
module.exports = Test;
|
||||
|
||||
/**
|
||||
* Initialize a new `Test` with the given `title` and callback `fn`.
|
||||
*
|
||||
* @api private
|
||||
* @param {String} title
|
||||
* @param {Function} fn
|
||||
*/
|
||||
function Test (title, fn) {
|
||||
if (!isString(title)) {
|
||||
throw new Error('Test `title` should be a "string" but "' + typeof title + '" was given instead.');
|
||||
}
|
||||
Runnable.call(this, title, fn);
|
||||
this.pending = !fn;
|
||||
this.type = 'test';
|
||||
}
|
||||
|
||||
/**
|
||||
* Inherit from `Runnable.prototype`.
|
||||
*/
|
||||
utils.inherits(Test, Runnable);
|
||||
|
||||
Test.prototype.clone = function () {
|
||||
var test = new Test(this.title, this.fn);
|
||||
test.timeout(this.timeout());
|
||||
test.slow(this.slow());
|
||||
test.enableTimeouts(this.enableTimeouts());
|
||||
test.retries(this.retries());
|
||||
test.currentRetry(this.currentRetry());
|
||||
test.globals(this.globals());
|
||||
test.parent = this.parent;
|
||||
test.file = this.file;
|
||||
test.ctx = this.ctx;
|
||||
return test;
|
||||
};
|
||||
625
Client/node_modules/mocha/lib/utils.js
generated
vendored
Executable file
625
Client/node_modules/mocha/lib/utils.js
generated
vendored
Executable file
@@ -0,0 +1,625 @@
|
||||
'use strict';
|
||||
|
||||
/* eslint-env browser */
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var basename = require('path').basename;
|
||||
var debug = require('debug')('mocha:watch');
|
||||
var exists = require('fs').existsSync;
|
||||
var glob = require('glob');
|
||||
var path = require('path');
|
||||
var join = path.join;
|
||||
var readdirSync = require('fs').readdirSync;
|
||||
var statSync = require('fs').statSync;
|
||||
var watchFile = require('fs').watchFile;
|
||||
var lstatSync = require('fs').lstatSync;
|
||||
var he = require('he');
|
||||
|
||||
/**
|
||||
* Ignored directories.
|
||||
*/
|
||||
|
||||
var ignore = ['node_modules', '.git'];
|
||||
|
||||
exports.inherits = require('util').inherits;
|
||||
|
||||
/**
|
||||
* Escape special characters in the given string of html.
|
||||
*
|
||||
* @api private
|
||||
* @param {string} html
|
||||
* @return {string}
|
||||
*/
|
||||
exports.escape = function (html) {
|
||||
return he.encode(String(html), { useNamedReferences: false });
|
||||
};
|
||||
|
||||
/**
|
||||
* Test if the given obj is type of string.
|
||||
*
|
||||
* @api private
|
||||
* @param {Object} obj
|
||||
* @return {boolean}
|
||||
*/
|
||||
exports.isString = function (obj) {
|
||||
return typeof obj === 'string';
|
||||
};
|
||||
|
||||
/**
|
||||
* Watch the given `files` for changes
|
||||
* and invoke `fn(file)` on modification.
|
||||
*
|
||||
* @api private
|
||||
* @param {Array} files
|
||||
* @param {Function} fn
|
||||
*/
|
||||
exports.watch = function (files, fn) {
|
||||
var options = { interval: 100 };
|
||||
files.forEach(function (file) {
|
||||
debug('file %s', file);
|
||||
watchFile(file, options, function (curr, prev) {
|
||||
if (prev.mtime < curr.mtime) {
|
||||
fn(file);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Ignored files.
|
||||
*
|
||||
* @api private
|
||||
* @param {string} path
|
||||
* @return {boolean}
|
||||
*/
|
||||
function ignored (path) {
|
||||
return !~ignore.indexOf(path);
|
||||
}
|
||||
|
||||
/**
|
||||
* Lookup files in the given `dir`.
|
||||
*
|
||||
* @api private
|
||||
* @param {string} dir
|
||||
* @param {string[]} [ext=['.js']]
|
||||
* @param {Array} [ret=[]]
|
||||
* @return {Array}
|
||||
*/
|
||||
exports.files = function (dir, ext, ret) {
|
||||
ret = ret || [];
|
||||
ext = ext || ['js'];
|
||||
|
||||
var re = new RegExp('\\.(' + ext.join('|') + ')$');
|
||||
|
||||
readdirSync(dir)
|
||||
.filter(ignored)
|
||||
.forEach(function (path) {
|
||||
path = join(dir, path);
|
||||
if (lstatSync(path).isDirectory()) {
|
||||
exports.files(path, ext, ret);
|
||||
} else if (path.match(re)) {
|
||||
ret.push(path);
|
||||
}
|
||||
});
|
||||
|
||||
return ret;
|
||||
};
|
||||
|
||||
/**
|
||||
* Compute a slug from the given `str`.
|
||||
*
|
||||
* @api private
|
||||
* @param {string} str
|
||||
* @return {string}
|
||||
*/
|
||||
exports.slug = function (str) {
|
||||
return str
|
||||
.toLowerCase()
|
||||
.replace(/ +/g, '-')
|
||||
.replace(/[^-\w]/g, '');
|
||||
};
|
||||
|
||||
/**
|
||||
* Strip the function definition from `str`, and re-indent for pre whitespace.
|
||||
*
|
||||
* @param {string} str
|
||||
* @return {string}
|
||||
*/
|
||||
exports.clean = function (str) {
|
||||
str = str
|
||||
.replace(/\r\n?|[\n\u2028\u2029]/g, '\n').replace(/^\uFEFF/, '')
|
||||
// (traditional)-> space/name parameters body (lambda)-> parameters body multi-statement/single keep body content
|
||||
.replace(/^function(?:\s*|\s+[^(]*)\([^)]*\)\s*\{((?:.|\n)*?)\s*\}$|^\([^)]*\)\s*=>\s*(?:\{((?:.|\n)*?)\s*\}|((?:.|\n)*))$/, '$1$2$3');
|
||||
|
||||
var spaces = str.match(/^\n?( *)/)[1].length;
|
||||
var tabs = str.match(/^\n?(\t*)/)[1].length;
|
||||
var re = new RegExp('^\n?' + (tabs ? '\t' : ' ') + '{' + (tabs || spaces) + '}', 'gm');
|
||||
|
||||
str = str.replace(re, '');
|
||||
|
||||
return str.trim();
|
||||
};
|
||||
|
||||
/**
|
||||
* Parse the given `qs`.
|
||||
*
|
||||
* @api private
|
||||
* @param {string} qs
|
||||
* @return {Object}
|
||||
*/
|
||||
exports.parseQuery = function (qs) {
|
||||
return qs.replace('?', '').split('&').reduce(function (obj, pair) {
|
||||
var i = pair.indexOf('=');
|
||||
var key = pair.slice(0, i);
|
||||
var val = pair.slice(++i);
|
||||
|
||||
// Due to how the URLSearchParams API treats spaces
|
||||
obj[key] = decodeURIComponent(val.replace(/\+/g, '%20'));
|
||||
|
||||
return obj;
|
||||
}, {});
|
||||
};
|
||||
|
||||
/**
|
||||
* Highlight the given string of `js`.
|
||||
*
|
||||
* @api private
|
||||
* @param {string} js
|
||||
* @return {string}
|
||||
*/
|
||||
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`.
|
||||
*
|
||||
* @api private
|
||||
* @param {string} name
|
||||
*/
|
||||
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()`
|
||||
*
|
||||
* @api private
|
||||
* @param {*} value The value to inspect.
|
||||
* @param {string} typeHint The type of the value
|
||||
* @returns {string}
|
||||
*/
|
||||
function emptyRepresentation (value, typeHint) {
|
||||
switch (typeHint) {
|
||||
case 'function':
|
||||
return '[Function]';
|
||||
case 'object':
|
||||
return '{}';
|
||||
case 'array':
|
||||
return '[]';
|
||||
default:
|
||||
return value.toString();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Takes some variable and asks `Object.prototype.toString()` what it thinks it
|
||||
* is.
|
||||
*
|
||||
* @api private
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toString
|
||||
* @param {*} value The value to test.
|
||||
* @returns {string} Computed type
|
||||
* @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'
|
||||
* type(new String('foo') // 'object'
|
||||
*/
|
||||
var type = exports.type = function type (value) {
|
||||
if (value === undefined) {
|
||||
return 'undefined';
|
||||
} else if (value === null) {
|
||||
return 'null';
|
||||
} else if (Buffer.isBuffer(value)) {
|
||||
return 'buffer';
|
||||
}
|
||||
return Object.prototype.toString.call(value)
|
||||
.replace(/^\[.+\s(.+?)]$/, '$1')
|
||||
.toLowerCase();
|
||||
};
|
||||
|
||||
/**
|
||||
* Stringify `value`. 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().
|
||||
*
|
||||
* @api private
|
||||
* @see exports.type
|
||||
* @param {*} value
|
||||
* @return {string}
|
||||
*/
|
||||
exports.stringify = function (value) {
|
||||
var typeHint = type(value);
|
||||
|
||||
if (!~['object', 'array', 'function'].indexOf(typeHint)) {
|
||||
if (typeHint === 'buffer') {
|
||||
var json = Buffer.prototype.toJSON.call(value);
|
||||
// Based on the toJSON result
|
||||
return jsonStringify(json.data && json.type ? json.data : json, 2)
|
||||
.replace(/,(\n|$)/g, '$1');
|
||||
}
|
||||
|
||||
// IE7/IE8 has a bizarre String constructor; needs to be coerced
|
||||
// into an array and back to obj.
|
||||
if (typeHint === 'string' && typeof value === 'object') {
|
||||
value = value.split('').reduce(function (acc, char, idx) {
|
||||
acc[idx] = char;
|
||||
return acc;
|
||||
}, {});
|
||||
typeHint = 'object';
|
||||
} else {
|
||||
return jsonStringify(value);
|
||||
}
|
||||
}
|
||||
|
||||
for (var prop in value) {
|
||||
if (Object.prototype.hasOwnProperty.call(value, prop)) {
|
||||
return jsonStringify(exports.canonicalize(value, null, typeHint), 2).replace(/,(\n|$)/g, '$1');
|
||||
}
|
||||
}
|
||||
|
||||
return emptyRepresentation(value, typeHint);
|
||||
};
|
||||
|
||||
/**
|
||||
* like JSON.stringify but more sense.
|
||||
*
|
||||
* @api private
|
||||
* @param {Object} object
|
||||
* @param {number=} spaces
|
||||
* @param {number=} depth
|
||||
* @returns {*}
|
||||
*/
|
||||
function jsonStringify (object, spaces, depth) {
|
||||
if (typeof spaces === 'undefined') {
|
||||
// primitive types
|
||||
return _stringify(object);
|
||||
}
|
||||
|
||||
depth = depth || 1;
|
||||
var space = spaces * depth;
|
||||
var str = Array.isArray(object) ? '[' : '{';
|
||||
var end = Array.isArray(object) ? ']' : '}';
|
||||
var length = typeof object.length === 'number' ? object.length : Object.keys(object).length;
|
||||
// `.repeat()` polyfill
|
||||
function repeat (s, n) {
|
||||
return new Array(n).join(s);
|
||||
}
|
||||
|
||||
function _stringify (val) {
|
||||
switch (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 'symbol':
|
||||
case 'number':
|
||||
val = val === 0 && (1 / val) === -Infinity // `-0`
|
||||
? '-0'
|
||||
: val.toString();
|
||||
break;
|
||||
case 'date':
|
||||
var sDate = isNaN(val.getTime()) ? val.toString() : val.toISOString();
|
||||
val = '[Date: ' + sDate + ']';
|
||||
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.prototype.hasOwnProperty.call(object, i)) {
|
||||
continue; // not my business
|
||||
}
|
||||
--length;
|
||||
str += '\n ' + repeat(' ', space) +
|
||||
(Array.isArray(object) ? '' : '"' + i + '": ') + // key
|
||||
_stringify(object[i]) + // value
|
||||
(length ? ',' : ''); // comma
|
||||
}
|
||||
|
||||
return str +
|
||||
// [], {}
|
||||
(str.length !== 1 ? '\n' + repeat(' ', --space) + end : end);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a new Thing that has the keys in sorted order. Recursive.
|
||||
*
|
||||
* 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()`
|
||||
*
|
||||
* @api private
|
||||
* @see {@link exports.stringify}
|
||||
* @param {*} value Thing to inspect. May or may not have properties.
|
||||
* @param {Array} [stack=[]] Stack of seen values
|
||||
* @param {string} [typeHint] Type hint
|
||||
* @return {(Object|Array|Function|string|undefined)}
|
||||
*/
|
||||
exports.canonicalize = function canonicalize (value, stack, typeHint) {
|
||||
var canonicalizedObj;
|
||||
/* eslint-disable no-unused-vars */
|
||||
var prop;
|
||||
/* eslint-enable no-unused-vars */
|
||||
typeHint = typeHint || type(value);
|
||||
function withStack (value, fn) {
|
||||
stack.push(value);
|
||||
fn();
|
||||
stack.pop();
|
||||
}
|
||||
|
||||
stack = stack || [];
|
||||
|
||||
if (stack.indexOf(value) !== -1) {
|
||||
return '[Circular]';
|
||||
}
|
||||
|
||||
switch (typeHint) {
|
||||
case 'undefined':
|
||||
case 'buffer':
|
||||
case 'null':
|
||||
canonicalizedObj = value;
|
||||
break;
|
||||
case 'array':
|
||||
withStack(value, function () {
|
||||
canonicalizedObj = value.map(function (item) {
|
||||
return exports.canonicalize(item, stack);
|
||||
});
|
||||
});
|
||||
break;
|
||||
case 'function':
|
||||
/* eslint-disable guard-for-in */
|
||||
for (prop in value) {
|
||||
canonicalizedObj = {};
|
||||
break;
|
||||
}
|
||||
/* eslint-enable guard-for-in */
|
||||
if (!canonicalizedObj) {
|
||||
canonicalizedObj = emptyRepresentation(value, typeHint);
|
||||
break;
|
||||
}
|
||||
/* falls through */
|
||||
case 'object':
|
||||
canonicalizedObj = canonicalizedObj || {};
|
||||
withStack(value, function () {
|
||||
Object.keys(value).sort().forEach(function (key) {
|
||||
canonicalizedObj[key] = exports.canonicalize(value[key], stack);
|
||||
});
|
||||
});
|
||||
break;
|
||||
case 'date':
|
||||
case 'number':
|
||||
case 'regexp':
|
||||
case 'boolean':
|
||||
case 'symbol':
|
||||
canonicalizedObj = value;
|
||||
break;
|
||||
default:
|
||||
canonicalizedObj = value + '';
|
||||
}
|
||||
|
||||
return canonicalizedObj;
|
||||
};
|
||||
|
||||
/**
|
||||
* Lookup file names at the given `path`.
|
||||
*
|
||||
* @api public
|
||||
* @param {string} path Base path to start searching from.
|
||||
* @param {string[]} extensions File extensions to look for.
|
||||
* @param {boolean} recursive Whether or not to recurse into subdirectories.
|
||||
* @return {string[]} An array of paths.
|
||||
*/
|
||||
exports.lookupFiles = function lookupFiles (path, extensions, recursive) {
|
||||
var files = [];
|
||||
|
||||
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 = statSync(path);
|
||||
if (stat.isFile()) {
|
||||
return path;
|
||||
}
|
||||
} catch (err) {
|
||||
// ignore error
|
||||
return;
|
||||
}
|
||||
|
||||
readdirSync(path).forEach(function (file) {
|
||||
file = join(path, file);
|
||||
try {
|
||||
var stat = statSync(file);
|
||||
if (stat.isDirectory()) {
|
||||
if (recursive) {
|
||||
files = files.concat(lookupFiles(file, extensions, recursive));
|
||||
}
|
||||
return;
|
||||
}
|
||||
} catch (err) {
|
||||
// ignore error
|
||||
return;
|
||||
}
|
||||
var re = new RegExp('\\.(?:' + extensions.join('|') + ')$');
|
||||
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 and internal node functions from stack trace).
|
||||
* @returns {Function}
|
||||
*/
|
||||
exports.stackTraceFilter = function () {
|
||||
// TODO: Replace with `process.browser`
|
||||
var is = typeof document === 'undefined' ? { node: true } : { browser: true };
|
||||
var slash = path.sep;
|
||||
var cwd;
|
||||
if (is.node) {
|
||||
cwd = process.cwd() + slash;
|
||||
} else {
|
||||
cwd = (typeof location === 'undefined'
|
||||
? window.location
|
||||
: location).href.replace(/\/[^/]*$/, '/');
|
||||
slash = '/';
|
||||
}
|
||||
|
||||
function isMochaInternal (line) {
|
||||
return (~line.indexOf('node_modules' + slash + 'mocha' + slash)) ||
|
||||
(~line.indexOf('node_modules' + slash + 'mocha.js')) ||
|
||||
(~line.indexOf('bower_components' + slash + 'mocha.js')) ||
|
||||
(~line.indexOf(slash + 'mocha.js'));
|
||||
}
|
||||
|
||||
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 = stack.reduce(function (list, line) {
|
||||
if (isMochaInternal(line)) {
|
||||
return list;
|
||||
}
|
||||
|
||||
if (is.node && isNodeInternal(line)) {
|
||||
return list;
|
||||
}
|
||||
|
||||
// Clean up cwd(absolute)
|
||||
if (/\(?.+:\d+:\d+\)?$/.test(line)) {
|
||||
line = line.replace(cwd, '');
|
||||
}
|
||||
|
||||
list.push(line);
|
||||
return list;
|
||||
}, []);
|
||||
|
||||
return stack.join('\n');
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Crude, but effective.
|
||||
* @api
|
||||
* @param {*} value
|
||||
* @returns {boolean} Whether or not `value` is a Promise
|
||||
*/
|
||||
exports.isPromise = function isPromise (value) {
|
||||
return typeof value === 'object' && typeof value.then === 'function';
|
||||
};
|
||||
|
||||
/**
|
||||
* It's a noop.
|
||||
* @api
|
||||
*/
|
||||
exports.noop = function () {};
|
||||
326
Client/node_modules/mocha/mocha.css
generated
vendored
Executable file
326
Client/node_modules/mocha/mocha.css
generated
vendored
Executable file
@@ -0,0 +1,326 @@
|
||||
@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;
|
||||
}
|
||||
|
||||
#mocha .test .html-error {
|
||||
overflow: auto;
|
||||
color: black;
|
||||
line-height: 1.5;
|
||||
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: -webkit-calc(100% - 42px);
|
||||
max-width: -moz-calc(100% - 42px);
|
||||
max-width: calc(100% - 42px); /*(2)*/
|
||||
max-height: 300px;
|
||||
word-wrap: break-word;
|
||||
border-bottom-color: #ddd;
|
||||
-webkit-box-shadow: 0 1px 3px #eee;
|
||||
-moz-box-shadow: 0 1px 3px #eee;
|
||||
box-shadow: 0 1px 3px #eee;
|
||||
-webkit-border-radius: 3px;
|
||||
-moz-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
#mocha .test .html-error pre.error {
|
||||
border: none;
|
||||
-webkit-border-radius: 0;
|
||||
-moz-border-radius: 0;
|
||||
border-radius: 0;
|
||||
-webkit-box-shadow: 0;
|
||||
-moz-box-shadow: 0;
|
||||
box-shadow: 0;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
margin-top: 18px;
|
||||
max-height: none;
|
||||
}
|
||||
|
||||
/**
|
||||
* (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: -webkit-calc(100% - 42px);
|
||||
max-width: -moz-calc(100% - 42px);
|
||||
max-width: calc(100% - 42px); /*(2)*/
|
||||
word-wrap: break-word;
|
||||
border-bottom-color: #ddd;
|
||||
-webkit-box-shadow: 0 1px 3px #eee;
|
||||
-moz-box-shadow: 0 1px 3px #eee;
|
||||
box-shadow: 0 1px 3px #eee;
|
||||
-webkit-border-radius: 3px;
|
||||
-moz-border-radius: 3px;
|
||||
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;
|
||||
-webkit-border-radius: 15px;
|
||||
-moz-border-radius: 15px;
|
||||
border-radius: 15px;
|
||||
-webkit-transition:opacity 200ms;
|
||||
-moz-transition:opacity 200ms;
|
||||
-o-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;
|
||||
|
||||
/**
|
||||
* Set safe initial values, so mochas .progress does not inherit these
|
||||
* properties from Bootstrap .progress (which causes .progress height to
|
||||
* equal line height set in Bootstrap).
|
||||
*/
|
||||
height: auto;
|
||||
-webkit-box-shadow: none;
|
||||
-moz-box-shadow: none;
|
||||
box-shadow: none;
|
||||
background-color: initial;
|
||||
}
|
||||
|
||||
#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;
|
||||
}
|
||||
}
|
||||
15336
Client/node_modules/mocha/mocha.js
generated
vendored
Executable file
15336
Client/node_modules/mocha/mocha.js
generated
vendored
Executable file
File diff suppressed because one or more lines are too long
15
Client/node_modules/mocha/node_modules/glob/LICENSE
generated
vendored
Executable file
15
Client/node_modules/mocha/node_modules/glob/LICENSE
generated
vendored
Executable file
@@ -0,0 +1,15 @@
|
||||
The ISC License
|
||||
|
||||
Copyright (c) Isaac Z. Schlueter and Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
368
Client/node_modules/mocha/node_modules/glob/README.md
generated
vendored
Executable file
368
Client/node_modules/mocha/node_modules/glob/README.md
generated
vendored
Executable file
@@ -0,0 +1,368 @@
|
||||
# Glob
|
||||
|
||||
Match files using the patterns the shell uses, like stars and stuff.
|
||||
|
||||
[](https://travis-ci.org/isaacs/node-glob/) [](https://ci.appveyor.com/project/isaacs/node-glob) [](https://coveralls.io/github/isaacs/node-glob?branch=master)
|
||||
|
||||
This is a glob implementation in JavaScript. It uses the `minimatch`
|
||||
library to do its matching.
|
||||
|
||||

|
||||
|
||||
## Usage
|
||||
|
||||
Install with npm
|
||||
|
||||
```
|
||||
npm i glob
|
||||
```
|
||||
|
||||
```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.
|
||||
})
|
||||
```
|
||||
|
||||
## Glob Primer
|
||||
|
||||
"Globs" are the patterns you type when you do stuff like `ls *.js` on
|
||||
the command line, or put `build/*` in a `.gitignore` file.
|
||||
|
||||
Before parsing the path part patterns, braced sections are expanded
|
||||
into a set. Braced sections start with `{` and end with `}`, with any
|
||||
number of comma-delimited sections within. Braced sections may contain
|
||||
slash characters, so `a{/b/c,bcd}` would expand into `a/b/c` and `abcd`.
|
||||
|
||||
The following characters have special magic meaning when used in a
|
||||
path portion:
|
||||
|
||||
* `*` Matches 0 or more characters in a single path portion
|
||||
* `?` Matches 1 character
|
||||
* `[...]` Matches a range of characters, similar to a RegExp range.
|
||||
If the first character of the range is `!` or `^` then it matches
|
||||
any character not in the range.
|
||||
* `!(pattern|pattern|pattern)` Matches anything that does not match
|
||||
any of the patterns provided.
|
||||
* `?(pattern|pattern|pattern)` Matches zero or one occurrence of the
|
||||
patterns provided.
|
||||
* `+(pattern|pattern|pattern)` Matches one or more occurrences of the
|
||||
patterns provided.
|
||||
* `*(a|b|c)` Matches zero or more occurrences of the patterns provided
|
||||
* `@(pattern|pat*|pat?erN)` Matches exactly one of the patterns
|
||||
provided
|
||||
* `**` If a "globstar" is alone in a path portion, then it matches
|
||||
zero or more directories and subdirectories searching for matches.
|
||||
It does not crawl symlinked directories.
|
||||
|
||||
### Dots
|
||||
|
||||
If a file or directory path portion has a `.` as the first character,
|
||||
then it will not match any glob pattern unless that pattern's
|
||||
corresponding path part also has a `.` as its first character.
|
||||
|
||||
For example, the pattern `a/.*/c` would match the file at `a/.b/c`.
|
||||
However the pattern `a/*/c` would not, because `*` does not start with
|
||||
a dot character.
|
||||
|
||||
You can make glob treat dots as normal characters by setting
|
||||
`dot:true` in the options.
|
||||
|
||||
### Basename Matching
|
||||
|
||||
If you set `matchBase:true` in the options, and the pattern has no
|
||||
slashes in it, then it will seek for any file anywhere in the tree
|
||||
with a matching basename. For example, `*.js` would match
|
||||
`test/simple/basic.js`.
|
||||
|
||||
### Empty Sets
|
||||
|
||||
If no matching files are found, then an empty array is returned. This
|
||||
differs from the shell, where the pattern itself is returned. For
|
||||
example:
|
||||
|
||||
$ echo a*s*d*f
|
||||
a*s*d*f
|
||||
|
||||
To get the bash-style behavior, set the `nonull:true` in the options.
|
||||
|
||||
### See Also:
|
||||
|
||||
* `man sh`
|
||||
* `man bash` (Search for "Pattern Matching")
|
||||
* `man 3 fnmatch`
|
||||
* `man 5 gitignore`
|
||||
* [minimatch documentation](https://github.com/isaacs/minimatch)
|
||||
|
||||
## glob.hasMagic(pattern, [options])
|
||||
|
||||
Returns `true` if there are any special characters in the pattern, and
|
||||
`false` otherwise.
|
||||
|
||||
Note that the options affect the results. If `noext:true` is set in
|
||||
the options object, then `+(a|b)` will not be considered a magic
|
||||
pattern. If the pattern has a brace expansion, like `a/{b/c,x/y}`
|
||||
then that is considered magical, unless `nobrace:true` is set in the
|
||||
options.
|
||||
|
||||
## 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 instantiating 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.
|
||||
* `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.
|
||||
* `cache` Convenience object. Each field has the following possible
|
||||
values:
|
||||
* `false` - Path does not exist
|
||||
* `true` - Path exists
|
||||
* `'FILE'` - Path exists, and is not a directory
|
||||
* `'DIR'` - Path exists, and is a directory
|
||||
* `[file, entries, ...]` - Path exists, is a directory, and the
|
||||
array value is the results of `fs.readdir`
|
||||
* `statCache` Cache of `fs.stat` results, to prevent statting the same
|
||||
path multiple times.
|
||||
* `symlinks` A record of which paths are symbolic links, which is
|
||||
relevant in resolving `**` patterns.
|
||||
* `realpathCache` An optional object which is passed to `fs.realpath`
|
||||
to minimize unnecessary syscalls. It is stored on the instantiated
|
||||
Glob object, and may be re-used.
|
||||
|
||||
### 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 specific
|
||||
thing that matched. It is not deduplicated or resolved to a realpath.
|
||||
* `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
|
||||
|
||||
* `pause` Temporarily stop the search
|
||||
* `resume` Resume the search
|
||||
* `abort` Stop the search forever
|
||||
|
||||
### 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.
|
||||
|
||||
If you are running many `glob` operations, you can pass a Glob object
|
||||
as the `options` argument to a subsequent operation to shortcut some
|
||||
`stat` and `readdir` calls. At the very least, you may pass in shared
|
||||
`symlinks`, `statCache`, `realpathCache`, and `cache` options, so that
|
||||
parallel glob operations will be sped up by sharing information about
|
||||
the filesystem.
|
||||
|
||||
* `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.
|
||||
* `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.)
|
||||
* `symlinks` A cache of known symbolic links. You may pass in a
|
||||
previously generated `symlinks` object to save `lstat` calls when
|
||||
resolving `**` matches.
|
||||
* `sync` DEPRECATED: use `glob.sync(pattern, opts)` instead.
|
||||
* `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).
|
||||
* `debug` Set to enable debug logging in minimatch and glob.
|
||||
* `nobrace` Do not expand `{a,b}` and `{1..3}` brace sets.
|
||||
* `noglobstar` Do not match `**` against multiple filenames. (Ie,
|
||||
treat it as a normal `*` instead.)
|
||||
* `noext` Do not match `+(a|b)` "extglob" patterns.
|
||||
* `nocase` Perform a case-insensitive match. Note: on
|
||||
case-insensitive filesystems, non-magic patterns will match by
|
||||
default, since `stat` and `readdir` will not raise errors.
|
||||
* `matchBase` Perform a basename-only match if the pattern does not
|
||||
contain any slash characters. That is, `*.js` would be treated as
|
||||
equivalent to `**/*.js`, matching all js files in all directories.
|
||||
* `nodir` Do not match directories, only files. (Note: to match
|
||||
*only* directories, simply put a `/` at the end of the pattern.)
|
||||
* `ignore` Add a pattern or an array of glob patterns to exclude matches.
|
||||
Note: `ignore` patterns are *always* in `dot:true` mode, regardless
|
||||
of any other settings.
|
||||
* `follow` Follow symlinked directories when expanding `**` patterns.
|
||||
Note that this can result in a lot of duplicate references in the
|
||||
presence of cyclic links.
|
||||
* `realpath` Set to true to call `fs.realpath` on all of the results.
|
||||
In the case of a symlink that cannot be resolved, the full absolute
|
||||
path to the matched entry is returned (though it will usually be a
|
||||
broken symlink)
|
||||
* `absolute` Set to true to always receive absolute paths for matched
|
||||
files. Unlike `realpath`, this also affects the values returned in
|
||||
the `match` event.
|
||||
|
||||
## 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.
|
||||
|
||||
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.3, 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.
|
||||
|
||||
Note that symlinked directories are not crawled as part of a `**`,
|
||||
though their contents may match against subsequent portions of the
|
||||
pattern. This prevents infinite loops and duplicates and the like.
|
||||
|
||||
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.
|
||||
|
||||
### Comments and Negation
|
||||
|
||||
Previously, this module let you mark a pattern as a "comment" if it
|
||||
started with a `#` character, or a "negated" pattern if it started
|
||||
with a `!` character.
|
||||
|
||||
These options were deprecated in version 5, and removed in version 6.
|
||||
|
||||
To specify things that should not match, use the `ignore` option.
|
||||
|
||||
## 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.
|
||||
|
||||
## Contributing
|
||||
|
||||
Any change to behavior (including bugfixes) must come with a test.
|
||||
|
||||
Patches that fail tests or reduce performance will be rejected.
|
||||
|
||||
```
|
||||
# to run tests
|
||||
npm test
|
||||
|
||||
# to re-generate test fixtures
|
||||
npm run test-regen
|
||||
|
||||
# to benchmark against bash/zsh
|
||||
npm run bench
|
||||
|
||||
# to profile javascript
|
||||
npm run prof
|
||||
```
|
||||
67
Client/node_modules/mocha/node_modules/glob/changelog.md
generated
vendored
Executable file
67
Client/node_modules/mocha/node_modules/glob/changelog.md
generated
vendored
Executable file
@@ -0,0 +1,67 @@
|
||||
## 7.0
|
||||
|
||||
- Raise error if `options.cwd` is specified, and not a directory
|
||||
|
||||
## 6.0
|
||||
|
||||
- Remove comment and negation pattern support
|
||||
- Ignore patterns are always in `dot:true` mode
|
||||
|
||||
## 5.0
|
||||
|
||||
- Deprecate comment and negation patterns
|
||||
- Fix regression in `mark` and `nodir` options from making all cache
|
||||
keys absolute path.
|
||||
- Abort if `fs.readdir` returns an error that's unexpected
|
||||
- Don't emit `match` events for ignored items
|
||||
- Treat ENOTSUP like ENOTDIR in readdir
|
||||
|
||||
## 4.5
|
||||
|
||||
- Add `options.follow` to always follow directory symlinks in globstar
|
||||
- Add `options.realpath` to call `fs.realpath` on all results
|
||||
- Always cache based on absolute path
|
||||
|
||||
## 4.4
|
||||
|
||||
- Add `options.ignore`
|
||||
- Fix handling of broken symlinks
|
||||
|
||||
## 4.3
|
||||
|
||||
- Bump minimatch to 2.x
|
||||
- Pass all tests on Windows
|
||||
|
||||
## 4.2
|
||||
|
||||
- Add `glob.hasMagic` function
|
||||
- Add `options.nodir` flag
|
||||
|
||||
## 4.1
|
||||
|
||||
- Refactor sync and async implementations for performance
|
||||
- Throw if callback provided to sync glob function
|
||||
- Treat symbolic links in globstar results the same as Bash 4.3
|
||||
|
||||
## 4.0
|
||||
|
||||
- Use `^` for dependency versions (bumped major because this breaks
|
||||
older npm versions)
|
||||
- Ensure callbacks are only ever called once
|
||||
- switch to ISC license
|
||||
|
||||
## 3.x
|
||||
|
||||
- Rewrite in JavaScript
|
||||
- Add support for setting root, cwd, and windows support
|
||||
- Cache many fs calls
|
||||
- Add globstar support
|
||||
- emit match events
|
||||
|
||||
## 2.x
|
||||
|
||||
- Use `glob.h` and `fnmatch.h` from NetBSD
|
||||
|
||||
## 1.x
|
||||
|
||||
- `glob.h` static binding.
|
||||
240
Client/node_modules/mocha/node_modules/glob/common.js
generated
vendored
Executable file
240
Client/node_modules/mocha/node_modules/glob/common.js
generated
vendored
Executable file
@@ -0,0 +1,240 @@
|
||||
exports.alphasort = alphasort
|
||||
exports.alphasorti = alphasorti
|
||||
exports.setopts = setopts
|
||||
exports.ownProp = ownProp
|
||||
exports.makeAbs = makeAbs
|
||||
exports.finish = finish
|
||||
exports.mark = mark
|
||||
exports.isIgnored = isIgnored
|
||||
exports.childrenIgnored = childrenIgnored
|
||||
|
||||
function ownProp (obj, field) {
|
||||
return Object.prototype.hasOwnProperty.call(obj, field)
|
||||
}
|
||||
|
||||
var path = require("path")
|
||||
var minimatch = require("minimatch")
|
||||
var isAbsolute = require("path-is-absolute")
|
||||
var Minimatch = minimatch.Minimatch
|
||||
|
||||
function alphasorti (a, b) {
|
||||
return a.toLowerCase().localeCompare(b.toLowerCase())
|
||||
}
|
||||
|
||||
function alphasort (a, b) {
|
||||
return a.localeCompare(b)
|
||||
}
|
||||
|
||||
function setupIgnores (self, options) {
|
||||
self.ignore = options.ignore || []
|
||||
|
||||
if (!Array.isArray(self.ignore))
|
||||
self.ignore = [self.ignore]
|
||||
|
||||
if (self.ignore.length) {
|
||||
self.ignore = self.ignore.map(ignoreMap)
|
||||
}
|
||||
}
|
||||
|
||||
// ignore patterns are always in dot:true mode.
|
||||
function ignoreMap (pattern) {
|
||||
var gmatcher = null
|
||||
if (pattern.slice(-3) === '/**') {
|
||||
var gpattern = pattern.replace(/(\/\*\*)+$/, '')
|
||||
gmatcher = new Minimatch(gpattern, { dot: true })
|
||||
}
|
||||
|
||||
return {
|
||||
matcher: new Minimatch(pattern, { dot: true }),
|
||||
gmatcher: gmatcher
|
||||
}
|
||||
}
|
||||
|
||||
function setopts (self, pattern, options) {
|
||||
if (!options)
|
||||
options = {}
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
self.silent = !!options.silent
|
||||
self.pattern = pattern
|
||||
self.strict = options.strict !== false
|
||||
self.realpath = !!options.realpath
|
||||
self.realpathCache = options.realpathCache || Object.create(null)
|
||||
self.follow = !!options.follow
|
||||
self.dot = !!options.dot
|
||||
self.mark = !!options.mark
|
||||
self.nodir = !!options.nodir
|
||||
if (self.nodir)
|
||||
self.mark = true
|
||||
self.sync = !!options.sync
|
||||
self.nounique = !!options.nounique
|
||||
self.nonull = !!options.nonull
|
||||
self.nosort = !!options.nosort
|
||||
self.nocase = !!options.nocase
|
||||
self.stat = !!options.stat
|
||||
self.noprocess = !!options.noprocess
|
||||
self.absolute = !!options.absolute
|
||||
|
||||
self.maxLength = options.maxLength || Infinity
|
||||
self.cache = options.cache || Object.create(null)
|
||||
self.statCache = options.statCache || Object.create(null)
|
||||
self.symlinks = options.symlinks || Object.create(null)
|
||||
|
||||
setupIgnores(self, options)
|
||||
|
||||
self.changedCwd = false
|
||||
var cwd = process.cwd()
|
||||
if (!ownProp(options, "cwd"))
|
||||
self.cwd = cwd
|
||||
else {
|
||||
self.cwd = path.resolve(options.cwd)
|
||||
self.changedCwd = self.cwd !== cwd
|
||||
}
|
||||
|
||||
self.root = options.root || path.resolve(self.cwd, "/")
|
||||
self.root = path.resolve(self.root)
|
||||
if (process.platform === "win32")
|
||||
self.root = self.root.replace(/\\/g, "/")
|
||||
|
||||
// TODO: is an absolute `cwd` supposed to be resolved against `root`?
|
||||
// e.g. { cwd: '/test', root: __dirname } === path.join(__dirname, '/test')
|
||||
self.cwdAbs = isAbsolute(self.cwd) ? self.cwd : makeAbs(self, self.cwd)
|
||||
if (process.platform === "win32")
|
||||
self.cwdAbs = self.cwdAbs.replace(/\\/g, "/")
|
||||
self.nomount = !!options.nomount
|
||||
|
||||
// disable comments and negation in Minimatch.
|
||||
// Note that they are not supported in Glob itself anyway.
|
||||
options.nonegate = true
|
||||
options.nocomment = true
|
||||
|
||||
self.minimatch = new Minimatch(pattern, options)
|
||||
self.options = self.minimatch.options
|
||||
}
|
||||
|
||||
function finish (self) {
|
||||
var nou = self.nounique
|
||||
var all = nou ? [] : Object.create(null)
|
||||
|
||||
for (var i = 0, l = self.matches.length; i < l; i ++) {
|
||||
var matches = self.matches[i]
|
||||
if (!matches || Object.keys(matches).length === 0) {
|
||||
if (self.nonull) {
|
||||
// do like the shell, and spit out the literal glob
|
||||
var literal = self.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 (!self.nosort)
|
||||
all = all.sort(self.nocase ? alphasorti : alphasort)
|
||||
|
||||
// at *some* point we statted all of these
|
||||
if (self.mark) {
|
||||
for (var i = 0; i < all.length; i++) {
|
||||
all[i] = self._mark(all[i])
|
||||
}
|
||||
if (self.nodir) {
|
||||
all = all.filter(function (e) {
|
||||
var notDir = !(/\/$/.test(e))
|
||||
var c = self.cache[e] || self.cache[makeAbs(self, e)]
|
||||
if (notDir && c)
|
||||
notDir = c !== 'DIR' && !Array.isArray(c)
|
||||
return notDir
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
if (self.ignore.length)
|
||||
all = all.filter(function(m) {
|
||||
return !isIgnored(self, m)
|
||||
})
|
||||
|
||||
self.found = all
|
||||
}
|
||||
|
||||
function mark (self, p) {
|
||||
var abs = makeAbs(self, p)
|
||||
var c = self.cache[abs]
|
||||
var m = p
|
||||
if (c) {
|
||||
var isDir = c === 'DIR' || Array.isArray(c)
|
||||
var slash = p.slice(-1) === '/'
|
||||
|
||||
if (isDir && !slash)
|
||||
m += '/'
|
||||
else if (!isDir && slash)
|
||||
m = m.slice(0, -1)
|
||||
|
||||
if (m !== p) {
|
||||
var mabs = makeAbs(self, m)
|
||||
self.statCache[mabs] = self.statCache[abs]
|
||||
self.cache[mabs] = self.cache[abs]
|
||||
}
|
||||
}
|
||||
|
||||
return m
|
||||
}
|
||||
|
||||
// lotta situps...
|
||||
function makeAbs (self, f) {
|
||||
var abs = f
|
||||
if (f.charAt(0) === '/') {
|
||||
abs = path.join(self.root, f)
|
||||
} else if (isAbsolute(f) || f === '') {
|
||||
abs = f
|
||||
} else if (self.changedCwd) {
|
||||
abs = path.resolve(self.cwd, f)
|
||||
} else {
|
||||
abs = path.resolve(f)
|
||||
}
|
||||
|
||||
if (process.platform === 'win32')
|
||||
abs = abs.replace(/\\/g, '/')
|
||||
|
||||
return abs
|
||||
}
|
||||
|
||||
|
||||
// Return true, if pattern ends with globstar '**', for the accompanying parent directory.
|
||||
// Ex:- If node_modules/** is the pattern, add 'node_modules' to ignore list along with it's contents
|
||||
function isIgnored (self, path) {
|
||||
if (!self.ignore.length)
|
||||
return false
|
||||
|
||||
return self.ignore.some(function(item) {
|
||||
return item.matcher.match(path) || !!(item.gmatcher && item.gmatcher.match(path))
|
||||
})
|
||||
}
|
||||
|
||||
function childrenIgnored (self, path) {
|
||||
if (!self.ignore.length)
|
||||
return false
|
||||
|
||||
return self.ignore.some(function(item) {
|
||||
return !!(item.gmatcher && item.gmatcher.match(path))
|
||||
})
|
||||
}
|
||||
790
Client/node_modules/mocha/node_modules/glob/glob.js
generated
vendored
Executable file
790
Client/node_modules/mocha/node_modules/glob/glob.js
generated
vendored
Executable file
@@ -0,0 +1,790 @@
|
||||
// Approach:
|
||||
//
|
||||
// 1. Get the minimatch set
|
||||
// 2. For each pattern in the set, PROCESS(pattern, false)
|
||||
// 3. Store matches per-set, then uniq them
|
||||
//
|
||||
// PROCESS(pattern, inGlobStar)
|
||||
// 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.
|
||||
//
|
||||
// If inGlobStar and PREFIX is symlink and points to dir
|
||||
// set ENTRIES = []
|
||||
// else readdir(PREFIX) as ENTRIES
|
||||
// If fail, END
|
||||
//
|
||||
// with ENTRIES
|
||||
// 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 .. $], false)
|
||||
// // handle other cases.
|
||||
// for ENTRY in ENTRIES (not dotfiles)
|
||||
// // attach globstar + tail onto the entry
|
||||
// // Mark that this entry is a globstar match
|
||||
// PROCESS(pattern[0..n] + ENTRY + pattern[n .. $], true)
|
||||
//
|
||||
// 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('fs')
|
||||
var rp = require('fs.realpath')
|
||||
var minimatch = require('minimatch')
|
||||
var Minimatch = minimatch.Minimatch
|
||||
var inherits = require('inherits')
|
||||
var EE = require('events').EventEmitter
|
||||
var path = require('path')
|
||||
var assert = require('assert')
|
||||
var isAbsolute = require('path-is-absolute')
|
||||
var globSync = require('./sync.js')
|
||||
var common = require('./common.js')
|
||||
var alphasort = common.alphasort
|
||||
var alphasorti = common.alphasorti
|
||||
var setopts = common.setopts
|
||||
var ownProp = common.ownProp
|
||||
var inflight = require('inflight')
|
||||
var util = require('util')
|
||||
var childrenIgnored = common.childrenIgnored
|
||||
var isIgnored = common.isIgnored
|
||||
|
||||
var once = require('once')
|
||||
|
||||
function glob (pattern, options, cb) {
|
||||
if (typeof options === 'function') cb = options, options = {}
|
||||
if (!options) options = {}
|
||||
|
||||
if (options.sync) {
|
||||
if (cb)
|
||||
throw new TypeError('callback provided to sync glob')
|
||||
return globSync(pattern, options)
|
||||
}
|
||||
|
||||
return new Glob(pattern, options, cb)
|
||||
}
|
||||
|
||||
glob.sync = globSync
|
||||
var GlobSync = glob.GlobSync = globSync.GlobSync
|
||||
|
||||
// old api surface
|
||||
glob.glob = glob
|
||||
|
||||
function extend (origin, add) {
|
||||
if (add === null || typeof add !== 'object') {
|
||||
return origin
|
||||
}
|
||||
|
||||
var keys = Object.keys(add)
|
||||
var i = keys.length
|
||||
while (i--) {
|
||||
origin[keys[i]] = add[keys[i]]
|
||||
}
|
||||
return origin
|
||||
}
|
||||
|
||||
glob.hasMagic = function (pattern, options_) {
|
||||
var options = extend({}, options_)
|
||||
options.noprocess = true
|
||||
|
||||
var g = new Glob(pattern, options)
|
||||
var set = g.minimatch.set
|
||||
|
||||
if (!pattern)
|
||||
return false
|
||||
|
||||
if (set.length > 1)
|
||||
return true
|
||||
|
||||
for (var j = 0; j < set[0].length; j++) {
|
||||
if (typeof set[0][j] !== 'string')
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
glob.Glob = Glob
|
||||
inherits(Glob, EE)
|
||||
function Glob (pattern, options, cb) {
|
||||
if (typeof options === 'function') {
|
||||
cb = options
|
||||
options = null
|
||||
}
|
||||
|
||||
if (options && options.sync) {
|
||||
if (cb)
|
||||
throw new TypeError('callback provided to sync glob')
|
||||
return new GlobSync(pattern, options)
|
||||
}
|
||||
|
||||
if (!(this instanceof Glob))
|
||||
return new Glob(pattern, options, cb)
|
||||
|
||||
setopts(this, pattern, options)
|
||||
this._didRealPath = false
|
||||
|
||||
// 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)
|
||||
|
||||
if (typeof cb === 'function') {
|
||||
cb = once(cb)
|
||||
this.on('error', cb)
|
||||
this.on('end', function (matches) {
|
||||
cb(null, matches)
|
||||
})
|
||||
}
|
||||
|
||||
var self = this
|
||||
this._processing = 0
|
||||
|
||||
this._emitQueue = []
|
||||
this._processQueue = []
|
||||
this.paused = false
|
||||
|
||||
if (this.noprocess)
|
||||
return this
|
||||
|
||||
if (n === 0)
|
||||
return done()
|
||||
|
||||
var sync = true
|
||||
for (var i = 0; i < n; i ++) {
|
||||
this._process(this.minimatch.set[i], i, false, done)
|
||||
}
|
||||
sync = false
|
||||
|
||||
function done () {
|
||||
--self._processing
|
||||
if (self._processing <= 0) {
|
||||
if (sync) {
|
||||
process.nextTick(function () {
|
||||
self._finish()
|
||||
})
|
||||
} else {
|
||||
self._finish()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Glob.prototype._finish = function () {
|
||||
assert(this instanceof Glob)
|
||||
if (this.aborted)
|
||||
return
|
||||
|
||||
if (this.realpath && !this._didRealpath)
|
||||
return this._realpath()
|
||||
|
||||
common.finish(this)
|
||||
this.emit('end', this.found)
|
||||
}
|
||||
|
||||
Glob.prototype._realpath = function () {
|
||||
if (this._didRealpath)
|
||||
return
|
||||
|
||||
this._didRealpath = true
|
||||
|
||||
var n = this.matches.length
|
||||
if (n === 0)
|
||||
return this._finish()
|
||||
|
||||
var self = this
|
||||
for (var i = 0; i < this.matches.length; i++)
|
||||
this._realpathSet(i, next)
|
||||
|
||||
function next () {
|
||||
if (--n === 0)
|
||||
self._finish()
|
||||
}
|
||||
}
|
||||
|
||||
Glob.prototype._realpathSet = function (index, cb) {
|
||||
var matchset = this.matches[index]
|
||||
if (!matchset)
|
||||
return cb()
|
||||
|
||||
var found = Object.keys(matchset)
|
||||
var self = this
|
||||
var n = found.length
|
||||
|
||||
if (n === 0)
|
||||
return cb()
|
||||
|
||||
var set = this.matches[index] = Object.create(null)
|
||||
found.forEach(function (p, i) {
|
||||
// If there's a problem with the stat, then it means that
|
||||
// one or more of the links in the realpath couldn't be
|
||||
// resolved. just return the abs value in that case.
|
||||
p = self._makeAbs(p)
|
||||
rp.realpath(p, self.realpathCache, function (er, real) {
|
||||
if (!er)
|
||||
set[real] = true
|
||||
else if (er.syscall === 'stat')
|
||||
set[p] = true
|
||||
else
|
||||
self.emit('error', er) // srsly wtf right here
|
||||
|
||||
if (--n === 0) {
|
||||
self.matches[index] = set
|
||||
cb()
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
Glob.prototype._mark = function (p) {
|
||||
return common.mark(this, p)
|
||||
}
|
||||
|
||||
Glob.prototype._makeAbs = function (f) {
|
||||
return common.makeAbs(this, f)
|
||||
}
|
||||
|
||||
Glob.prototype.abort = function () {
|
||||
this.aborted = true
|
||||
this.emit('abort')
|
||||
}
|
||||
|
||||
Glob.prototype.pause = function () {
|
||||
if (!this.paused) {
|
||||
this.paused = true
|
||||
this.emit('pause')
|
||||
}
|
||||
}
|
||||
|
||||
Glob.prototype.resume = function () {
|
||||
if (this.paused) {
|
||||
this.emit('resume')
|
||||
this.paused = false
|
||||
if (this._emitQueue.length) {
|
||||
var eq = this._emitQueue.slice(0)
|
||||
this._emitQueue.length = 0
|
||||
for (var i = 0; i < eq.length; i ++) {
|
||||
var e = eq[i]
|
||||
this._emitMatch(e[0], e[1])
|
||||
}
|
||||
}
|
||||
if (this._processQueue.length) {
|
||||
var pq = this._processQueue.slice(0)
|
||||
this._processQueue.length = 0
|
||||
for (var i = 0; i < pq.length; i ++) {
|
||||
var p = pq[i]
|
||||
this._processing--
|
||||
this._process(p[0], p[1], p[2], p[3])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Glob.prototype._process = function (pattern, index, inGlobStar, cb) {
|
||||
assert(this instanceof Glob)
|
||||
assert(typeof cb === 'function')
|
||||
|
||||
if (this.aborted)
|
||||
return
|
||||
|
||||
this._processing++
|
||||
if (this.paused) {
|
||||
this._processQueue.push([pattern, index, inGlobStar, cb])
|
||||
return
|
||||
}
|
||||
|
||||
//console.error('PROCESS %d', this._processing, pattern)
|
||||
|
||||
// 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:
|
||||
this._processSimple(pattern.join('/'), index, 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).join('/')
|
||||
break
|
||||
}
|
||||
|
||||
var remain = pattern.slice(n)
|
||||
|
||||
// get the list of entries.
|
||||
var read
|
||||
if (prefix === null)
|
||||
read = '.'
|
||||
else if (isAbsolute(prefix) || isAbsolute(pattern.join('/'))) {
|
||||
if (!prefix || !isAbsolute(prefix))
|
||||
prefix = '/' + prefix
|
||||
read = prefix
|
||||
} else
|
||||
read = prefix
|
||||
|
||||
var abs = this._makeAbs(read)
|
||||
|
||||
//if ignored, skip _processing
|
||||
if (childrenIgnored(this, read))
|
||||
return cb()
|
||||
|
||||
var isGlobStar = remain[0] === minimatch.GLOBSTAR
|
||||
if (isGlobStar)
|
||||
this._processGlobStar(prefix, read, abs, remain, index, inGlobStar, cb)
|
||||
else
|
||||
this._processReaddir(prefix, read, abs, remain, index, inGlobStar, cb)
|
||||
}
|
||||
|
||||
Glob.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar, cb) {
|
||||
var self = this
|
||||
this._readdir(abs, inGlobStar, function (er, entries) {
|
||||
return self._processReaddir2(prefix, read, abs, remain, index, inGlobStar, entries, cb)
|
||||
})
|
||||
}
|
||||
|
||||
Glob.prototype._processReaddir2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) {
|
||||
|
||||
// if the abs isn't a dir, then nothing can match!
|
||||
if (!entries)
|
||||
return cb()
|
||||
|
||||
// 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 = remain[0]
|
||||
var negate = !!this.minimatch.negate
|
||||
var rawGlob = pn._glob
|
||||
var dotOk = this.dot || rawGlob.charAt(0) === '.'
|
||||
|
||||
var matchedEntries = []
|
||||
for (var i = 0; i < entries.length; i++) {
|
||||
var e = entries[i]
|
||||
if (e.charAt(0) !== '.' || dotOk) {
|
||||
var m
|
||||
if (negate && !prefix) {
|
||||
m = !e.match(pn)
|
||||
} else {
|
||||
m = e.match(pn)
|
||||
}
|
||||
if (m)
|
||||
matchedEntries.push(e)
|
||||
}
|
||||
}
|
||||
|
||||
//console.error('prd2', prefix, entries, remain[0]._glob, matchedEntries)
|
||||
|
||||
var len = matchedEntries.length
|
||||
// If there are no matched entries, then nothing matches.
|
||||
if (len === 0)
|
||||
return cb()
|
||||
|
||||
// if this is the last remaining pattern bit, then no need for
|
||||
// an additional stat *unless* the user has specified mark or
|
||||
// stat explicitly. We know they exist, since readdir returned
|
||||
// them.
|
||||
|
||||
if (remain.length === 1 && !this.mark && !this.stat) {
|
||||
if (!this.matches[index])
|
||||
this.matches[index] = Object.create(null)
|
||||
|
||||
for (var i = 0; i < len; i ++) {
|
||||
var e = matchedEntries[i]
|
||||
if (prefix) {
|
||||
if (prefix !== '/')
|
||||
e = prefix + '/' + e
|
||||
else
|
||||
e = prefix + e
|
||||
}
|
||||
|
||||
if (e.charAt(0) === '/' && !this.nomount) {
|
||||
e = path.join(this.root, e)
|
||||
}
|
||||
this._emitMatch(index, e)
|
||||
}
|
||||
// This was the last one, and no stats were needed
|
||||
return cb()
|
||||
}
|
||||
|
||||
// now test all matched entries as stand-ins for that part
|
||||
// of the pattern.
|
||||
remain.shift()
|
||||
for (var i = 0; i < len; i ++) {
|
||||
var e = matchedEntries[i]
|
||||
var newPattern
|
||||
if (prefix) {
|
||||
if (prefix !== '/')
|
||||
e = prefix + '/' + e
|
||||
else
|
||||
e = prefix + e
|
||||
}
|
||||
this._process([e].concat(remain), index, inGlobStar, cb)
|
||||
}
|
||||
cb()
|
||||
}
|
||||
|
||||
Glob.prototype._emitMatch = function (index, e) {
|
||||
if (this.aborted)
|
||||
return
|
||||
|
||||
if (isIgnored(this, e))
|
||||
return
|
||||
|
||||
if (this.paused) {
|
||||
this._emitQueue.push([index, e])
|
||||
return
|
||||
}
|
||||
|
||||
var abs = isAbsolute(e) ? e : this._makeAbs(e)
|
||||
|
||||
if (this.mark)
|
||||
e = this._mark(e)
|
||||
|
||||
if (this.absolute)
|
||||
e = abs
|
||||
|
||||
if (this.matches[index][e])
|
||||
return
|
||||
|
||||
if (this.nodir) {
|
||||
var c = this.cache[abs]
|
||||
if (c === 'DIR' || Array.isArray(c))
|
||||
return
|
||||
}
|
||||
|
||||
this.matches[index][e] = true
|
||||
|
||||
var st = this.statCache[abs]
|
||||
if (st)
|
||||
this.emit('stat', e, st)
|
||||
|
||||
this.emit('match', e)
|
||||
}
|
||||
|
||||
Glob.prototype._readdirInGlobStar = function (abs, cb) {
|
||||
if (this.aborted)
|
||||
return
|
||||
|
||||
// follow all symlinked directories forever
|
||||
// just proceed as if this is a non-globstar situation
|
||||
if (this.follow)
|
||||
return this._readdir(abs, false, cb)
|
||||
|
||||
var lstatkey = 'lstat\0' + abs
|
||||
var self = this
|
||||
var lstatcb = inflight(lstatkey, lstatcb_)
|
||||
|
||||
if (lstatcb)
|
||||
fs.lstat(abs, lstatcb)
|
||||
|
||||
function lstatcb_ (er, lstat) {
|
||||
if (er && er.code === 'ENOENT')
|
||||
return cb()
|
||||
|
||||
var isSym = lstat && lstat.isSymbolicLink()
|
||||
self.symlinks[abs] = isSym
|
||||
|
||||
// If it's not a symlink or a dir, then it's definitely a regular file.
|
||||
// don't bother doing a readdir in that case.
|
||||
if (!isSym && lstat && !lstat.isDirectory()) {
|
||||
self.cache[abs] = 'FILE'
|
||||
cb()
|
||||
} else
|
||||
self._readdir(abs, false, cb)
|
||||
}
|
||||
}
|
||||
|
||||
Glob.prototype._readdir = function (abs, inGlobStar, cb) {
|
||||
if (this.aborted)
|
||||
return
|
||||
|
||||
cb = inflight('readdir\0'+abs+'\0'+inGlobStar, cb)
|
||||
if (!cb)
|
||||
return
|
||||
|
||||
//console.error('RD %j %j', +inGlobStar, abs)
|
||||
if (inGlobStar && !ownProp(this.symlinks, abs))
|
||||
return this._readdirInGlobStar(abs, cb)
|
||||
|
||||
if (ownProp(this.cache, abs)) {
|
||||
var c = this.cache[abs]
|
||||
if (!c || c === 'FILE')
|
||||
return cb()
|
||||
|
||||
if (Array.isArray(c))
|
||||
return cb(null, c)
|
||||
}
|
||||
|
||||
var self = this
|
||||
fs.readdir(abs, readdirCb(this, abs, cb))
|
||||
}
|
||||
|
||||
function readdirCb (self, abs, cb) {
|
||||
return function (er, entries) {
|
||||
if (er)
|
||||
self._readdirError(abs, er, cb)
|
||||
else
|
||||
self._readdirEntries(abs, entries, cb)
|
||||
}
|
||||
}
|
||||
|
||||
Glob.prototype._readdirEntries = function (abs, entries, cb) {
|
||||
if (this.aborted)
|
||||
return
|
||||
|
||||
// if we haven't asked to stat everything, then just
|
||||
// assume that everything in there exists, so we can avoid
|
||||
// having to stat it a second time.
|
||||
if (!this.mark && !this.stat) {
|
||||
for (var i = 0; i < entries.length; i ++) {
|
||||
var e = entries[i]
|
||||
if (abs === '/')
|
||||
e = abs + e
|
||||
else
|
||||
e = abs + '/' + e
|
||||
this.cache[e] = true
|
||||
}
|
||||
}
|
||||
|
||||
this.cache[abs] = entries
|
||||
return cb(null, entries)
|
||||
}
|
||||
|
||||
Glob.prototype._readdirError = function (f, er, cb) {
|
||||
if (this.aborted)
|
||||
return
|
||||
|
||||
// handle errors, and cache the information
|
||||
switch (er.code) {
|
||||
case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205
|
||||
case 'ENOTDIR': // totally normal. means it *does* exist.
|
||||
var abs = this._makeAbs(f)
|
||||
this.cache[abs] = 'FILE'
|
||||
if (abs === this.cwdAbs) {
|
||||
var error = new Error(er.code + ' invalid cwd ' + this.cwd)
|
||||
error.path = this.cwd
|
||||
error.code = er.code
|
||||
this.emit('error', error)
|
||||
this.abort()
|
||||
}
|
||||
break
|
||||
|
||||
case 'ENOENT': // not terribly unusual
|
||||
case 'ELOOP':
|
||||
case 'ENAMETOOLONG':
|
||||
case 'UNKNOWN':
|
||||
this.cache[this._makeAbs(f)] = false
|
||||
break
|
||||
|
||||
default: // some unusual error. Treat as failure.
|
||||
this.cache[this._makeAbs(f)] = false
|
||||
if (this.strict) {
|
||||
this.emit('error', er)
|
||||
// If the error is handled, then we abort
|
||||
// if not, we threw out of here
|
||||
this.abort()
|
||||
}
|
||||
if (!this.silent)
|
||||
console.error('glob error', er)
|
||||
break
|
||||
}
|
||||
|
||||
return cb()
|
||||
}
|
||||
|
||||
Glob.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar, cb) {
|
||||
var self = this
|
||||
this._readdir(abs, inGlobStar, function (er, entries) {
|
||||
self._processGlobStar2(prefix, read, abs, remain, index, inGlobStar, entries, cb)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Glob.prototype._processGlobStar2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) {
|
||||
//console.error('pgs2', prefix, remain[0], entries)
|
||||
|
||||
// no entries means not a dir, so it can never have matches
|
||||
// foo.txt/** doesn't match foo.txt
|
||||
if (!entries)
|
||||
return cb()
|
||||
|
||||
// test without the globstar, and with every child both below
|
||||
// and replacing the globstar.
|
||||
var remainWithoutGlobStar = remain.slice(1)
|
||||
var gspref = prefix ? [ prefix ] : []
|
||||
var noGlobStar = gspref.concat(remainWithoutGlobStar)
|
||||
|
||||
// the noGlobStar pattern exits the inGlobStar state
|
||||
this._process(noGlobStar, index, false, cb)
|
||||
|
||||
var isSym = this.symlinks[abs]
|
||||
var len = entries.length
|
||||
|
||||
// If it's a symlink, and we're in a globstar, then stop
|
||||
if (isSym && inGlobStar)
|
||||
return cb()
|
||||
|
||||
for (var i = 0; i < len; i++) {
|
||||
var e = entries[i]
|
||||
if (e.charAt(0) === '.' && !this.dot)
|
||||
continue
|
||||
|
||||
// these two cases enter the inGlobStar state
|
||||
var instead = gspref.concat(entries[i], remainWithoutGlobStar)
|
||||
this._process(instead, index, true, cb)
|
||||
|
||||
var below = gspref.concat(entries[i], remain)
|
||||
this._process(below, index, true, cb)
|
||||
}
|
||||
|
||||
cb()
|
||||
}
|
||||
|
||||
Glob.prototype._processSimple = function (prefix, index, cb) {
|
||||
// XXX review this. Shouldn't it be doing the mounting etc
|
||||
// before doing stat? kinda weird?
|
||||
var self = this
|
||||
this._stat(prefix, function (er, exists) {
|
||||
self._processSimple2(prefix, index, er, exists, cb)
|
||||
})
|
||||
}
|
||||
Glob.prototype._processSimple2 = function (prefix, index, er, exists, cb) {
|
||||
|
||||
//console.error('ps2', prefix, exists)
|
||||
|
||||
if (!this.matches[index])
|
||||
this.matches[index] = Object.create(null)
|
||||
|
||||
// If it doesn't exist, then just mark the lack of results
|
||||
if (!exists)
|
||||
return cb()
|
||||
|
||||
if (prefix && isAbsolute(prefix) && !this.nomount) {
|
||||
var trail = /[\/\\]$/.test(prefix)
|
||||
if (prefix.charAt(0) === '/') {
|
||||
prefix = path.join(this.root, prefix)
|
||||
} else {
|
||||
prefix = path.resolve(this.root, prefix)
|
||||
if (trail)
|
||||
prefix += '/'
|
||||
}
|
||||
}
|
||||
|
||||
if (process.platform === 'win32')
|
||||
prefix = prefix.replace(/\\/g, '/')
|
||||
|
||||
// Mark this as a match
|
||||
this._emitMatch(index, prefix)
|
||||
cb()
|
||||
}
|
||||
|
||||
// Returns either 'DIR', 'FILE', or false
|
||||
Glob.prototype._stat = function (f, cb) {
|
||||
var abs = this._makeAbs(f)
|
||||
var needDir = f.slice(-1) === '/'
|
||||
|
||||
if (f.length > this.maxLength)
|
||||
return cb()
|
||||
|
||||
if (!this.stat && ownProp(this.cache, abs)) {
|
||||
var c = this.cache[abs]
|
||||
|
||||
if (Array.isArray(c))
|
||||
c = 'DIR'
|
||||
|
||||
// It exists, but maybe not how we need it
|
||||
if (!needDir || c === 'DIR')
|
||||
return cb(null, c)
|
||||
|
||||
if (needDir && c === 'FILE')
|
||||
return cb()
|
||||
|
||||
// otherwise we have to stat, because maybe c=true
|
||||
// if we know it exists, but not what it is.
|
||||
}
|
||||
|
||||
var exists
|
||||
var stat = this.statCache[abs]
|
||||
if (stat !== undefined) {
|
||||
if (stat === false)
|
||||
return cb(null, stat)
|
||||
else {
|
||||
var type = stat.isDirectory() ? 'DIR' : 'FILE'
|
||||
if (needDir && type === 'FILE')
|
||||
return cb()
|
||||
else
|
||||
return cb(null, type, stat)
|
||||
}
|
||||
}
|
||||
|
||||
var self = this
|
||||
var statcb = inflight('stat\0' + abs, lstatcb_)
|
||||
if (statcb)
|
||||
fs.lstat(abs, statcb)
|
||||
|
||||
function lstatcb_ (er, lstat) {
|
||||
if (lstat && lstat.isSymbolicLink()) {
|
||||
// If it's a symlink, then treat it as the target, unless
|
||||
// the target does not exist, then treat it as a file.
|
||||
return fs.stat(abs, function (er, stat) {
|
||||
if (er)
|
||||
self._stat2(f, abs, null, lstat, cb)
|
||||
else
|
||||
self._stat2(f, abs, er, stat, cb)
|
||||
})
|
||||
} else {
|
||||
self._stat2(f, abs, er, lstat, cb)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Glob.prototype._stat2 = function (f, abs, er, stat, cb) {
|
||||
if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) {
|
||||
this.statCache[abs] = false
|
||||
return cb()
|
||||
}
|
||||
|
||||
var needDir = f.slice(-1) === '/'
|
||||
this.statCache[abs] = stat
|
||||
|
||||
if (abs.slice(-1) === '/' && stat && !stat.isDirectory())
|
||||
return cb(null, false, stat)
|
||||
|
||||
var c = true
|
||||
if (stat)
|
||||
c = stat.isDirectory() ? 'DIR' : 'FILE'
|
||||
this.cache[abs] = this.cache[abs] || c
|
||||
|
||||
if (needDir && c === 'FILE')
|
||||
return cb()
|
||||
|
||||
return cb(null, c, stat)
|
||||
}
|
||||
76
Client/node_modules/mocha/node_modules/glob/package.json
generated
vendored
Executable file
76
Client/node_modules/mocha/node_modules/glob/package.json
generated
vendored
Executable file
@@ -0,0 +1,76 @@
|
||||
{
|
||||
"_from": "glob@7.1.2",
|
||||
"_id": "glob@7.1.2",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==",
|
||||
"_location": "/mocha/glob",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "glob@7.1.2",
|
||||
"name": "glob",
|
||||
"escapedName": "glob",
|
||||
"rawSpec": "7.1.2",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "7.1.2"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/mocha"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz",
|
||||
"_shasum": "c19c9df9a028702d678612384a6552404c636d15",
|
||||
"_spec": "glob@7.1.2",
|
||||
"_where": "/home/nathan/Projects/Upsilon/UpsilonVsCodeLanguageServer/Client/node_modules/mocha",
|
||||
"author": {
|
||||
"name": "Isaac Z. Schlueter",
|
||||
"email": "i@izs.me",
|
||||
"url": "http://blog.izs.me/"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/isaacs/node-glob/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"fs.realpath": "^1.0.0",
|
||||
"inflight": "^1.0.4",
|
||||
"inherits": "2",
|
||||
"minimatch": "^3.0.4",
|
||||
"once": "^1.3.0",
|
||||
"path-is-absolute": "^1.0.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "a little globber",
|
||||
"devDependencies": {
|
||||
"mkdirp": "0",
|
||||
"rimraf": "^2.2.8",
|
||||
"tap": "^7.1.2",
|
||||
"tick": "0.0.6"
|
||||
},
|
||||
"engines": {
|
||||
"node": "*"
|
||||
},
|
||||
"files": [
|
||||
"glob.js",
|
||||
"sync.js",
|
||||
"common.js"
|
||||
],
|
||||
"homepage": "https://github.com/isaacs/node-glob#readme",
|
||||
"license": "ISC",
|
||||
"main": "glob.js",
|
||||
"name": "glob",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/isaacs/node-glob.git"
|
||||
},
|
||||
"scripts": {
|
||||
"bench": "bash benchmark.sh",
|
||||
"benchclean": "node benchclean.js",
|
||||
"prepublish": "npm run benchclean",
|
||||
"prof": "bash prof.sh && cat profile.txt",
|
||||
"profclean": "rm -f v8.log profile.txt",
|
||||
"test": "tap test/*.js --cov",
|
||||
"test-regen": "npm run profclean && TEST_REGEN=1 node test/00-setup.js"
|
||||
},
|
||||
"version": "7.1.2"
|
||||
}
|
||||
486
Client/node_modules/mocha/node_modules/glob/sync.js
generated
vendored
Executable file
486
Client/node_modules/mocha/node_modules/glob/sync.js
generated
vendored
Executable file
@@ -0,0 +1,486 @@
|
||||
module.exports = globSync
|
||||
globSync.GlobSync = GlobSync
|
||||
|
||||
var fs = require('fs')
|
||||
var rp = require('fs.realpath')
|
||||
var minimatch = require('minimatch')
|
||||
var Minimatch = minimatch.Minimatch
|
||||
var Glob = require('./glob.js').Glob
|
||||
var util = require('util')
|
||||
var path = require('path')
|
||||
var assert = require('assert')
|
||||
var isAbsolute = require('path-is-absolute')
|
||||
var common = require('./common.js')
|
||||
var alphasort = common.alphasort
|
||||
var alphasorti = common.alphasorti
|
||||
var setopts = common.setopts
|
||||
var ownProp = common.ownProp
|
||||
var childrenIgnored = common.childrenIgnored
|
||||
var isIgnored = common.isIgnored
|
||||
|
||||
function globSync (pattern, options) {
|
||||
if (typeof options === 'function' || arguments.length === 3)
|
||||
throw new TypeError('callback provided to sync glob\n'+
|
||||
'See: https://github.com/isaacs/node-glob/issues/167')
|
||||
|
||||
return new GlobSync(pattern, options).found
|
||||
}
|
||||
|
||||
function GlobSync (pattern, options) {
|
||||
if (!pattern)
|
||||
throw new Error('must provide pattern')
|
||||
|
||||
if (typeof options === 'function' || arguments.length === 3)
|
||||
throw new TypeError('callback provided to sync glob\n'+
|
||||
'See: https://github.com/isaacs/node-glob/issues/167')
|
||||
|
||||
if (!(this instanceof GlobSync))
|
||||
return new GlobSync(pattern, options)
|
||||
|
||||
setopts(this, pattern, options)
|
||||
|
||||
if (this.noprocess)
|
||||
return this
|
||||
|
||||
var n = this.minimatch.set.length
|
||||
this.matches = new Array(n)
|
||||
for (var i = 0; i < n; i ++) {
|
||||
this._process(this.minimatch.set[i], i, false)
|
||||
}
|
||||
this._finish()
|
||||
}
|
||||
|
||||
GlobSync.prototype._finish = function () {
|
||||
assert(this instanceof GlobSync)
|
||||
if (this.realpath) {
|
||||
var self = this
|
||||
this.matches.forEach(function (matchset, index) {
|
||||
var set = self.matches[index] = Object.create(null)
|
||||
for (var p in matchset) {
|
||||
try {
|
||||
p = self._makeAbs(p)
|
||||
var real = rp.realpathSync(p, self.realpathCache)
|
||||
set[real] = true
|
||||
} catch (er) {
|
||||
if (er.syscall === 'stat')
|
||||
set[self._makeAbs(p)] = true
|
||||
else
|
||||
throw er
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
common.finish(this)
|
||||
}
|
||||
|
||||
|
||||
GlobSync.prototype._process = function (pattern, index, inGlobStar) {
|
||||
assert(this instanceof GlobSync)
|
||||
|
||||
// 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:
|
||||
this._processSimple(pattern.join('/'), index)
|
||||
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).join('/')
|
||||
break
|
||||
}
|
||||
|
||||
var remain = pattern.slice(n)
|
||||
|
||||
// get the list of entries.
|
||||
var read
|
||||
if (prefix === null)
|
||||
read = '.'
|
||||
else if (isAbsolute(prefix) || isAbsolute(pattern.join('/'))) {
|
||||
if (!prefix || !isAbsolute(prefix))
|
||||
prefix = '/' + prefix
|
||||
read = prefix
|
||||
} else
|
||||
read = prefix
|
||||
|
||||
var abs = this._makeAbs(read)
|
||||
|
||||
//if ignored, skip processing
|
||||
if (childrenIgnored(this, read))
|
||||
return
|
||||
|
||||
var isGlobStar = remain[0] === minimatch.GLOBSTAR
|
||||
if (isGlobStar)
|
||||
this._processGlobStar(prefix, read, abs, remain, index, inGlobStar)
|
||||
else
|
||||
this._processReaddir(prefix, read, abs, remain, index, inGlobStar)
|
||||
}
|
||||
|
||||
|
||||
GlobSync.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar) {
|
||||
var entries = this._readdir(abs, inGlobStar)
|
||||
|
||||
// if the abs isn't a dir, then nothing can match!
|
||||
if (!entries)
|
||||
return
|
||||
|
||||
// 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 = remain[0]
|
||||
var negate = !!this.minimatch.negate
|
||||
var rawGlob = pn._glob
|
||||
var dotOk = this.dot || rawGlob.charAt(0) === '.'
|
||||
|
||||
var matchedEntries = []
|
||||
for (var i = 0; i < entries.length; i++) {
|
||||
var e = entries[i]
|
||||
if (e.charAt(0) !== '.' || dotOk) {
|
||||
var m
|
||||
if (negate && !prefix) {
|
||||
m = !e.match(pn)
|
||||
} else {
|
||||
m = e.match(pn)
|
||||
}
|
||||
if (m)
|
||||
matchedEntries.push(e)
|
||||
}
|
||||
}
|
||||
|
||||
var len = matchedEntries.length
|
||||
// If there are no matched entries, then nothing matches.
|
||||
if (len === 0)
|
||||
return
|
||||
|
||||
// if this is the last remaining pattern bit, then no need for
|
||||
// an additional stat *unless* the user has specified mark or
|
||||
// stat explicitly. We know they exist, since readdir returned
|
||||
// them.
|
||||
|
||||
if (remain.length === 1 && !this.mark && !this.stat) {
|
||||
if (!this.matches[index])
|
||||
this.matches[index] = Object.create(null)
|
||||
|
||||
for (var i = 0; i < len; i ++) {
|
||||
var e = matchedEntries[i]
|
||||
if (prefix) {
|
||||
if (prefix.slice(-1) !== '/')
|
||||
e = prefix + '/' + e
|
||||
else
|
||||
e = prefix + e
|
||||
}
|
||||
|
||||
if (e.charAt(0) === '/' && !this.nomount) {
|
||||
e = path.join(this.root, e)
|
||||
}
|
||||
this._emitMatch(index, e)
|
||||
}
|
||||
// This was the last one, and no stats were needed
|
||||
return
|
||||
}
|
||||
|
||||
// now test all matched entries as stand-ins for that part
|
||||
// of the pattern.
|
||||
remain.shift()
|
||||
for (var i = 0; i < len; i ++) {
|
||||
var e = matchedEntries[i]
|
||||
var newPattern
|
||||
if (prefix)
|
||||
newPattern = [prefix, e]
|
||||
else
|
||||
newPattern = [e]
|
||||
this._process(newPattern.concat(remain), index, inGlobStar)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GlobSync.prototype._emitMatch = function (index, e) {
|
||||
if (isIgnored(this, e))
|
||||
return
|
||||
|
||||
var abs = this._makeAbs(e)
|
||||
|
||||
if (this.mark)
|
||||
e = this._mark(e)
|
||||
|
||||
if (this.absolute) {
|
||||
e = abs
|
||||
}
|
||||
|
||||
if (this.matches[index][e])
|
||||
return
|
||||
|
||||
if (this.nodir) {
|
||||
var c = this.cache[abs]
|
||||
if (c === 'DIR' || Array.isArray(c))
|
||||
return
|
||||
}
|
||||
|
||||
this.matches[index][e] = true
|
||||
|
||||
if (this.stat)
|
||||
this._stat(e)
|
||||
}
|
||||
|
||||
|
||||
GlobSync.prototype._readdirInGlobStar = function (abs) {
|
||||
// follow all symlinked directories forever
|
||||
// just proceed as if this is a non-globstar situation
|
||||
if (this.follow)
|
||||
return this._readdir(abs, false)
|
||||
|
||||
var entries
|
||||
var lstat
|
||||
var stat
|
||||
try {
|
||||
lstat = fs.lstatSync(abs)
|
||||
} catch (er) {
|
||||
if (er.code === 'ENOENT') {
|
||||
// lstat failed, doesn't exist
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
var isSym = lstat && lstat.isSymbolicLink()
|
||||
this.symlinks[abs] = isSym
|
||||
|
||||
// If it's not a symlink or a dir, then it's definitely a regular file.
|
||||
// don't bother doing a readdir in that case.
|
||||
if (!isSym && lstat && !lstat.isDirectory())
|
||||
this.cache[abs] = 'FILE'
|
||||
else
|
||||
entries = this._readdir(abs, false)
|
||||
|
||||
return entries
|
||||
}
|
||||
|
||||
GlobSync.prototype._readdir = function (abs, inGlobStar) {
|
||||
var entries
|
||||
|
||||
if (inGlobStar && !ownProp(this.symlinks, abs))
|
||||
return this._readdirInGlobStar(abs)
|
||||
|
||||
if (ownProp(this.cache, abs)) {
|
||||
var c = this.cache[abs]
|
||||
if (!c || c === 'FILE')
|
||||
return null
|
||||
|
||||
if (Array.isArray(c))
|
||||
return c
|
||||
}
|
||||
|
||||
try {
|
||||
return this._readdirEntries(abs, fs.readdirSync(abs))
|
||||
} catch (er) {
|
||||
this._readdirError(abs, er)
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
GlobSync.prototype._readdirEntries = function (abs, entries) {
|
||||
// if we haven't asked to stat everything, then just
|
||||
// assume that everything in there exists, so we can avoid
|
||||
// having to stat it a second time.
|
||||
if (!this.mark && !this.stat) {
|
||||
for (var i = 0; i < entries.length; i ++) {
|
||||
var e = entries[i]
|
||||
if (abs === '/')
|
||||
e = abs + e
|
||||
else
|
||||
e = abs + '/' + e
|
||||
this.cache[e] = true
|
||||
}
|
||||
}
|
||||
|
||||
this.cache[abs] = entries
|
||||
|
||||
// mark and cache dir-ness
|
||||
return entries
|
||||
}
|
||||
|
||||
GlobSync.prototype._readdirError = function (f, er) {
|
||||
// handle errors, and cache the information
|
||||
switch (er.code) {
|
||||
case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205
|
||||
case 'ENOTDIR': // totally normal. means it *does* exist.
|
||||
var abs = this._makeAbs(f)
|
||||
this.cache[abs] = 'FILE'
|
||||
if (abs === this.cwdAbs) {
|
||||
var error = new Error(er.code + ' invalid cwd ' + this.cwd)
|
||||
error.path = this.cwd
|
||||
error.code = er.code
|
||||
throw error
|
||||
}
|
||||
break
|
||||
|
||||
case 'ENOENT': // not terribly unusual
|
||||
case 'ELOOP':
|
||||
case 'ENAMETOOLONG':
|
||||
case 'UNKNOWN':
|
||||
this.cache[this._makeAbs(f)] = false
|
||||
break
|
||||
|
||||
default: // some unusual error. Treat as failure.
|
||||
this.cache[this._makeAbs(f)] = false
|
||||
if (this.strict)
|
||||
throw er
|
||||
if (!this.silent)
|
||||
console.error('glob error', er)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
GlobSync.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar) {
|
||||
|
||||
var entries = this._readdir(abs, inGlobStar)
|
||||
|
||||
// no entries means not a dir, so it can never have matches
|
||||
// foo.txt/** doesn't match foo.txt
|
||||
if (!entries)
|
||||
return
|
||||
|
||||
// test without the globstar, and with every child both below
|
||||
// and replacing the globstar.
|
||||
var remainWithoutGlobStar = remain.slice(1)
|
||||
var gspref = prefix ? [ prefix ] : []
|
||||
var noGlobStar = gspref.concat(remainWithoutGlobStar)
|
||||
|
||||
// the noGlobStar pattern exits the inGlobStar state
|
||||
this._process(noGlobStar, index, false)
|
||||
|
||||
var len = entries.length
|
||||
var isSym = this.symlinks[abs]
|
||||
|
||||
// If it's a symlink, and we're in a globstar, then stop
|
||||
if (isSym && inGlobStar)
|
||||
return
|
||||
|
||||
for (var i = 0; i < len; i++) {
|
||||
var e = entries[i]
|
||||
if (e.charAt(0) === '.' && !this.dot)
|
||||
continue
|
||||
|
||||
// these two cases enter the inGlobStar state
|
||||
var instead = gspref.concat(entries[i], remainWithoutGlobStar)
|
||||
this._process(instead, index, true)
|
||||
|
||||
var below = gspref.concat(entries[i], remain)
|
||||
this._process(below, index, true)
|
||||
}
|
||||
}
|
||||
|
||||
GlobSync.prototype._processSimple = function (prefix, index) {
|
||||
// XXX review this. Shouldn't it be doing the mounting etc
|
||||
// before doing stat? kinda weird?
|
||||
var exists = this._stat(prefix)
|
||||
|
||||
if (!this.matches[index])
|
||||
this.matches[index] = Object.create(null)
|
||||
|
||||
// If it doesn't exist, then just mark the lack of results
|
||||
if (!exists)
|
||||
return
|
||||
|
||||
if (prefix && isAbsolute(prefix) && !this.nomount) {
|
||||
var trail = /[\/\\]$/.test(prefix)
|
||||
if (prefix.charAt(0) === '/') {
|
||||
prefix = path.join(this.root, prefix)
|
||||
} else {
|
||||
prefix = path.resolve(this.root, prefix)
|
||||
if (trail)
|
||||
prefix += '/'
|
||||
}
|
||||
}
|
||||
|
||||
if (process.platform === 'win32')
|
||||
prefix = prefix.replace(/\\/g, '/')
|
||||
|
||||
// Mark this as a match
|
||||
this._emitMatch(index, prefix)
|
||||
}
|
||||
|
||||
// Returns either 'DIR', 'FILE', or false
|
||||
GlobSync.prototype._stat = function (f) {
|
||||
var abs = this._makeAbs(f)
|
||||
var needDir = f.slice(-1) === '/'
|
||||
|
||||
if (f.length > this.maxLength)
|
||||
return false
|
||||
|
||||
if (!this.stat && ownProp(this.cache, abs)) {
|
||||
var c = this.cache[abs]
|
||||
|
||||
if (Array.isArray(c))
|
||||
c = 'DIR'
|
||||
|
||||
// It exists, but maybe not how we need it
|
||||
if (!needDir || c === 'DIR')
|
||||
return c
|
||||
|
||||
if (needDir && c === 'FILE')
|
||||
return false
|
||||
|
||||
// otherwise we have to stat, because maybe c=true
|
||||
// if we know it exists, but not what it is.
|
||||
}
|
||||
|
||||
var exists
|
||||
var stat = this.statCache[abs]
|
||||
if (!stat) {
|
||||
var lstat
|
||||
try {
|
||||
lstat = fs.lstatSync(abs)
|
||||
} catch (er) {
|
||||
if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) {
|
||||
this.statCache[abs] = false
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
if (lstat && lstat.isSymbolicLink()) {
|
||||
try {
|
||||
stat = fs.statSync(abs)
|
||||
} catch (er) {
|
||||
stat = lstat
|
||||
}
|
||||
} else {
|
||||
stat = lstat
|
||||
}
|
||||
}
|
||||
|
||||
this.statCache[abs] = stat
|
||||
|
||||
var c = true
|
||||
if (stat)
|
||||
c = stat.isDirectory() ? 'DIR' : 'FILE'
|
||||
|
||||
this.cache[abs] = this.cache[abs] || c
|
||||
|
||||
if (needDir && c === 'FILE')
|
||||
return false
|
||||
|
||||
return c
|
||||
}
|
||||
|
||||
GlobSync.prototype._mark = function (p) {
|
||||
return common.mark(this, p)
|
||||
}
|
||||
|
||||
GlobSync.prototype._makeAbs = function (f) {
|
||||
return common.makeAbs(this, f)
|
||||
}
|
||||
1396
Client/node_modules/mocha/package.json
generated
vendored
Executable file
1396
Client/node_modules/mocha/package.json
generated
vendored
Executable file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user