initial commit taken from gitlab.lrz.de

This commit is contained in:
privatereese
2018-08-24 18:09:42 +02:00
parent ae54ed4c48
commit fc05486403
28494 changed files with 2159823 additions and 0 deletions

15
node_modules/jest/README.md generated vendored Normal file
View File

@@ -0,0 +1,15 @@
# Jest
🃏 Delightful JavaScript Testing
* **👩🏻‍💻 Easy Setup**: Jest is a complete and easy to set up JavaScript testing
solution. In fact, Jest works out of the box for any React project.
* **🏃🏽 Instant Feedback**: Failed tests run first. Fast interactive mode can
switch between running all tests or only test files related to changed files.
* **📸 Snapshot Testing**: Jest can
[capture snapshots](http://facebook.github.io/jest/docs/snapshot-testing.html)
of React trees or other serializable values to simplify UI testing.
Read More: http://facebook.github.io/jest/

13
node_modules/jest/bin/jest.js generated vendored Executable file
View File

@@ -0,0 +1,13 @@
#!/usr/bin/env node
/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
const importLocal = require('import-local');
if (!importLocal(__filename)) {
require('jest-cli/bin/jest');
}

18
node_modules/jest/build/jest.js generated vendored Normal file
View File

@@ -0,0 +1,18 @@
'use strict';
var _jestCli;
function _load_jestCli() {
return _jestCli = _interopRequireDefault(require('jest-cli'));
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
module.exports = (_jestCli || _load_jestCli()).default; /**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/

1
node_modules/jest/node_modules/.bin/jest generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../jest-cli/bin/jest.js

10
node_modules/jest/node_modules/ansi-regex/index.js generated vendored Normal file
View File

@@ -0,0 +1,10 @@
'use strict';
module.exports = () => {
const pattern = [
'[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[a-zA-Z\\d]*)*)?\\u0007)',
'(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))'
].join('|');
return new RegExp(pattern, 'g');
};

9
node_modules/jest/node_modules/ansi-regex/license generated vendored Normal file
View File

@@ -0,0 +1,9 @@
MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
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.

121
node_modules/jest/node_modules/ansi-regex/package.json generated vendored Normal file
View File

@@ -0,0 +1,121 @@
{
"_args": [
[
"ansi-regex@^3.0.0",
"/home/bernhard/freifunk-app/node_modules/jest/node_modules/strip-ansi"
]
],
"_from": "ansi-regex@>=3.0.0 <4.0.0",
"_id": "ansi-regex@3.0.0",
"_inCache": true,
"_installable": true,
"_location": "/jest/ansi-regex",
"_nodeVersion": "4.8.3",
"_npmOperationalInternal": {
"host": "s3://npm-registry-packages",
"tmp": "tmp/ansi-regex-3.0.0.tgz_1497985412590_0.5700640194118023"
},
"_npmUser": {
"email": "sindresorhus@gmail.com",
"name": "sindresorhus"
},
"_npmVersion": "2.15.11",
"_phantomChildren": {},
"_requested": {
"name": "ansi-regex",
"raw": "ansi-regex@^3.0.0",
"rawSpec": "^3.0.0",
"scope": null,
"spec": ">=3.0.0 <4.0.0",
"type": "range"
},
"_requiredBy": [
"/jest/strip-ansi"
],
"_resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz",
"_shasum": "ed0317c322064f79466c02966bddb605ab37d998",
"_shrinkwrap": null,
"_spec": "ansi-regex@^3.0.0",
"_where": "/home/bernhard/freifunk-app/node_modules/jest/node_modules/strip-ansi",
"author": {
"email": "sindresorhus@gmail.com",
"name": "Sindre Sorhus",
"url": "sindresorhus.com"
},
"bugs": {
"url": "https://github.com/chalk/ansi-regex/issues"
},
"dependencies": {},
"description": "Regular expression for matching ANSI escape codes",
"devDependencies": {
"ava": "*",
"xo": "*"
},
"directories": {},
"dist": {
"shasum": "ed0317c322064f79466c02966bddb605ab37d998",
"tarball": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz"
},
"engines": {
"node": ">=4"
},
"files": [
"index.js"
],
"gitHead": "0a8cc19946c03c38520fe8c086b8adb66f9cce0b",
"homepage": "https://github.com/chalk/ansi-regex#readme",
"keywords": [
"256",
"ansi",
"cli",
"color",
"colors",
"colour",
"command-line",
"console",
"escape",
"find",
"formatting",
"match",
"pattern",
"re",
"regex",
"regexp",
"rgb",
"shell",
"string",
"styles",
"terminal",
"test",
"text",
"tty",
"xterm"
],
"license": "MIT",
"maintainers": [
{
"name": "dthree",
"email": "threedeecee@gmail.com"
},
{
"name": "qix",
"email": "i.am.qix@gmail.com"
},
{
"name": "sindresorhus",
"email": "sindresorhus@gmail.com"
}
],
"name": "ansi-regex",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "git+https://github.com/chalk/ansi-regex.git"
},
"scripts": {
"test": "xo && ava",
"view-supported": "node fixtures/view-codes.js"
},
"version": "3.0.0"
}

46
node_modules/jest/node_modules/ansi-regex/readme.md generated vendored Normal file
View File

@@ -0,0 +1,46 @@
# ansi-regex [![Build Status](https://travis-ci.org/chalk/ansi-regex.svg?branch=master)](https://travis-ci.org/chalk/ansi-regex)
> Regular expression for matching [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code)
## Install
```
$ npm install ansi-regex
```
## Usage
```js
const ansiRegex = require('ansi-regex');
ansiRegex().test('\u001B[4mcake\u001B[0m');
//=> true
ansiRegex().test('cake');
//=> false
'\u001B[4mcake\u001B[0m'.match(ansiRegex());
//=> ['\u001B[4m', '\u001B[0m']
```
## FAQ
### Why do you test for codes not in the ECMA 48 standard?
Some of the codes we run as a test are codes that we acquired finding various lists of non-standard or manufacturer specific codes. We test for both standard and non-standard codes, as most of them follow the same or similar format and can be safely matched in strings without the risk of removing actual string content. There are a few non-standard control codes that do not follow the traditional format (i.e. they end in numbers) thus forcing us to exclude them from the test because we cannot reliably match them.
On the historical side, those ECMA standards were established in the early 90's whereas the VT100, for example, was designed in the mid/late 70's. At that point in time, control codes were still pretty ungoverned and engineers used them for a multitude of things, namely to activate hardware ports that may have been proprietary. Somewhere else you see a similar 'anarchy' of codes is in the x86 architecture for processors; there are a ton of "interrupts" that can mean different things on certain brands of processors, most of which have been phased out.
## Maintainers
- [Sindre Sorhus](https://github.com/sindresorhus)
- [Josh Junon](https://github.com/qix-)
## License
MIT

165
node_modules/jest/node_modules/ansi-styles/index.js generated vendored Normal file
View File

@@ -0,0 +1,165 @@
'use strict';
const colorConvert = require('color-convert');
const wrapAnsi16 = (fn, offset) => function () {
const code = fn.apply(colorConvert, arguments);
return `\u001B[${code + offset}m`;
};
const wrapAnsi256 = (fn, offset) => function () {
const code = fn.apply(colorConvert, arguments);
return `\u001B[${38 + offset};5;${code}m`;
};
const wrapAnsi16m = (fn, offset) => function () {
const rgb = fn.apply(colorConvert, arguments);
return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
};
function assembleStyles() {
const codes = new Map();
const styles = {
modifier: {
reset: [0, 0],
// 21 isn't widely supported and 22 does the same thing
bold: [1, 22],
dim: [2, 22],
italic: [3, 23],
underline: [4, 24],
inverse: [7, 27],
hidden: [8, 28],
strikethrough: [9, 29]
},
color: {
black: [30, 39],
red: [31, 39],
green: [32, 39],
yellow: [33, 39],
blue: [34, 39],
magenta: [35, 39],
cyan: [36, 39],
white: [37, 39],
gray: [90, 39],
// Bright color
redBright: [91, 39],
greenBright: [92, 39],
yellowBright: [93, 39],
blueBright: [94, 39],
magentaBright: [95, 39],
cyanBright: [96, 39],
whiteBright: [97, 39]
},
bgColor: {
bgBlack: [40, 49],
bgRed: [41, 49],
bgGreen: [42, 49],
bgYellow: [43, 49],
bgBlue: [44, 49],
bgMagenta: [45, 49],
bgCyan: [46, 49],
bgWhite: [47, 49],
// Bright color
bgBlackBright: [100, 49],
bgRedBright: [101, 49],
bgGreenBright: [102, 49],
bgYellowBright: [103, 49],
bgBlueBright: [104, 49],
bgMagentaBright: [105, 49],
bgCyanBright: [106, 49],
bgWhiteBright: [107, 49]
}
};
// Fix humans
styles.color.grey = styles.color.gray;
for (const groupName of Object.keys(styles)) {
const group = styles[groupName];
for (const styleName of Object.keys(group)) {
const style = group[styleName];
styles[styleName] = {
open: `\u001B[${style[0]}m`,
close: `\u001B[${style[1]}m`
};
group[styleName] = styles[styleName];
codes.set(style[0], style[1]);
}
Object.defineProperty(styles, groupName, {
value: group,
enumerable: false
});
Object.defineProperty(styles, 'codes', {
value: codes,
enumerable: false
});
}
const ansi2ansi = n => n;
const rgb2rgb = (r, g, b) => [r, g, b];
styles.color.close = '\u001B[39m';
styles.bgColor.close = '\u001B[49m';
styles.color.ansi = {
ansi: wrapAnsi16(ansi2ansi, 0)
};
styles.color.ansi256 = {
ansi256: wrapAnsi256(ansi2ansi, 0)
};
styles.color.ansi16m = {
rgb: wrapAnsi16m(rgb2rgb, 0)
};
styles.bgColor.ansi = {
ansi: wrapAnsi16(ansi2ansi, 10)
};
styles.bgColor.ansi256 = {
ansi256: wrapAnsi256(ansi2ansi, 10)
};
styles.bgColor.ansi16m = {
rgb: wrapAnsi16m(rgb2rgb, 10)
};
for (let key of Object.keys(colorConvert)) {
if (typeof colorConvert[key] !== 'object') {
continue;
}
const suite = colorConvert[key];
if (key === 'ansi16') {
key = 'ansi';
}
if ('ansi16' in suite) {
styles.color.ansi[key] = wrapAnsi16(suite.ansi16, 0);
styles.bgColor.ansi[key] = wrapAnsi16(suite.ansi16, 10);
}
if ('ansi256' in suite) {
styles.color.ansi256[key] = wrapAnsi256(suite.ansi256, 0);
styles.bgColor.ansi256[key] = wrapAnsi256(suite.ansi256, 10);
}
if ('rgb' in suite) {
styles.color.ansi16m[key] = wrapAnsi16m(suite.rgb, 0);
styles.bgColor.ansi16m[key] = wrapAnsi16m(suite.rgb, 10);
}
}
return styles;
}
// Make the export immutable
Object.defineProperty(module, 'exports', {
enumerable: true,
get: assembleStyles
});

9
node_modules/jest/node_modules/ansi-styles/license generated vendored Normal file
View File

@@ -0,0 +1,9 @@
MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
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.

122
node_modules/jest/node_modules/ansi-styles/package.json generated vendored Normal file
View File

@@ -0,0 +1,122 @@
{
"_args": [
[
"ansi-styles@^3.2.1",
"/home/bernhard/freifunk-app/node_modules/jest/node_modules/chalk"
]
],
"_from": "ansi-styles@>=3.2.1 <4.0.0",
"_id": "ansi-styles@3.2.1",
"_inCache": true,
"_installable": true,
"_location": "/jest/ansi-styles",
"_nodeVersion": "8.9.4",
"_npmOperationalInternal": {
"host": "s3://npm-registry-packages",
"tmp": "tmp/ansi-styles_3.2.1_1519983600652_0.7656433427334486"
},
"_npmUser": {
"email": "sindresorhus@gmail.com",
"name": "sindresorhus"
},
"_npmVersion": "5.6.0",
"_phantomChildren": {},
"_requested": {
"name": "ansi-styles",
"raw": "ansi-styles@^3.2.1",
"rawSpec": "^3.2.1",
"scope": null,
"spec": ">=3.2.1 <4.0.0",
"type": "range"
},
"_requiredBy": [
"/jest/chalk"
],
"_resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
"_shasum": "41fbb20243e50b12be0f04b8dedbf07520ce841d",
"_shrinkwrap": null,
"_spec": "ansi-styles@^3.2.1",
"_where": "/home/bernhard/freifunk-app/node_modules/jest/node_modules/chalk",
"author": {
"email": "sindresorhus@gmail.com",
"name": "Sindre Sorhus",
"url": "sindresorhus.com"
},
"ava": {
"require": "babel-polyfill"
},
"bugs": {
"url": "https://github.com/chalk/ansi-styles/issues"
},
"dependencies": {
"color-convert": "^1.9.0"
},
"description": "ANSI escape codes for styling strings in the terminal",
"devDependencies": {
"ava": "*",
"babel-polyfill": "^6.23.0",
"svg-term-cli": "^2.1.1",
"xo": "*"
},
"directories": {},
"dist": {
"fileCount": 4,
"integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
"shasum": "41fbb20243e50b12be0f04b8dedbf07520ce841d",
"tarball": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
"unpackedSize": 9371
},
"engines": {
"node": ">=4"
},
"files": [
"index.js"
],
"gitHead": "de7527a86c1cf49906b0eb32a0de1402d849ccc2",
"homepage": "https://github.com/chalk/ansi-styles#readme",
"keywords": [
"256",
"ansi",
"cli",
"color",
"colors",
"colour",
"command-line",
"console",
"escape",
"formatting",
"log",
"logging",
"rgb",
"shell",
"string",
"styles",
"terminal",
"text",
"tty",
"xterm"
],
"license": "MIT",
"maintainers": [
{
"name": "qix",
"email": "i.am.qix@gmail.com"
},
{
"name": "sindresorhus",
"email": "sindresorhus@gmail.com"
}
],
"name": "ansi-styles",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "git+https://github.com/chalk/ansi-styles.git"
},
"scripts": {
"screenshot": "svg-term --command='node screenshot' --out=screenshot.svg --padding=3 --width=55 --height=3 --at=1000 --no-cursor",
"test": "xo && ava"
},
"version": "3.2.1"
}

147
node_modules/jest/node_modules/ansi-styles/readme.md generated vendored Normal file
View File

@@ -0,0 +1,147 @@
# ansi-styles [![Build Status](https://travis-ci.org/chalk/ansi-styles.svg?branch=master)](https://travis-ci.org/chalk/ansi-styles)
> [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) for styling strings in the terminal
You probably want the higher-level [chalk](https://github.com/chalk/chalk) module for styling your strings.
<img src="https://cdn.rawgit.com/chalk/ansi-styles/8261697c95bf34b6c7767e2cbe9941a851d59385/screenshot.svg" width="900">
## Install
```
$ npm install ansi-styles
```
## Usage
```js
const style = require('ansi-styles');
console.log(`${style.green.open}Hello world!${style.green.close}`);
// Color conversion between 16/256/truecolor
// NOTE: If conversion goes to 16 colors or 256 colors, the original color
// may be degraded to fit that color palette. This means terminals
// that do not support 16 million colors will best-match the
// original color.
console.log(style.bgColor.ansi.hsl(120, 80, 72) + 'Hello world!' + style.bgColor.close);
console.log(style.color.ansi256.rgb(199, 20, 250) + 'Hello world!' + style.color.close);
console.log(style.color.ansi16m.hex('#ABCDEF') + 'Hello world!' + style.color.close);
```
## API
Each style has an `open` and `close` property.
## Styles
### Modifiers
- `reset`
- `bold`
- `dim`
- `italic` *(Not widely supported)*
- `underline`
- `inverse`
- `hidden`
- `strikethrough` *(Not widely supported)*
### Colors
- `black`
- `red`
- `green`
- `yellow`
- `blue`
- `magenta`
- `cyan`
- `white`
- `gray` ("bright black")
- `redBright`
- `greenBright`
- `yellowBright`
- `blueBright`
- `magentaBright`
- `cyanBright`
- `whiteBright`
### Background colors
- `bgBlack`
- `bgRed`
- `bgGreen`
- `bgYellow`
- `bgBlue`
- `bgMagenta`
- `bgCyan`
- `bgWhite`
- `bgBlackBright`
- `bgRedBright`
- `bgGreenBright`
- `bgYellowBright`
- `bgBlueBright`
- `bgMagentaBright`
- `bgCyanBright`
- `bgWhiteBright`
## Advanced usage
By default, you get a map of styles, but the styles are also available as groups. They are non-enumerable so they don't show up unless you access them explicitly. This makes it easier to expose only a subset in a higher-level module.
- `style.modifier`
- `style.color`
- `style.bgColor`
###### Example
```js
console.log(style.color.green.open);
```
Raw escape codes (i.e. without the CSI escape prefix `\u001B[` and render mode postfix `m`) are available under `style.codes`, which returns a `Map` with the open codes as keys and close codes as values.
###### Example
```js
console.log(style.codes.get(36));
//=> 39
```
## [256 / 16 million (TrueColor) support](https://gist.github.com/XVilka/8346728)
`ansi-styles` uses the [`color-convert`](https://github.com/Qix-/color-convert) package to allow for converting between various colors and ANSI escapes, with support for 256 and 16 million colors.
To use these, call the associated conversion function with the intended output, for example:
```js
style.color.ansi.rgb(100, 200, 15); // RGB to 16 color ansi foreground code
style.bgColor.ansi.rgb(100, 200, 15); // RGB to 16 color ansi background code
style.color.ansi256.hsl(120, 100, 60); // HSL to 256 color ansi foreground code
style.bgColor.ansi256.hsl(120, 100, 60); // HSL to 256 color ansi foreground code
style.color.ansi16m.hex('#C0FFEE'); // Hex (RGB) to 16 million color foreground code
style.bgColor.ansi16m.hex('#C0FFEE'); // Hex (RGB) to 16 million color background code
```
## Related
- [ansi-escapes](https://github.com/sindresorhus/ansi-escapes) - ANSI escape codes for manipulating the terminal
## Maintainers
- [Sindre Sorhus](https://github.com/sindresorhus)
- [Josh Junon](https://github.com/qix-)
## License
MIT

228
node_modules/jest/node_modules/chalk/index.js generated vendored Normal file
View File

@@ -0,0 +1,228 @@
'use strict';
const escapeStringRegexp = require('escape-string-regexp');
const ansiStyles = require('ansi-styles');
const stdoutColor = require('supports-color').stdout;
const template = require('./templates.js');
const isSimpleWindowsTerm = process.platform === 'win32' && !(process.env.TERM || '').toLowerCase().startsWith('xterm');
// `supportsColor.level` → `ansiStyles.color[name]` mapping
const levelMapping = ['ansi', 'ansi', 'ansi256', 'ansi16m'];
// `color-convert` models to exclude from the Chalk API due to conflicts and such
const skipModels = new Set(['gray']);
const styles = Object.create(null);
function applyOptions(obj, options) {
options = options || {};
// Detect level if not set manually
const scLevel = stdoutColor ? stdoutColor.level : 0;
obj.level = options.level === undefined ? scLevel : options.level;
obj.enabled = 'enabled' in options ? options.enabled : obj.level > 0;
}
function Chalk(options) {
// We check for this.template here since calling `chalk.constructor()`
// by itself will have a `this` of a previously constructed chalk object
if (!this || !(this instanceof Chalk) || this.template) {
const chalk = {};
applyOptions(chalk, options);
chalk.template = function () {
const args = [].slice.call(arguments);
return chalkTag.apply(null, [chalk.template].concat(args));
};
Object.setPrototypeOf(chalk, Chalk.prototype);
Object.setPrototypeOf(chalk.template, chalk);
chalk.template.constructor = Chalk;
return chalk.template;
}
applyOptions(this, options);
}
// Use bright blue on Windows as the normal blue color is illegible
if (isSimpleWindowsTerm) {
ansiStyles.blue.open = '\u001B[94m';
}
for (const key of Object.keys(ansiStyles)) {
ansiStyles[key].closeRe = new RegExp(escapeStringRegexp(ansiStyles[key].close), 'g');
styles[key] = {
get() {
const codes = ansiStyles[key];
return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, key);
}
};
}
styles.visible = {
get() {
return build.call(this, this._styles || [], true, 'visible');
}
};
ansiStyles.color.closeRe = new RegExp(escapeStringRegexp(ansiStyles.color.close), 'g');
for (const model of Object.keys(ansiStyles.color.ansi)) {
if (skipModels.has(model)) {
continue;
}
styles[model] = {
get() {
const level = this.level;
return function () {
const open = ansiStyles.color[levelMapping[level]][model].apply(null, arguments);
const codes = {
open,
close: ansiStyles.color.close,
closeRe: ansiStyles.color.closeRe
};
return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model);
};
}
};
}
ansiStyles.bgColor.closeRe = new RegExp(escapeStringRegexp(ansiStyles.bgColor.close), 'g');
for (const model of Object.keys(ansiStyles.bgColor.ansi)) {
if (skipModels.has(model)) {
continue;
}
const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1);
styles[bgModel] = {
get() {
const level = this.level;
return function () {
const open = ansiStyles.bgColor[levelMapping[level]][model].apply(null, arguments);
const codes = {
open,
close: ansiStyles.bgColor.close,
closeRe: ansiStyles.bgColor.closeRe
};
return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model);
};
}
};
}
const proto = Object.defineProperties(() => {}, styles);
function build(_styles, _empty, key) {
const builder = function () {
return applyStyle.apply(builder, arguments);
};
builder._styles = _styles;
builder._empty = _empty;
const self = this;
Object.defineProperty(builder, 'level', {
enumerable: true,
get() {
return self.level;
},
set(level) {
self.level = level;
}
});
Object.defineProperty(builder, 'enabled', {
enumerable: true,
get() {
return self.enabled;
},
set(enabled) {
self.enabled = enabled;
}
});
// See below for fix regarding invisible grey/dim combination on Windows
builder.hasGrey = this.hasGrey || key === 'gray' || key === 'grey';
// `__proto__` is used because we must return a function, but there is
// no way to create a function with a different prototype
builder.__proto__ = proto; // eslint-disable-line no-proto
return builder;
}
function applyStyle() {
// Support varags, but simply cast to string in case there's only one arg
const args = arguments;
const argsLen = args.length;
let str = String(arguments[0]);
if (argsLen === 0) {
return '';
}
if (argsLen > 1) {
// Don't slice `arguments`, it prevents V8 optimizations
for (let a = 1; a < argsLen; a++) {
str += ' ' + args[a];
}
}
if (!this.enabled || this.level <= 0 || !str) {
return this._empty ? '' : str;
}
// Turns out that on Windows dimmed gray text becomes invisible in cmd.exe,
// see https://github.com/chalk/chalk/issues/58
// If we're on Windows and we're dealing with a gray color, temporarily make 'dim' a noop.
const originalDim = ansiStyles.dim.open;
if (isSimpleWindowsTerm && this.hasGrey) {
ansiStyles.dim.open = '';
}
for (const code of this._styles.slice().reverse()) {
// Replace any instances already present with a re-opening code
// otherwise only the part of the string until said closing code
// will be colored, and the rest will simply be 'plain'.
str = code.open + str.replace(code.closeRe, code.open) + code.close;
// Close the styling before a linebreak and reopen
// after next line to fix a bleed issue on macOS
// https://github.com/chalk/chalk/pull/92
str = str.replace(/\r?\n/g, `${code.close}$&${code.open}`);
}
// Reset the original `dim` if we changed it to work around the Windows dimmed gray issue
ansiStyles.dim.open = originalDim;
return str;
}
function chalkTag(chalk, strings) {
if (!Array.isArray(strings)) {
// If chalk() was called by itself or with a string,
// return the string itself as a string.
return [].slice.call(arguments, 1).join(' ');
}
const args = [].slice.call(arguments, 2);
const parts = [strings.raw[0]];
for (let i = 1; i < strings.length; i++) {
parts.push(String(args[i - 1]).replace(/[{}\\]/g, '\\$&'));
parts.push(String(strings.raw[i]));
}
return template(chalk, parts.join(''));
}
Object.defineProperties(Chalk.prototype, styles);
module.exports = Chalk(); // eslint-disable-line new-cap
module.exports.supportsColor = stdoutColor;
module.exports.default = module.exports; // For TypeScript

93
node_modules/jest/node_modules/chalk/index.js.flow generated vendored Normal file
View File

@@ -0,0 +1,93 @@
// @flow
type TemplateStringsArray = $ReadOnlyArray<string>;
export type Level = $Values<{
None: 0,
Basic: 1,
Ansi256: 2,
TrueColor: 3
}>;
export type ChalkOptions = {|
enabled?: boolean,
level?: Level
|};
export type ColorSupport = {|
level: Level,
hasBasic: boolean,
has256: boolean,
has16m: boolean
|};
export interface Chalk {
(...text: string[]): string,
(text: TemplateStringsArray, ...placeholders: string[]): string,
constructor(options?: ChalkOptions): Chalk,
enabled: boolean,
level: Level,
rgb(r: number, g: number, b: number): Chalk,
hsl(h: number, s: number, l: number): Chalk,
hsv(h: number, s: number, v: number): Chalk,
hwb(h: number, w: number, b: number): Chalk,
bgHex(color: string): Chalk,
bgKeyword(color: string): Chalk,
bgRgb(r: number, g: number, b: number): Chalk,
bgHsl(h: number, s: number, l: number): Chalk,
bgHsv(h: number, s: number, v: number): Chalk,
bgHwb(h: number, w: number, b: number): Chalk,
hex(color: string): Chalk,
keyword(color: string): Chalk,
+reset: Chalk,
+bold: Chalk,
+dim: Chalk,
+italic: Chalk,
+underline: Chalk,
+inverse: Chalk,
+hidden: Chalk,
+strikethrough: Chalk,
+visible: Chalk,
+black: Chalk,
+red: Chalk,
+green: Chalk,
+yellow: Chalk,
+blue: Chalk,
+magenta: Chalk,
+cyan: Chalk,
+white: Chalk,
+gray: Chalk,
+grey: Chalk,
+blackBright: Chalk,
+redBright: Chalk,
+greenBright: Chalk,
+yellowBright: Chalk,
+blueBright: Chalk,
+magentaBright: Chalk,
+cyanBright: Chalk,
+whiteBright: Chalk,
+bgBlack: Chalk,
+bgRed: Chalk,
+bgGreen: Chalk,
+bgYellow: Chalk,
+bgBlue: Chalk,
+bgMagenta: Chalk,
+bgCyan: Chalk,
+bgWhite: Chalk,
+bgBlackBright: Chalk,
+bgRedBright: Chalk,
+bgGreenBright: Chalk,
+bgYellowBright: Chalk,
+bgBlueBright: Chalk,
+bgMagentaBright: Chalk,
+bgCyanBright: Chalk,
+bgWhiteBrigh: Chalk,
supportsColor: ColorSupport
};
declare module.exports: Chalk;

9
node_modules/jest/node_modules/chalk/license generated vendored Normal file
View File

@@ -0,0 +1,9 @@
MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
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.

142
node_modules/jest/node_modules/chalk/package.json generated vendored Normal file
View File

@@ -0,0 +1,142 @@
{
"_args": [
[
"chalk@^2.0.1",
"/home/bernhard/freifunk-app/node_modules/jest/node_modules/jest-cli"
]
],
"_from": "chalk@>=2.0.1 <3.0.0",
"_id": "chalk@2.4.1",
"_inCache": true,
"_installable": true,
"_location": "/jest/chalk",
"_nodeVersion": "8.11.1",
"_npmOperationalInternal": {
"host": "s3://npm-registry-packages",
"tmp": "tmp/chalk_2.4.1_1524719751701_0.7780175911150953"
},
"_npmUser": {
"email": "sindresorhus@gmail.com",
"name": "sindresorhus"
},
"_npmVersion": "5.6.0",
"_phantomChildren": {},
"_requested": {
"name": "chalk",
"raw": "chalk@^2.0.1",
"rawSpec": "^2.0.1",
"scope": null,
"spec": ">=2.0.1 <3.0.0",
"type": "range"
},
"_requiredBy": [
"/jest/jest-cli"
],
"_resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz",
"_shasum": "18c49ab16a037b6eb0152cc83e3471338215b66e",
"_shrinkwrap": null,
"_spec": "chalk@^2.0.1",
"_where": "/home/bernhard/freifunk-app/node_modules/jest/node_modules/jest-cli",
"bugs": {
"url": "https://github.com/chalk/chalk/issues"
},
"dependencies": {
"ansi-styles": "^3.2.1",
"escape-string-regexp": "^1.0.5",
"supports-color": "^5.3.0"
},
"description": "Terminal string styling done right",
"devDependencies": {
"ava": "*",
"coveralls": "^3.0.0",
"execa": "^0.9.0",
"flow-bin": "^0.68.0",
"import-fresh": "^2.0.0",
"matcha": "^0.7.0",
"nyc": "^11.0.2",
"resolve-from": "^4.0.0",
"typescript": "^2.5.3",
"xo": "*"
},
"directories": {},
"dist": {
"fileCount": 7,
"integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==",
"npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa4WCICRA9TVsSAnZWagAAhgwP/2M/ItinhR06BFhLMh91\nK/ru5t71NzSzoEvI2nh4W57Wk9cU1NOYi1cI17nUvICHCL4Vq9mjvU0hajTw\ncAYtM0Lwl+G4Hk4JtuiZITYj93QY3yLSJ8zkj95JznFbH0Zd9KkZrkoGukcG\nFY9at0cfNyhBmwi5sEDAFktcw7wThQ6Wy3iIttQ0N1M6Lf1XILg9Xyq6Id/W\nlz3TbkCt6AZCS1icmDPIiLdVQuD9SfpusIDsHm5/6FJPShwmQjUlM6Kdy7lx\n6M8uhcIknpxjfPTA6/aSBC4qgXnDhuPPi9xF657/81Mswz4Tb71KOf6UqLPi\n3zk1D5PF71ujWs3wmPll9TAVGnWuNzE+X/7GVIB4qCrib3SgvRzMhL0Wo95v\nzxTpNoD23hKYwofUyV3cTFh47YwkVoPtOStRAgdE87rx+v3VjbWSThQJc3V8\nHOsIeTjpQMwAr/d2DnasHKlps/q+gnGKqhBhcf11tAKn9C7PsAQ2l6+E4Erc\nfPKqDRC6TVG7ABdwOtyNonHhrJ2JLgYj8d4mHdtsMTtFsUTOQR/+Rx0V8HJS\n9gBLmPr3yc/yEedYW68wP5tPK2SfvFTzgMBw5v0+tgIxOjUunGxDUV4a1Bpp\npCBLN7iS77FLMiMonfcD2z/SsoB+Hb+7q5eT/gua3BIUNNZEdmgw9queXw+q\n7DFE\r\n=LSlF\r\n-----END PGP SIGNATURE-----\r\n",
"shasum": "18c49ab16a037b6eb0152cc83e3471338215b66e",
"tarball": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz",
"unpackedSize": 26917
},
"engines": {
"node": ">=4"
},
"files": [
"index.js",
"index.js.flow",
"templates.js",
"types/index.d.ts"
],
"gitHead": "48ba5b0b9beadcabd9fc406ac4d9337d8fa6b36d",
"homepage": "https://github.com/chalk/chalk#readme",
"keywords": [
"256",
"ansi",
"cli",
"color",
"colors",
"colour",
"command-line",
"console",
"formatting",
"log",
"logging",
"rgb",
"shell",
"str",
"string",
"style",
"styles",
"terminal",
"text",
"tty",
"xterm"
],
"license": "MIT",
"maintainers": [
{
"name": "qix",
"email": "i.am.qix@gmail.com"
},
{
"name": "sindresorhus",
"email": "sindresorhus@gmail.com"
},
{
"name": "unicorn",
"email": "sindresorhus+unicorn@gmail.com"
}
],
"name": "chalk",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "git+https://github.com/chalk/chalk.git"
},
"scripts": {
"bench": "matcha benchmark.js",
"coveralls": "nyc report --reporter=text-lcov | coveralls",
"test": "xo && tsc --project types && flow --max-warnings=0 && nyc ava"
},
"types": "types/index.d.ts",
"version": "2.4.1",
"xo": {
"envs": [
"mocha",
"node"
],
"ignores": [
"test/_flow.js"
]
}
}

314
node_modules/jest/node_modules/chalk/readme.md generated vendored Normal file
View File

@@ -0,0 +1,314 @@
<h1 align="center">
<br>
<br>
<img width="320" src="media/logo.svg" alt="Chalk">
<br>
<br>
<br>
</h1>
> Terminal string styling done right
[![Build Status](https://travis-ci.org/chalk/chalk.svg?branch=master)](https://travis-ci.org/chalk/chalk) [![Coverage Status](https://coveralls.io/repos/github/chalk/chalk/badge.svg?branch=master)](https://coveralls.io/github/chalk/chalk?branch=master) [![](https://img.shields.io/badge/unicorn-approved-ff69b4.svg)](https://www.youtube.com/watch?v=9auOCbH5Ns4) [![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/xojs/xo) [![Mentioned in Awesome Node.js](https://awesome.re/mentioned-badge.svg)](https://github.com/sindresorhus/awesome-nodejs)
### [See what's new in Chalk 2](https://github.com/chalk/chalk/releases/tag/v2.0.0)
<img src="https://cdn.rawgit.com/chalk/ansi-styles/8261697c95bf34b6c7767e2cbe9941a851d59385/screenshot.svg" alt="" width="900">
## Highlights
- Expressive API
- Highly performant
- Ability to nest styles
- [256/Truecolor color support](#256-and-truecolor-color-support)
- Auto-detects color support
- Doesn't extend `String.prototype`
- Clean and focused
- Actively maintained
- [Used by ~23,000 packages](https://www.npmjs.com/browse/depended/chalk) as of December 31, 2017
## Install
```console
$ npm install chalk
```
<a href="https://www.patreon.com/sindresorhus">
<img src="https://c5.patreon.com/external/logo/become_a_patron_button@2x.png" width="160">
</a>
## Usage
```js
const chalk = require('chalk');
console.log(chalk.blue('Hello world!'));
```
Chalk comes with an easy to use composable API where you just chain and nest the styles you want.
```js
const chalk = require('chalk');
const log = console.log;
// Combine styled and normal strings
log(chalk.blue('Hello') + ' World' + chalk.red('!'));
// Compose multiple styles using the chainable API
log(chalk.blue.bgRed.bold('Hello world!'));
// Pass in multiple arguments
log(chalk.blue('Hello', 'World!', 'Foo', 'bar', 'biz', 'baz'));
// Nest styles
log(chalk.red('Hello', chalk.underline.bgBlue('world') + '!'));
// Nest styles of the same type even (color, underline, background)
log(chalk.green(
'I am a green line ' +
chalk.blue.underline.bold('with a blue substring') +
' that becomes green again!'
));
// ES2015 template literal
log(`
CPU: ${chalk.red('90%')}
RAM: ${chalk.green('40%')}
DISK: ${chalk.yellow('70%')}
`);
// ES2015 tagged template literal
log(chalk`
CPU: {red ${cpu.totalPercent}%}
RAM: {green ${ram.used / ram.total * 100}%}
DISK: {rgb(255,131,0) ${disk.used / disk.total * 100}%}
`);
// Use RGB colors in terminal emulators that support it.
log(chalk.keyword('orange')('Yay for orange colored text!'));
log(chalk.rgb(123, 45, 67).underline('Underlined reddish color'));
log(chalk.hex('#DEADED').bold('Bold gray!'));
```
Easily define your own themes:
```js
const chalk = require('chalk');
const error = chalk.bold.red;
const warning = chalk.keyword('orange');
console.log(error('Error!'));
console.log(warning('Warning!'));
```
Take advantage of console.log [string substitution](https://nodejs.org/docs/latest/api/console.html#console_console_log_data_args):
```js
const name = 'Sindre';
console.log(chalk.green('Hello %s'), name);
//=> 'Hello Sindre'
```
## API
### chalk.`<style>[.<style>...](string, [string...])`
Example: `chalk.red.bold.underline('Hello', 'world');`
Chain [styles](#styles) and call the last one as a method with a string argument. Order doesn't matter, and later styles take precedent in case of a conflict. This simply means that `chalk.red.yellow.green` is equivalent to `chalk.green`.
Multiple arguments will be separated by space.
### chalk.enabled
Color support is automatically detected, as is the level (see `chalk.level`). However, if you'd like to simply enable/disable Chalk, you can do so via the `.enabled` property.
Chalk is enabled by default unless explicitly disabled via the constructor or `chalk.level` is `0`.
If you need to change this in a reusable module, create a new instance:
```js
const ctx = new chalk.constructor({enabled: false});
```
### chalk.level
Color support is automatically detected, but you can override it by setting the `level` property. You should however only do this in your own code as it applies globally to all Chalk consumers.
If you need to change this in a reusable module, create a new instance:
```js
const ctx = new chalk.constructor({level: 0});
```
Levels are as follows:
0. All colors disabled
1. Basic color support (16 colors)
2. 256 color support
3. Truecolor support (16 million colors)
### chalk.supportsColor
Detect whether the terminal [supports color](https://github.com/chalk/supports-color). Used internally and handled for you, but exposed for convenience.
Can be overridden by the user with the flags `--color` and `--no-color`. For situations where using `--color` is not possible, add the environment variable `FORCE_COLOR=1` to forcefully enable color or `FORCE_COLOR=0` to forcefully disable. The use of `FORCE_COLOR` overrides all other color support checks.
Explicit 256/Truecolor mode can be enabled using the `--color=256` and `--color=16m` flags, respectively.
## Styles
### Modifiers
- `reset`
- `bold`
- `dim`
- `italic` *(Not widely supported)*
- `underline`
- `inverse`
- `hidden`
- `strikethrough` *(Not widely supported)*
- `visible` (Text is emitted only if enabled)
### Colors
- `black`
- `red`
- `green`
- `yellow`
- `blue` *(On Windows the bright version is used since normal blue is illegible)*
- `magenta`
- `cyan`
- `white`
- `gray` ("bright black")
- `redBright`
- `greenBright`
- `yellowBright`
- `blueBright`
- `magentaBright`
- `cyanBright`
- `whiteBright`
### Background colors
- `bgBlack`
- `bgRed`
- `bgGreen`
- `bgYellow`
- `bgBlue`
- `bgMagenta`
- `bgCyan`
- `bgWhite`
- `bgBlackBright`
- `bgRedBright`
- `bgGreenBright`
- `bgYellowBright`
- `bgBlueBright`
- `bgMagentaBright`
- `bgCyanBright`
- `bgWhiteBright`
## Tagged template literal
Chalk can be used as a [tagged template literal](http://exploringjs.com/es6/ch_template-literals.html#_tagged-template-literals).
```js
const chalk = require('chalk');
const miles = 18;
const calculateFeet = miles => miles * 5280;
console.log(chalk`
There are {bold 5280 feet} in a mile.
In {bold ${miles} miles}, there are {green.bold ${calculateFeet(miles)} feet}.
`);
```
Blocks are delimited by an opening curly brace (`{`), a style, some content, and a closing curly brace (`}`).
Template styles are chained exactly like normal Chalk styles. The following two statements are equivalent:
```js
console.log(chalk.bold.rgb(10, 100, 200)('Hello!'));
console.log(chalk`{bold.rgb(10,100,200) Hello!}`);
```
Note that function styles (`rgb()`, `hsl()`, `keyword()`, etc.) may not contain spaces between parameters.
All interpolated values (`` chalk`${foo}` ``) are converted to strings via the `.toString()` method. All curly braces (`{` and `}`) in interpolated value strings are escaped.
## 256 and Truecolor color support
Chalk supports 256 colors and [Truecolor](https://gist.github.com/XVilka/8346728) (16 million colors) on supported terminal apps.
Colors are downsampled from 16 million RGB values to an ANSI color format that is supported by the terminal emulator (or by specifying `{level: n}` as a Chalk option). For example, Chalk configured to run at level 1 (basic color support) will downsample an RGB value of #FF0000 (red) to 31 (ANSI escape for red).
Examples:
- `chalk.hex('#DEADED').underline('Hello, world!')`
- `chalk.keyword('orange')('Some orange text')`
- `chalk.rgb(15, 100, 204).inverse('Hello!')`
Background versions of these models are prefixed with `bg` and the first level of the module capitalized (e.g. `keyword` for foreground colors and `bgKeyword` for background colors).
- `chalk.bgHex('#DEADED').underline('Hello, world!')`
- `chalk.bgKeyword('orange')('Some orange text')`
- `chalk.bgRgb(15, 100, 204).inverse('Hello!')`
The following color models can be used:
- [`rgb`](https://en.wikipedia.org/wiki/RGB_color_model) - Example: `chalk.rgb(255, 136, 0).bold('Orange!')`
- [`hex`](https://en.wikipedia.org/wiki/Web_colors#Hex_triplet) - Example: `chalk.hex('#FF8800').bold('Orange!')`
- [`keyword`](https://www.w3.org/wiki/CSS/Properties/color/keywords) (CSS keywords) - Example: `chalk.keyword('orange').bold('Orange!')`
- [`hsl`](https://en.wikipedia.org/wiki/HSL_and_HSV) - Example: `chalk.hsl(32, 100, 50).bold('Orange!')`
- [`hsv`](https://en.wikipedia.org/wiki/HSL_and_HSV) - Example: `chalk.hsv(32, 100, 100).bold('Orange!')`
- [`hwb`](https://en.wikipedia.org/wiki/HWB_color_model) - Example: `chalk.hwb(32, 0, 50).bold('Orange!')`
- `ansi16`
- `ansi256`
## Windows
If you're on Windows, do yourself a favor and use [`cmder`](http://cmder.net/) instead of `cmd.exe`.
## Origin story
[colors.js](https://github.com/Marak/colors.js) used to be the most popular string styling module, but it has serious deficiencies like extending `String.prototype` which causes all kinds of [problems](https://github.com/yeoman/yo/issues/68) and the package is unmaintained. Although there are other packages, they either do too much or not enough. Chalk is a clean and focused alternative.
## Related
- [chalk-cli](https://github.com/chalk/chalk-cli) - CLI for this module
- [ansi-styles](https://github.com/chalk/ansi-styles) - ANSI escape codes for styling strings in the terminal
- [supports-color](https://github.com/chalk/supports-color) - Detect whether a terminal supports color
- [strip-ansi](https://github.com/chalk/strip-ansi) - Strip ANSI escape codes
- [strip-ansi-stream](https://github.com/chalk/strip-ansi-stream) - Strip ANSI escape codes from a stream
- [has-ansi](https://github.com/chalk/has-ansi) - Check if a string has ANSI escape codes
- [ansi-regex](https://github.com/chalk/ansi-regex) - Regular expression for matching ANSI escape codes
- [wrap-ansi](https://github.com/chalk/wrap-ansi) - Wordwrap a string with ANSI escape codes
- [slice-ansi](https://github.com/chalk/slice-ansi) - Slice a string with ANSI escape codes
- [color-convert](https://github.com/qix-/color-convert) - Converts colors between different models
- [chalk-animation](https://github.com/bokub/chalk-animation) - Animate strings in the terminal
- [gradient-string](https://github.com/bokub/gradient-string) - Apply color gradients to strings
- [chalk-pipe](https://github.com/LitoMore/chalk-pipe) - Create chalk style schemes with simpler style strings
- [terminal-link](https://github.com/sindresorhus/terminal-link) - Create clickable links in the terminal
## Maintainers
- [Sindre Sorhus](https://github.com/sindresorhus)
- [Josh Junon](https://github.com/qix-)
## License
MIT

128
node_modules/jest/node_modules/chalk/templates.js generated vendored Normal file
View File

@@ -0,0 +1,128 @@
'use strict';
const TEMPLATE_REGEX = /(?:\\(u[a-f\d]{4}|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
const ESCAPE_REGEX = /\\(u[a-f\d]{4}|x[a-f\d]{2}|.)|([^\\])/gi;
const ESCAPES = new Map([
['n', '\n'],
['r', '\r'],
['t', '\t'],
['b', '\b'],
['f', '\f'],
['v', '\v'],
['0', '\0'],
['\\', '\\'],
['e', '\u001B'],
['a', '\u0007']
]);
function unescape(c) {
if ((c[0] === 'u' && c.length === 5) || (c[0] === 'x' && c.length === 3)) {
return String.fromCharCode(parseInt(c.slice(1), 16));
}
return ESCAPES.get(c) || c;
}
function parseArguments(name, args) {
const results = [];
const chunks = args.trim().split(/\s*,\s*/g);
let matches;
for (const chunk of chunks) {
if (!isNaN(chunk)) {
results.push(Number(chunk));
} else if ((matches = chunk.match(STRING_REGEX))) {
results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, chr) => escape ? unescape(escape) : chr));
} else {
throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`);
}
}
return results;
}
function parseStyle(style) {
STYLE_REGEX.lastIndex = 0;
const results = [];
let matches;
while ((matches = STYLE_REGEX.exec(style)) !== null) {
const name = matches[1];
if (matches[2]) {
const args = parseArguments(name, matches[2]);
results.push([name].concat(args));
} else {
results.push([name]);
}
}
return results;
}
function buildStyle(chalk, styles) {
const enabled = {};
for (const layer of styles) {
for (const style of layer.styles) {
enabled[style[0]] = layer.inverse ? null : style.slice(1);
}
}
let current = chalk;
for (const styleName of Object.keys(enabled)) {
if (Array.isArray(enabled[styleName])) {
if (!(styleName in current)) {
throw new Error(`Unknown Chalk style: ${styleName}`);
}
if (enabled[styleName].length > 0) {
current = current[styleName].apply(current, enabled[styleName]);
} else {
current = current[styleName];
}
}
}
return current;
}
module.exports = (chalk, tmp) => {
const styles = [];
const chunks = [];
let chunk = [];
// eslint-disable-next-line max-params
tmp.replace(TEMPLATE_REGEX, (m, escapeChar, inverse, style, close, chr) => {
if (escapeChar) {
chunk.push(unescape(escapeChar));
} else if (style) {
const str = chunk.join('');
chunk = [];
chunks.push(styles.length === 0 ? str : buildStyle(chalk, styles)(str));
styles.push({inverse, styles: parseStyle(style)});
} else if (close) {
if (styles.length === 0) {
throw new Error('Found extraneous } in Chalk template literal');
}
chunks.push(buildStyle(chalk, styles)(chunk.join('')));
chunk = [];
styles.pop();
} else {
chunk.push(chr);
}
});
chunks.push(chunk.join(''));
if (styles.length > 0) {
const errMsg = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? '' : 's'} (\`}\`)`;
throw new Error(errMsg);
}
return chunks.join('');
};

97
node_modules/jest/node_modules/chalk/types/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,97 @@
// Type definitions for Chalk
// Definitions by: Thomas Sauer <https://github.com/t-sauer>
export const enum Level {
None = 0,
Basic = 1,
Ansi256 = 2,
TrueColor = 3
}
export interface ChalkOptions {
enabled?: boolean;
level?: Level;
}
export interface ChalkConstructor {
new (options?: ChalkOptions): Chalk;
(options?: ChalkOptions): Chalk;
}
export interface ColorSupport {
level: Level;
hasBasic: boolean;
has256: boolean;
has16m: boolean;
}
export interface Chalk {
(...text: string[]): string;
(text: TemplateStringsArray, ...placeholders: string[]): string;
constructor: ChalkConstructor;
enabled: boolean;
level: Level;
rgb(r: number, g: number, b: number): this;
hsl(h: number, s: number, l: number): this;
hsv(h: number, s: number, v: number): this;
hwb(h: number, w: number, b: number): this;
bgHex(color: string): this;
bgKeyword(color: string): this;
bgRgb(r: number, g: number, b: number): this;
bgHsl(h: number, s: number, l: number): this;
bgHsv(h: number, s: number, v: number): this;
bgHwb(h: number, w: number, b: number): this;
hex(color: string): this;
keyword(color: string): this;
readonly reset: this;
readonly bold: this;
readonly dim: this;
readonly italic: this;
readonly underline: this;
readonly inverse: this;
readonly hidden: this;
readonly strikethrough: this;
readonly visible: this;
readonly black: this;
readonly red: this;
readonly green: this;
readonly yellow: this;
readonly blue: this;
readonly magenta: this;
readonly cyan: this;
readonly white: this;
readonly gray: this;
readonly grey: this;
readonly blackBright: this;
readonly redBright: this;
readonly greenBright: this;
readonly yellowBright: this;
readonly blueBright: this;
readonly magentaBright: this;
readonly cyanBright: this;
readonly whiteBright: this;
readonly bgBlack: this;
readonly bgRed: this;
readonly bgGreen: this;
readonly bgYellow: this;
readonly bgBlue: this;
readonly bgMagenta: this;
readonly bgCyan: this;
readonly bgWhite: this;
readonly bgBlackBright: this;
readonly bgRedBright: this;
readonly bgGreenBright: this;
readonly bgYellowBright: this;
readonly bgBlueBright: this;
readonly bgMagentaBright: this;
readonly bgCyanBright: this;
readonly bgWhiteBright: this;
}
declare const chalk: Chalk & { supportsColor: ColorSupport };
export default chalk

51
node_modules/jest/node_modules/cliui/CHANGELOG.md generated vendored Normal file
View File

@@ -0,0 +1,51 @@
# Change Log
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
<a name="4.1.0"></a>
# [4.1.0](https://github.com/yargs/cliui/compare/v4.0.0...v4.1.0) (2018-04-23)
### Features
* add resetOutput method ([#57](https://github.com/yargs/cliui/issues/57)) ([7246902](https://github.com/yargs/cliui/commit/7246902))
<a name="4.0.0"></a>
# [4.0.0](https://github.com/yargs/cliui/compare/v3.2.0...v4.0.0) (2017-12-18)
### Bug Fixes
* downgrades strip-ansi to version 3.0.1 ([#54](https://github.com/yargs/cliui/issues/54)) ([5764c46](https://github.com/yargs/cliui/commit/5764c46))
* set env variable FORCE_COLOR. ([#56](https://github.com/yargs/cliui/issues/56)) ([7350e36](https://github.com/yargs/cliui/commit/7350e36))
### Chores
* drop support for node < 4 ([#53](https://github.com/yargs/cliui/issues/53)) ([b105376](https://github.com/yargs/cliui/commit/b105376))
### Features
* add fallback for window width ([#45](https://github.com/yargs/cliui/issues/45)) ([d064922](https://github.com/yargs/cliui/commit/d064922))
### BREAKING CHANGES
* officially drop support for Node < 4
<a name="3.2.0"></a>
# [3.2.0](https://github.com/yargs/cliui/compare/v3.1.2...v3.2.0) (2016-04-11)
### Bug Fixes
* reduces tarball size ([acc6c33](https://github.com/yargs/cliui/commit/acc6c33))
### Features
* adds standard-version for release management ([ff84e32](https://github.com/yargs/cliui/commit/ff84e32))

14
node_modules/jest/node_modules/cliui/LICENSE.txt generated vendored Normal file
View File

@@ -0,0 +1,14 @@
Copyright (c) 2015, 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.

115
node_modules/jest/node_modules/cliui/README.md generated vendored Normal file
View File

@@ -0,0 +1,115 @@
# cliui
[![Build Status](https://travis-ci.org/yargs/cliui.svg)](https://travis-ci.org/yargs/cliui)
[![Coverage Status](https://coveralls.io/repos/yargs/cliui/badge.svg?branch=)](https://coveralls.io/r/yargs/cliui?branch=)
[![NPM version](https://img.shields.io/npm/v/cliui.svg)](https://www.npmjs.com/package/cliui)
[![Standard Version](https://img.shields.io/badge/release-standard%20version-brightgreen.svg)](https://github.com/conventional-changelog/standard-version)
easily create complex multi-column command-line-interfaces.
## Example
```js
var ui = require('cliui')()
ui.div('Usage: $0 [command] [options]')
ui.div({
text: 'Options:',
padding: [2, 0, 2, 0]
})
ui.div(
{
text: "-f, --file",
width: 20,
padding: [0, 4, 0, 4]
},
{
text: "the file to load." +
chalk.green("(if this description is long it wraps).")
,
width: 20
},
{
text: chalk.red("[required]"),
align: 'right'
}
)
console.log(ui.toString())
```
<img width="500" src="screenshot.png">
## Layout DSL
cliui exposes a simple layout DSL:
If you create a single `ui.row`, passing a string rather than an
object:
* `\n`: characters will be interpreted as new rows.
* `\t`: characters will be interpreted as new columns.
* `\s`: characters will be interpreted as padding.
**as an example...**
```js
var ui = require('./')({
width: 60
})
ui.div(
'Usage: node ./bin/foo.js\n' +
' <regex>\t provide a regex\n' +
' <glob>\t provide a glob\t [required]'
)
console.log(ui.toString())
```
**will output:**
```shell
Usage: node ./bin/foo.js
<regex> provide a regex
<glob> provide a glob [required]
```
## Methods
```js
cliui = require('cliui')
```
### cliui({width: integer})
Specify the maximum width of the UI being generated.
If no width is provided, cliui will try to get the current window's width and use it, and if that doesn't work, width will be set to `80`.
### cliui({wrap: boolean})
Enable or disable the wrapping of text in a column.
### cliui.div(column, column, column)
Create a row with any number of columns, a column
can either be a string, or an object with the following
options:
* **text:** some text to place in the column.
* **width:** the width of a column.
* **align:** alignment, `right` or `center`.
* **padding:** `[top, right, bottom, left]`.
* **border:** should a border be placed around the div?
### cliui.span(column, column, column)
Similar to `div`, except the next row will be appended without
a new line being created.
### cliui.resetOutput()
Resets the UI elements of the current cliui instance, maintaining the values
set for `width` and `wrap`.

324
node_modules/jest/node_modules/cliui/index.js generated vendored Normal file
View File

@@ -0,0 +1,324 @@
var stringWidth = require('string-width')
var stripAnsi = require('strip-ansi')
var wrap = require('wrap-ansi')
var align = {
right: alignRight,
center: alignCenter
}
var top = 0
var right = 1
var bottom = 2
var left = 3
function UI (opts) {
this.width = opts.width
this.wrap = opts.wrap
this.rows = []
}
UI.prototype.span = function () {
var cols = this.div.apply(this, arguments)
cols.span = true
}
UI.prototype.resetOutput = function () {
this.rows = []
}
UI.prototype.div = function () {
if (arguments.length === 0) this.div('')
if (this.wrap && this._shouldApplyLayoutDSL.apply(this, arguments)) {
return this._applyLayoutDSL(arguments[0])
}
var cols = []
for (var i = 0, arg; (arg = arguments[i]) !== undefined; i++) {
if (typeof arg === 'string') cols.push(this._colFromString(arg))
else cols.push(arg)
}
this.rows.push(cols)
return cols
}
UI.prototype._shouldApplyLayoutDSL = function () {
return arguments.length === 1 && typeof arguments[0] === 'string' &&
/[\t\n]/.test(arguments[0])
}
UI.prototype._applyLayoutDSL = function (str) {
var _this = this
var rows = str.split('\n')
var leftColumnWidth = 0
// simple heuristic for layout, make sure the
// second column lines up along the left-hand.
// don't allow the first column to take up more
// than 50% of the screen.
rows.forEach(function (row) {
var columns = row.split('\t')
if (columns.length > 1 && stringWidth(columns[0]) > leftColumnWidth) {
leftColumnWidth = Math.min(
Math.floor(_this.width * 0.5),
stringWidth(columns[0])
)
}
})
// generate a table:
// replacing ' ' with padding calculations.
// using the algorithmically generated width.
rows.forEach(function (row) {
var columns = row.split('\t')
_this.div.apply(_this, columns.map(function (r, i) {
return {
text: r.trim(),
padding: _this._measurePadding(r),
width: (i === 0 && columns.length > 1) ? leftColumnWidth : undefined
}
}))
})
return this.rows[this.rows.length - 1]
}
UI.prototype._colFromString = function (str) {
return {
text: str,
padding: this._measurePadding(str)
}
}
UI.prototype._measurePadding = function (str) {
// measure padding without ansi escape codes
var noAnsi = stripAnsi(str)
return [0, noAnsi.match(/\s*$/)[0].length, 0, noAnsi.match(/^\s*/)[0].length]
}
UI.prototype.toString = function () {
var _this = this
var lines = []
_this.rows.forEach(function (row, i) {
_this.rowToString(row, lines)
})
// don't display any lines with the
// hidden flag set.
lines = lines.filter(function (line) {
return !line.hidden
})
return lines.map(function (line) {
return line.text
}).join('\n')
}
UI.prototype.rowToString = function (row, lines) {
var _this = this
var padding
var rrows = this._rasterize(row)
var str = ''
var ts
var width
var wrapWidth
rrows.forEach(function (rrow, r) {
str = ''
rrow.forEach(function (col, c) {
ts = '' // temporary string used during alignment/padding.
width = row[c].width // the width with padding.
wrapWidth = _this._negatePadding(row[c]) // the width without padding.
ts += col
for (var i = 0; i < wrapWidth - stringWidth(col); i++) {
ts += ' '
}
// align the string within its column.
if (row[c].align && row[c].align !== 'left' && _this.wrap) {
ts = align[row[c].align](ts, wrapWidth)
if (stringWidth(ts) < wrapWidth) ts += new Array(width - stringWidth(ts)).join(' ')
}
// apply border and padding to string.
padding = row[c].padding || [0, 0, 0, 0]
if (padding[left]) str += new Array(padding[left] + 1).join(' ')
str += addBorder(row[c], ts, '| ')
str += ts
str += addBorder(row[c], ts, ' |')
if (padding[right]) str += new Array(padding[right] + 1).join(' ')
// if prior row is span, try to render the
// current row on the prior line.
if (r === 0 && lines.length > 0) {
str = _this._renderInline(str, lines[lines.length - 1])
}
})
// remove trailing whitespace.
lines.push({
text: str.replace(/ +$/, ''),
span: row.span
})
})
return lines
}
function addBorder (col, ts, style) {
if (col.border) {
if (/[.']-+[.']/.test(ts)) return ''
else if (ts.trim().length) return style
else return ' '
}
return ''
}
// if the full 'source' can render in
// the target line, do so.
UI.prototype._renderInline = function (source, previousLine) {
var leadingWhitespace = source.match(/^ */)[0].length
var target = previousLine.text
var targetTextWidth = stringWidth(target.trimRight())
if (!previousLine.span) return source
// if we're not applying wrapping logic,
// just always append to the span.
if (!this.wrap) {
previousLine.hidden = true
return target + source
}
if (leadingWhitespace < targetTextWidth) return source
previousLine.hidden = true
return target.trimRight() + new Array(leadingWhitespace - targetTextWidth + 1).join(' ') + source.trimLeft()
}
UI.prototype._rasterize = function (row) {
var _this = this
var i
var rrow
var rrows = []
var widths = this._columnWidths(row)
var wrapped
// word wrap all columns, and create
// a data-structure that is easy to rasterize.
row.forEach(function (col, c) {
// leave room for left and right padding.
col.width = widths[c]
if (_this.wrap) wrapped = wrap(col.text, _this._negatePadding(col), { hard: true }).split('\n')
else wrapped = col.text.split('\n')
if (col.border) {
wrapped.unshift('.' + new Array(_this._negatePadding(col) + 3).join('-') + '.')
wrapped.push("'" + new Array(_this._negatePadding(col) + 3).join('-') + "'")
}
// add top and bottom padding.
if (col.padding) {
for (i = 0; i < (col.padding[top] || 0); i++) wrapped.unshift('')
for (i = 0; i < (col.padding[bottom] || 0); i++) wrapped.push('')
}
wrapped.forEach(function (str, r) {
if (!rrows[r]) rrows.push([])
rrow = rrows[r]
for (var i = 0; i < c; i++) {
if (rrow[i] === undefined) rrow.push('')
}
rrow.push(str)
})
})
return rrows
}
UI.prototype._negatePadding = function (col) {
var wrapWidth = col.width
if (col.padding) wrapWidth -= (col.padding[left] || 0) + (col.padding[right] || 0)
if (col.border) wrapWidth -= 4
return wrapWidth
}
UI.prototype._columnWidths = function (row) {
var _this = this
var widths = []
var unset = row.length
var unsetWidth
var remainingWidth = this.width
// column widths can be set in config.
row.forEach(function (col, i) {
if (col.width) {
unset--
widths[i] = col.width
remainingWidth -= col.width
} else {
widths[i] = undefined
}
})
// any unset widths should be calculated.
if (unset) unsetWidth = Math.floor(remainingWidth / unset)
widths.forEach(function (w, i) {
if (!_this.wrap) widths[i] = row[i].width || stringWidth(row[i].text)
else if (w === undefined) widths[i] = Math.max(unsetWidth, _minWidth(row[i]))
})
return widths
}
// calculates the minimum width of
// a column, based on padding preferences.
function _minWidth (col) {
var padding = col.padding || []
var minWidth = 1 + (padding[left] || 0) + (padding[right] || 0)
if (col.border) minWidth += 4
return minWidth
}
function getWindowWidth () {
if (typeof process === 'object' && process.stdout && process.stdout.columns) return process.stdout.columns
}
function alignRight (str, width) {
str = str.trim()
var padding = ''
var strWidth = stringWidth(str)
if (strWidth < width) {
padding = new Array(width - strWidth + 1).join(' ')
}
return padding + str
}
function alignCenter (str, width) {
str = str.trim()
var padding = ''
var strWidth = stringWidth(str.trim())
if (strWidth < width) {
padding = new Array(parseInt((width - strWidth) / 2, 10) + 1).join(' ')
}
return padding + str
}
module.exports = function (opts) {
opts = opts || {}
return new UI({
width: (opts || {}).width || getWindowWidth() || 80,
wrap: typeof opts.wrap === 'boolean' ? opts.wrap : true
})
}

130
node_modules/jest/node_modules/cliui/package.json generated vendored Normal file
View File

@@ -0,0 +1,130 @@
{
"_args": [
[
"cliui@^4.0.0",
"/home/bernhard/freifunk-app/node_modules/jest/node_modules/yargs"
]
],
"_from": "cliui@>=4.0.0 <5.0.0",
"_id": "cliui@4.1.0",
"_inCache": true,
"_installable": true,
"_location": "/jest/cliui",
"_nodeVersion": "8.8.1",
"_npmOperationalInternal": {
"host": "s3://npm-registry-packages",
"tmp": "tmp/cliui_4.1.0_1524450515410_0.021997836619508382"
},
"_npmUser": {
"email": "ben@npmjs.com",
"name": "bcoe"
},
"_npmVersion": "5.8.0",
"_phantomChildren": {},
"_requested": {
"name": "cliui",
"raw": "cliui@^4.0.0",
"rawSpec": "^4.0.0",
"scope": null,
"spec": ">=4.0.0 <5.0.0",
"type": "range"
},
"_requiredBy": [
"/jest/yargs"
],
"_resolved": "https://registry.npmjs.org/cliui/-/cliui-4.1.0.tgz",
"_shasum": "348422dbe82d800b3022eef4f6ac10bf2e4d1b49",
"_shrinkwrap": null,
"_spec": "cliui@^4.0.0",
"_where": "/home/bernhard/freifunk-app/node_modules/jest/node_modules/yargs",
"author": {
"email": "ben@npmjs.com",
"name": "Ben Coe"
},
"bugs": {
"url": "https://github.com/yargs/cliui/issues"
},
"config": {
"blanket": {
"data-cover-never": [
"node_modules",
"test"
],
"output-reporter": "spec",
"pattern": [
"index.js"
]
}
},
"dependencies": {
"string-width": "^2.1.1",
"strip-ansi": "^4.0.0",
"wrap-ansi": "^2.0.0"
},
"description": "easily create complex multi-column command-line-interfaces",
"devDependencies": {
"chai": "^3.5.0",
"chalk": "^1.1.2",
"coveralls": "^2.11.8",
"mocha": "^3.0.0",
"nyc": "^10.0.0",
"standard": "^8.0.0",
"standard-version": "^3.0.0"
},
"directories": {},
"dist": {
"fileCount": 5,
"integrity": "sha512-4FG+RSG9DL7uEwRUZXZn3SS34DiDPfzP0VOiEwtUWlE+AR2EIg+hSyvrIgUUfhdgR/UkAeW2QHgeP+hWrXs7jQ==",
"npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa3UTUCRA9TVsSAnZWagAAQBYP/21PAh+wIPQktq2XDuQ+\ntMjuDek2ebHLK5M4RyNM6TAJioGf5uHwUmqV7rHAhm9gRJn+dIIqkIukvLZy\ntln2x5GkDmYIxOC2wsj8Lbyc0k1cxoynJt8v8F/oE6EEaa6mRHuk3SJQU5Yy\nim1ofDj95s/mWcHeyrjdcfyvKJ4e6GZwylinGspAk1hR6UO33RoiWL4c2YIY\n7jYvi4HNVwv52cqGyoI78QZ8Js90rOCyZQz8QP6tZ1NMo1SwUC3jPauspGsn\npMgHslY1s0fZWp70Ac/MziJdx2XTFzYJZKkiuyJCxsyBuX7f1kUTD/Za235A\nDlpUmgj5a9UKpVtptlJ3nMRmgqXBClnIjvmm9NG2nJ8Egt3QxFdBZaxgJNbM\nMFss+LSZNnxBvmgnAC37sMvie06xwV2UOB/+eiK1EWBdVILV7END0hyRSyuM\naFsVZpqDAaXSVS4hwUFQvPA4biDGncxwDmktuOuJHSGVbIqRJJ7EEfVVBbFl\nH2KZQ8gxFT93Gg6x3tFuXlXQdPaHKvtZTkKJCLtigINk1Rr9PlUzstLRayay\nG55YvsSlDm1P2FMYosbMUrNHe0f8SVgyLsZk/tQ40htjK7zMthyAamxq+JpT\nl63y6KDYrtAwAE41206ry1QyNvlCyp+ZHv5KSZdxcUW25ZK5kwJDCMs1Sbkw\nn7bO\r\n=CsbE\r\n-----END PGP SIGNATURE-----\r\n",
"shasum": "348422dbe82d800b3022eef4f6ac10bf2e4d1b49",
"tarball": "https://registry.npmjs.org/cliui/-/cliui-4.1.0.tgz",
"unpackedSize": 14471
},
"engine": {
"node": ">=4"
},
"files": [
"index.js"
],
"gitHead": "83ada4a595ad60fff4fb962a3288eccbe163bccf",
"homepage": "https://github.com/yargs/cliui#readme",
"keywords": [
"cli",
"command-line",
"console",
"design",
"layout",
"table",
"wrap"
],
"license": "ISC",
"main": "index.js",
"maintainers": [
{
"name": "bcoe",
"email": "ben@npmjs.com"
}
],
"name": "cliui",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "git+ssh://git@github.com/yargs/cliui.git"
},
"scripts": {
"coverage": "nyc --reporter=text-lcov mocha | coveralls",
"pretest": "standard",
"release": "standard-version",
"test": "nyc mocha"
},
"standard": {
"globals": [
"it"
],
"ignore": [
"**/example/**"
]
},
"version": "4.1.0"
}

15
node_modules/jest/node_modules/jest-cli/README.md generated vendored Normal file
View File

@@ -0,0 +1,15 @@
# Jest
🃏 Delightful JavaScript Testing
* **👩🏻‍💻 Easy Setup**: Jest is a complete and easy to set up JavaScript testing
solution. In fact, Jest works out of the box for any React project.
* **🏃🏽 Instant Feedback**: Failed tests run first. Fast interactive mode can
switch between running all tests or only test files related to changed files.
* **📸 Snapshot Testing**: Jest can
[capture snapshots](http://facebook.github.io/jest/docs/snapshot-testing.html)
of React trees or other serializable values to simplify UI testing.
Read More: http://facebook.github.io/jest/

17
node_modules/jest/node_modules/jest-cli/bin/jest.js generated vendored Executable file
View File

@@ -0,0 +1,17 @@
#!/usr/bin/env node
/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
const importLocal = require('import-local');
if (!importLocal(__filename)) {
if (process.env.NODE_ENV == null) {
process.env.NODE_ENV = 'test';
}
require('../build/cli').run();
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

@@ -0,0 +1,36 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
class BaseWatchPlugin {
constructor(_ref) {
let stdin = _ref.stdin,
stdout = _ref.stdout;
this._stdin = stdin;
this._stdout = stdout;
}
apply(hooks) {}
getUsageInfo(globalConfig) {
return null;
}
onKey(value) {}
run(globalConfig, updateConfigAndRun) {
return Promise.resolve();
}
} /**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/
exports.default = BaseWatchPlugin;

View File

@@ -0,0 +1,469 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.options = exports.docs = exports.usage = exports.check = undefined;
var _jestConfig;
function _load_jestConfig() {
return _jestConfig = require('jest-config');
}
var _isCi;
function _load_isCi() {
return _isCi = _interopRequireDefault(require('is-ci'));
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const check = exports.check = argv => {
if (argv.runInBand && argv.hasOwnProperty('maxWorkers')) {
throw new Error('Both --runInBand and --maxWorkers were specified, but these two ' + 'options do not make sense together. Which is it?');
}
for (const key of ['onlyChanged', 'lastCommit', 'changedFilesWithAncestor', 'changedSince']) {
if (argv[key] && argv.watchAll) {
throw new Error(`Both --${key} and --watchAll were specified, but these two ` + 'options do not make sense together. Try the --watch option which ' + 'reruns only tests related to changed files.');
}
}
if (argv.findRelatedTests && argv._.length === 0) {
throw new Error('The --findRelatedTests option requires file paths to be specified.\n' + 'Example usage: jest --findRelatedTests ./src/source.js ' + './src/index.js.');
}
if (argv.hasOwnProperty('maxWorkers') && argv.maxWorkers === undefined) {
throw new Error('The --maxWorkers (-w) option requires a number to be specified.\n' + 'Example usage: jest --maxWorkers 2\n' + 'Or did you mean --watch?');
}
if (argv.config && !(0, (_jestConfig || _load_jestConfig()).isJSONString)(argv.config) && !argv.config.match(/\.js(on)?$/)) {
throw new Error('The --config option requires a JSON string literal, or a file path with a .js or .json extension.\n' + 'Example usage: jest --config ./jest.config.js');
}
return true;
}; /**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/
const usage = exports.usage = 'Usage: $0 [--config=<pathToConfigFile>] [TestPathPattern]';
const docs = exports.docs = 'Documentation: https://facebook.github.io/jest/';
const options = exports.options = {
all: {
default: undefined,
description: 'The opposite of `onlyChanged`. If `onlyChanged` is set by ' + 'default, running jest with `--all` will force Jest to run all tests ' + 'instead of running only tests related to changed files.'
},
automock: {
default: undefined,
description: 'Automock all files by default.',
type: 'boolean'
},
bail: {
alias: 'b',
default: undefined,
description: 'Exit the test suite immediately upon the first failing test.',
type: 'boolean'
},
browser: {
default: undefined,
description: 'Respect the "browser" field in package.json ' + 'when resolving modules. Some packages export different versions ' + 'based on whether they are operating in node.js or a browser.',
type: 'boolean'
},
cache: {
default: undefined,
description: 'Whether to use the transform cache. Disable the cache ' + 'using --no-cache.',
type: 'boolean'
},
cacheDirectory: {
description: 'The directory where Jest should store its cached ' + ' dependency information.',
type: 'string'
},
changedFilesWithAncestor: {
default: undefined,
description: 'Runs tests related to the current changes and the changes made in the ' + 'last commit. Behaves similarly to `--onlyChanged`.',
type: 'boolean'
},
changedSince: {
description: 'Runs tests related the changes since the provided branch. If the ' + 'current branch has diverged from the given branch, then only changes ' + 'made locally will be tested. Behaves similarly to `--onlyChanged`.',
nargs: 1,
type: 'string'
},
ci: {
default: (_isCi || _load_isCi()).default,
description: 'Whether to run Jest in continuous integration (CI) mode. ' + 'This option is on by default in most popular CI environments. It will ' + ' prevent snapshots from being written unless explicitly requested.',
type: 'boolean'
},
clearCache: {
default: undefined,
description: 'Clears the configured Jest cache directory and then exits. ' + 'Default directory can be found by calling jest --showConfig',
type: 'boolean'
},
clearMocks: {
default: undefined,
description: 'Automatically clear mock calls and instances between every ' + 'test. Equivalent to calling jest.clearAllMocks() between each test.',
type: 'boolean'
},
collectCoverage: {
default: undefined,
description: 'Alias for --coverage.',
type: 'boolean'
},
collectCoverageFrom: {
description: 'An array of glob patterns relative to <rootDir> matching the files ' + 'that coverage info needs to be collected from.',
type: 'array'
},
collectCoverageOnlyFrom: {
description: 'Explicit list of paths coverage will be restricted to.',
type: 'array'
},
color: {
default: undefined,
description: 'Forces test results output color highlighting (even if ' + 'stdout is not a TTY). Set to false if you would like to have no colors.',
type: 'boolean'
},
colors: {
default: undefined,
description: 'Alias for `--color`.',
type: 'boolean'
},
config: {
alias: 'c',
description: 'The path to a jest config file specifying how to find ' + 'and execute tests. If no rootDir is set in the config, the current ' + 'directory is assumed to be the rootDir for the project. This can also ' + 'be a JSON encoded value which Jest will use as configuration.',
type: 'string'
},
coverage: {
default: undefined,
description: 'Indicates that test coverage information should be ' + 'collected and reported in the output.',
type: 'boolean'
},
coverageDirectory: {
description: 'The directory where Jest should output its coverage files.',
type: 'string'
},
coveragePathIgnorePatterns: {
description: 'An array of regexp pattern strings that are matched ' + 'against all file paths before executing the test. If the file path' + 'matches any of the patterns, coverage information will be skipped.',
type: 'array'
},
coverageReporters: {
description: 'A list of reporter names that Jest uses when writing ' + 'coverage reports. Any istanbul reporter can be used.',
type: 'array'
},
coverageThreshold: {
description: 'A JSON string with which will be used to configure ' + 'minimum threshold enforcement for coverage results',
type: 'string'
},
debug: {
default: undefined,
description: 'Print debugging info about your jest config.',
type: 'boolean'
},
detectLeaks: {
default: false,
description: '**EXPERIMENTAL**: Detect memory leaks in tests. After executing a ' + 'test, it will try to garbage collect the global object used, and fail ' + 'if it was leaked',
type: 'boolean'
},
env: {
description: 'The test environment used for all tests. This can point to ' + 'any file or node module. Examples: `jsdom`, `node` or ' + '`path/to/my-environment.js`',
type: 'string'
},
expand: {
alias: 'e',
default: undefined,
description: 'Use this flag to show full diffs instead of a patch.',
type: 'boolean'
},
findRelatedTests: {
default: undefined,
description: 'Find related tests for a list of source files that were ' + 'passed in as arguments. Useful for pre-commit hook integration to run ' + 'the minimal amount of tests necessary.',
type: 'boolean'
},
forceExit: {
default: undefined,
description: 'Force Jest to exit after all tests have completed running. ' + 'This is useful when resources set up by test code cannot be ' + 'adequately cleaned up.',
type: 'boolean'
},
globalSetup: {
description: 'The path to a module that runs before All Tests.',
type: 'string'
},
globalTeardown: {
description: 'The path to a module that runs after All Tests.',
type: 'string'
},
globals: {
description: 'A JSON string with map of global variables that need ' + 'to be available in all test environments.',
type: 'string'
},
haste: {
description: 'A JSON string with map of variables for the haste module system',
type: 'string'
},
json: {
default: undefined,
description: 'Prints the test results in JSON. This mode will send all ' + 'other test output and user messages to stderr.',
type: 'boolean'
},
lastCommit: {
default: undefined,
description: 'Run all tests affected by file changes in the last commit made. ' + 'Behaves similarly to `--onlyChanged`.',
type: 'boolean'
},
listTests: {
default: false,
description: 'Lists all tests Jest will run given the arguments and ' + 'exits. Most useful in a CI system together with `--findRelatedTests` ' + 'to determine the tests Jest will run based on specific files',
type: 'boolean'
},
logHeapUsage: {
default: undefined,
description: 'Logs the heap usage after every test. Useful to debug ' + 'memory leaks. Use together with `--runInBand` and `--expose-gc` in ' + 'node.',
type: 'boolean'
},
mapCoverage: {
default: undefined,
description: 'Maps code coverage reports against original source code ' + 'when transformers supply source maps.\n\nDEPRECATED',
type: 'boolean'
},
maxWorkers: {
alias: 'w',
description: 'Specifies the maximum number of workers the worker-pool ' + 'will spawn for running tests. This defaults to the number of the ' + 'cores available on your machine. (its usually best not to override ' + 'this default)',
type: 'number'
},
moduleDirectories: {
description: 'An array of directory names to be searched recursively ' + "up from the requiring module's location.",
type: 'array'
},
moduleFileExtensions: {
description: 'An array of file extensions your modules use. If you ' + 'require modules without specifying a file extension, these are the ' + 'extensions Jest will look for. ',
type: 'array'
},
moduleNameMapper: {
description: 'A JSON string with a map from regular expressions to ' + 'module names that allow to stub out resources, like images or ' + 'styles with a single module',
type: 'string'
},
modulePathIgnorePatterns: {
description: 'An array of regexp pattern strings that are matched ' + 'against all module paths before those paths are to be considered ' + '"visible" to the module loader.',
type: 'array'
},
modulePaths: {
description: 'An alternative API to setting the NODE_PATH env variable, ' + 'modulePaths is an array of absolute paths to additional locations to ' + 'search when resolving modules.',
type: 'array'
},
noStackTrace: {
default: undefined,
description: 'Disables stack trace in test results output',
type: 'boolean'
},
notify: {
default: undefined,
description: 'Activates notifications for test results.',
type: 'boolean'
},
notifyMode: {
default: 'always',
description: 'Specifies when notifications will appear for test results.',
type: 'string'
},
onlyChanged: {
alias: 'o',
default: undefined,
description: 'Attempts to identify which tests to run based on which ' + "files have changed in the current repository. Only works if you're " + 'running tests in a git or hg repository at the moment.',
type: 'boolean'
},
onlyFailures: {
alias: 'f',
default: undefined,
description: 'Run tests that failed in the previous execution.',
type: 'boolean'
},
outputFile: {
description: 'Write test results to a file when the --json option is ' + 'also specified.',
type: 'string'
},
passWithNoTests: {
default: false,
description: 'Will not fail if no tests are found (for example while using `--testPathPattern`.)',
type: 'boolean'
},
preset: {
description: "A preset that is used as a base for Jest's configuration.",
type: 'string'
},
projects: {
description: 'A list of projects that use Jest to run all tests of all ' + 'projects in a single instance of Jest.',
type: 'array'
},
reporters: {
description: 'A list of custom reporters for the test suite.',
type: 'array'
},
resetMocks: {
default: undefined,
description: 'Automatically reset mock state between every test. ' + 'Equivalent to calling jest.resetAllMocks() between each test.',
type: 'boolean'
},
resetModules: {
default: undefined,
description: 'If enabled, the module registry for every test file will ' + 'be reset before running each individual test.',
type: 'boolean'
},
resolver: {
description: 'A JSON string which allows the use of a custom resolver.',
type: 'string'
},
restoreMocks: {
default: undefined,
description: 'Automatically restore mock state and implementation between every test. ' + 'Equivalent to calling jest.restoreAllMocks() between each test.',
type: 'boolean'
},
rootDir: {
description: 'The root directory that Jest should scan for tests and ' + 'modules within.',
type: 'string'
},
roots: {
description: 'A list of paths to directories that Jest should use to ' + 'search for files in.',
type: 'array'
},
runInBand: {
alias: 'i',
default: undefined,
description: 'Run all tests serially in the current process (rather than ' + 'creating a worker pool of child processes that run tests). This ' + 'is sometimes useful for debugging, but such use cases are pretty ' + 'rare.',
type: 'boolean'
},
runTestsByPath: {
default: false,
description: 'Used when provided patterns are exact file paths. This avoids ' + 'converting them into a regular expression and matching it against ' + 'every single file.',
type: 'boolean'
},
setupFiles: {
description: 'The paths to modules that run some code to configure or ' + 'set up the testing environment before each test. ',
type: 'array'
},
setupTestFrameworkScriptFile: {
description: 'The path to a module that runs some code to configure or ' + 'set up the testing framework before each test.',
type: 'string'
},
showConfig: {
default: undefined,
description: 'Print your jest config and then exits.',
type: 'boolean'
},
silent: {
default: undefined,
description: 'Prevent tests from printing messages through the console.',
type: 'boolean'
},
snapshotSerializers: {
description: 'A list of paths to snapshot serializer modules Jest should ' + 'use for snapshot testing.',
type: 'array'
},
testEnvironment: {
description: 'Alias for --env',
type: 'string'
},
testFailureExitCode: {
description: 'Exit code of `jest` command if the test run failed',
type: 'string' // number
},
testLocationInResults: {
default: false,
description: 'Add `location` information to the test results',
type: 'boolean'
},
testMatch: {
description: 'The glob patterns Jest uses to detect test files.',
type: 'array'
},
testNamePattern: {
alias: 't',
description: 'Run only tests with a name that matches the regex pattern.',
type: 'string'
},
testPathIgnorePatterns: {
description: 'An array of regexp pattern strings that are matched ' + 'against all test paths before executing the test. If the test path ' + 'matches any of the patterns, it will be skipped.',
type: 'array'
},
testPathPattern: {
description: 'A regexp pattern string that is matched against all tests ' + 'paths before executing the test.',
type: 'array'
},
testRegex: {
description: 'The regexp pattern Jest uses to detect test files.',
type: 'string'
},
testResultsProcessor: {
description: 'Allows the use of a custom results processor. ' + 'This processor must be a node module that exports ' + 'a function expecting as the first argument the result object',
type: 'string'
},
testRunner: {
description: 'Allows to specify a custom test runner. The default is ' + ' `jasmine2`. A path to a custom test runner can be provided: ' + '`<rootDir>/path/to/testRunner.js`.',
type: 'string'
},
testURL: {
description: 'This option sets the URL for the jsdom environment.',
type: 'string'
},
timers: {
description: 'Setting this value to fake allows the use of fake timers ' + 'for functions such as setTimeout.',
type: 'string'
},
transform: {
description: 'A JSON string which maps from regular expressions to paths ' + 'to transformers.',
type: 'string'
},
transformIgnorePatterns: {
description: 'An array of regexp pattern strings that are matched ' + 'against all source file paths before transformation.',
type: 'array'
},
unmockedModulePathPatterns: {
description: 'An array of regexp pattern strings that are matched ' + 'against all modules before the module loader will automatically ' + 'return a mock for them.',
type: 'array'
},
updateSnapshot: {
alias: 'u',
default: undefined,
description: 'Use this flag to re-record snapshots. ' + 'Can be used together with a test suite pattern or with ' + '`--testNamePattern` to re-record snapshot for test matching ' + 'the pattern',
type: 'boolean'
},
useStderr: {
default: undefined,
description: 'Divert all output to stderr.',
type: 'boolean'
},
verbose: {
default: undefined,
description: 'Display individual test results with the test suite hierarchy.',
type: 'boolean'
},
version: {
alias: 'v',
default: undefined,
description: 'Print the version and exit',
type: 'boolean'
},
watch: {
default: undefined,
description: 'Watch files for changes and rerun tests related to ' + 'changed files. If you want to re-run all tests when a file has ' + 'changed, use the `--watchAll` option.',
type: 'boolean'
},
watchAll: {
default: undefined,
description: 'Watch files for changes and rerun all tests. If you want ' + 'to re-run only the tests related to the changed files, use the ' + '`--watch` option.',
type: 'boolean'
},
watchPathIgnorePatterns: {
description: 'An array of regexp pattern strings that are matched ' + 'against all paths before trigger test re-run in watch mode. ' + 'If the test path matches any of the patterns, it will be skipped.',
type: 'array'
},
watchman: {
default: undefined,
description: 'Whether to use watchman for file crawling. Disable using ' + '--no-watchman.',
type: 'boolean'
}
};

View File

@@ -0,0 +1,471 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.runCLI = exports.run = undefined;
let run = exports.run = (() => {
var _ref = _asyncToGenerator(function* (maybeArgv, project) {
try {
const argv = buildArgv(maybeArgv, project);
const projects = getProjectListFromCLIArgs(argv, project);
var _ref2 = yield runCLI(argv, projects);
const results = _ref2.results,
globalConfig = _ref2.globalConfig;
readResultsAndExit(results, globalConfig);
} catch (error) {
(0, (_jestUtil || _load_jestUtil()).clearLine)(process.stderr);
(0, (_jestUtil || _load_jestUtil()).clearLine)(process.stdout);
console.error((_chalk || _load_chalk()).default.red(error.stack));
(0, (_exit || _load_exit()).default)(1);
throw error;
}
});
return function run(_x, _x2) {
return _ref.apply(this, arguments);
};
})();
var _jestUtil;
function _load_jestUtil() {
return _jestUtil = require('jest-util');
}
var _jestValidate;
function _load_jestValidate() {
return _jestValidate = require('jest-validate');
}
var _jestConfig;
function _load_jestConfig() {
return _jestConfig = require('jest-config');
}
var _package;
function _load_package() {
return _package = require('../../package.json');
}
var _args;
function _load_args() {
return _args = _interopRequireWildcard(require('./args'));
}
var _chalk;
function _load_chalk() {
return _chalk = _interopRequireDefault(require('chalk'));
}
var _create_context;
function _load_create_context() {
return _create_context = _interopRequireDefault(require('../lib/create_context'));
}
var _exit;
function _load_exit() {
return _exit = _interopRequireDefault(require('exit'));
}
var _get_changed_files_promise;
function _load_get_changed_files_promise() {
return _get_changed_files_promise = _interopRequireDefault(require('../get_changed_files_promise'));
}
var _fs;
function _load_fs() {
return _fs = _interopRequireDefault(require('fs'));
}
var _handle_deprecation_warnings;
function _load_handle_deprecation_warnings() {
return _handle_deprecation_warnings = _interopRequireDefault(require('../lib/handle_deprecation_warnings'));
}
var _log_debug_messages;
function _load_log_debug_messages() {
return _log_debug_messages = _interopRequireDefault(require('../lib/log_debug_messages'));
}
var _pre_run_message;
function _load_pre_run_message() {
return _pre_run_message = require('../pre_run_message');
}
var _run_jest;
function _load_run_jest() {
return _run_jest = _interopRequireDefault(require('../run_jest'));
}
var _jestRuntime;
function _load_jestRuntime() {
return _jestRuntime = _interopRequireDefault(require('jest-runtime'));
}
var _test_watcher;
function _load_test_watcher() {
return _test_watcher = _interopRequireDefault(require('../test_watcher'));
}
var _watch;
function _load_watch() {
return _watch = _interopRequireDefault(require('../watch'));
}
var _yargs;
function _load_yargs() {
return _yargs = _interopRequireDefault(require('yargs'));
}
var _rimraf;
function _load_rimraf() {
return _rimraf = _interopRequireDefault(require('rimraf'));
}
var _realpathNative;
function _load_realpathNative() {
return _realpathNative = require('realpath-native');
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } /**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/
const runCLI = exports.runCLI = (() => {
var _ref3 = _asyncToGenerator(function* (argv, projects) {
const realFs = require('fs');
const fs = require('graceful-fs');
fs.gracefulify(realFs);
let results;
// If we output a JSON object, we can't write anything to stdout, since
// it'll break the JSON structure and it won't be valid.
const outputStream = argv.json || argv.useStderr ? process.stderr : process.stdout;
argv.version && printVersionAndExit(outputStream);
var _getConfigs = getConfigs(projects, argv, outputStream);
const globalConfig = _getConfigs.globalConfig,
configs = _getConfigs.configs,
hasDeprecationWarnings = _getConfigs.hasDeprecationWarnings;
if (argv.clearCache) {
configs.forEach(function (config) {
(_rimraf || _load_rimraf()).default.sync(config.cacheDirectory);
process.stdout.write(`Cleared ${config.cacheDirectory}\n`);
});
(0, (_exit || _load_exit()).default)(0);
}
yield _run(globalConfig, configs, hasDeprecationWarnings, outputStream, function (r) {
return results = r;
});
if (argv.watch || argv.watchAll) {
// If in watch mode, return the promise that will never resolve.
// If the watch mode is interrupted, watch should handle the process
// shutdown.
return new Promise(function () {});
}
if (!results) {
throw new Error('AggregatedResult must be present after test run is complete');
}
return Promise.resolve({ globalConfig, results });
});
return function runCLI(_x3, _x4) {
return _ref3.apply(this, arguments);
};
})();
const readResultsAndExit = (result, globalConfig) => {
const code = !result || result.success ? 0 : globalConfig.testFailureExitCode;
process.on('exit', () => process.exitCode = code);
if (globalConfig.forceExit) {
(0, (_exit || _load_exit()).default)(code);
}
};
const buildArgv = (maybeArgv, project) => {
const argv = (0, (_yargs || _load_yargs()).default)(maybeArgv || process.argv.slice(2)).usage((_args || _load_args()).usage).alias('help', 'h').options((_args || _load_args()).options).epilogue((_args || _load_args()).docs).check((_args || _load_args()).check).version(false).argv;
(0, (_jestValidate || _load_jestValidate()).validateCLIOptions)(argv, (_args || _load_args()).options);
return argv;
};
const getProjectListFromCLIArgs = (argv, project) => {
const projects = argv.projects ? argv.projects : [];
if (project) {
projects.push(project);
}
if (!projects.length && process.platform === 'win32') {
try {
projects.push((0, (_realpathNative || _load_realpathNative()).sync)(process.cwd()));
} catch (err) {
// do nothing, just catch error
// process.binding('fs').realpath can throw, e.g. on mapped drives
}
}
if (!projects.length) {
projects.push(process.cwd());
}
return projects;
};
const printDebugInfoAndExitIfNeeded = (argv, globalConfig, configs, outputStream) => {
if (argv.debug || argv.showConfig) {
(0, (_log_debug_messages || _load_log_debug_messages()).default)(globalConfig, configs, outputStream);
}
if (argv.showConfig) {
(0, (_exit || _load_exit()).default)(0);
}
};
const printVersionAndExit = outputStream => {
outputStream.write(`v${(_package || _load_package()).version}\n`);
(0, (_exit || _load_exit()).default)(0);
};
const ensureNoDuplicateConfigs = (parsedConfigs, projects) => {
const configPathSet = new Set();
for (const _ref4 of parsedConfigs) {
const configPath = _ref4.configPath;
if (configPathSet.has(configPath)) {
let message = 'One or more specified projects share the same config file\n';
parsedConfigs.forEach((_ref5, index) => {
let configPath = _ref5.configPath;
message = message + '\nProject: "' + projects[index] + '"\nConfig: "' + String(configPath) + '"';
});
throw new Error(message);
}
if (configPath !== null) {
configPathSet.add(configPath);
}
}
};
// Possible scenarios:
// 1. jest --config config.json
// 2. jest --projects p1 p2
// 3. jest --projects p1 p2 --config config.json
// 4. jest --projects p1
// 5. jest
//
// If no projects are specified, process.cwd() will be used as the default
// (and only) project.
const getConfigs = (projectsFromCLIArgs, argv, outputStream) => {
let globalConfig;
let hasDeprecationWarnings;
let configs = [];
let projects = projectsFromCLIArgs;
let configPath;
if (projectsFromCLIArgs.length === 1) {
const parsedConfig = (0, (_jestConfig || _load_jestConfig()).readConfig)(argv, projects[0]);
configPath = parsedConfig.configPath;
if (parsedConfig.globalConfig.projects) {
// If this was a single project, and its config has `projects`
// settings, use that value instead.
projects = parsedConfig.globalConfig.projects;
}
hasDeprecationWarnings = parsedConfig.hasDeprecationWarnings;
globalConfig = parsedConfig.globalConfig;
configs = [parsedConfig.projectConfig];
if (globalConfig.projects && globalConfig.projects.length) {
// Even though we had one project in CLI args, there might be more
// projects defined in the config.
projects = globalConfig.projects;
}
}
if (projects.length > 1) {
const parsedConfigs = projects.filter(root => {
// Ignore globbed files that cannot be `require`d.
if ((_fs || _load_fs()).default.existsSync(root) && !(_fs || _load_fs()).default.lstatSync(root).isDirectory() && !root.endsWith('.js') && !root.endsWith('.json')) {
return false;
}
return true;
}).map(root => (0, (_jestConfig || _load_jestConfig()).readConfig)(argv, root, true, configPath));
ensureNoDuplicateConfigs(parsedConfigs, projects);
configs = parsedConfigs.map((_ref6) => {
let projectConfig = _ref6.projectConfig;
return projectConfig;
});
if (!hasDeprecationWarnings) {
hasDeprecationWarnings = parsedConfigs.some((_ref7) => {
let hasDeprecationWarnings = _ref7.hasDeprecationWarnings;
return !!hasDeprecationWarnings;
});
}
// If no config was passed initially, use the one from the first project
if (!globalConfig) {
globalConfig = parsedConfigs[0].globalConfig;
}
}
if (!globalConfig || !configs.length) {
throw new Error('jest: No configuration found for any project.');
}
printDebugInfoAndExitIfNeeded(argv, globalConfig, configs, outputStream);
return {
configs,
globalConfig,
hasDeprecationWarnings: !!hasDeprecationWarnings
};
};
const buildContextsAndHasteMaps = (() => {
var _ref8 = _asyncToGenerator(function* (configs, globalConfig, outputStream) {
const hasteMapInstances = Array(configs.length);
const contexts = yield Promise.all(configs.map((() => {
var _ref9 = _asyncToGenerator(function* (config, index) {
(0, (_jestUtil || _load_jestUtil()).createDirectory)(config.cacheDirectory);
const hasteMapInstance = (_jestRuntime || _load_jestRuntime()).default.createHasteMap(config, {
console: new (_jestUtil || _load_jestUtil()).Console(outputStream, outputStream),
maxWorkers: globalConfig.maxWorkers,
resetCache: !config.cache,
watch: globalConfig.watch || globalConfig.watchAll,
watchman: globalConfig.watchman
});
hasteMapInstances[index] = hasteMapInstance;
return (0, (_create_context || _load_create_context()).default)(config, (yield hasteMapInstance.build()));
});
return function (_x8, _x9) {
return _ref9.apply(this, arguments);
};
})()));
return { contexts, hasteMapInstances };
});
return function buildContextsAndHasteMaps(_x5, _x6, _x7) {
return _ref8.apply(this, arguments);
};
})();
const _run = (() => {
var _ref10 = _asyncToGenerator(function* (globalConfig, configs, hasDeprecationWarnings, outputStream, onComplete) {
// Queries to hg/git can take a while, so we need to start the process
// as soon as possible, so by the time we need the result it's already there.
const changedFilesPromise = (0, (_get_changed_files_promise || _load_get_changed_files_promise()).default)(globalConfig, configs);
var _ref11 = yield buildContextsAndHasteMaps(configs, globalConfig, outputStream);
const contexts = _ref11.contexts,
hasteMapInstances = _ref11.hasteMapInstances;
globalConfig.watch || globalConfig.watchAll ? yield runWatch(contexts, configs, hasDeprecationWarnings, globalConfig, outputStream, hasteMapInstances, changedFilesPromise) : yield runWithoutWatch(globalConfig, contexts, outputStream, onComplete, changedFilesPromise);
});
return function _run(_x10, _x11, _x12, _x13, _x14) {
return _ref10.apply(this, arguments);
};
})();
const runWatch = (() => {
var _ref12 = _asyncToGenerator(function* (contexts, configs, hasDeprecationWarnings, globalConfig, outputStream, hasteMapInstances, changedFilesPromise) {
if (hasDeprecationWarnings) {
try {
yield (0, (_handle_deprecation_warnings || _load_handle_deprecation_warnings()).default)(outputStream, process.stdin);
return (0, (_watch || _load_watch()).default)(globalConfig, contexts, outputStream, hasteMapInstances);
} catch (e) {
(0, (_exit || _load_exit()).default)(0);
}
}
return (0, (_watch || _load_watch()).default)(globalConfig, contexts, outputStream, hasteMapInstances);
});
return function runWatch(_x15, _x16, _x17, _x18, _x19, _x20, _x21) {
return _ref12.apply(this, arguments);
};
})();
const runWithoutWatch = (() => {
var _ref13 = _asyncToGenerator(function* (globalConfig, contexts, outputStream, onComplete, changedFilesPromise) {
const startRun = (() => {
var _ref14 = _asyncToGenerator(function* () {
if (!globalConfig.listTests) {
(0, (_pre_run_message || _load_pre_run_message()).print)(outputStream);
}
return yield (0, (_run_jest || _load_run_jest()).default)({
changedFilesPromise,
contexts,
failedTestsCache: null,
globalConfig,
onComplete,
outputStream,
startRun,
testWatcher: new (_test_watcher || _load_test_watcher()).default({ isWatchMode: false })
});
});
return function startRun() {
return _ref14.apply(this, arguments);
};
})();
return yield startRun();
});
return function runWithoutWatch(_x22, _x23, _x24, _x25, _x26) {
return _ref13.apply(this, arguments);
};
})();

View File

@@ -0,0 +1,47 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/
const isWindows = process.platform === 'win32';
const CLEAR = exports.CLEAR = isWindows ? '\x1B[2J\x1B[0f' : '\x1B[2J\x1B[3J\x1B[H';
const KEYS = exports.KEYS = {
A: '61',
ARROW_DOWN: '1b5b42',
ARROW_LEFT: '1b5b44',
ARROW_RIGHT: '1b5b43',
ARROW_UP: '1b5b41',
BACKSPACE: isWindows ? '08' : '7f',
C: '63',
CONTROL_C: '03',
CONTROL_D: '04',
ENTER: '0d',
ESCAPE: '1b',
F: '66',
I: '69',
O: '6f',
P: '70',
Q: '71',
QUESTION_MARK: '3f',
S: '73',
T: '74',
U: '75',
W: '77'
};
const ICONS = exports.ICONS = {
failed: isWindows ? '\u00D7' : '\u2715',
pending: '\u25CB',
success: isWindows ? '\u221A' : '\u2713'
};

View File

@@ -0,0 +1,29 @@
// Copyright 2004-present Facebook. All Rights Reserved.
// Instrumentation Header
{
var <%= instrumented.names.statement %>;
var <%= instrumented.names.expression %>;
var <%= instrumented.names.block %>;
var nodes = <%= coverageStorageVar %>.nodes = {};
var blocks = <%= coverageStorageVar %>.blocks = {};
<%= instrumented.names.statement %> = function(i) {
var node = nodes[i] = (nodes[i] || {index: i, count:0})
node.count++;
};
<%= instrumented.names.expression %> = function(i) {
var node = nodes[i] = (nodes[i] || {index: i, count:0})
node.count++;
};
<%= instrumented.names.block %> = function(i) {
var block = blocks[i] = (blocks[i] || {index: i, count:0})
block.count++;
};
};
////////////////////////
// Instrumented Code
<%= source %>

View File

@@ -0,0 +1,44 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
class FailedTestsCache {
filterTests(tests) {
if (!this._enabledTestsMap) {
return tests;
}
// $FlowFixMe
return tests.filter(testResult => this._enabledTestsMap[testResult.path]);
}
setTestResults(testResults) {
this._enabledTestsMap = (testResults || []).filter(testResult => testResult.numFailingTests).reduce((suiteMap, testResult) => {
suiteMap[testResult.testFilePath] = testResult.testResults.filter(test => test.status === 'failed').reduce((testMap, test) => {
testMap[test.fullName] = true;
return testMap;
}, {});
return suiteMap;
}, {});
this._enabledTestsMap = Object.freeze(this._enabledTestsMap);
}
updateConfig(globalConfig) {
if (!this._enabledTestsMap) {
return globalConfig;
}
// $FlowFixMe Object.assign
const newConfig = Object.assign({}, globalConfig);
newConfig.enabledTestsMap = this._enabledTestsMap;
return Object.freeze(newConfig);
}
}
exports.default = FailedTestsCache; /**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/

View File

@@ -0,0 +1,40 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = function (source, filename, globalConfig, config) {
const coverageOptions = {
collectCoverage: globalConfig.collectCoverage,
collectCoverageFrom: globalConfig.collectCoverageFrom,
collectCoverageOnlyFrom: globalConfig.collectCoverageOnlyFrom
};
if ((_jestRuntime || _load_jestRuntime()).default.shouldInstrument(filename, coverageOptions, config)) {
// Transform file without instrumentation first, to make sure produced
// source code is ES6 (no flowtypes etc.) and can be instrumented
const transformResult = new (_jestRuntime || _load_jestRuntime()).default.ScriptTransformer(config).transformSource(filename, source, false);
const instrumenter = (0, (_istanbulLibInstrument || _load_istanbulLibInstrument()).createInstrumenter)();
instrumenter.instrumentSync(transformResult.code, filename);
return {
coverage: instrumenter.fileCoverage,
sourceMapPath: transformResult.sourceMapPath
};
} else {
return null;
}
};
var _istanbulLibInstrument;
function _load_istanbulLibInstrument() {
return _istanbulLibInstrument = require('istanbul-lib-instrument');
}
var _jestRuntime;
function _load_jestRuntime() {
return _jestRuntime = _interopRequireDefault(require('jest-runtime'));
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

View File

@@ -0,0 +1,31 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _jestChangedFiles;
function _load_jestChangedFiles() {
return _jestChangedFiles = require('jest-changed-files');
}
exports.default = (globalConfig, configs) => {
if (globalConfig.onlyChanged) {
const allRootsForAllProjects = configs.reduce((roots, config) => roots.concat(config.roots || []), []);
return (0, (_jestChangedFiles || _load_jestChangedFiles()).getChangedFilesForRoots)(allRootsForAllProjects, {
changedSince: globalConfig.changedSince,
lastCommit: globalConfig.lastCommit,
withAncestor: globalConfig.changedFilesWithAncestor
});
}
return undefined;
}; /**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/

View File

@@ -0,0 +1,33 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = getNoTestFound;
var _chalk;
function _load_chalk() {
return _chalk = _interopRequireDefault(require('chalk'));
}
var _pluralize;
function _load_pluralize() {
return _pluralize = _interopRequireDefault(require('./pluralize'));
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function getNoTestFound(testRunData, globalConfig) {
const testFiles = testRunData.reduce((current, testRun) => current += testRun.matches.total, 0);
let dataMessage;
if (globalConfig.runTestsByPath) {
dataMessage = `Files: ${globalConfig.nonFlagArgs.map(p => `"${p}"`).join(', ')}`;
} else {
dataMessage = `Pattern: ${(_chalk || _load_chalk()).default.yellow(globalConfig.testPathPattern)} - 0 matches`;
}
return (_chalk || _load_chalk()).default.bold('No tests found') + '\n' + `In ${(_chalk || _load_chalk()).default.bold(process.cwd())}` + '\n' + ` ${(0, (_pluralize || _load_pluralize()).default)('file', testFiles, 's')} checked across ${(0, (_pluralize || _load_pluralize()).default)('project', testRunData.length, 's')}. Run with \`--verbose\` for more details.` + '\n' + dataMessage;
}

View File

@@ -0,0 +1,18 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = getNoTestFoundFailed;
var _chalk;
function _load_chalk() {
return _chalk = _interopRequireDefault(require('chalk'));
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function getNoTestFoundFailed() {
return (_chalk || _load_chalk()).default.bold('No failed test found.\n') + (_chalk || _load_chalk()).default.dim('Press `f` to run all tests.');
}

View File

@@ -0,0 +1,42 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = getNoTestsFoundMessage;
var _get_no_test_found;
function _load_get_no_test_found() {
return _get_no_test_found = _interopRequireDefault(require('./get_no_test_found'));
}
var _get_no_test_found_related_to_changed_files;
function _load_get_no_test_found_related_to_changed_files() {
return _get_no_test_found_related_to_changed_files = _interopRequireDefault(require('./get_no_test_found_related_to_changed_files'));
}
var _get_no_test_found_verbose;
function _load_get_no_test_found_verbose() {
return _get_no_test_found_verbose = _interopRequireDefault(require('./get_no_test_found_verbose'));
}
var _get_no_test_found_failed;
function _load_get_no_test_found_failed() {
return _get_no_test_found_failed = _interopRequireDefault(require('./get_no_test_found_failed'));
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function getNoTestsFoundMessage(testRunData, globalConfig) {
if (globalConfig.onlyFailures) {
return (0, (_get_no_test_found_failed || _load_get_no_test_found_failed()).default)();
}
if (globalConfig.onlyChanged) {
return (0, (_get_no_test_found_related_to_changed_files || _load_get_no_test_found_related_to_changed_files()).default)(globalConfig);
}
return testRunData.length === 1 || globalConfig.verbose ? (0, (_get_no_test_found_verbose || _load_get_no_test_found_verbose()).default)(testRunData, globalConfig) : (0, (_get_no_test_found || _load_get_no_test_found()).default)(testRunData, globalConfig);
}

View File

@@ -0,0 +1,30 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = getNoTestFoundRelatedToChangedFiles;
var _chalk;
function _load_chalk() {
return _chalk = _interopRequireDefault(require('chalk'));
}
var _jestUtil;
function _load_jestUtil() {
return _jestUtil = require('jest-util');
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function getNoTestFoundRelatedToChangedFiles(globalConfig) {
let msg = (_chalk || _load_chalk()).default.bold('No tests found related to files changed since last commit.');
if ((_jestUtil || _load_jestUtil()).isInteractive) {
msg += (_chalk || _load_chalk()).default.dim('\n' + (globalConfig.watch ? 'Press `a` to run all tests, or run Jest with `--watchAll`.' : 'Run Jest without `-o` or with `--all` to run all tests.'));
}
return msg;
}

View File

@@ -0,0 +1,49 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = getNoTestFoundVerbose;
var _chalk;
function _load_chalk() {
return _chalk = _interopRequireDefault(require('chalk'));
}
var _pluralize;
function _load_pluralize() {
return _pluralize = _interopRequireDefault(require('./pluralize'));
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function getNoTestFoundVerbose(testRunData, globalConfig) {
const individualResults = testRunData.map(testRun => {
const stats = testRun.matches.stats || {};
const config = testRun.context.config;
const statsMessage = Object.keys(stats).map(key => {
if (key === 'roots' && config.roots.length === 1) {
return null;
}
const value = config[key];
if (value) {
const matches = (0, (_pluralize || _load_pluralize()).default)('match', stats[key], 'es');
return ` ${key}: ${(_chalk || _load_chalk()).default.yellow(value)} - ${matches}`;
}
return null;
}).filter(line => line).join('\n');
return testRun.matches.total ? `In ${(_chalk || _load_chalk()).default.bold(config.rootDir)}\n` + ` ${(0, (_pluralize || _load_pluralize()).default)('file', testRun.matches.total || 0, 's')} checked.\n` + statsMessage : `No files found in ${config.rootDir}.\n` + `Make sure Jest's configuration does not exclude this directory.` + `\nTo set up Jest, make sure a package.json file exists.\n` + `Jest Documentation: ` + `facebook.github.io/jest/docs/configuration.html`;
});
let dataMessage;
if (globalConfig.runTestsByPath) {
dataMessage = `Files: ${globalConfig.nonFlagArgs.map(p => `"${p}"`).join(', ')}`;
} else {
dataMessage = `Pattern: ${(_chalk || _load_chalk()).default.yellow(globalConfig.testPathPattern)} - 0 matches`;
}
return (_chalk || _load_chalk()).default.bold('No tests found') + '\n' + individualResults.join('\n') + '\n' + dataMessage;
}

49
node_modules/jest/node_modules/jest-cli/build/jest.js generated vendored Normal file
View File

@@ -0,0 +1,49 @@
'use strict';
var _package;
function _load_package() {
return _package = require('../package.json');
}
var _search_source;
function _load_search_source() {
return _search_source = _interopRequireDefault(require('./search_source'));
}
var _test_scheduler;
function _load_test_scheduler() {
return _test_scheduler = _interopRequireDefault(require('./test_scheduler'));
}
var _test_watcher;
function _load_test_watcher() {
return _test_watcher = _interopRequireDefault(require('./test_watcher'));
}
var _cli;
function _load_cli() {
return _cli = require('./cli');
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
module.exports = {
SearchSource: (_search_source || _load_search_source()).default,
TestScheduler: (_test_scheduler || _load_test_scheduler()).default,
TestWatcher: (_test_watcher || _load_test_watcher()).default,
getVersion: () => (_package || _load_package()).version,
run: (_cli || _load_cli()).run,
runCLI: (_cli || _load_cli()).runCLI
}; /**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/

View File

@@ -0,0 +1,60 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }
class JestHooks {
constructor() {
this._listeners = {
shouldRunTestSuite: [],
testRunComplete: []
};
}
getSubscriber() {
return {
shouldRunTestSuite: fn => {
this._listeners.shouldRunTestSuite.push(fn);
},
testRunComplete: fn => {
this._listeners.testRunComplete.push(fn);
}
};
}
getEmitter() {
var _this = this;
return {
shouldRunTestSuite: (() => {
var _ref = _asyncToGenerator(function* (testPath) {
return Promise.all(_this._listeners.shouldRunTestSuite.map(function (listener) {
return listener(testPath);
})).then(function (result) {
return result.every(function (shouldRunTestSuite) {
return shouldRunTestSuite;
});
});
});
return function shouldRunTestSuite(_x) {
return _ref.apply(this, arguments);
};
})(),
testRunComplete: results => this._listeners.testRunComplete.forEach(listener => listener(results))
};
}
} /**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/
exports.default = JestHooks;

View File

@@ -0,0 +1,102 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _constants;
function _load_constants() {
return _constants = require('../constants');
}
/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/
class Prompt {
constructor() {
this._onResize = this._onResize.bind(this);
}
_onResize() {
this._onChange(this._value);
}
enter(onChange, onSuccess, onCancel) {
this._entering = true;
this._value = '';
this._onSuccess = onSuccess;
this._onCancel = onCancel;
this._selection = null;
this._offset = -1;
this._promptLength = 0;
this._onChange = () => onChange(this._value, {
max: 10,
offset: this._offset
});
this._onChange();
process.stdout.on('resize', this._onResize);
}
setPromptLength(length) {
this._promptLength = length;
}
setPromptSelection(selected) {
this._selection = selected;
}
put(key) {
switch (key) {
case (_constants || _load_constants()).KEYS.ENTER:
this._entering = false;
this._onSuccess(this._selection || this._value);
this.abort();
break;
case (_constants || _load_constants()).KEYS.ESCAPE:
this._entering = false;
this._onCancel(this._value);
this.abort();
break;
case (_constants || _load_constants()).KEYS.ARROW_DOWN:
this._offset = Math.min(this._offset + 1, this._promptLength - 1);
this._onChange();
break;
case (_constants || _load_constants()).KEYS.ARROW_UP:
this._offset = Math.max(this._offset - 1, -1);
this._onChange();
break;
case (_constants || _load_constants()).KEYS.ARROW_LEFT:
case (_constants || _load_constants()).KEYS.ARROW_RIGHT:
break;
default:
const char = new Buffer(key, 'hex').toString();
this._value = key === (_constants || _load_constants()).KEYS.BACKSPACE ? this._value.slice(0, -1) : this._value + char;
this._offset = -1;
this._selection = null;
this._onChange();
break;
}
}
abort() {
this._entering = false;
this._value = '';
process.stdout.removeListener('resize', this._onResize);
}
isEntering() {
return this._entering;
}
}
exports.default = Prompt;

View File

@@ -0,0 +1,39 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _chalk;
function _load_chalk() {
return _chalk = _interopRequireDefault(require('chalk'));
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/
const activeFilters = function (globalConfig) {
let delimiter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '\n';
const testNamePattern = globalConfig.testNamePattern,
testPathPattern = globalConfig.testPathPattern;
if (testNamePattern || testPathPattern) {
const filters = [testPathPattern ? (_chalk || _load_chalk()).default.dim('filename ') + (_chalk || _load_chalk()).default.yellow('/' + testPathPattern + '/') : null, testNamePattern ? (_chalk || _load_chalk()).default.dim('test name ') + (_chalk || _load_chalk()).default.yellow('/' + testNamePattern + '/') : null].filter(f => f).join(', ');
const messages = ['\n' + (_chalk || _load_chalk()).default.bold('Active Filters: ') + filters];
return messages.filter(message => !!message).join(delimiter);
}
return '';
};
exports.default = activeFilters;

View File

@@ -0,0 +1,22 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _chalk;
function _load_chalk() {
return _chalk = _interopRequireDefault(require('chalk'));
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = (str, start, end) => (_chalk || _load_chalk()).default.dim(str.slice(0, start)) + (_chalk || _load_chalk()).default.reset(str.slice(start, end)) + (_chalk || _load_chalk()).default.dim(str.slice(end)); /**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/

View File

@@ -0,0 +1,33 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _jestRuntime;
function _load_jestRuntime() {
return _jestRuntime = _interopRequireDefault(require('jest-runtime'));
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/
exports.default = (config, _ref) => {
let hasteFS = _ref.hasteFS,
moduleMap = _ref.moduleMap;
return {
config,
hasteFS,
moduleMap,
resolver: (_jestRuntime || _load_jestRuntime()).default.createResolver(config, moduleMap)
};
};

View File

@@ -0,0 +1,69 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _chalk;
function _load_chalk() {
return _chalk = _interopRequireDefault(require('chalk'));
}
var _colorize;
function _load_colorize() {
return _colorize = _interopRequireDefault(require('./colorize'));
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/
const DOTS = '...';
const ENTER = '⏎';
exports.default = (testName, pattern, width) => {
const inlineTestName = testName.replace(/(\r\n|\n|\r)/gm, ENTER);
let regexp;
try {
regexp = new RegExp(pattern, 'i');
} catch (e) {
return (_chalk || _load_chalk()).default.dim(inlineTestName);
}
const match = inlineTestName.match(regexp);
if (!match) {
return (_chalk || _load_chalk()).default.dim(inlineTestName);
}
// $FlowFixMe
const startPatternIndex = Math.max(match.index, 0);
const endPatternIndex = startPatternIndex + match[0].length;
if (inlineTestName.length <= width) {
return (0, (_colorize || _load_colorize()).default)(inlineTestName, startPatternIndex, endPatternIndex);
}
const slicedTestName = inlineTestName.slice(0, width - DOTS.length);
if (startPatternIndex < slicedTestName.length) {
if (endPatternIndex > slicedTestName.length) {
return (0, (_colorize || _load_colorize()).default)(slicedTestName + DOTS, startPatternIndex, slicedTestName.length + DOTS.length);
} else {
return (0, (_colorize || _load_colorize()).default)(slicedTestName + DOTS, Math.min(startPatternIndex, slicedTestName.length), endPatternIndex);
}
}
return `${(_chalk || _load_chalk()).default.dim(slicedTestName)}${(_chalk || _load_chalk()).default.reset(DOTS)}`;
};

View File

@@ -0,0 +1,54 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _chalk;
function _load_chalk() {
return _chalk = _interopRequireDefault(require('chalk'));
}
var _constants;
function _load_constants() {
return _constants = require('../constants');
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/
exports.default = function (pipe) {
let stdin = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : process.stdin;
return new Promise((resolve, reject) => {
if (typeof stdin.setRawMode === 'function') {
const messages = [(_chalk || _load_chalk()).default.red('There are deprecation warnings.\n'), (_chalk || _load_chalk()).default.dim(' \u203A Press ') + 'Enter' + (_chalk || _load_chalk()).default.dim(' to continue.'), (_chalk || _load_chalk()).default.dim(' \u203A Press ') + 'Esc' + (_chalk || _load_chalk()).default.dim(' to exit.')];
pipe.write(messages.join('\n'));
// $FlowFixMe
stdin.setRawMode(true);
stdin.resume();
stdin.setEncoding('hex');
stdin.on('data', key => {
if (key === (_constants || _load_constants()).KEYS.ENTER) {
resolve();
} else if ([(_constants || _load_constants()).KEYS.ESCAPE, (_constants || _load_constants()).KEYS.CONTROL_C, (_constants || _load_constants()).KEYS.CONTROL_D].indexOf(key) !== -1) {
reject();
}
});
} else {
resolve();
}
});
};

View File

@@ -0,0 +1,20 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = isValidPath;
const SNAPSHOT_EXTENSION = 'snap'; /**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/
function isValidPath(globalConfig, config, filePath) {
return !filePath.includes(globalConfig.coverageDirectory) && !config.watchPathIgnorePatterns.some(pattern => filePath.match(pattern)) && !filePath.endsWith(`.${SNAPSHOT_EXTENSION}`);
}

View File

@@ -0,0 +1,30 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = logDebugMessages;
var _package;
function _load_package() {
return _package = require('../../package.json');
}
/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/
function logDebugMessages(globalConfig, configs, outputStream) {
const output = {
configs,
globalConfig,
version: (_package || _load_package()).version
};
outputStream.write(JSON.stringify(output, null, ' ') + '\n');
}

View File

@@ -0,0 +1,50 @@
/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.printRestoredPatternCaret = exports.printPatternCaret = undefined;
var _chalk;
function _load_chalk() {
return _chalk = _interopRequireDefault(require('chalk'));
}
var _ansiEscapes;
function _load_ansiEscapes() {
return _ansiEscapes = _interopRequireDefault(require('ansi-escapes'));
}
var _stringLength;
function _load_stringLength() {
return _stringLength = _interopRequireDefault(require('string-length'));
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const printPatternCaret = exports.printPatternCaret = (pattern, pipe) => {
const inputText = `${(_chalk || _load_chalk()).default.dim(' pattern \u203A')} ${pattern}`;
pipe.write((_ansiEscapes || _load_ansiEscapes()).default.eraseDown);
pipe.write(inputText);
pipe.write((_ansiEscapes || _load_ansiEscapes()).default.cursorSavePosition);
};
const printRestoredPatternCaret = exports.printRestoredPatternCaret = (pattern, currentUsageRows, pipe) => {
const inputText = `${(_chalk || _load_chalk()).default.dim(' pattern \u203A')} ${pattern}`;
pipe.write((_ansiEscapes || _load_ansiEscapes()).default.cursorTo((0, (_stringLength || _load_stringLength()).default)(inputText), currentUsageRows - 1));
pipe.write((_ansiEscapes || _load_ansiEscapes()).default.cursorRestorePosition);
};

View File

@@ -0,0 +1,39 @@
/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = scroll;
function scroll(size, _ref) {
let offset = _ref.offset,
max = _ref.max;
let start = 0;
let index = Math.min(offset, size);
const halfScreen = max / 2;
if (index <= halfScreen) {
start = 0;
} else {
if (size >= max) {
start = Math.min(index - halfScreen - 1, size - max);
}
index = Math.min(index - start, size);
}
return {
end: Math.min(size, start + max),
index,
start
};
}

View File

@@ -0,0 +1,16 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/
/* $FlowFixMe */
const getTerminalWidth = exports.getTerminalWidth = () => process.stdout.columns;

View File

@@ -0,0 +1,60 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/
exports.default = (globalConfig, options) => {
// $FlowFixMe Object.assign
const newConfig = Object.assign({}, globalConfig);
if (!options) {
options = {};
}
if (options.updateSnapshot) {
newConfig.updateSnapshot = options.updateSnapshot;
}
if (options.mode === 'watch') {
newConfig.watch = true;
newConfig.watchAll = false;
} else if (options.mode === 'watchAll') {
newConfig.watch = false;
newConfig.watchAll = true;
}
if ('testPathPattern' in options) {
newConfig.testPathPattern = options.testPathPattern || '';
}
if ('testNamePattern' in options) {
newConfig.testNamePattern = options.testNamePattern || '';
}
newConfig.onlyChanged = false;
newConfig.onlyChanged = !newConfig.watchAll && !newConfig.testNamePattern && !newConfig.testPathPattern;
if (options.noSCM) {
newConfig.noSCM = true;
}
if (options.passWithNoTests) {
newConfig.passWithNoTests = true;
}
if ('onlyFailures' in options) {
newConfig.onlyFailures = options.onlyFailures || false;
}
return Object.freeze(newConfig);
};

View File

@@ -0,0 +1,70 @@
/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _chalk;
function _load_chalk() {
return _chalk = _interopRequireDefault(require('chalk'));
}
var _ansiEscapes;
function _load_ansiEscapes() {
return _ansiEscapes = _interopRequireDefault(require('ansi-escapes'));
}
var _Prompt;
function _load_Prompt() {
return _Prompt = _interopRequireDefault(require('./lib/Prompt'));
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const usage = entity => `\n${(_chalk || _load_chalk()).default.bold('Pattern Mode Usage')}\n` + ` ${(_chalk || _load_chalk()).default.dim('\u203A Press')} Esc ${(_chalk || _load_chalk()).default.dim('to exit pattern mode.')}\n` + ` ${(_chalk || _load_chalk()).default.dim('\u203A Press')} Enter ` + `${(_chalk || _load_chalk()).default.dim(`to filter by a ${entity} regex pattern.`)}\n` + `\n`;
const usageRows = usage('').split('\n').length;
class PatternPrompt {
constructor(pipe, prompt) {
this._pipe = pipe;
this._prompt = prompt;
this._currentUsageRows = usageRows;
}
run(onSuccess, onCancel, options) {
this._pipe.write((_ansiEscapes || _load_ansiEscapes()).default.cursorHide);
this._pipe.write((_ansiEscapes || _load_ansiEscapes()).default.clearScreen);
if (options && options.header) {
this._pipe.write(options.header + '\n');
this._currentUsageRows = usageRows + options.header.split('\n').length;
} else {
this._currentUsageRows = usageRows;
}
this._pipe.write(usage(this._entityName));
this._pipe.write((_ansiEscapes || _load_ansiEscapes()).default.cursorShow);
this._prompt.enter(this._onChange.bind(this), onSuccess, onCancel);
}
_onChange(pattern, options) {
this._pipe.write((_ansiEscapes || _load_ansiEscapes()).default.eraseLine);
this._pipe.write((_ansiEscapes || _load_ansiEscapes()).default.cursorLeft);
}
}
exports.default = PatternPrompt;

View File

@@ -0,0 +1,46 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _base_watch_plugin;
function _load_base_watch_plugin() {
return _base_watch_plugin = _interopRequireDefault(require('../base_watch_plugin'));
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } /**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/
class QuitPlugin extends (_base_watch_plugin || _load_base_watch_plugin()).default {
run() {
var _this = this;
return _asyncToGenerator(function* () {
if (typeof _this._stdin.setRawMode === 'function') {
_this._stdin.setRawMode(false);
}
_this._stdout.write('\n');
process.exit(0);
})();
}
getUsageInfo() {
return {
key: 'q'.codePointAt(0),
prompt: 'quit watch mode'
};
}
}
exports.default = QuitPlugin;

View File

@@ -0,0 +1,71 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _base_watch_plugin;
function _load_base_watch_plugin() {
return _base_watch_plugin = _interopRequireDefault(require('../base_watch_plugin'));
}
var _test_name_pattern_prompt;
function _load_test_name_pattern_prompt() {
return _test_name_pattern_prompt = _interopRequireDefault(require('../test_name_pattern_prompt'));
}
var _active_filters_message;
function _load_active_filters_message() {
return _active_filters_message = _interopRequireDefault(require('../lib/active_filters_message'));
}
var _Prompt;
function _load_Prompt() {
return _Prompt = _interopRequireDefault(require('../lib/Prompt'));
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
class TestNamePatternPlugin extends (_base_watch_plugin || _load_base_watch_plugin()).default {
constructor(options) {
super(options);
this._prompt = new (_Prompt || _load_Prompt()).default();
}
getUsageInfo() {
return {
key: 't'.codePointAt(0),
prompt: 'filter by a test name regex pattern'
};
}
onKey(key) {
this._prompt.put(key);
}
run(globalConfig, updateConfigAndRun) {
return new Promise((res, rej) => {
const testPathPatternPrompt = new (_test_name_pattern_prompt || _load_test_name_pattern_prompt()).default(this._stdout, this._prompt);
testPathPatternPrompt.run(value => {
updateConfigAndRun({ testNamePattern: value });
res();
}, rej, {
header: (0, (_active_filters_message || _load_active_filters_message()).default)(globalConfig)
});
});
}
} /**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/
exports.default = TestNamePatternPlugin;

View File

@@ -0,0 +1,72 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _base_watch_plugin;
function _load_base_watch_plugin() {
return _base_watch_plugin = _interopRequireDefault(require('../base_watch_plugin'));
}
var _test_path_pattern_prompt;
function _load_test_path_pattern_prompt() {
return _test_path_pattern_prompt = _interopRequireDefault(require('../test_path_pattern_prompt'));
}
var _active_filters_message;
function _load_active_filters_message() {
return _active_filters_message = _interopRequireDefault(require('../lib/active_filters_message'));
}
var _Prompt;
function _load_Prompt() {
return _Prompt = _interopRequireDefault(require('../lib/Prompt'));
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
class TestPathPatternPlugin extends (_base_watch_plugin || _load_base_watch_plugin()).default {
constructor(options) {
super(options);
this._prompt = new (_Prompt || _load_Prompt()).default();
}
getUsageInfo() {
return {
key: 'p'.codePointAt(0),
prompt: 'filter by a filename regex pattern'
};
}
onKey(key) {
this._prompt.put(key);
}
run(globalConfig, updateConfigAndRun) {
return new Promise((res, rej) => {
const testPathPatternPrompt = new (_test_path_pattern_prompt || _load_test_path_pattern_prompt()).default(this._stdout, this._prompt);
testPathPatternPrompt.run(value => {
updateConfigAndRun({ testPathPattern: value });
res();
}, rej, {
header: (0, (_active_filters_message || _load_active_filters_message()).default)(globalConfig)
});
});
}
} /**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/
exports.default = TestPathPatternPlugin;

View File

@@ -0,0 +1,47 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _base_watch_plugin;
function _load_base_watch_plugin() {
return _base_watch_plugin = _interopRequireDefault(require('../base_watch_plugin'));
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/
class UpdateSnapshotsPlugin extends (_base_watch_plugin || _load_base_watch_plugin()).default {
run(globalConfig, updateConfigAndRun) {
updateConfigAndRun({ updateSnapshot: 'all' });
return Promise.resolve(false);
}
apply(hooks) {
hooks.testRunComplete(results => {
this._hasSnapshotFailure = results.snapshot.failure;
});
}
getUsageInfo(globalConfig) {
if (this._hasSnapshotFailure) {
return {
key: 'u'.codePointAt(0),
prompt: 'update failing snapshots'
};
}
return null;
}
}
exports.default = UpdateSnapshotsPlugin;

View File

@@ -0,0 +1,87 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _base_watch_plugin;
function _load_base_watch_plugin() {
return _base_watch_plugin = _interopRequireDefault(require('../base_watch_plugin'));
}
var _jestUtil;
function _load_jestUtil() {
return _jestUtil = require('jest-util');
}
var _snapshot_interactive_mode;
function _load_snapshot_interactive_mode() {
return _snapshot_interactive_mode = _interopRequireDefault(require('../snapshot_interactive_mode'));
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
class UpdateSnapshotInteractivePlugin extends (_base_watch_plugin || _load_base_watch_plugin()).default {
constructor(options) {
super(options);
this._failedSnapshotTestPaths = [];
this._snapshotInteractiveMode = new (_snapshot_interactive_mode || _load_snapshot_interactive_mode()).default(this._stdout);
}
apply(hooks) {
hooks.testRunComplete(results => {
this._failedSnapshotTestPaths = (0, (_jestUtil || _load_jestUtil()).getFailedSnapshotTests)(results);
if (this._snapshotInteractiveMode.isActive()) {
this._snapshotInteractiveMode.updateWithResults(results);
}
});
}
onKey(key) {
if (this._snapshotInteractiveMode.isActive()) {
this._snapshotInteractiveMode.put(key);
}
}
run(globalConfig, updateConfigAndRun) {
if (this._failedSnapshotTestPaths.length) {
return new Promise(res => {
this._snapshotInteractiveMode.run(this._failedSnapshotTestPaths, (path, shouldUpdateSnapshot) => {
updateConfigAndRun({
testNamePattern: '',
testPathPattern: path,
updateSnapshot: shouldUpdateSnapshot ? 'all' : 'none'
});
if (!this._snapshotInteractiveMode.isActive()) {
res();
}
});
});
} else {
return Promise.resolve();
}
}
getUsageInfo(globalConfig) {
if (this._failedSnapshotTestPaths && this._failedSnapshotTestPaths.length > 0) {
return {
key: 'i'.codePointAt(0),
prompt: 'update failing snapshots interactively'
};
}
return null;
}
} /**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/
exports.default = UpdateSnapshotInteractivePlugin;

View File

@@ -0,0 +1,9 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = pluralize;
function pluralize(word, count, ending) {
return `${count} ${word}${count === 1 ? '' : ending}`;
}

View File

@@ -0,0 +1,41 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.remove = exports.print = undefined;
var _jestUtil;
function _load_jestUtil() {
return _jestUtil = require('jest-util');
}
var _chalk;
function _load_chalk() {
return _chalk = _interopRequireDefault(require('chalk'));
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/
const print = exports.print = stream => {
if ((_jestUtil || _load_jestUtil()).isInteractive) {
stream.write((_chalk || _load_chalk()).default.bold.dim('Determining test suites to run...'));
}
};
const remove = exports.remove = stream => {
if ((_jestUtil || _load_jestUtil()).isInteractive) {
(0, (_jestUtil || _load_jestUtil()).clearLine)(stream);
}
};

View File

@@ -0,0 +1,82 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }
class ReporterDispatcher {
constructor() {
this._reporters = [];
}
register(reporter) {
this._reporters.push(reporter);
}
unregister(ReporterClass) {
this._reporters = this._reporters.filter(reporter => !(reporter instanceof ReporterClass));
}
onTestResult(test, testResult, results) {
var _this = this;
return _asyncToGenerator(function* () {
for (const reporter of _this._reporters) {
reporter.onTestResult && (yield reporter.onTestResult(test, testResult, results));
}
})();
}
onTestStart(test) {
var _this2 = this;
return _asyncToGenerator(function* () {
for (const reporter of _this2._reporters) {
reporter.onTestStart && (yield reporter.onTestStart(test));
}
})();
}
onRunStart(results, options) {
var _this3 = this;
return _asyncToGenerator(function* () {
for (const reporter of _this3._reporters) {
reporter.onRunStart && (yield reporter.onRunStart(results, options));
}
})();
}
onRunComplete(contexts, results) {
var _this4 = this;
return _asyncToGenerator(function* () {
for (const reporter of _this4._reporters) {
reporter.onRunComplete && (yield reporter.onRunComplete(contexts, results));
}
})();
}
// Return a list of last errors for every reporter
getErrors() {
return this._reporters.reduce((list, reporter) => {
const error = reporter.getLastError && reporter.getLastError();
return error ? list.concat(error) : list;
}, []);
}
hasErrors() {
return this.getErrors().length !== 0;
}
}
exports.default = ReporterDispatcher; /**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/

View File

@@ -0,0 +1,189 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _chalk;
function _load_chalk() {
return _chalk = _interopRequireDefault(require('chalk'));
}
var _stringLength;
function _load_stringLength() {
return _stringLength = _interopRequireDefault(require('string-length'));
}
var _utils;
function _load_utils() {
return _utils = require('./utils');
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/
const RUNNING_TEXT = ' RUNS ';
const RUNNING = (_chalk || _load_chalk()).default.reset.inverse.yellow.bold(RUNNING_TEXT) + ' ';
/**
* This class is a perf optimization for sorting the list of currently
* running tests. It tries to keep tests in the same positions without
* shifting the whole list.
*/
class CurrentTestList {
constructor() {
this._array = [];
}
add(testPath, config) {
const index = this._array.indexOf(null);
const record = { config, testPath };
if (index !== -1) {
this._array[index] = record;
} else {
this._array.push(record);
}
}
delete(testPath) {
const record = this._array.find(record => record && record.testPath === testPath);
this._array[this._array.indexOf(record || null)] = null;
}
get() {
return this._array;
}
}
/**
* A class that generates the CLI status of currently running tests
* and also provides an ANSI escape sequence to remove status lines
* from the terminal.
*/
class Status {
constructor() {
this._cache = null;
this._currentTests = new CurrentTestList();
this._done = false;
this._emitScheduled = false;
this._estimatedTime = 0;
this._height = 0;
this._showStatus = false;
}
onChange(callback) {
this._callback = callback;
}
runStarted(aggregatedResults, options) {
this._estimatedTime = options && options.estimatedTime || 0;
this._showStatus = options && options.showStatus;
this._interval = setInterval(() => this._tick(), 1000);
this._aggregatedResults = aggregatedResults;
this._debouncedEmit();
}
runFinished() {
this._done = true;
clearInterval(this._interval);
this._emit();
}
testStarted(testPath, config) {
this._currentTests.add(testPath, config);
if (!this._showStatus) {
this._emit();
} else {
this._debouncedEmit();
}
}
testFinished(config, testResult, aggregatedResults) {
const testFilePath = testResult.testFilePath;
this._aggregatedResults = aggregatedResults;
this._currentTests.delete(testFilePath);
this._debouncedEmit();
}
get() {
if (this._cache) {
return this._cache;
}
if (this._done) {
return { clear: '', content: '' };
}
// $FlowFixMe
const width = process.stdout.columns;
let content = '\n';
this._currentTests.get().forEach(record => {
if (record) {
const config = record.config,
testPath = record.testPath;
const projectDisplayName = config.displayName ? (0, (_utils || _load_utils()).printDisplayName)(config) + ' ' : '';
const prefix = RUNNING + projectDisplayName;
content += (0, (_utils || _load_utils()).wrapAnsiString)(prefix + (0, (_utils || _load_utils()).trimAndFormatPath)((0, (_stringLength || _load_stringLength()).default)(prefix), config, testPath, width), width) + '\n';
}
});
if (this._showStatus && this._aggregatedResults) {
content += '\n' + (0, (_utils || _load_utils()).getSummary)(this._aggregatedResults, {
estimatedTime: this._estimatedTime,
roundTime: true,
width
});
}
let height = 0;
for (let i = 0; i < content.length; i++) {
if (content[i] === '\n') {
height++;
}
}
const clear = '\r\x1B[K\r\x1B[1A'.repeat(height);
return this._cache = { clear, content };
}
_emit() {
this._cache = null;
this._lastUpdated = Date.now();
this._callback();
}
_debouncedEmit() {
if (!this._emitScheduled) {
// Perf optimization to avoid two separate renders When
// one test finishes and another test starts executing.
this._emitScheduled = true;
setTimeout(() => {
this._emit();
this._emitScheduled = false;
}, 100);
}
}
_tick() {
this._debouncedEmit();
}
}
exports.default = Status;

View File

@@ -0,0 +1,46 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _pre_run_message;
function _load_pre_run_message() {
return _pre_run_message = require('../pre_run_message');
}
class BaseReporter {
log(message) {
process.stderr.write(message + '\n');
}
onRunStart(results, options) {
(0, (_pre_run_message || _load_pre_run_message()).remove)(process.stderr);
}
onTestResult(test, testResult, results) {}
onTestStart(test) {}
onRunComplete(contexts, aggregatedResults) {}
_setError(error) {
this._error = error;
}
// Return an error that occurred during reporting. This error will
// define whether the test run was successful or failed.
getLastError() {
return this._error;
}
}
exports.default = BaseReporter; /**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/

View File

@@ -0,0 +1,357 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _jestUtil;
function _load_jestUtil() {
return _jestUtil = require('jest-util');
}
var _istanbulApi;
function _load_istanbulApi() {
return _istanbulApi = require('istanbul-api');
}
var _chalk;
function _load_chalk() {
return _chalk = _interopRequireDefault(require('chalk'));
}
var _istanbulLibCoverage;
function _load_istanbulLibCoverage() {
return _istanbulLibCoverage = _interopRequireDefault(require('istanbul-lib-coverage'));
}
var _istanbulLibSourceMaps;
function _load_istanbulLibSourceMaps() {
return _istanbulLibSourceMaps = _interopRequireDefault(require('istanbul-lib-source-maps'));
}
var _jestWorker;
function _load_jestWorker() {
return _jestWorker = _interopRequireDefault(require('jest-worker'));
}
var _base_reporter;
function _load_base_reporter() {
return _base_reporter = _interopRequireDefault(require('./base_reporter'));
}
var _path;
function _load_path() {
return _path = _interopRequireDefault(require('path'));
}
var _glob;
function _load_glob() {
return _glob = _interopRequireDefault(require('glob'));
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } /**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/
const FAIL_COLOR = (_chalk || _load_chalk()).default.bold.red;
const RUNNING_TEST_COLOR = (_chalk || _load_chalk()).default.bold.dim;
class CoverageReporter extends (_base_reporter || _load_base_reporter()).default {
constructor(globalConfig) {
super();
this._coverageMap = (_istanbulLibCoverage || _load_istanbulLibCoverage()).default.createCoverageMap({});
this._globalConfig = globalConfig;
this._sourceMapStore = (_istanbulLibSourceMaps || _load_istanbulLibSourceMaps()).default.createSourceMapStore();
}
onTestResult(test, testResult, aggregatedResults) {
if (testResult.coverage) {
this._coverageMap.merge(testResult.coverage);
// Remove coverage data to free up some memory.
delete testResult.coverage;
Object.keys(testResult.sourceMaps).forEach(sourcePath => {
let inputSourceMap;
try {
const coverage = this._coverageMap.fileCoverageFor(sourcePath);
var _coverage$toJSON = coverage.toJSON();
inputSourceMap = _coverage$toJSON.inputSourceMap;
} finally {
if (inputSourceMap) {
this._sourceMapStore.registerMap(sourcePath, inputSourceMap);
} else {
this._sourceMapStore.registerURL(sourcePath, testResult.sourceMaps[sourcePath]);
}
}
});
}
}
onRunComplete(contexts, aggregatedResults) {
var _this = this;
return _asyncToGenerator(function* () {
yield _this._addUntestedFiles(_this._globalConfig, contexts);
var _sourceMapStore$trans = _this._sourceMapStore.transformCoverage(_this._coverageMap);
const map = _sourceMapStore$trans.map,
sourceFinder = _sourceMapStore$trans.sourceFinder;
const reporter = (0, (_istanbulApi || _load_istanbulApi()).createReporter)();
try {
if (_this._globalConfig.coverageDirectory) {
reporter.dir = _this._globalConfig.coverageDirectory;
}
let coverageReporters = _this._globalConfig.coverageReporters || [];
if (!_this._globalConfig.useStderr && coverageReporters.length && coverageReporters.indexOf('text') === -1) {
coverageReporters = coverageReporters.concat(['text-summary']);
}
reporter.addAll(coverageReporters);
reporter.write(map, sourceFinder && { sourceFinder });
aggregatedResults.coverageMap = map;
} catch (e) {
console.error((_chalk || _load_chalk()).default.red(`
Failed to write coverage reports:
ERROR: ${e.toString()}
STACK: ${e.stack}
`));
}
_this._checkThreshold(_this._globalConfig, map);
})();
}
_addUntestedFiles(globalConfig, contexts) {
var _this2 = this;
return _asyncToGenerator(function* () {
const files = [];
contexts.forEach(function (context) {
const config = context.config;
if (globalConfig.collectCoverageFrom && globalConfig.collectCoverageFrom.length) {
context.hasteFS.matchFilesWithGlob(globalConfig.collectCoverageFrom, config.rootDir).forEach(function (filePath) {
return files.push({
config,
path: filePath
});
});
}
});
if (!files.length) {
return;
}
if ((_jestUtil || _load_jestUtil()).isInteractive) {
process.stderr.write(RUNNING_TEST_COLOR('Running coverage on untested files...'));
}
let worker;
if (_this2._globalConfig.maxWorkers <= 1) {
worker = require('./coverage_worker');
} else {
// $FlowFixMe: assignment of a worker with custom properties.
worker = new (_jestWorker || _load_jestWorker()).default(require.resolve('./coverage_worker'), {
exposedMethods: ['worker'],
maxRetries: 2,
numWorkers: _this2._globalConfig.maxWorkers
});
}
const instrumentation = files.map((() => {
var _ref = _asyncToGenerator(function* (fileObj) {
const filename = fileObj.path;
const config = fileObj.config;
if (!_this2._coverageMap.data[filename]) {
try {
const result = yield worker.worker({
config,
globalConfig,
path: filename
});
if (result) {
_this2._coverageMap.addFileCoverage(result.coverage);
if (result.sourceMapPath) {
_this2._sourceMapStore.registerURL(filename, result.sourceMapPath);
}
}
} catch (error) {
console.error((_chalk || _load_chalk()).default.red([`Failed to collect coverage from ${filename}`, `ERROR: ${error.message}`, `STACK: ${error.stack}`].join('\n')));
}
}
});
return function (_x) {
return _ref.apply(this, arguments);
};
})());
try {
yield Promise.all(instrumentation);
} catch (err) {
// Do nothing; errors were reported earlier to the console.
}
if ((_jestUtil || _load_jestUtil()).isInteractive) {
(0, (_jestUtil || _load_jestUtil()).clearLine)(process.stderr);
}
if (worker && typeof worker.end === 'function') {
worker.end();
}
})();
}
_checkThreshold(globalConfig, map) {
if (globalConfig.coverageThreshold) {
function check(name, thresholds, actuals) {
return ['statements', 'branches', 'lines', 'functions'].reduce((errors, key) => {
const actual = actuals[key].pct;
const actualUncovered = actuals[key].total - actuals[key].covered;
const threshold = thresholds[key];
if (threshold != null) {
if (threshold < 0) {
if (threshold * -1 < actualUncovered) {
errors.push(`Jest: Uncovered count for ${key} (${actualUncovered})` + `exceeds ${name} threshold (${-1 * threshold})`);
}
} else if (actual < threshold) {
errors.push(`Jest: "${name}" coverage threshold for ${key} (${threshold}%) not met: ${actual}%`);
}
}
return errors;
}, []);
}
const THRESHOLD_GROUP_TYPES = {
GLOB: 'glob',
GLOBAL: 'global',
PATH: 'path'
};
const coveredFiles = map.files();
const thresholdGroups = Object.keys(globalConfig.coverageThreshold);
const numThresholdGroups = thresholdGroups.length;
const groupTypeByThresholdGroup = {};
const filesByGlob = {};
const coveredFilesSortedIntoThresholdGroup = coveredFiles.map(file => {
for (let i = 0; i < numThresholdGroups; i++) {
const thresholdGroup = thresholdGroups[i];
const absoluteThresholdGroup = (_path || _load_path()).default.resolve(thresholdGroup);
// The threshold group might be a path:
if (file.indexOf(absoluteThresholdGroup) === 0) {
groupTypeByThresholdGroup[thresholdGroup] = THRESHOLD_GROUP_TYPES.PATH;
return [file, thresholdGroup];
}
// If the threshold group is not a path it might be a glob:
// Note: glob.sync is slow. By memoizing the files matching each glob
// (rather than recalculating it for each covered file) we save a tonne
// of execution time.
if (filesByGlob[absoluteThresholdGroup] === undefined) {
filesByGlob[absoluteThresholdGroup] = (_glob || _load_glob()).default.sync(absoluteThresholdGroup).map(filePath => (_path || _load_path()).default.resolve(filePath));
}
if (filesByGlob[absoluteThresholdGroup].indexOf(file) > -1) {
groupTypeByThresholdGroup[thresholdGroup] = THRESHOLD_GROUP_TYPES.GLOB;
return [file, thresholdGroup];
}
}
// Neither a glob or a path? Toss it in global if there's a global threshold:
if (thresholdGroups.indexOf(THRESHOLD_GROUP_TYPES.GLOBAL) > -1) {
groupTypeByThresholdGroup[THRESHOLD_GROUP_TYPES.GLOBAL] = THRESHOLD_GROUP_TYPES.GLOBAL;
return [file, THRESHOLD_GROUP_TYPES.GLOBAL];
}
// A covered file that doesn't have a threshold:
return [file, undefined];
});
const getFilesInThresholdGroup = thresholdGroup => coveredFilesSortedIntoThresholdGroup.filter(fileAndGroup => fileAndGroup[1] === thresholdGroup).map(fileAndGroup => fileAndGroup[0]);
function combineCoverage(filePaths) {
return filePaths.map(filePath => map.fileCoverageFor(filePath)).reduce((combinedCoverage, nextFileCoverage) => {
if (combinedCoverage === undefined || combinedCoverage === null) {
return nextFileCoverage.toSummary();
}
return combinedCoverage.merge(nextFileCoverage.toSummary());
}, undefined);
}
let errors = [];
thresholdGroups.forEach(thresholdGroup => {
switch (groupTypeByThresholdGroup[thresholdGroup]) {
case THRESHOLD_GROUP_TYPES.GLOBAL:
{
const coverage = combineCoverage(getFilesInThresholdGroup(THRESHOLD_GROUP_TYPES.GLOBAL));
if (coverage) {
errors = errors.concat(check(thresholdGroup, globalConfig.coverageThreshold[thresholdGroup], coverage));
}
break;
}
case THRESHOLD_GROUP_TYPES.PATH:
{
const coverage = combineCoverage(getFilesInThresholdGroup(thresholdGroup));
if (coverage) {
errors = errors.concat(check(thresholdGroup, globalConfig.coverageThreshold[thresholdGroup], coverage));
}
break;
}
case THRESHOLD_GROUP_TYPES.GLOB:
getFilesInThresholdGroup(thresholdGroup).forEach(fileMatchingGlob => {
errors = errors.concat(check(fileMatchingGlob, globalConfig.coverageThreshold[thresholdGroup], map.fileCoverageFor(fileMatchingGlob).toSummary()));
});
break;
default:
errors = errors.concat(`Jest: Coverage data for ${thresholdGroup} was not found.`);
}
});
errors = errors.filter(err => err !== undefined && err !== null && err.length > 0);
if (errors.length > 0) {
this.log(`${FAIL_COLOR(errors.join('\n'))}`);
this._setError(new Error(errors.join('\n')));
}
}
}
// Only exposed for the internal runner. Should not be used
getCoverageMap() {
return this._coverageMap;
}
}
exports.default = CoverageReporter;

View File

@@ -0,0 +1,49 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.worker = worker;
var _exit;
function _load_exit() {
return _exit = _interopRequireDefault(require('exit'));
}
var _fs;
function _load_fs() {
return _fs = _interopRequireDefault(require('fs'));
}
var _generate_empty_coverage;
function _load_generate_empty_coverage() {
return _generate_empty_coverage = _interopRequireDefault(require('../generate_empty_coverage'));
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
// Make sure uncaught errors are logged before we exit.
/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/
process.on('uncaughtException', err => {
console.error(err.stack);
(0, (_exit || _load_exit()).default)(1);
});
function worker(_ref) {
let config = _ref.config,
globalConfig = _ref.globalConfig,
path = _ref.path;
return (0, (_generate_empty_coverage || _load_generate_empty_coverage()).default)((_fs || _load_fs()).default.readFileSync(path, 'utf8'), path, globalConfig, config);
}

View File

@@ -0,0 +1,204 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _jestUtil;
function _load_jestUtil() {
return _jestUtil = require('jest-util');
}
var _chalk;
function _load_chalk() {
return _chalk = _interopRequireDefault(require('chalk'));
}
var _base_reporter;
function _load_base_reporter() {
return _base_reporter = _interopRequireDefault(require('./base_reporter'));
}
var _Status;
function _load_Status() {
return _Status = _interopRequireDefault(require('./Status'));
}
var _get_result_header;
function _load_get_result_header() {
return _get_result_header = _interopRequireDefault(require('./get_result_header'));
}
var _get_snapshot_status;
function _load_get_snapshot_status() {
return _get_snapshot_status = _interopRequireDefault(require('./get_snapshot_status'));
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/
/* global stream$Writable, tty$WriteStream */
const TITLE_BULLET = (_chalk || _load_chalk()).default.bold('\u25cf ');
class DefaultReporter extends (_base_reporter || _load_base_reporter()).default {
constructor(globalConfig) {
super();
this._globalConfig = globalConfig;
this._clear = '';
this._out = process.stdout.write.bind(process.stdout);
this._err = process.stderr.write.bind(process.stderr);
this._status = new (_Status || _load_Status()).default();
this._bufferedOutput = new Set();
this._wrapStdio(process.stdout);
this._wrapStdio(process.stderr);
this._status.onChange(() => {
this._clearStatus();
this._printStatus();
});
} // ANSI clear sequence for the last printed status
_wrapStdio(stream) {
const originalWrite = stream.write;
let buffer = [];
let timeout = null;
const flushBufferedOutput = () => {
const string = buffer.join('');
buffer = [];
// This is to avoid conflicts between random output and status text
this._clearStatus();
if (string) {
originalWrite.call(stream, string);
}
this._printStatus();
this._bufferedOutput.delete(flushBufferedOutput);
};
this._bufferedOutput.add(flushBufferedOutput);
const debouncedFlush = () => {
// If the process blows up no errors would be printed.
// There should be a smart way to buffer stderr, but for now
// we just won't buffer it.
if (stream === process.stderr) {
flushBufferedOutput();
} else {
if (!timeout) {
timeout = setTimeout(() => {
flushBufferedOutput();
timeout = null;
}, 100);
}
}
};
// $FlowFixMe
stream.write = chunk => {
buffer.push(chunk);
debouncedFlush();
return true;
};
}
// Don't wait for the debounced call and flush all output immediately.
forceFlushBufferedOutput() {
for (const flushBufferedOutput of this._bufferedOutput) {
flushBufferedOutput();
}
}
_clearStatus() {
if ((_jestUtil || _load_jestUtil()).isInteractive) {
if (this._globalConfig.useStderr) {
this._err(this._clear);
} else {
this._out(this._clear);
}
}
}
_printStatus() {
var _status$get = this._status.get();
const content = _status$get.content,
clear = _status$get.clear;
this._clear = clear;
if ((_jestUtil || _load_jestUtil()).isInteractive) {
if (this._globalConfig.useStderr) {
this._err(content);
} else {
this._out(content);
}
}
}
onRunStart(aggregatedResults, options) {
this._status.runStarted(aggregatedResults, options);
}
onTestStart(test) {
this._status.testStarted(test.path, test.context.config);
}
onRunComplete() {
this.forceFlushBufferedOutput();
this._status.runFinished();
// $FlowFixMe
process.stdout.write = this._out;
// $FlowFixMe
process.stderr.write = this._err;
(0, (_jestUtil || _load_jestUtil()).clearLine)(process.stderr);
}
onTestResult(test, testResult, aggregatedResults) {
this.testFinished(test.context.config, testResult, aggregatedResults);
if (!testResult.skipped) {
this.printTestFileHeader(testResult.testFilePath, test.context.config, testResult);
this.printTestFileFailureMessage(testResult.testFilePath, test.context.config, testResult);
}
this.forceFlushBufferedOutput();
}
testFinished(config, testResult, aggregatedResults) {
this._status.testFinished(config, testResult, aggregatedResults);
}
printTestFileHeader(testPath, config, result) {
this.log((0, (_get_result_header || _load_get_result_header()).default)(result, this._globalConfig, config));
const consoleBuffer = result.console;
if (consoleBuffer && consoleBuffer.length) {
this.log(' ' + TITLE_BULLET + 'Console\n\n' + (0, (_jestUtil || _load_jestUtil()).getConsoleOutput)(config.cwd, !!this._globalConfig.verbose, consoleBuffer));
}
}
printTestFileFailureMessage(testPath, config, result) {
if (result.failureMessage) {
this.log(result.failureMessage);
}
const didUpdate = this._globalConfig.updateSnapshot === 'all';
const snapshotStatuses = (0, (_get_snapshot_status || _load_get_snapshot_status()).default)(result.snapshot, didUpdate);
snapshotStatuses.forEach(this.log);
}
}
exports.default = DefaultReporter;

View File

@@ -0,0 +1,59 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _chalk;
function _load_chalk() {
return _chalk = _interopRequireDefault(require('chalk'));
}
var _utils;
function _load_utils() {
return _utils = require('./utils');
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/
const LONG_TEST_COLOR = (_chalk || _load_chalk()).default.reset.bold.bgRed;
// Explicitly reset for these messages since they can get written out in the
// middle of error logging
const FAIL_TEXT = 'FAIL';
const PASS_TEXT = 'PASS';
const FAIL = (_chalk || _load_chalk()).default.supportsColor ? (_chalk || _load_chalk()).default.reset.inverse.bold.red(` ${FAIL_TEXT} `) : FAIL_TEXT;
const PASS = (_chalk || _load_chalk()).default.supportsColor ? (_chalk || _load_chalk()).default.reset.inverse.bold.green(` ${PASS_TEXT} `) : PASS_TEXT;
exports.default = (result, globalConfig, projectConfig) => {
const testPath = result.testFilePath;
const status = result.numFailingTests > 0 || result.testExecError ? FAIL : PASS;
const runTime = result.perfStats ? (result.perfStats.end - result.perfStats.start) / 1000 : null;
const testDetail = [];
if (runTime !== null && runTime > 5) {
testDetail.push(LONG_TEST_COLOR(runTime + 's'));
}
if (result.memoryUsage) {
const toMB = bytes => Math.floor(bytes / 1024 / 1024);
testDetail.push(`${toMB(result.memoryUsage)} MB heap size`);
}
const projectDisplayName = projectConfig && projectConfig.displayName ? (0, (_utils || _load_utils()).printDisplayName)(projectConfig) + ' ' : '';
return `${status} ${projectDisplayName}${(0, (_utils || _load_utils()).formatTestPath)(projectConfig ? projectConfig : globalConfig, testPath)}` + (testDetail.length ? ` (${testDetail.join(', ')})` : '');
};

View File

@@ -0,0 +1,55 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
const chalk = require('chalk'); /**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/
var _require = require('./utils');
const pluralize = _require.pluralize;
const ARROW = ' \u203A ';
const FAIL_COLOR = chalk.bold.red;
const SNAPSHOT_ADDED = chalk.bold.green;
const SNAPSHOT_REMOVED = chalk.bold.red;
const SNAPSHOT_UPDATED = chalk.bold.green;
exports.default = (snapshot, afterUpdate) => {
const statuses = [];
if (snapshot.added) {
statuses.push(SNAPSHOT_ADDED(ARROW + pluralize('snapshot', snapshot.added)) + ' written.');
}
if (snapshot.updated) {
statuses.push(SNAPSHOT_UPDATED(ARROW + pluralize('snapshot', snapshot.updated)) + ` updated.`);
}
if (snapshot.unchecked) {
statuses.push(FAIL_COLOR(ARROW + pluralize('obsolete snapshot', snapshot.unchecked)) + (afterUpdate ? ' removed' : ' found') + '.');
snapshot.uncheckedKeys.forEach(key => {
statuses.push(FAIL_COLOR(` - ${key}`));
});
}
if (snapshot.fileDeleted) {
statuses.push(SNAPSHOT_REMOVED(ARROW + 'Obsolete snapshot file') + ` removed.`);
}
if (snapshot.unmatched) {
statuses.push(FAIL_COLOR(ARROW + pluralize('snapshot test', snapshot.unmatched)) + ' failed.');
}
return statuses;
};

View File

@@ -0,0 +1,61 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _chalk;
function _load_chalk() {
return _chalk = _interopRequireDefault(require('chalk'));
}
var _utils;
function _load_utils() {
return _utils = require('./utils');
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const ARROW = ' \u203A '; /**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/
const FAIL_COLOR = (_chalk || _load_chalk()).default.bold.red;
const SNAPSHOT_ADDED = (_chalk || _load_chalk()).default.bold.green;
const SNAPSHOT_NOTE = (_chalk || _load_chalk()).default.dim;
const SNAPSHOT_REMOVED = (_chalk || _load_chalk()).default.bold.red;
const SNAPSHOT_SUMMARY = (_chalk || _load_chalk()).default.bold;
const SNAPSHOT_UPDATED = (_chalk || _load_chalk()).default.bold.green;
exports.default = (snapshots, updateCommand) => {
const summary = [];
summary.push(SNAPSHOT_SUMMARY('Snapshot Summary'));
if (snapshots.added) {
summary.push(SNAPSHOT_ADDED(ARROW + (0, (_utils || _load_utils()).pluralize)('snapshot', snapshots.added)) + ` written in ${(0, (_utils || _load_utils()).pluralize)('test suite', snapshots.filesAdded)}.`);
}
if (snapshots.unmatched) {
summary.push(FAIL_COLOR(ARROW + (0, (_utils || _load_utils()).pluralize)('snapshot test', snapshots.unmatched)) + ` failed in ` + `${(0, (_utils || _load_utils()).pluralize)('test suite', snapshots.filesUnmatched)}. ` + SNAPSHOT_NOTE('Inspect your code changes or ' + updateCommand + ' to update them.'));
}
if (snapshots.updated) {
summary.push(SNAPSHOT_UPDATED(ARROW + (0, (_utils || _load_utils()).pluralize)('snapshot', snapshots.updated)) + ` updated in ${(0, (_utils || _load_utils()).pluralize)('test suite', snapshots.filesUpdated)}.`);
}
if (snapshots.filesRemoved) {
summary.push(SNAPSHOT_REMOVED(ARROW + (0, (_utils || _load_utils()).pluralize)('obsolete snapshot file', snapshots.filesRemoved)) + (snapshots.didUpdate ? ' removed.' : ' found, ' + updateCommand + ' to remove ' + (snapshots.filesRemoved === 1 ? 'it' : 'them.') + '.'));
}
if (snapshots.unchecked) {
summary.push(FAIL_COLOR(ARROW + (0, (_utils || _load_utils()).pluralize)('obsolete snapshot', snapshots.unchecked)) + (snapshots.didUpdate ? ' removed.' : ' found, ' + updateCommand + ' to remove ' + (snapshots.filesRemoved === 1 ? 'it' : 'them') + '.'));
}
return summary;
};

View File

@@ -0,0 +1,101 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _exit;
function _load_exit() {
return _exit = _interopRequireDefault(require('exit'));
}
var _path;
function _load_path() {
return _path = _interopRequireDefault(require('path'));
}
var _util;
function _load_util() {
return _util = _interopRequireDefault(require('util'));
}
var _nodeNotifier;
function _load_nodeNotifier() {
return _nodeNotifier = _interopRequireDefault(require('node-notifier'));
}
var _base_reporter;
function _load_base_reporter() {
return _base_reporter = _interopRequireDefault(require('./base_reporter'));
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/
const isDarwin = process.platform === 'darwin';
const icon = (_path || _load_path()).default.resolve(__dirname, '../assets/jest_logo.png');
class NotifyReporter extends (_base_reporter || _load_base_reporter()).default {
constructor(globalConfig, startRun, context) {
super();
this._globalConfig = globalConfig;
this._startRun = startRun;
this._context = context;
}
onRunComplete(contexts, result) {
const success = result.numFailedTests === 0 && result.numRuntimeErrorTestSuites === 0;
const notifyMode = this._globalConfig.notifyMode;
const statusChanged = this._context.previousSuccess !== success || this._context.firstRun;
if (success && (notifyMode === 'always' || notifyMode === 'success' || notifyMode === 'success-change' || notifyMode === 'change' && statusChanged || notifyMode === 'failure-change' && statusChanged)) {
const title = (_util || _load_util()).default.format('%d%% Passed', 100);
const message = (_util || _load_util()).default.format((isDarwin ? '\u2705 ' : '') + '%d tests passed', result.numPassedTests);
(_nodeNotifier || _load_nodeNotifier()).default.notify({ icon, message, title });
} else if (!success && (notifyMode === 'always' || notifyMode === 'failure' || notifyMode === 'failure-change' || notifyMode === 'change' && statusChanged || notifyMode === 'success-change' && statusChanged)) {
const failed = result.numFailedTests / result.numTotalTests;
const title = (_util || _load_util()).default.format('%d%% Failed', Math.ceil(Number.isNaN(failed) ? 0 : failed * 100));
const message = (_util || _load_util()).default.format((isDarwin ? '\u26D4\uFE0F ' : '') + '%d of %d tests failed', result.numFailedTests, result.numTotalTests);
const restartAnswer = 'Run again';
const quitAnswer = 'Exit tests';
(_nodeNotifier || _load_nodeNotifier()).default.notify({
actions: [restartAnswer, quitAnswer],
closeLabel: 'Close',
icon,
message,
title
}, (err, _, metadata) => {
if (err || !metadata) {
return;
}
if (metadata.activationValue === quitAnswer) {
(0, (_exit || _load_exit()).default)(0);
return;
}
if (metadata.activationValue === restartAnswer) {
this._startRun(this._globalConfig);
}
});
}
this._context.previousSuccess = success;
this._context.firstRun = false;
}
}
exports.default = NotifyReporter;

View File

@@ -0,0 +1,183 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _chalk;
function _load_chalk() {
return _chalk = _interopRequireDefault(require('chalk'));
}
var _base_reporter;
function _load_base_reporter() {
return _base_reporter = _interopRequireDefault(require('./base_reporter'));
}
var _utils;
function _load_utils() {
return _utils = require('./utils');
}
var _get_result_header;
function _load_get_result_header() {
return _get_result_header = _interopRequireDefault(require('./get_result_header'));
}
var _get_snapshot_summary;
function _load_get_snapshot_summary() {
return _get_snapshot_summary = _interopRequireDefault(require('./get_snapshot_summary'));
}
var _test_path_pattern_to_regexp;
function _load_test_path_pattern_to_regexp() {
return _test_path_pattern_to_regexp = _interopRequireDefault(require('../test_path_pattern_to_regexp'));
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/
const TEST_SUMMARY_THRESHOLD = 20;
const NPM_EVENTS = new Set(['prepublish', 'publish', 'postpublish', 'preinstall', 'install', 'postinstall', 'preuninstall', 'uninstall', 'postuninstall', 'preversion', 'version', 'postversion', 'pretest', 'test', 'posttest', 'prestop', 'stop', 'poststop', 'prestart', 'start', 'poststart', 'prerestart', 'restart', 'postrestart']);
class SummaryReporter extends (_base_reporter || _load_base_reporter()).default {
constructor(globalConfig) {
super();
this._globalConfig = globalConfig;
this._estimatedTime = 0;
}
// If we write more than one character at a time it is possible that
// Node.js exits in the middle of printing the result. This was first observed
// in Node.js 0.10 and still persists in Node.js 6.7+.
// Let's print the test failure summary character by character which is safer
// when hundreds of tests are failing.
_write(string) {
for (let i = 0; i < string.length; i++) {
process.stderr.write(string.charAt(i));
}
}
onRunStart(aggregatedResults, options) {
super.onRunStart(aggregatedResults, options);
this._estimatedTime = options.estimatedTime;
}
onRunComplete(contexts, aggregatedResults) {
const numTotalTestSuites = aggregatedResults.numTotalTestSuites,
testResults = aggregatedResults.testResults,
wasInterrupted = aggregatedResults.wasInterrupted;
if (numTotalTestSuites) {
const lastResult = testResults[testResults.length - 1];
// Print a newline if the last test did not fail to line up newlines
// similar to when an error would have been thrown in the test.
if (!this._globalConfig.verbose && lastResult && !lastResult.numFailingTests && !lastResult.testExecError) {
this.log('');
}
this._printSummary(aggregatedResults, this._globalConfig);
this._printSnapshotSummary(aggregatedResults.snapshot, this._globalConfig);
if (numTotalTestSuites) {
let message = (0, (_utils || _load_utils()).getSummary)(aggregatedResults, {
estimatedTime: this._estimatedTime
});
if (!this._globalConfig.silent) {
message += '\n' + (wasInterrupted ? (_chalk || _load_chalk()).default.bold.red('Test run was interrupted.') : this._getTestSummary(contexts, this._globalConfig));
}
this.log(message);
}
}
}
_printSnapshotSummary(snapshots, globalConfig) {
if (snapshots.added || snapshots.filesRemoved || snapshots.unchecked || snapshots.unmatched || snapshots.updated) {
let updateCommand;
const event = process.env.npm_lifecycle_event;
const prefix = NPM_EVENTS.has(event) ? '' : 'run ';
const isYarn = typeof process.env.npm_config_user_agent === 'string' && process.env.npm_config_user_agent.match('yarn') !== null;
const client = isYarn ? 'yarn' : 'npm';
const scriptUsesJest = typeof process.env.npm_lifecycle_script === 'string' && process.env.npm_lifecycle_script.indexOf('jest') !== -1;
if (globalConfig.watch) {
updateCommand = 'press `u`';
} else if (event && scriptUsesJest) {
updateCommand = `run \`${client + ' ' + prefix + event + (isYarn ? '' : ' --')} -u\``;
} else {
updateCommand = 're-run jest with `-u`';
}
const snapshotSummary = (0, (_get_snapshot_summary || _load_get_snapshot_summary()).default)(snapshots, updateCommand);
snapshotSummary.forEach(this.log);
this.log(''); // print empty line
}
}
_printSummary(aggregatedResults, globalConfig) {
// If there were any failing tests and there was a large number of tests
// executed, re-print the failing results at the end of execution output.
const failedTests = aggregatedResults.numFailedTests;
const runtimeErrors = aggregatedResults.numRuntimeErrorTestSuites;
if (failedTests + runtimeErrors > 0 && aggregatedResults.numTotalTestSuites > TEST_SUMMARY_THRESHOLD) {
this.log((_chalk || _load_chalk()).default.bold('Summary of all failing tests'));
aggregatedResults.testResults.forEach(testResult => {
const failureMessage = testResult.failureMessage;
if (failureMessage) {
this._write((0, (_get_result_header || _load_get_result_header()).default)(testResult, globalConfig) + '\n' + failureMessage + '\n');
}
});
this.log(''); // print empty line
}
}
_getTestSummary(contexts, globalConfig) {
const getMatchingTestsInfo = () => {
const prefix = globalConfig.findRelatedTests ? ' related to files matching ' : ' matching ';
return (_chalk || _load_chalk()).default.dim(prefix) + (0, (_test_path_pattern_to_regexp || _load_test_path_pattern_to_regexp()).default)(globalConfig.testPathPattern).toString();
};
let testInfo = '';
if (globalConfig.runTestsByPath) {
testInfo = (_chalk || _load_chalk()).default.dim(' within paths');
} else if (globalConfig.onlyChanged) {
testInfo = (_chalk || _load_chalk()).default.dim(' related to changed files');
} else if (globalConfig.testPathPattern) {
testInfo = getMatchingTestsInfo();
}
let nameInfo = '';
if (globalConfig.runTestsByPath) {
nameInfo = ' ' + globalConfig.nonFlagArgs.map(p => `"${p}"`).join(', ');
} else if (globalConfig.testNamePattern) {
nameInfo = (_chalk || _load_chalk()).default.dim(' with tests matching ') + `"${globalConfig.testNamePattern}"`;
}
const contextInfo = contexts.size > 1 ? (_chalk || _load_chalk()).default.dim(' in ') + contexts.size + (_chalk || _load_chalk()).default.dim(' projects') : '';
return (_chalk || _load_chalk()).default.dim('Ran all test suites') + testInfo + nameInfo + contextInfo + (_chalk || _load_chalk()).default.dim('.');
}
}
exports.default = SummaryReporter;

View File

@@ -0,0 +1,211 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.wrapAnsiString = exports.getSummary = exports.pluralize = exports.relativePath = exports.formatTestPath = exports.trimAndFormatPath = exports.printDisplayName = undefined;
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); /**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/
var _path;
function _load_path() {
return _path = _interopRequireDefault(require('path'));
}
var _chalk;
function _load_chalk() {
return _chalk = _interopRequireDefault(require('chalk'));
}
var _slash;
function _load_slash() {
return _slash = _interopRequireDefault(require('slash'));
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const PROGRESS_BAR_WIDTH = 40;
const printDisplayName = exports.printDisplayName = config => {
const displayName = config.displayName;
if (displayName) {
return (_chalk || _load_chalk()).default.supportsColor ? (_chalk || _load_chalk()).default.reset.inverse.white(` ${displayName} `) : displayName;
}
return '';
};
const trimAndFormatPath = exports.trimAndFormatPath = (pad, config, testPath, columns) => {
const maxLength = columns - pad;
const relative = relativePath(config, testPath);
const basename = relative.basename;
let dirname = relative.dirname;
// length is ok
if ((dirname + (_path || _load_path()).default.sep + basename).length <= maxLength) {
return (0, (_slash || _load_slash()).default)((_chalk || _load_chalk()).default.dim(dirname + (_path || _load_path()).default.sep) + (_chalk || _load_chalk()).default.bold(basename));
}
// we can fit trimmed dirname and full basename
const basenameLength = basename.length;
if (basenameLength + 4 < maxLength) {
const dirnameLength = maxLength - 4 - basenameLength;
dirname = '...' + dirname.slice(dirname.length - dirnameLength, dirname.length);
return (0, (_slash || _load_slash()).default)((_chalk || _load_chalk()).default.dim(dirname + (_path || _load_path()).default.sep) + (_chalk || _load_chalk()).default.bold(basename));
}
if (basenameLength + 4 === maxLength) {
return (0, (_slash || _load_slash()).default)((_chalk || _load_chalk()).default.dim('...' + (_path || _load_path()).default.sep) + (_chalk || _load_chalk()).default.bold(basename));
}
// can't fit dirname, but can fit trimmed basename
return (0, (_slash || _load_slash()).default)((_chalk || _load_chalk()).default.bold('...' + basename.slice(basename.length - maxLength - 4, basename.length)));
};
const formatTestPath = exports.formatTestPath = (config, testPath) => {
var _relativePath = relativePath(config, testPath);
const dirname = _relativePath.dirname,
basename = _relativePath.basename;
return (_chalk || _load_chalk()).default.dim(dirname + (_path || _load_path()).default.sep) + (_chalk || _load_chalk()).default.bold(basename);
};
const relativePath = exports.relativePath = (config, testPath) => {
// this function can be called with ProjectConfigs or GlobalConfigs. GlobalConfigs
// do not have config.cwd, only config.rootDir. Try using config.cwd, fallback
// to config.rootDir. (Also, some unit just use config.rootDir, which is ok)
testPath = (_path || _load_path()).default.relative(config.cwd || config.rootDir, testPath);
const dirname = (_path || _load_path()).default.dirname(testPath);
const basename = (_path || _load_path()).default.basename(testPath);
return { basename, dirname };
};
const pluralize = exports.pluralize = (word, count) => `${count} ${word}${count === 1 ? '' : 's'}`;
const getSummary = exports.getSummary = (aggregatedResults, options) => {
let runTime = (Date.now() - aggregatedResults.startTime) / 1000;
if (options && options.roundTime) {
runTime = Math.floor(runTime);
}
const estimatedTime = options && options.estimatedTime || 0;
const snapshotResults = aggregatedResults.snapshot;
const snapshotsAdded = snapshotResults.added;
const snapshotsFailed = snapshotResults.unmatched;
const snapshotsPassed = snapshotResults.matched;
const snapshotsTotal = snapshotResults.total;
const snapshotsUpdated = snapshotResults.updated;
const suitesFailed = aggregatedResults.numFailedTestSuites;
const suitesPassed = aggregatedResults.numPassedTestSuites;
const suitesPending = aggregatedResults.numPendingTestSuites;
const suitesRun = suitesFailed + suitesPassed;
const suitesTotal = aggregatedResults.numTotalTestSuites;
const testsFailed = aggregatedResults.numFailedTests;
const testsPassed = aggregatedResults.numPassedTests;
const testsPending = aggregatedResults.numPendingTests;
const testsTotal = aggregatedResults.numTotalTests;
const width = options && options.width || 0;
const suites = (_chalk || _load_chalk()).default.bold('Test Suites: ') + (suitesFailed ? (_chalk || _load_chalk()).default.bold.red(`${suitesFailed} failed`) + ', ' : '') + (suitesPending ? (_chalk || _load_chalk()).default.bold.yellow(`${suitesPending} skipped`) + ', ' : '') + (suitesPassed ? (_chalk || _load_chalk()).default.bold.green(`${suitesPassed} passed`) + ', ' : '') + (suitesRun !== suitesTotal ? suitesRun + ' of ' + suitesTotal : suitesTotal) + ` total`;
const tests = (_chalk || _load_chalk()).default.bold('Tests: ') + (testsFailed ? (_chalk || _load_chalk()).default.bold.red(`${testsFailed} failed`) + ', ' : '') + (testsPending ? (_chalk || _load_chalk()).default.bold.yellow(`${testsPending} skipped`) + ', ' : '') + (testsPassed ? (_chalk || _load_chalk()).default.bold.green(`${testsPassed} passed`) + ', ' : '') + `${testsTotal} total`;
const snapshots = (_chalk || _load_chalk()).default.bold('Snapshots: ') + (snapshotsFailed ? (_chalk || _load_chalk()).default.bold.red(`${snapshotsFailed} failed`) + ', ' : '') + (snapshotsUpdated ? (_chalk || _load_chalk()).default.bold.green(`${snapshotsUpdated} updated`) + ', ' : '') + (snapshotsAdded ? (_chalk || _load_chalk()).default.bold.green(`${snapshotsAdded} added`) + ', ' : '') + (snapshotsPassed ? (_chalk || _load_chalk()).default.bold.green(`${snapshotsPassed} passed`) + ', ' : '') + `${snapshotsTotal} total`;
const time = renderTime(runTime, estimatedTime, width);
return [suites, tests, snapshots, time].join('\n');
};
const renderTime = (runTime, estimatedTime, width) => {
// If we are more than one second over the estimated time, highlight it.
const renderedTime = estimatedTime && runTime >= estimatedTime + 1 ? (_chalk || _load_chalk()).default.bold.yellow(runTime + 's') : runTime + 's';
let time = (_chalk || _load_chalk()).default.bold(`Time:`) + ` ${renderedTime}`;
if (runTime < estimatedTime) {
time += `, estimated ${estimatedTime}s`;
}
// Only show a progress bar if the test run is actually going to take
// some time.
if (estimatedTime > 2 && runTime < estimatedTime && width) {
const availableWidth = Math.min(PROGRESS_BAR_WIDTH, width);
const length = Math.min(Math.floor(runTime / estimatedTime * availableWidth), availableWidth);
if (availableWidth >= 2) {
time += '\n' + (_chalk || _load_chalk()).default.green('█').repeat(length) + (_chalk || _load_chalk()).default.white('█').repeat(availableWidth - length);
}
}
return time;
};
// word-wrap a string that contains ANSI escape sequences.
// ANSI escape sequences do not add to the string length.
const wrapAnsiString = exports.wrapAnsiString = (string, terminalWidth) => {
if (terminalWidth === 0) {
// if the terminal width is zero, don't bother word-wrapping
return string;
}
const ANSI_REGEXP = /[\u001b\u009b]\[\d{1,2}m/g;
const tokens = [];
let lastIndex = 0;
let match;
while (match = ANSI_REGEXP.exec(string)) {
const ansi = match[0];
const index = match['index'];
if (index != lastIndex) {
tokens.push(['string', string.slice(lastIndex, index)]);
}
tokens.push(['ansi', ansi]);
lastIndex = index + ansi.length;
}
if (lastIndex != string.length - 1) {
tokens.push(['string', string.slice(lastIndex, string.length)]);
}
let lastLineLength = 0;
return tokens.reduce((lines, _ref) => {
var _ref2 = _slicedToArray(_ref, 2);
let kind = _ref2[0],
token = _ref2[1];
if (kind === 'string') {
if (lastLineLength + token.length > terminalWidth) {
while (token.length) {
const chunk = token.slice(0, terminalWidth - lastLineLength);
const remaining = token.slice(terminalWidth - lastLineLength, token.length);
lines[lines.length - 1] += chunk;
lastLineLength += chunk.length;
token = remaining;
if (token.length) {
lines.push('');
lastLineLength = 0;
}
}
} else {
lines[lines.length - 1] += token;
lastLineLength += token.length;
}
} else {
lines[lines.length - 1] += token;
}
return lines;
}, ['']).join('\n');
};

View File

@@ -0,0 +1,146 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _chalk;
function _load_chalk() {
return _chalk = _interopRequireDefault(require('chalk'));
}
var _constants;
function _load_constants() {
return _constants = require('../constants');
}
var _default_reporter;
function _load_default_reporter() {
return _default_reporter = _interopRequireDefault(require('./default_reporter'));
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/
class VerboseReporter extends (_default_reporter || _load_default_reporter()).default {
constructor(globalConfig) {
super(globalConfig);
this._globalConfig = globalConfig;
}
static filterTestResults(testResults) {
return testResults.filter((_ref) => {
let status = _ref.status;
return status !== 'pending';
});
}
static groupTestsBySuites(testResults) {
const root = { suites: [], tests: [], title: '' };
testResults.forEach(testResult => {
let targetSuite = root;
// Find the target suite for this test,
// creating nested suites as necessary.
for (const title of testResult.ancestorTitles) {
let matchingSuite = targetSuite.suites.find(s => s.title === title);
if (!matchingSuite) {
matchingSuite = { suites: [], tests: [], title };
targetSuite.suites.push(matchingSuite);
}
targetSuite = matchingSuite;
}
targetSuite.tests.push(testResult);
});
return root;
}
onTestResult(test, result, aggregatedResults) {
super.testFinished(test.context.config, result, aggregatedResults);
if (!result.skipped) {
this.printTestFileHeader(result.testFilePath, test.context.config, result);
if (!result.testExecError && !result.skipped) {
this._logTestResults(result.testResults);
}
this.printTestFileFailureMessage(result.testFilePath, test.context.config, result);
}
super.forceFlushBufferedOutput();
}
_logTestResults(testResults) {
this._logSuite(VerboseReporter.groupTestsBySuites(testResults), 0);
this._logLine();
}
_logSuite(suite, indentLevel) {
if (suite.title) {
this._logLine(suite.title, indentLevel);
}
this._logTests(suite.tests, indentLevel + 1);
suite.suites.forEach(suite => this._logSuite(suite, indentLevel + 1));
}
_getIcon(status) {
if (status === 'failed') {
return (_chalk || _load_chalk()).default.red((_constants || _load_constants()).ICONS.failed);
} else if (status === 'pending') {
return (_chalk || _load_chalk()).default.yellow((_constants || _load_constants()).ICONS.pending);
} else {
return (_chalk || _load_chalk()).default.green((_constants || _load_constants()).ICONS.success);
}
}
_logTest(test, indentLevel) {
const status = this._getIcon(test.status);
const time = test.duration ? ` (${test.duration.toFixed(0)}ms)` : '';
this._logLine(status + ' ' + (_chalk || _load_chalk()).default.dim(test.title + time), indentLevel);
}
_logTests(tests, indentLevel) {
if (this._globalConfig.expand) {
tests.forEach(test => this._logTest(test, indentLevel));
} else {
const skippedCount = tests.reduce((result, test) => {
if (test.status === 'pending') {
result += 1;
} else {
this._logTest(test, indentLevel);
}
return result;
}, 0);
if (skippedCount > 0) {
this._logSkippedTests(skippedCount, indentLevel);
}
}
}
_logSkippedTests(count, indentLevel) {
const icon = this._getIcon('pending');
const text = (_chalk || _load_chalk()).default.dim(`skipped ${count} test${count === 1 ? '' : 's'}`);
this._logLine(`${icon} ${text}`, indentLevel);
}
_logLine(str, indentLevel) {
const indentation = ' '.repeat(indentLevel || 0);
this.log(indentation + (str || ''));
}
}
exports.default = VerboseReporter;

View File

@@ -0,0 +1,257 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _chalk;
function _load_chalk() {
return _chalk = _interopRequireDefault(require('chalk'));
}
var _path;
function _load_path() {
return _path = _interopRequireDefault(require('path'));
}
var _jestUtil;
function _load_jestUtil() {
return _jestUtil = require('jest-util');
}
var _exit;
function _load_exit() {
return _exit = _interopRequireDefault(require('exit'));
}
var _gracefulFs;
function _load_gracefulFs() {
return _gracefulFs = _interopRequireDefault(require('graceful-fs'));
}
var _get_no_test_found_message;
function _load_get_no_test_found_message() {
return _get_no_test_found_message = _interopRequireDefault(require('./get_no_test_found_message'));
}
var _search_source;
function _load_search_source() {
return _search_source = _interopRequireDefault(require('./search_source'));
}
var _test_scheduler;
function _load_test_scheduler() {
return _test_scheduler = _interopRequireDefault(require('./test_scheduler'));
}
var _test_sequencer;
function _load_test_sequencer() {
return _test_sequencer = _interopRequireDefault(require('./test_sequencer'));
}
var _test_result_helpers;
function _load_test_result_helpers() {
return _test_result_helpers = require('./test_result_helpers');
}
var _failed_tests_cache;
function _load_failed_tests_cache() {
return _failed_tests_cache = _interopRequireDefault(require('./failed_tests_cache'));
}
var _jest_hooks;
function _load_jest_hooks() {
return _jest_hooks = _interopRequireDefault(require('./jest_hooks'));
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } /**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/
const setConfig = (contexts, newConfig) => contexts.forEach(context => context.config = Object.freeze(Object.assign({}, context.config, newConfig)));
const getTestPaths = (() => {
var _ref = _asyncToGenerator(function* (globalConfig, context, outputStream, changedFilesPromise, jestHooks) {
const source = new (_search_source || _load_search_source()).default(context);
const data = yield source.getTestPaths(globalConfig, changedFilesPromise);
if (!data.tests.length && globalConfig.onlyChanged && data.noSCM) {
new (_jestUtil || _load_jestUtil()).Console(outputStream, outputStream).log('Jest can only find uncommitted changed files in a git or hg ' + 'repository. If you make your project a git or hg ' + 'repository (`git init` or `hg init`), Jest will be able ' + 'to only run tests related to files changed since the last ' + 'commit.');
}
const shouldTestArray = yield Promise.all(data.tests.map(function (test) {
return jestHooks.shouldRunTestSuite(test.path);
}));
const filteredTests = data.tests.filter(function (test, i) {
return shouldTestArray[i];
});
return Object.assign({}, data, {
allTests: filteredTests.length,
tests: filteredTests
});
});
return function getTestPaths(_x, _x2, _x3, _x4, _x5) {
return _ref.apply(this, arguments);
};
})();
const processResults = (runResults, options) => {
const outputFile = options.outputFile;
if (options.testResultsProcessor) {
/* $FlowFixMe */
runResults = require(options.testResultsProcessor)(runResults);
}
if (options.isJSON) {
if (outputFile) {
const filePath = (_path || _load_path()).default.resolve(process.cwd(), outputFile);
(_gracefulFs || _load_gracefulFs()).default.writeFileSync(filePath, JSON.stringify((0, (_jestUtil || _load_jestUtil()).formatTestResults)(runResults)));
process.stdout.write(`Test results written to: ` + `${(_path || _load_path()).default.relative(process.cwd(), filePath)}\n`);
} else {
process.stdout.write(JSON.stringify((0, (_jestUtil || _load_jestUtil()).formatTestResults)(runResults)));
}
}
return options.onComplete && options.onComplete(runResults);
};
const testSchedulerContext = {
firstRun: true,
previousSuccess: true
};
exports.default = (() => {
var _ref3 = _asyncToGenerator(function* (_ref2) {
let contexts = _ref2.contexts,
globalConfig = _ref2.globalConfig,
outputStream = _ref2.outputStream,
testWatcher = _ref2.testWatcher;
var _ref2$jestHooks = _ref2.jestHooks;
let jestHooks = _ref2$jestHooks === undefined ? new (_jest_hooks || _load_jest_hooks()).default().getEmitter() : _ref2$jestHooks,
startRun = _ref2.startRun,
changedFilesPromise = _ref2.changedFilesPromise,
onComplete = _ref2.onComplete,
failedTestsCache = _ref2.failedTestsCache;
const sequencer = new (_test_sequencer || _load_test_sequencer()).default();
let allTests = [];
if (changedFilesPromise && globalConfig.watch) {
var _ref4 = yield changedFilesPromise;
const repos = _ref4.repos;
const noSCM = Object.keys(repos).every(function (scm) {
return repos[scm].size === 0;
});
if (noSCM) {
process.stderr.write('\n' + (_chalk || _load_chalk()).default.bold('--watch') + ' is not supported without git/hg, please use --watchAll ' + '\n');
(0, (_exit || _load_exit()).default)(1);
}
}
const testRunData = yield Promise.all(contexts.map((() => {
var _ref5 = _asyncToGenerator(function* (context) {
const matches = yield getTestPaths(globalConfig, context, outputStream, changedFilesPromise, jestHooks);
allTests = allTests.concat(matches.tests);
return { context, matches };
});
return function (_x7) {
return _ref5.apply(this, arguments);
};
})()));
allTests = sequencer.sort(allTests);
if (globalConfig.listTests) {
const testsPaths = Array.from(new Set(allTests.map(function (test) {
return test.path;
})));
if (globalConfig.json) {
console.log(JSON.stringify(testsPaths));
} else {
console.log(testsPaths.join('\n'));
}
onComplete && onComplete((0, (_test_result_helpers || _load_test_result_helpers()).makeEmptyAggregatedTestResult)());
return null;
}
if (globalConfig.onlyFailures && failedTestsCache) {
allTests = failedTestsCache.filterTests(allTests);
globalConfig = failedTestsCache.updateConfig(globalConfig);
}
if (!allTests.length) {
const noTestsFoundMessage = (0, (_get_no_test_found_message || _load_get_no_test_found_message()).default)(testRunData, globalConfig);
if (globalConfig.passWithNoTests || globalConfig.findRelatedTests || globalConfig.lastCommit || globalConfig.onlyChanged) {
new (_jestUtil || _load_jestUtil()).Console(outputStream, outputStream).log(noTestsFoundMessage);
} else {
new (_jestUtil || _load_jestUtil()).Console(outputStream, outputStream).error(noTestsFoundMessage);
(0, (_exit || _load_exit()).default)(1);
}
} else if (allTests.length === 1 && globalConfig.silent !== true && globalConfig.verbose !== false) {
globalConfig = Object.freeze(Object.assign({}, globalConfig, { verbose: true }));
}
// When using more than one context, make all printed paths relative to the
// current cwd. Do not modify rootDir, since will be used by custom resolvers.
// If --runInBand is true, the resolver saved a copy during initialization,
// however, if it is running on spawned processes, the initiation of the
// custom resolvers is done within each spawned process and it needs the
// original value of rootDir. Instead, use the {cwd: Path} property to resolve
// paths when printing.
setConfig(contexts, { cwd: process.cwd() });
if (globalConfig.globalSetup) {
// $FlowFixMe
yield require(globalConfig.globalSetup)();
}
const results = yield new (_test_scheduler || _load_test_scheduler()).default(globalConfig, {
startRun
}, testSchedulerContext).scheduleTests(allTests, testWatcher);
sequencer.cacheResults(allTests, results);
if (globalConfig.globalTeardown) {
// $FlowFixMe
yield require(globalConfig.globalTeardown)();
}
return processResults(results, {
isJSON: globalConfig.json,
onComplete,
outputFile: globalConfig.outputFile,
testResultsProcessor: globalConfig.testResultsProcessor
});
});
function runJest(_x6) {
return _ref3.apply(this, arguments);
}
return runJest;
})();

View File

@@ -0,0 +1,195 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _path;
function _load_path() {
return _path = _interopRequireDefault(require('path'));
}
var _micromatch;
function _load_micromatch() {
return _micromatch = _interopRequireDefault(require('micromatch'));
}
var _jestResolveDependencies;
function _load_jestResolveDependencies() {
return _jestResolveDependencies = _interopRequireDefault(require('jest-resolve-dependencies'));
}
var _test_path_pattern_to_regexp;
function _load_test_path_pattern_to_regexp() {
return _test_path_pattern_to_regexp = _interopRequireDefault(require('./test_path_pattern_to_regexp'));
}
var _jestRegexUtil;
function _load_jestRegexUtil() {
return _jestRegexUtil = require('jest-regex-util');
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } /**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/
const globsToMatcher = globs => {
if (globs == null || globs.length === 0) {
return () => true;
}
const matchers = globs.map(each => (_micromatch || _load_micromatch()).default.matcher(each, { dot: true }));
return path => matchers.some(each => each(path));
};
const regexToMatcher = testRegex => {
if (!testRegex) {
return () => true;
}
const regex = new RegExp(testRegex);
return path => regex.test(path);
};
const toTests = (context, tests) => tests.map(path => ({
context,
duration: undefined,
path
}));
class SearchSource {
constructor(context) {
const config = context.config;
this._context = context;
this._rootPattern = new RegExp(config.roots.map(dir => (0, (_jestRegexUtil || _load_jestRegexUtil()).escapePathForRegex)(dir + (_path || _load_path()).default.sep)).join('|'));
const ignorePattern = config.testPathIgnorePatterns;
this._testIgnorePattern = ignorePattern.length ? new RegExp(ignorePattern.join('|')) : null;
this._testPathCases = {
roots: path => this._rootPattern.test(path),
testMatch: globsToMatcher(config.testMatch),
testPathIgnorePatterns: path => !this._testIgnorePattern || !this._testIgnorePattern.test(path),
testRegex: regexToMatcher(config.testRegex)
};
}
_filterTestPathsWithStats(allPaths, testPathPattern) {
const data = {
stats: {},
tests: [],
total: allPaths.length
};
const testCases = Object.assign({}, this._testPathCases);
if (testPathPattern) {
const regex = (0, (_test_path_pattern_to_regexp || _load_test_path_pattern_to_regexp()).default)(testPathPattern);
testCases.testPathPattern = path => regex.test(path);
}
const testCasesKeys = Object.keys(testCases);
data.tests = allPaths.filter(test => {
return testCasesKeys.reduce((flag, key) => {
if (testCases[key](test.path)) {
data.stats[key] = ++data.stats[key] || 1;
return flag && true;
}
data.stats[key] = data.stats[key] || 0;
return false;
}, true);
});
return data;
}
_getAllTestPaths(testPathPattern) {
return this._filterTestPathsWithStats(toTests(this._context, this._context.hasteFS.getAllFiles()), testPathPattern);
}
isTestFilePath(path) {
return Object.keys(this._testPathCases).every(key => this._testPathCases[key](path));
}
findMatchingTests(testPathPattern) {
return this._getAllTestPaths(testPathPattern);
}
findRelatedTests(allPaths) {
const dependencyResolver = new (_jestResolveDependencies || _load_jestResolveDependencies()).default(this._context.resolver, this._context.hasteFS);
return {
tests: toTests(this._context, dependencyResolver.resolveInverse(allPaths, this.isTestFilePath.bind(this), {
skipNodeResolution: this._context.config.skipNodeResolution
}))
};
}
findTestsByPaths(paths) {
return {
tests: toTests(this._context, paths.map(p => (_path || _load_path()).default.resolve(process.cwd(), p)).filter(this.isTestFilePath.bind(this)))
};
}
findRelatedTestsFromPattern(paths) {
if (Array.isArray(paths) && paths.length) {
const resolvedPaths = paths.map(p => (_path || _load_path()).default.resolve(process.cwd(), p));
return this.findRelatedTests(new Set(resolvedPaths));
}
return { tests: [] };
}
findTestRelatedToChangedFiles(changedFilesPromise) {
var _this = this;
return _asyncToGenerator(function* () {
var _ref = yield changedFilesPromise;
const repos = _ref.repos,
changedFiles = _ref.changedFiles;
// no SCM (git/hg/...) is found in any of the roots.
const noSCM = Object.keys(repos).every(function (scm) {
return repos[scm].size === 0;
});
return noSCM ? { noSCM: true, tests: [] } : _this.findRelatedTests(changedFiles);
})();
}
getTestPaths(globalConfig, changedFilesPromise) {
var _this2 = this;
return _asyncToGenerator(function* () {
const paths = globalConfig.nonFlagArgs;
if (globalConfig.onlyChanged) {
if (!changedFilesPromise) {
throw new Error('This promise must be present when running with -o.');
}
return _this2.findTestRelatedToChangedFiles(changedFilesPromise);
} else if (globalConfig.runTestsByPath && paths && paths.length) {
return Promise.resolve(_this2.findTestsByPaths(paths));
} else if (globalConfig.findRelatedTests && paths && paths.length) {
return Promise.resolve(_this2.findRelatedTestsFromPattern(paths));
} else if (globalConfig.testPathPattern != null) {
return Promise.resolve(_this2.findMatchingTests(globalConfig.testPathPattern));
} else {
return Promise.resolve({ tests: [] });
}
})();
}
}
exports.default = SearchSource;

View File

@@ -0,0 +1,113 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
const chalk = require('chalk'); /**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*
*/
const ansiEscapes = require('ansi-escapes');
var _require = require('./reporters/utils');
const pluralize = _require.pluralize;
var _require2 = require('./constants');
const KEYS = _require2.KEYS;
class SnapshotInteractiveMode {
constructor(pipe) {
this._pipe = pipe;
this._isActive = false;
}
isActive() {
return this._isActive;
}
_drawUIOverlay() {
this._pipe.write(ansiEscapes.cursorUp(6));
this._pipe.write(ansiEscapes.eraseDown);
const numFailed = this._testFilePaths.length;
const numPass = this._countPaths - this._testFilePaths.length;
let stats = chalk.bold.red(pluralize('suite', numFailed) + ' failed');
if (numPass) {
stats += ', ' + chalk.bold.green(pluralize('suite', numPass) + ' passed');
}
const messages = ['\n' + chalk.bold('Interactive Snapshot Progress'), ' \u203A ' + stats, '\n' + chalk.bold('Watch Usage'), chalk.dim(' \u203A Press ') + 'u' + chalk.dim(' to update failing snapshots for this test.'), this._testFilePaths.length > 1 ? chalk.dim(' \u203A Press ') + 's' + chalk.dim(' to skip the current test suite.') : '', chalk.dim(' \u203A Press ') + 'q' + chalk.dim(' to quit Interactive Snapshot Update Mode.'), chalk.dim(' \u203A Press ') + 'Enter' + chalk.dim(' to trigger a test run.')];
this._pipe.write(messages.filter(Boolean).join('\n') + '\n');
}
put(key) {
switch (key) {
case KEYS.S:
const testFilePath = this._testFilePaths.shift();
this._testFilePaths.push(testFilePath);
this._run(false);
break;
case KEYS.U:
this._run(true);
break;
case KEYS.Q:
case KEYS.ESCAPE:
this.abort();
break;
case KEYS.ENTER:
this._run(false);
break;
default:
break;
}
}
abort() {
this._isActive = false;
this._updateTestRunnerConfig('', false);
}
updateWithResults(results) {
const hasSnapshotFailure = !!results.snapshot.failure;
if (hasSnapshotFailure) {
this._drawUIOverlay();
return;
}
this._testFilePaths.shift();
if (this._testFilePaths.length === 0) {
this.abort();
return;
}
this._run(false);
}
_run(shouldUpdateSnapshot) {
const testFilePath = this._testFilePaths[0];
this._updateTestRunnerConfig(testFilePath, shouldUpdateSnapshot);
}
run(failedSnapshotTestPaths, onConfigChange) {
if (!failedSnapshotTestPaths.length) {
return;
}
this._testFilePaths = [].concat(failedSnapshotTestPaths);
this._countPaths = this._testFilePaths.length;
this._updateTestRunnerConfig = onConfigChange;
this._isActive = true;
this._run(false);
}
}
exports.default = SnapshotInteractiveMode;

View File

@@ -0,0 +1,84 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _Prompt;
function _load_Prompt() {
return _Prompt = _interopRequireDefault(require('./lib/Prompt'));
}
var _pattern_mode_helpers;
function _load_pattern_mode_helpers() {
return _pattern_mode_helpers = require('./lib/pattern_mode_helpers');
}
var _pattern_prompt;
function _load_pattern_prompt() {
return _pattern_prompt = _interopRequireDefault(require('./pattern_prompt'));
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
class TestNamePatternPrompt extends (_pattern_prompt || _load_pattern_prompt()).default {
constructor(pipe, prompt) {
super(pipe, prompt);
this._entityName = 'tests';
this._cachedTestResults = [];
}
_onChange(pattern, options) {
super._onChange(pattern, options);
this._printPrompt(pattern, options);
}
_printPrompt(pattern, options) {
const pipe = this._pipe;
(0, (_pattern_mode_helpers || _load_pattern_mode_helpers()).printPatternCaret)(pattern, pipe);
(0, (_pattern_mode_helpers || _load_pattern_mode_helpers()).printRestoredPatternCaret)(pattern, this._currentUsageRows, pipe);
}
_getMatchedTests(pattern) {
let regex;
try {
regex = new RegExp(pattern, 'i');
} catch (e) {
return [];
}
const matchedTests = [];
this._cachedTestResults.forEach((_ref) => {
let testResults = _ref.testResults;
return testResults.forEach((_ref2) => {
let title = _ref2.title;
if (regex.test(title)) {
matchedTests.push(title);
}
});
});
return matchedTests;
}
updateCachedTestResults() {
let testResults = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
this._cachedTestResults = testResults;
}
}
exports.default = TestNamePatternPrompt; /**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/

View File

@@ -0,0 +1,76 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _Prompt;
function _load_Prompt() {
return _Prompt = _interopRequireDefault(require('./lib/Prompt'));
}
var _pattern_mode_helpers;
function _load_pattern_mode_helpers() {
return _pattern_mode_helpers = require('./lib/pattern_mode_helpers');
}
var _pattern_prompt;
function _load_pattern_prompt() {
return _pattern_prompt = _interopRequireDefault(require('./pattern_prompt'));
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
class TestPathPatternPrompt extends (_pattern_prompt || _load_pattern_prompt()).default {
constructor(pipe, prompt) {
super(pipe, prompt);
this._entityName = 'filenames';
}
_onChange(pattern, options) {
super._onChange(pattern, options);
this._printPrompt(pattern, options);
}
_printPrompt(pattern, options) {
const pipe = this._pipe;
(0, (_pattern_mode_helpers || _load_pattern_mode_helpers()).printPatternCaret)(pattern, pipe);
(0, (_pattern_mode_helpers || _load_pattern_mode_helpers()).printRestoredPatternCaret)(pattern, this._currentUsageRows, pipe);
}
_getMatchedTests(pattern) {
let regex;
try {
regex = new RegExp(pattern, 'i');
} catch (e) {}
let tests = [];
if (regex) {
this._searchSources.forEach((_ref) => {
let searchSource = _ref.searchSource,
context = _ref.context;
tests = tests.concat(searchSource.findMatchingTests(pattern).tests);
});
}
return tests;
}
updateSearchSources(searchSources) {
this._searchSources = searchSources;
}
}
exports.default = TestPathPatternPrompt; /**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/

View File

@@ -0,0 +1,19 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/
// Because we serialize/deserialize globalConfig when we spawn workers,
// we can't pass regular expression. Using this shared function on both sides
// will ensure that we produce consistent regexp for testPathPattern.
exports.default = testPathPattern => new RegExp(testPathPattern, 'i');

View File

@@ -0,0 +1,118 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
const makeEmptyAggregatedTestResult = exports.makeEmptyAggregatedTestResult = () => {
return {
numFailedTestSuites: 0,
numFailedTests: 0,
numPassedTestSuites: 0,
numPassedTests: 0,
numPendingTestSuites: 0,
numPendingTests: 0,
numRuntimeErrorTestSuites: 0,
numTotalTestSuites: 0,
numTotalTests: 0,
snapshot: {
added: 0,
didUpdate: false, // is set only after the full run
failure: false,
filesAdded: 0,
// combines individual test results + removed files after the full run
filesRemoved: 0,
filesUnmatched: 0,
filesUpdated: 0,
matched: 0,
total: 0,
unchecked: 0,
uncheckedKeys: [],
unmatched: 0,
updated: 0
},
startTime: 0,
success: true,
testResults: [],
wasInterrupted: false
};
}; /**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/
const buildFailureTestResult = exports.buildFailureTestResult = (testPath, err) => {
return {
console: null,
displayName: '',
failureMessage: null,
leaks: false,
numFailingTests: 0,
numPassingTests: 0,
numPendingTests: 0,
perfStats: {
end: 0,
start: 0
},
skipped: false,
snapshot: {
added: 0,
fileDeleted: false,
matched: 0,
unchecked: 0,
uncheckedKeys: [],
unmatched: 0,
updated: 0
},
sourceMaps: {},
testExecError: err,
testFilePath: testPath,
testResults: []
};
};
// Add individual test result to an aggregated test result
const addResult = exports.addResult = (aggregatedResults, testResult) => {
aggregatedResults.testResults.push(testResult);
aggregatedResults.numTotalTests += testResult.numPassingTests + testResult.numFailingTests + testResult.numPendingTests;
aggregatedResults.numFailedTests += testResult.numFailingTests;
aggregatedResults.numPassedTests += testResult.numPassingTests;
aggregatedResults.numPendingTests += testResult.numPendingTests;
if (testResult.testExecError) {
aggregatedResults.numRuntimeErrorTestSuites++;
}
if (testResult.skipped) {
aggregatedResults.numPendingTestSuites++;
} else if (testResult.numFailingTests > 0 || testResult.testExecError) {
aggregatedResults.numFailedTestSuites++;
} else {
aggregatedResults.numPassedTestSuites++;
}
// Snapshot data
if (testResult.snapshot.added) {
aggregatedResults.snapshot.filesAdded++;
}
if (testResult.snapshot.fileDeleted) {
aggregatedResults.snapshot.filesRemoved++;
}
if (testResult.snapshot.unmatched) {
aggregatedResults.snapshot.filesUnmatched++;
}
if (testResult.snapshot.updated) {
aggregatedResults.snapshot.filesUpdated++;
}
aggregatedResults.snapshot.added += testResult.snapshot.added;
aggregatedResults.snapshot.matched += testResult.snapshot.matched;
aggregatedResults.snapshot.unchecked += testResult.snapshot.unchecked;
aggregatedResults.snapshot.uncheckedKeys = testResult.snapshot.uncheckedKeys;
aggregatedResults.snapshot.unmatched += testResult.snapshot.unmatched;
aggregatedResults.snapshot.updated += testResult.snapshot.updated;
aggregatedResults.snapshot.total += testResult.snapshot.added + testResult.snapshot.matched + testResult.snapshot.unmatched + testResult.snapshot.updated;
};

View File

@@ -0,0 +1,380 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
var _chalk;
function _load_chalk() {
return _chalk = _interopRequireDefault(require('chalk'));
}
var _jestMessageUtil;
function _load_jestMessageUtil() {
return _jestMessageUtil = require('jest-message-util');
}
var _test_result_helpers;
function _load_test_result_helpers() {
return _test_result_helpers = require('./test_result_helpers');
}
var _coverage_reporter;
function _load_coverage_reporter() {
return _coverage_reporter = _interopRequireDefault(require('./reporters/coverage_reporter'));
}
var _default_reporter;
function _load_default_reporter() {
return _default_reporter = _interopRequireDefault(require('./reporters/default_reporter'));
}
var _exit;
function _load_exit() {
return _exit = _interopRequireDefault(require('exit'));
}
var _notify_reporter;
function _load_notify_reporter() {
return _notify_reporter = _interopRequireDefault(require('./reporters/notify_reporter'));
}
var _reporter_dispatcher;
function _load_reporter_dispatcher() {
return _reporter_dispatcher = _interopRequireDefault(require('./reporter_dispatcher'));
}
var _jestSnapshot;
function _load_jestSnapshot() {
return _jestSnapshot = _interopRequireDefault(require('jest-snapshot'));
}
var _summary_reporter;
function _load_summary_reporter() {
return _summary_reporter = _interopRequireDefault(require('./reporters/summary_reporter'));
}
var _jestRunner;
function _load_jestRunner() {
return _jestRunner = _interopRequireDefault(require('jest-runner'));
}
var _test_watcher;
function _load_test_watcher() {
return _test_watcher = _interopRequireDefault(require('./test_watcher'));
}
var _verbose_reporter;
function _load_verbose_reporter() {
return _verbose_reporter = _interopRequireDefault(require('./reporters/verbose_reporter'));
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } /**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/
const SLOW_TEST_TIME = 3000;
// The default jest-runner is required because it is the default test runner
// and required implicitly through the `runner` ProjectConfig option.
(_jestRunner || _load_jestRunner()).default;
class TestScheduler {
constructor(globalConfig, options, context) {
this._dispatcher = new (_reporter_dispatcher || _load_reporter_dispatcher()).default();
this._globalConfig = globalConfig;
this._options = options;
this._context = context;
this._setupReporters();
}
addReporter(reporter) {
this._dispatcher.register(reporter);
}
removeReporter(ReporterClass) {
this._dispatcher.unregister(ReporterClass);
}
scheduleTests(tests, watcher) {
var _this = this;
return _asyncToGenerator(function* () {
const onStart = _this._dispatcher.onTestStart.bind(_this._dispatcher);
const timings = [];
const contexts = new Set();
tests.forEach(function (test) {
contexts.add(test.context);
if (test.duration) {
timings.push(test.duration);
}
});
const aggregatedResults = createAggregatedResults(tests.length);
const estimatedTime = Math.ceil(getEstimatedTime(timings, _this._globalConfig.maxWorkers) / 1000);
// Run in band if we only have one test or one worker available.
// If we are confident from previous runs that the tests will finish quickly
// we also run in band to reduce the overhead of spawning workers.
const runInBand = _this._globalConfig.maxWorkers <= 1 || tests.length <= 1 || tests.length <= 20 && timings.length > 0 && timings.every(function (timing) {
return timing < SLOW_TEST_TIME;
});
const onResult = (() => {
var _ref = _asyncToGenerator(function* (test, testResult) {
if (watcher.isInterrupted()) {
return Promise.resolve();
}
if (testResult.testResults.length === 0) {
const message = 'Your test suite must contain at least one test.';
return onFailure(test, {
message,
stack: new Error(message).stack
});
}
// Throws when the context is leaked after executinga test.
if (testResult.leaks) {
const message = (_chalk || _load_chalk()).default.red.bold('EXPERIMENTAL FEATURE!\n') + 'Your test suite is leaking memory. Please ensure all references are cleaned.\n' + '\n' + 'There is a number of things that can leak memory:\n' + ' - Async operations that have not finished (e.g. fs.readFile).\n' + ' - Timers not properly mocked (e.g. setInterval, setTimeout).\n' + ' - Keeping references to the global scope.';
return onFailure(test, {
message,
stack: new Error(message).stack
});
}
(0, (_test_result_helpers || _load_test_result_helpers()).addResult)(aggregatedResults, testResult);
yield _this._dispatcher.onTestResult(test, testResult, aggregatedResults);
return _this._bailIfNeeded(contexts, aggregatedResults, watcher);
});
return function onResult(_x, _x2) {
return _ref.apply(this, arguments);
};
})();
const onFailure = (() => {
var _ref2 = _asyncToGenerator(function* (test, error) {
if (watcher.isInterrupted()) {
return;
}
const testResult = (0, (_test_result_helpers || _load_test_result_helpers()).buildFailureTestResult)(test.path, error);
testResult.failureMessage = (0, (_jestMessageUtil || _load_jestMessageUtil()).formatExecError)(testResult, test.context.config, _this._globalConfig, test.path);
(0, (_test_result_helpers || _load_test_result_helpers()).addResult)(aggregatedResults, testResult);
yield _this._dispatcher.onTestResult(test, testResult, aggregatedResults);
});
return function onFailure(_x3, _x4) {
return _ref2.apply(this, arguments);
};
})();
const updateSnapshotState = function () {
contexts.forEach(function (context) {
const status = (_jestSnapshot || _load_jestSnapshot()).default.cleanup(context.hasteFS, _this._globalConfig.updateSnapshot);
aggregatedResults.snapshot.filesRemoved += status.filesRemoved;
});
const updateAll = _this._globalConfig.updateSnapshot === 'all';
aggregatedResults.snapshot.didUpdate = updateAll;
aggregatedResults.snapshot.failure = !!(!updateAll && (aggregatedResults.snapshot.unchecked || aggregatedResults.snapshot.unmatched || aggregatedResults.snapshot.filesRemoved));
};
yield _this._dispatcher.onRunStart(aggregatedResults, {
estimatedTime,
showStatus: !runInBand
});
const testRunners = Object.create(null);
contexts.forEach(function (_ref3) {
let config = _ref3.config;
if (!testRunners[config.runner]) {
// $FlowFixMe
testRunners[config.runner] = new (require(config.runner))(_this._globalConfig);
}
});
const testsByRunner = _this._partitionTests(testRunners, tests);
if (testsByRunner) {
try {
for (const runner of Object.keys(testRunners)) {
yield testRunners[runner].runTests(testsByRunner[runner], watcher, onStart, onResult, onFailure, {
serial: runInBand
});
}
} catch (error) {
if (!watcher.isInterrupted()) {
throw error;
}
}
}
updateSnapshotState();
aggregatedResults.wasInterrupted = watcher.isInterrupted();
yield _this._dispatcher.onRunComplete(contexts, aggregatedResults);
const anyTestFailures = !(aggregatedResults.numFailedTests === 0 && aggregatedResults.numRuntimeErrorTestSuites === 0);
const anyReporterErrors = _this._dispatcher.hasErrors();
aggregatedResults.success = !(anyTestFailures || aggregatedResults.snapshot.failure || anyReporterErrors);
return aggregatedResults;
})();
}
_partitionTests(testRunners, tests) {
if (Object.keys(testRunners).length > 1) {
return tests.reduce((testRuns, test) => {
const runner = test.context.config.runner;
if (!testRuns[runner]) {
testRuns[runner] = [];
}
testRuns[runner].push(test);
return testRuns;
}, Object.create(null));
} else if (tests.length > 0 && tests[0] != null) {
// If there is only one runner, don't partition the tests.
return Object.assign(Object.create(null), {
[tests[0].context.config.runner]: tests
});
} else {
return null;
}
}
_shouldAddDefaultReporters(reporters) {
return !reporters || !!reporters.find(reporterConfig => reporterConfig[0] === 'default');
}
_setupReporters() {
var _globalConfig = this._globalConfig;
const collectCoverage = _globalConfig.collectCoverage,
notify = _globalConfig.notify,
reporters = _globalConfig.reporters;
const isDefault = this._shouldAddDefaultReporters(reporters);
if (isDefault) {
this._setupDefaultReporters(collectCoverage);
}
if (!isDefault && collectCoverage) {
this.addReporter(new (_coverage_reporter || _load_coverage_reporter()).default(this._globalConfig));
}
if (notify) {
this.addReporter(new (_notify_reporter || _load_notify_reporter()).default(this._globalConfig, this._options.startRun, this._context));
}
if (reporters && Array.isArray(reporters)) {
this._addCustomReporters(reporters);
}
}
_setupDefaultReporters(collectCoverage) {
this.addReporter(this._globalConfig.verbose ? new (_verbose_reporter || _load_verbose_reporter()).default(this._globalConfig) : new (_default_reporter || _load_default_reporter()).default(this._globalConfig));
if (collectCoverage) {
this.addReporter(new (_coverage_reporter || _load_coverage_reporter()).default(this._globalConfig));
}
this.addReporter(new (_summary_reporter || _load_summary_reporter()).default(this._globalConfig));
}
_addCustomReporters(reporters) {
const customReporters = reporters.filter(reporterConfig => reporterConfig[0] !== 'default');
customReporters.forEach((reporter, index) => {
var _getReporterProps = this._getReporterProps(reporter);
const options = _getReporterProps.options,
path = _getReporterProps.path;
try {
// $FlowFixMe
const Reporter = require(path);
this.addReporter(new Reporter(this._globalConfig, options));
} catch (error) {
throw new Error('An error occurred while adding the reporter at path "' + path + '".' + error.message);
}
});
}
/**
* Get properties of a reporter in an object
* to make dealing with them less painful.
*/
_getReporterProps(reporter) {
if (typeof reporter === 'string') {
return { options: this._options, path: reporter };
} else if (Array.isArray(reporter)) {
var _reporter = _slicedToArray(reporter, 2);
const path = _reporter[0],
options = _reporter[1];
return { options, path };
}
throw new Error('Reporter should be either a string or an array');
}
_bailIfNeeded(contexts, aggregatedResults, watcher) {
if (this._globalConfig.bail && aggregatedResults.numFailedTests !== 0) {
if (watcher.isWatchMode()) {
watcher.setState({ interrupted: true });
} else {
const failureExit = () => (0, (_exit || _load_exit()).default)(1);
return this._dispatcher.onRunComplete(contexts, aggregatedResults).then(failureExit).catch(failureExit);
}
}
return Promise.resolve();
}
}
exports.default = TestScheduler;
const createAggregatedResults = numTotalTestSuites => {
const result = (0, (_test_result_helpers || _load_test_result_helpers()).makeEmptyAggregatedTestResult)();
result.numTotalTestSuites = numTotalTestSuites;
result.startTime = Date.now();
result.success = false;
return result;
};
const getEstimatedTime = (timings, workers) => {
if (!timings.length) {
return 0;
}
const max = Math.max.apply(null, timings);
return timings.length <= workers ? max : Math.max(timings.reduce((sum, time) => sum + time) / workers, max);
};

View File

@@ -0,0 +1,115 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _fs;
function _load_fs() {
return _fs = _interopRequireDefault(require('fs'));
}
var _jestHasteMap;
function _load_jestHasteMap() {
return _jestHasteMap = require('jest-haste-map');
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const FAIL = 0;
// $FlowFixMe: Missing ESM export
/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/
const SUCCESS = 1;
class TestSequencer {
constructor() {
this._cache = new Map();
}
_getCachePath(context) {
const config = context.config;
return (0, (_jestHasteMap || _load_jestHasteMap()).getCacheFilePath)(config.cacheDirectory, 'perf-cache-' + config.name);
}
_getCache(test) {
const context = test.context;
if (!this._cache.has(context) && context.config.cache) {
const cachePath = this._getCachePath(context);
if ((_fs || _load_fs()).default.existsSync(cachePath)) {
try {
this._cache.set(context, JSON.parse((_fs || _load_fs()).default.readFileSync(cachePath, 'utf8')));
} catch (e) {}
}
}
let cache = this._cache.get(context);
if (!cache) {
cache = {};
this._cache.set(context, cache);
}
return cache;
}
// When running more tests than we have workers available, sort the tests
// by size - big test files usually take longer to complete, so we run
// them first in an effort to minimize worker idle time at the end of a
// long test run.
//
// After a test run we store the time it took to run a test and on
// subsequent runs we use that to run the slowest tests first, yielding the
// fastest results.
sort(tests) {
const stats = {};
const fileSize = test => stats[test.path] || (stats[test.path] = (_fs || _load_fs()).default.statSync(test.path).size);
const hasFailed = (cache, test) => cache[test.path] && cache[test.path][0] === FAIL;
const time = (cache, test) => cache[test.path] && cache[test.path][1];
tests.forEach(test => test.duration = time(this._getCache(test), test));
return tests.sort((testA, testB) => {
const cacheA = this._getCache(testA);
const cacheB = this._getCache(testB);
const failedA = hasFailed(cacheA, testA);
const failedB = hasFailed(cacheB, testB);
const hasTimeA = testA.duration != null;
if (failedA !== failedB) {
return failedA ? -1 : 1;
} else if (hasTimeA != (testB.duration != null)) {
// Check if only one of two tests has timing information
return hasTimeA != null ? 1 : -1;
} else if (testA.duration != null && testB.duration != null) {
return testA.duration < testB.duration ? 1 : -1;
} else {
return fileSize(testA) < fileSize(testB) ? 1 : -1;
}
});
}
cacheResults(tests, results) {
const map = Object.create(null);
tests.forEach(test => map[test.path] = test);
results.testResults.forEach(testResult => {
if (testResult && map[testResult.testFilePath] && !testResult.skipped) {
const cache = this._getCache(map[testResult.testFilePath]);
const perf = testResult.perfStats;
cache[testResult.testFilePath] = [testResult.numFailingTests ? FAIL : SUCCESS, perf.end - perf.start || 0];
}
});
this._cache.forEach((cache, context) => (_fs || _load_fs()).default.writeFileSync(this._getCachePath(context), JSON.stringify(cache)));
}
}
exports.default = TestSequencer;

View File

@@ -0,0 +1,45 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _events;
function _load_events() {
return _events = _interopRequireDefault(require('events'));
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
class TestWatcher extends (_events || _load_events()).default {
constructor(_ref) {
let isWatchMode = _ref.isWatchMode;
super();
this.state = { interrupted: false };
this._isWatchMode = isWatchMode;
}
setState(state) {
Object.assign(this.state, state);
this.emit('change', this.state);
}
isInterrupted() {
return this.state.interrupted;
}
isWatchMode() {
return this._isWatchMode;
}
}
exports.default = TestWatcher; /**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/

View File

@@ -0,0 +1 @@
'use strict';

449
node_modules/jest/node_modules/jest-cli/build/watch.js generated vendored Normal file
View File

@@ -0,0 +1,449 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = watch;
var _ansiEscapes;
function _load_ansiEscapes() {
return _ansiEscapes = _interopRequireDefault(require('ansi-escapes'));
}
var _chalk;
function _load_chalk() {
return _chalk = _interopRequireDefault(require('chalk'));
}
var _get_changed_files_promise;
function _load_get_changed_files_promise() {
return _get_changed_files_promise = _interopRequireDefault(require('./get_changed_files_promise'));
}
var _exit;
function _load_exit() {
return _exit = _interopRequireDefault(require('exit'));
}
var _jestRegexUtil;
function _load_jestRegexUtil() {
return _jestRegexUtil = require('jest-regex-util');
}
var _jestHasteMap;
function _load_jestHasteMap() {
return _jestHasteMap = _interopRequireDefault(require('jest-haste-map'));
}
var _is_valid_path;
function _load_is_valid_path() {
return _is_valid_path = _interopRequireDefault(require('./lib/is_valid_path'));
}
var _jestUtil;
function _load_jestUtil() {
return _jestUtil = require('jest-util');
}
var _pre_run_message;
function _load_pre_run_message() {
return _pre_run_message = require('./pre_run_message');
}
var _create_context;
function _load_create_context() {
return _create_context = _interopRequireDefault(require('./lib/create_context'));
}
var _run_jest;
function _load_run_jest() {
return _run_jest = _interopRequireDefault(require('./run_jest'));
}
var _update_global_config;
function _load_update_global_config() {
return _update_global_config = _interopRequireDefault(require('./lib/update_global_config'));
}
var _search_source;
function _load_search_source() {
return _search_source = _interopRequireDefault(require('./search_source'));
}
var _test_watcher;
function _load_test_watcher() {
return _test_watcher = _interopRequireDefault(require('./test_watcher'));
}
var _failed_tests_cache;
function _load_failed_tests_cache() {
return _failed_tests_cache = _interopRequireDefault(require('./failed_tests_cache'));
}
var _constants;
function _load_constants() {
return _constants = require('./constants');
}
var _jest_hooks;
function _load_jest_hooks() {
return _jest_hooks = _interopRequireDefault(require('./jest_hooks'));
}
var _test_path_pattern;
function _load_test_path_pattern() {
return _test_path_pattern = _interopRequireDefault(require('./plugins/test_path_pattern'));
}
var _test_name_pattern;
function _load_test_name_pattern() {
return _test_name_pattern = _interopRequireDefault(require('./plugins/test_name_pattern'));
}
var _update_snapshots;
function _load_update_snapshots() {
return _update_snapshots = _interopRequireDefault(require('./plugins/update_snapshots'));
}
var _update_snapshots_interactive;
function _load_update_snapshots_interactive() {
return _update_snapshots_interactive = _interopRequireDefault(require('./plugins/update_snapshots_interactive'));
}
var _quit;
function _load_quit() {
return _quit = _interopRequireDefault(require('./plugins/quit'));
}
var _active_filters_message;
function _load_active_filters_message() {
return _active_filters_message = _interopRequireDefault(require('./lib/active_filters_message'));
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; return arr2; } else { return Array.from(arr); } } /**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/
let hasExitListener = false;
const INTERNAL_PLUGINS = [(_test_path_pattern || _load_test_path_pattern()).default, (_test_name_pattern || _load_test_name_pattern()).default, (_update_snapshots || _load_update_snapshots()).default, (_update_snapshots_interactive || _load_update_snapshots_interactive()).default, (_quit || _load_quit()).default];
const getSortedUsageRows = (watchPlugins, globalConfig) => {
const internalPlugins = watchPlugins.slice(0, INTERNAL_PLUGINS.length).map(p => p.getUsageInfo && p.getUsageInfo(globalConfig)).filter(Boolean);
const thirdPartyPlugins = watchPlugins.slice(INTERNAL_PLUGINS.length).map(p => p.getUsageInfo && p.getUsageInfo(globalConfig)).filter(Boolean).sort((a, b) => a.key - b.key);
return internalPlugins.concat(thirdPartyPlugins);
};
function watch(initialGlobalConfig, contexts, outputStream, hasteMapInstances) {
let stdin = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : process.stdin;
let hooks = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : new (_jest_hooks || _load_jest_hooks()).default();
// `globalConfig` will be constantly updated and reassigned as a result of
// watch mode interactions.
let globalConfig = initialGlobalConfig;
let activePlugin;
globalConfig = (0, (_update_global_config || _load_update_global_config()).default)(globalConfig, {
mode: globalConfig.watch ? 'watch' : 'watchAll',
passWithNoTests: true
});
const updateConfigAndRun = function () {
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
let testNamePattern = _ref.testNamePattern,
testPathPattern = _ref.testPathPattern,
updateSnapshot = _ref.updateSnapshot;
const previousUpdateSnapshot = globalConfig.updateSnapshot;
globalConfig = (0, (_update_global_config || _load_update_global_config()).default)(globalConfig, {
mode: 'watch',
testNamePattern: testNamePattern !== undefined ? testNamePattern : globalConfig.testNamePattern,
testPathPattern: testPathPattern !== undefined ? (0, (_jestRegexUtil || _load_jestRegexUtil()).replacePathSepForRegex)(testPathPattern) : globalConfig.testPathPattern,
updateSnapshot: updateSnapshot !== undefined ? updateSnapshot : globalConfig.updateSnapshot
});
startRun(globalConfig);
globalConfig = (0, (_update_global_config || _load_update_global_config()).default)(globalConfig, {
// updateSnapshot is not sticky after a run.
updateSnapshot: previousUpdateSnapshot === 'all' ? 'none' : previousUpdateSnapshot
});
};
const watchPlugins = INTERNAL_PLUGINS.map(InternalPlugin => new InternalPlugin({ stdin, stdout: outputStream }));
watchPlugins.forEach(plugin => {
const hookSubscriber = hooks.getSubscriber();
if (plugin.apply) {
plugin.apply(hookSubscriber);
}
});
if (globalConfig.watchPlugins != null) {
for (const pluginModulePath of globalConfig.watchPlugins) {
// $FlowFixMe dynamic require
const ThirdPartyPlugin = require(pluginModulePath);
const plugin = new ThirdPartyPlugin({
stdin,
stdout: outputStream
});
const hookSubscriber = hooks.getSubscriber();
if (plugin.apply) {
plugin.apply(hookSubscriber);
}
watchPlugins.push(plugin);
}
}
const failedTestsCache = new (_failed_tests_cache || _load_failed_tests_cache()).default();
let searchSources = contexts.map(context => ({
context,
searchSource: new (_search_source || _load_search_source()).default(context)
}));
let isRunning = false;
let testWatcher;
let shouldDisplayWatchUsage = true;
let isWatchUsageDisplayed = false;
hasteMapInstances.forEach((hasteMapInstance, index) => {
hasteMapInstance.on('change', (_ref2) => {
let eventsQueue = _ref2.eventsQueue,
hasteFS = _ref2.hasteFS,
moduleMap = _ref2.moduleMap;
const validPaths = eventsQueue.filter((_ref3) => {
let filePath = _ref3.filePath;
return (0, (_is_valid_path || _load_is_valid_path()).default)(globalConfig, contexts[index].config, filePath);
});
if (validPaths.length) {
const context = contexts[index] = (0, (_create_context || _load_create_context()).default)(contexts[index].config, {
hasteFS,
moduleMap
});
activePlugin = null;
searchSources = searchSources.slice();
searchSources[index] = {
context,
searchSource: new (_search_source || _load_search_source()).default(context)
};
startRun(globalConfig);
}
});
});
if (!hasExitListener) {
hasExitListener = true;
process.on('exit', () => {
if (activePlugin) {
outputStream.write((_ansiEscapes || _load_ansiEscapes()).default.cursorDown());
outputStream.write((_ansiEscapes || _load_ansiEscapes()).default.eraseDown);
}
});
}
const startRun = globalConfig => {
if (isRunning) {
return null;
}
testWatcher = new (_test_watcher || _load_test_watcher()).default({ isWatchMode: true });
(_jestUtil || _load_jestUtil()).isInteractive && outputStream.write((_constants || _load_constants()).CLEAR);
(0, (_pre_run_message || _load_pre_run_message()).print)(outputStream);
isRunning = true;
const configs = contexts.map(context => context.config);
const changedFilesPromise = (0, (_get_changed_files_promise || _load_get_changed_files_promise()).default)(globalConfig, configs);
return (0, (_run_jest || _load_run_jest()).default)({
changedFilesPromise,
contexts,
failedTestsCache,
globalConfig,
jestHooks: hooks.getEmitter(),
onComplete: results => {
isRunning = false;
hooks.getEmitter().testRunComplete(results);
// Create a new testWatcher instance so that re-runs won't be blocked.
// The old instance that was passed to Jest will still be interrupted
// and prevent test runs from the previous run.
testWatcher = new (_test_watcher || _load_test_watcher()).default({ isWatchMode: true });
// Do not show any Watch Usage related stuff when running in a
// non-interactive environment
if ((_jestUtil || _load_jestUtil()).isInteractive) {
if (shouldDisplayWatchUsage) {
outputStream.write(usage(globalConfig, watchPlugins));
shouldDisplayWatchUsage = false; // hide Watch Usage after first run
isWatchUsageDisplayed = true;
} else {
outputStream.write(showToggleUsagePrompt());
shouldDisplayWatchUsage = false;
isWatchUsageDisplayed = false;
}
} else {
outputStream.write('\n');
}
failedTestsCache.setTestResults(results.testResults);
},
outputStream,
startRun,
testWatcher
}).catch(error => console.error((_chalk || _load_chalk()).default.red(error.stack)));
};
const onKeypress = key => {
if (key === (_constants || _load_constants()).KEYS.CONTROL_C || key === (_constants || _load_constants()).KEYS.CONTROL_D) {
if (typeof stdin.setRawMode === 'function') {
stdin.setRawMode(false);
}
outputStream.write('\n');
(0, (_exit || _load_exit()).default)(0);
return;
}
if (activePlugin != null && activePlugin.onKey) {
// if a plugin is activate, Jest should let it handle keystrokes, so ignore
// them here
activePlugin.onKey(key);
return;
}
// Abort test run
const pluginKeys = getSortedUsageRows(watchPlugins, globalConfig).map(usage => Number(usage.key).toString(16));
if (isRunning && testWatcher && [(_constants || _load_constants()).KEYS.Q, (_constants || _load_constants()).KEYS.ENTER, (_constants || _load_constants()).KEYS.A, (_constants || _load_constants()).KEYS.O, (_constants || _load_constants()).KEYS.F].concat(pluginKeys).indexOf(key) !== -1) {
testWatcher.setState({ interrupted: true });
return;
}
const matchingWatchPlugin = watchPlugins.find(plugin => {
const usageData = plugin.getUsageInfo && plugin.getUsageInfo(globalConfig) || {};
return usageData.key === parseInt(key, 16);
});
if (matchingWatchPlugin != null) {
// "activate" the plugin, which has jest ignore keystrokes so the plugin
// can handle them
activePlugin = matchingWatchPlugin;
if (activePlugin.run) {
activePlugin.run(globalConfig, updateConfigAndRun).then(shouldRerun => {
activePlugin = null;
if (shouldRerun) {
updateConfigAndRun();
}
}, () => {
activePlugin = null;
onCancelPatternPrompt();
});
} else {
activePlugin = null;
}
}
switch (key) {
case (_constants || _load_constants()).KEYS.ENTER:
startRun(globalConfig);
break;
case (_constants || _load_constants()).KEYS.A:
globalConfig = (0, (_update_global_config || _load_update_global_config()).default)(globalConfig, {
mode: 'watchAll',
testNamePattern: '',
testPathPattern: ''
});
startRun(globalConfig);
break;
case (_constants || _load_constants()).KEYS.C:
updateConfigAndRun({
testNamePattern: '',
testPathPattern: ''
});
break;
case (_constants || _load_constants()).KEYS.F:
globalConfig = (0, (_update_global_config || _load_update_global_config()).default)(globalConfig, {
onlyFailures: !globalConfig.onlyFailures
});
startRun(globalConfig);
break;
case (_constants || _load_constants()).KEYS.O:
globalConfig = (0, (_update_global_config || _load_update_global_config()).default)(globalConfig, {
mode: 'watch',
testNamePattern: '',
testPathPattern: ''
});
startRun(globalConfig);
break;
case (_constants || _load_constants()).KEYS.QUESTION_MARK:
break;
case (_constants || _load_constants()).KEYS.W:
if (!shouldDisplayWatchUsage && !isWatchUsageDisplayed) {
outputStream.write((_ansiEscapes || _load_ansiEscapes()).default.cursorUp());
outputStream.write((_ansiEscapes || _load_ansiEscapes()).default.eraseDown);
outputStream.write(usage(globalConfig, watchPlugins));
isWatchUsageDisplayed = true;
shouldDisplayWatchUsage = false;
}
break;
}
};
const onCancelPatternPrompt = () => {
outputStream.write((_ansiEscapes || _load_ansiEscapes()).default.cursorHide);
outputStream.write((_ansiEscapes || _load_ansiEscapes()).default.clearScreen);
outputStream.write(usage(globalConfig, watchPlugins));
outputStream.write((_ansiEscapes || _load_ansiEscapes()).default.cursorShow);
};
if (typeof stdin.setRawMode === 'function') {
stdin.setRawMode(true);
stdin.resume();
stdin.setEncoding('hex');
stdin.on('data', onKeypress);
}
startRun(globalConfig);
return Promise.resolve();
}
const usage = function (globalConfig, watchPlugins) {
let delimiter = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '\n';
const messages = [(0, (_active_filters_message || _load_active_filters_message()).default)(globalConfig), globalConfig.testPathPattern || globalConfig.testNamePattern ? (_chalk || _load_chalk()).default.dim(' \u203A Press ') + 'c' + (_chalk || _load_chalk()).default.dim(' to clear filters.') : null, '\n' + (_chalk || _load_chalk()).default.bold('Watch Usage'), globalConfig.watch ? (_chalk || _load_chalk()).default.dim(' \u203A Press ') + 'a' + (_chalk || _load_chalk()).default.dim(' to run all tests.') : null, globalConfig.onlyFailures ? (_chalk || _load_chalk()).default.dim(' \u203A Press ') + 'f' + (_chalk || _load_chalk()).default.dim(' to run all tests.') : (_chalk || _load_chalk()).default.dim(' \u203A Press ') + 'f' + (_chalk || _load_chalk()).default.dim(' to run only failed tests.'), (globalConfig.watchAll || globalConfig.testPathPattern || globalConfig.testNamePattern) && !globalConfig.noSCM ? (_chalk || _load_chalk()).default.dim(' \u203A Press ') + 'o' + (_chalk || _load_chalk()).default.dim(' to only run tests related to changed files.') : null].concat(_toConsumableArray(getSortedUsageRows(watchPlugins, globalConfig).map(plugin => (_chalk || _load_chalk()).default.dim(' \u203A Press') + ' ' + String.fromCodePoint(plugin.key) + ' ' + (_chalk || _load_chalk()).default.dim(`to ${plugin.prompt}.`))), [(_chalk || _load_chalk()).default.dim(' \u203A Press ') + 'Enter' + (_chalk || _load_chalk()).default.dim(' to trigger a test run.')]);
return messages.filter(message => !!message).join(delimiter) + '\n';
};
const showToggleUsagePrompt = () => '\n' + (_chalk || _load_chalk()).default.bold('Watch Usage: ') + (_chalk || _load_chalk()).default.dim('Press ') + 'w' + (_chalk || _load_chalk()).default.dim(' to show more.');

155
node_modules/jest/node_modules/jest-cli/package.json generated vendored Normal file
View File

@@ -0,0 +1,155 @@
{
"_args": [
[
"jest-cli@^22.4.4",
"/home/bernhard/freifunk-app/node_modules/jest"
]
],
"_from": "jest-cli@>=22.4.4 <23.0.0",
"_id": "jest-cli@22.4.4",
"_inCache": true,
"_installable": true,
"_location": "/jest/jest-cli",
"_nodeVersion": "8.9.1",
"_npmOperationalInternal": {
"host": "s3://npm-registry-packages",
"tmp": "tmp/jest-cli_22.4.4_1526648368435_0.2713093929277455"
},
"_npmUser": {
"email": "mjesun@hotmail.com",
"name": "mjesun"
},
"_npmVersion": "5.5.1",
"_phantomChildren": {},
"_requested": {
"name": "jest-cli",
"raw": "jest-cli@^22.4.4",
"rawSpec": "^22.4.4",
"scope": null,
"spec": ">=22.4.4 <23.0.0",
"type": "range"
},
"_requiredBy": [
"/jest"
],
"_resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-22.4.4.tgz",
"_shasum": "68cd2a2aae983adb1e6638248ca21082fd6d9e90",
"_shrinkwrap": null,
"_spec": "jest-cli@^22.4.4",
"_where": "/home/bernhard/freifunk-app/node_modules/jest",
"bin": {
"jest": "./bin/jest.js"
},
"bugs": {
"url": "https://github.com/facebook/jest/issues"
},
"dependencies": {
"ansi-escapes": "^3.0.0",
"chalk": "^2.0.1",
"exit": "^0.1.2",
"glob": "^7.1.2",
"graceful-fs": "^4.1.11",
"import-local": "^1.0.0",
"is-ci": "^1.0.10",
"istanbul-api": "^1.1.14",
"istanbul-lib-coverage": "^1.1.1",
"istanbul-lib-instrument": "^1.8.0",
"istanbul-lib-source-maps": "^1.2.1",
"jest-changed-files": "^22.2.0",
"jest-config": "^22.4.4",
"jest-environment-jsdom": "^22.4.1",
"jest-get-type": "^22.1.0",
"jest-haste-map": "^22.4.2",
"jest-message-util": "^22.4.0",
"jest-regex-util": "^22.1.0",
"jest-resolve-dependencies": "^22.1.0",
"jest-runner": "^22.4.4",
"jest-runtime": "^22.4.4",
"jest-snapshot": "^22.4.0",
"jest-util": "^22.4.1",
"jest-validate": "^22.4.4",
"jest-worker": "^22.2.2",
"micromatch": "^2.3.11",
"node-notifier": "^5.2.1",
"realpath-native": "^1.0.0",
"rimraf": "^2.5.4",
"slash": "^1.0.0",
"string-length": "^2.0.0",
"strip-ansi": "^4.0.0",
"which": "^1.2.12",
"yargs": "^10.0.3"
},
"description": "Delightful JavaScript Testing.",
"devDependencies": {},
"directories": {},
"dist": {
"fileCount": 64,
"integrity": "sha512-I9dsgkeyjVEEZj9wrGrqlH+8OlNob9Iptyl+6L5+ToOLJmHm4JwOPatin1b2Bzp5R5YRQJ+oiedx7o1H7wJzhA==",
"npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa/s4yCRA9TVsSAnZWagAA0n8P/jFTxG1cU1ZUSX5MrcwB\nzvZqALAb+1EVPGPqBL7eCaWtEVx3ZmK2s6HSrNpXHwdwVueqL3WS/77XUnbm\nMS3rSRxZlPcZ3vxp0Lv4/xsHwQmDiSQ3rOaNsPQVjL4OPeLNWy2YZnQDWIMX\npbo1V2C2yjGTP9F+Iy3GFJH6iTPyP20C/A5SCmxoZroei53msk6MM7jVa6Yn\n5M5lQ6N5O0T2WKYlDzwQ2Zkd3qjznarbnT02Dg2hgX0MkPjG1XU+bNiFIPGb\nRnJ9OUdQLrlPSuZYHDUduYeGmKYZKHF01tzIPt1ytctYnHaeDJ0vb48S2skY\nxsBXtaXeVxjKZs5Q7W0PxiVKYZR/Lb1PgoNrPacHOKV5OG2ka4z71kADjOZd\ngMxefAkwqiIexJt7S2goncIFs6FCftckTUwqImeR4Z93Z+CaM5MPUQ1OujGC\n72rHc5HcwA9Xcd4QHopEWi7Nvx/FkdFBprJKX2ULWTSdgvlzNu0u+1mKi8s4\nGPFJXcQ2ovERwRyyF60TQorBYjVnkR01mnyKKXWAl0dD4WaU+u0B52wbodux\nCzCy0X/BP7sOHqI031jvL4UFDEMxUBjUn85GXInVZUNgdiV487ZyNi6kv8xR\nlK7cGfbnKbX1hXmSmrPRTxfh1bG2CuOZSdFPmlMe7Cx6nIH9r5x4RzJl5BAx\nZYry\r\n=AxxJ\r\n-----END PGP SIGNATURE-----\r\n",
"shasum": "68cd2a2aae983adb1e6638248ca21082fd6d9e90",
"tarball": "https://registry.npmjs.org/jest-cli/-/jest-cli-22.4.4.tgz",
"unpackedSize": 230599
},
"engines": {
"node": ">= 6"
},
"homepage": "http://facebook.github.io/jest/",
"keywords": [
"ava",
"babel",
"coverage",
"easy",
"expect",
"facebook",
"immersive",
"instant",
"jasmine",
"jest",
"jsdom",
"mocha",
"mocking",
"painless",
"qunit",
"runner",
"sandboxed",
"snapshot",
"tap",
"tape",
"test",
"testing",
"typescript",
"watch"
],
"license": "MIT",
"main": "build/jest.js",
"maintainers": [
{
"name": "aaronabramov",
"email": "aaron@abramov.io"
},
{
"name": "cpojer",
"email": "christoph.pojer@gmail.com"
},
{
"name": "fb",
"email": "opensource+npm@fb.com"
},
{
"name": "jeanlauliac",
"email": "jean@lauliac.com"
},
{
"name": "mjesun",
"email": "mjesun@hotmail.com"
}
],
"name": "jest-cli",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "git+https://github.com/facebook/jest.git"
},
"version": "22.4.4"
}

4
node_modules/jest/node_modules/strip-ansi/index.js generated vendored Normal file
View File

@@ -0,0 +1,4 @@
'use strict';
const ansiRegex = require('ansi-regex');
module.exports = input => typeof input === 'string' ? input.replace(ansiRegex(), '') : input;

9
node_modules/jest/node_modules/strip-ansi/license generated vendored Normal file
View File

@@ -0,0 +1,9 @@
MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
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.

120
node_modules/jest/node_modules/strip-ansi/package.json generated vendored Normal file
View File

@@ -0,0 +1,120 @@
{
"_args": [
[
"strip-ansi@^4.0.0",
"/home/bernhard/freifunk-app/node_modules/jest/node_modules/jest-cli"
]
],
"_from": "strip-ansi@>=4.0.0 <5.0.0",
"_id": "strip-ansi@4.0.0",
"_inCache": true,
"_installable": true,
"_location": "/jest/strip-ansi",
"_nodeVersion": "4.8.3",
"_npmOperationalInternal": {
"host": "s3://npm-registry-packages",
"tmp": "tmp/strip-ansi-4.0.0.tgz_1497986904730_0.4528853143565357"
},
"_npmUser": {
"email": "sindresorhus@gmail.com",
"name": "sindresorhus"
},
"_npmVersion": "2.15.11",
"_phantomChildren": {},
"_requested": {
"name": "strip-ansi",
"raw": "strip-ansi@^4.0.0",
"rawSpec": "^4.0.0",
"scope": null,
"spec": ">=4.0.0 <5.0.0",
"type": "range"
},
"_requiredBy": [
"/jest/cliui",
"/jest/jest-cli"
],
"_resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz",
"_shasum": "a8479022eb1ac368a871389b635262c505ee368f",
"_shrinkwrap": null,
"_spec": "strip-ansi@^4.0.0",
"_where": "/home/bernhard/freifunk-app/node_modules/jest/node_modules/jest-cli",
"author": {
"email": "sindresorhus@gmail.com",
"name": "Sindre Sorhus",
"url": "sindresorhus.com"
},
"bugs": {
"url": "https://github.com/chalk/strip-ansi/issues"
},
"dependencies": {
"ansi-regex": "^3.0.0"
},
"description": "Strip ANSI escape codes",
"devDependencies": {
"ava": "*",
"xo": "*"
},
"directories": {},
"dist": {
"shasum": "a8479022eb1ac368a871389b635262c505ee368f",
"tarball": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz"
},
"engines": {
"node": ">=4"
},
"files": [
"index.js"
],
"gitHead": "c299056a42b31d7a479d6a89b41318b2a2462cc7",
"homepage": "https://github.com/chalk/strip-ansi#readme",
"keywords": [
"256",
"ansi",
"color",
"colors",
"colour",
"command-line",
"console",
"escape",
"formatting",
"log",
"logging",
"remove",
"rgb",
"shell",
"string",
"strip",
"styles",
"terminal",
"text",
"trim",
"tty",
"xterm"
],
"license": "MIT",
"maintainers": [
{
"name": "dthree",
"email": "threedeecee@gmail.com"
},
{
"name": "qix",
"email": "i.am.qix@gmail.com"
},
{
"name": "sindresorhus",
"email": "sindresorhus@gmail.com"
}
],
"name": "strip-ansi",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "git+https://github.com/chalk/strip-ansi.git"
},
"scripts": {
"test": "xo && ava"
},
"version": "4.0.0"
}

39
node_modules/jest/node_modules/strip-ansi/readme.md generated vendored Normal file
View File

@@ -0,0 +1,39 @@
# strip-ansi [![Build Status](https://travis-ci.org/chalk/strip-ansi.svg?branch=master)](https://travis-ci.org/chalk/strip-ansi)
> Strip [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code)
## Install
```
$ npm install strip-ansi
```
## Usage
```js
const stripAnsi = require('strip-ansi');
stripAnsi('\u001B[4mUnicorn\u001B[0m');
//=> 'Unicorn'
```
## Related
- [strip-ansi-cli](https://github.com/chalk/strip-ansi-cli) - CLI for this module
- [has-ansi](https://github.com/chalk/has-ansi) - Check if a string has ANSI escape codes
- [ansi-regex](https://github.com/chalk/ansi-regex) - Regular expression for matching ANSI escape codes
- [chalk](https://github.com/chalk/chalk) - Terminal string styling done right
## Maintainers
- [Sindre Sorhus](https://github.com/sindresorhus)
- [Josh Junon](https://github.com/qix-)
## License
MIT

View File

@@ -0,0 +1,5 @@
'use strict';
module.exports = {
stdout: false,
stderr: false
};

131
node_modules/jest/node_modules/supports-color/index.js generated vendored Normal file
View File

@@ -0,0 +1,131 @@
'use strict';
const os = require('os');
const hasFlag = require('has-flag');
const env = process.env;
let forceColor;
if (hasFlag('no-color') ||
hasFlag('no-colors') ||
hasFlag('color=false')) {
forceColor = false;
} else if (hasFlag('color') ||
hasFlag('colors') ||
hasFlag('color=true') ||
hasFlag('color=always')) {
forceColor = true;
}
if ('FORCE_COLOR' in env) {
forceColor = env.FORCE_COLOR.length === 0 || parseInt(env.FORCE_COLOR, 10) !== 0;
}
function translateLevel(level) {
if (level === 0) {
return false;
}
return {
level,
hasBasic: true,
has256: level >= 2,
has16m: level >= 3
};
}
function supportsColor(stream) {
if (forceColor === false) {
return 0;
}
if (hasFlag('color=16m') ||
hasFlag('color=full') ||
hasFlag('color=truecolor')) {
return 3;
}
if (hasFlag('color=256')) {
return 2;
}
if (stream && !stream.isTTY && forceColor !== true) {
return 0;
}
const min = forceColor ? 1 : 0;
if (process.platform === 'win32') {
// Node.js 7.5.0 is the first version of Node.js to include a patch to
// libuv that enables 256 color output on Windows. Anything earlier and it
// won't work. However, here we target Node.js 8 at minimum as it is an LTS
// release, and Node.js 7 is not. Windows 10 build 10586 is the first Windows
// release that supports 256 colors. Windows 10 build 14931 is the first release
// that supports 16m/TrueColor.
const osRelease = os.release().split('.');
if (
Number(process.versions.node.split('.')[0]) >= 8 &&
Number(osRelease[0]) >= 10 &&
Number(osRelease[2]) >= 10586
) {
return Number(osRelease[2]) >= 14931 ? 3 : 2;
}
return 1;
}
if ('CI' in env) {
if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
return 1;
}
return min;
}
if ('TEAMCITY_VERSION' in env) {
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
}
if (env.COLORTERM === 'truecolor') {
return 3;
}
if ('TERM_PROGRAM' in env) {
const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
switch (env.TERM_PROGRAM) {
case 'iTerm.app':
return version >= 3 ? 3 : 2;
case 'Apple_Terminal':
return 2;
// No default
}
}
if (/-256(color)?$/i.test(env.TERM)) {
return 2;
}
if (/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
return 1;
}
if ('COLORTERM' in env) {
return 1;
}
if (env.TERM === 'dumb') {
return min;
}
return min;
}
function getSupportLevel(stream) {
const level = supportsColor(stream);
return translateLevel(level);
}
module.exports = {
supportsColor: getSupportLevel,
stdout: getSupportLevel(process.stdout),
stderr: getSupportLevel(process.stderr)
};

View File

@@ -0,0 +1,9 @@
MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
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.

View File

@@ -0,0 +1,120 @@
{
"_args": [
[
"supports-color@^5.3.0",
"/home/bernhard/freifunk-app/node_modules/jest/node_modules/chalk"
]
],
"_from": "supports-color@>=5.3.0 <6.0.0",
"_id": "supports-color@5.4.0",
"_inCache": true,
"_installable": true,
"_location": "/jest/supports-color",
"_nodeVersion": "8.10.0",
"_npmOperationalInternal": {
"host": "s3://npm-registry-packages",
"tmp": "tmp/supports-color_5.4.0_1523937461670_0.5515855155919032"
},
"_npmUser": {
"email": "sindresorhus@gmail.com",
"name": "sindresorhus"
},
"_npmVersion": "5.6.0",
"_phantomChildren": {},
"_requested": {
"name": "supports-color",
"raw": "supports-color@^5.3.0",
"rawSpec": "^5.3.0",
"scope": null,
"spec": ">=5.3.0 <6.0.0",
"type": "range"
},
"_requiredBy": [
"/jest/chalk"
],
"_resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz",
"_shasum": "1c6b337402c2137605efe19f10fec390f6faab54",
"_shrinkwrap": null,
"_spec": "supports-color@^5.3.0",
"_where": "/home/bernhard/freifunk-app/node_modules/jest/node_modules/chalk",
"author": {
"email": "sindresorhus@gmail.com",
"name": "Sindre Sorhus",
"url": "sindresorhus.com"
},
"browser": "browser.js",
"bugs": {
"url": "https://github.com/chalk/supports-color/issues"
},
"dependencies": {
"has-flag": "^3.0.0"
},
"description": "Detect whether a terminal supports color",
"devDependencies": {
"ava": "*",
"import-fresh": "^2.0.0",
"xo": "*"
},
"directories": {},
"dist": {
"fileCount": 5,
"integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==",
"npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa1XC3CRA9TVsSAnZWagAAKqEP/1b5ncwgky8BfhFodI/k\nxxuQA/s18s+3RUyXu1KSyFbn+6wbyprD0mlsATEhrc8ILe23ieTpKV9xsy7U\nUjkhV7TW0ibf1ndM8Xr2Y9VqG/FV+ZDcn/sJC1OS+v6cmVRXsMuwUNHzHPmC\nj4dGMR9auksDBY6BMIz/vLIf/nKzKUC84v+Wc2AvWSjx7eii/j2txPlW7eIt\nPxfUinegPSzxVx15ijd7rP7mckXqjAfXHoEiaoJkrfeDZZdwLnJKSgDlGn1B\nQyKxo32z3XBDyf3zIBhrNfEa4yagX1zDLq9q2Kjnt1mWAxAXbScBuMx7NXfW\nZ8IriNLHNnfP+X3lK0uhd8K6nHMX6Vtcl63Ib1jTLXCo+nvotGdydYymsL6I\nqD2HEatdn7bCCBO9rImSOXWIfvVImPP2KIt7n4rnckerpWgMwnS1zeTqfzrm\nUWTAOUgkmrKZEoKdP4GHakdJflUjCFf5bd3pJFgIA2KiSUSYMOP1YPziWLpE\nhq192CiFHEDFmuAjXFqDxH8ewbis8qBhp9P1hg9x5oV/pPABVnsuAFcEEGhR\nlLiUMxTL5sO4ya1ARHtPecOj+Br86kyn5O9TG4iQYzxMQufn/Iyi0La7xs0q\nRHtaokepsuCcZOO8zG5GRVV/WKClK9ePLcjOiYOgyc8OI065zzLT43amvCAZ\n+M/X\r\n=nrD9\r\n-----END PGP SIGNATURE-----\r\n",
"shasum": "1c6b337402c2137605efe19f10fec390f6faab54",
"tarball": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz",
"unpackedSize": 6693
},
"engines": {
"node": ">=4"
},
"files": [
"browser.js",
"index.js"
],
"gitHead": "bcd82c998094535f3462a3e37856852938ccbb37",
"homepage": "https://github.com/chalk/supports-color#readme",
"keywords": [
"16m",
"256",
"ansi",
"capability",
"cli",
"color",
"colors",
"colour",
"command-line",
"console",
"detect",
"rgb",
"shell",
"styles",
"support",
"supports",
"terminal",
"truecolor",
"tty",
"xterm"
],
"license": "MIT",
"maintainers": [
{
"name": "qix",
"email": "i.am.qix@gmail.com"
},
{
"name": "sindresorhus",
"email": "sindresorhus@gmail.com"
}
],
"name": "supports-color",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "git+https://github.com/chalk/supports-color.git"
},
"scripts": {
"test": "xo && ava"
},
"version": "5.4.0"
}

View File

@@ -0,0 +1,66 @@
# supports-color [![Build Status](https://travis-ci.org/chalk/supports-color.svg?branch=master)](https://travis-ci.org/chalk/supports-color)
> Detect whether a terminal supports color
## Install
```
$ npm install supports-color
```
## Usage
```js
const supportsColor = require('supports-color');
if (supportsColor.stdout) {
console.log('Terminal stdout supports color');
}
if (supportsColor.stdout.has256) {
console.log('Terminal stdout supports 256 colors');
}
if (supportsColor.stderr.has16m) {
console.log('Terminal stderr supports 16 million colors (truecolor)');
}
```
## API
Returns an `Object` with a `stdout` and `stderr` property for testing either streams. Each property is an `Object`, or `false` if color is not supported.
The `stdout`/`stderr` objects specifies a level of support for color through a `.level` property and a corresponding flag:
- `.level = 1` and `.hasBasic = true`: Basic color support (16 colors)
- `.level = 2` and `.has256 = true`: 256 color support
- `.level = 3` and `.has16m = true`: Truecolor support (16 million colors)
## Info
It obeys the `--color` and `--no-color` CLI flags.
Can be overridden by the user with the flags `--color` and `--no-color`. For situations where using `--color` is not possible, add the environment variable `FORCE_COLOR=1` to forcefully enable color or `FORCE_COLOR=0` to forcefully disable. The use of `FORCE_COLOR` overrides all other color support checks.
Explicit 256/Truecolor mode can be enabled using the `--color=256` and `--color=16m` flags, respectively.
## Related
- [supports-color-cli](https://github.com/chalk/supports-color-cli) - CLI for this module
- [chalk](https://github.com/chalk/chalk) - Terminal string styling done right
## Maintainers
- [Sindre Sorhus](https://github.com/sindresorhus)
- [Josh Junon](https://github.com/qix-)
## License
MIT

View File

@@ -0,0 +1,265 @@
# Change Log
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
<a name="8.1.0"></a>
# [8.1.0](https://github.com/yargs/yargs-parser/compare/v8.0.0...v8.1.0) (2017-12-20)
### Bug Fixes
* allow null config values ([#108](https://github.com/yargs/yargs-parser/issues/108)) ([d8b14f9](https://github.com/yargs/yargs-parser/commit/d8b14f9))
* ensure consistent parsing of dot-notation arguments ([#102](https://github.com/yargs/yargs-parser/issues/102)) ([c9bd79c](https://github.com/yargs/yargs-parser/commit/c9bd79c))
* implement [@antoniom](https://github.com/antoniom)'s fix for camel-case expansion ([3087e1d](https://github.com/yargs/yargs-parser/commit/3087e1d))
* only run coercion functions once, despite aliases. ([#76](https://github.com/yargs/yargs-parser/issues/76)) ([#103](https://github.com/yargs/yargs-parser/issues/103)) ([507aaef](https://github.com/yargs/yargs-parser/commit/507aaef))
* scientific notation circumvented bounds check ([#110](https://github.com/yargs/yargs-parser/issues/110)) ([3571f57](https://github.com/yargs/yargs-parser/commit/3571f57))
* tokenizer should ignore spaces at the beginning of the argString ([#106](https://github.com/yargs/yargs-parser/issues/106)) ([f34ead9](https://github.com/yargs/yargs-parser/commit/f34ead9))
### Features
* make combining arrays a configurable option ([#111](https://github.com/yargs/yargs-parser/issues/111)) ([c8bf536](https://github.com/yargs/yargs-parser/commit/c8bf536))
* merge array from arguments with array from config ([#83](https://github.com/yargs/yargs-parser/issues/83)) ([806ddd6](https://github.com/yargs/yargs-parser/commit/806ddd6))
<a name="8.0.0"></a>
# [8.0.0](https://github.com/yargs/yargs-parser/compare/v7.0.0...v8.0.0) (2017-10-05)
### Bug Fixes
* Ignore multiple spaces between arguments. ([#100](https://github.com/yargs/yargs-parser/issues/100)) ([d137227](https://github.com/yargs/yargs-parser/commit/d137227))
### Features
* allow configuration of prefix for boolean negation ([#94](https://github.com/yargs/yargs-parser/issues/94)) ([00bde7d](https://github.com/yargs/yargs-parser/commit/00bde7d))
* reworking how numbers are parsed ([#104](https://github.com/yargs/yargs-parser/issues/104)) ([fba00eb](https://github.com/yargs/yargs-parser/commit/fba00eb))
### BREAKING CHANGES
* strings that fail `Number.isSafeInteger()` are no longer coerced into numbers.
<a name="7.0.0"></a>
# [7.0.0](https://github.com/yargs/yargs-parser/compare/v6.0.1...v7.0.0) (2017-05-02)
### Chores
* revert populate-- logic ([#91](https://github.com/yargs/yargs-parser/issues/91)) ([6003e6d](https://github.com/yargs/yargs-parser/commit/6003e6d))
### BREAKING CHANGES
* populate-- now defaults to false.
<a name="6.0.1"></a>
## [6.0.1](https://github.com/yargs/yargs-parser/compare/v6.0.0...v6.0.1) (2017-05-01)
### Bug Fixes
* default '--' to undefined when not provided; this is closer to the array API ([#90](https://github.com/yargs/yargs-parser/issues/90)) ([4e739cc](https://github.com/yargs/yargs-parser/commit/4e739cc))
<a name="6.0.0"></a>
# [6.0.0](https://github.com/yargs/yargs-parser/compare/v4.2.1...v6.0.0) (2017-05-01)
### Bug Fixes
* environment variables should take precedence over config file ([#81](https://github.com/yargs/yargs-parser/issues/81)) ([76cee1f](https://github.com/yargs/yargs-parser/commit/76cee1f))
* parsing hints should apply for dot notation keys ([#86](https://github.com/yargs/yargs-parser/issues/86)) ([3e47d62](https://github.com/yargs/yargs-parser/commit/3e47d62))
### Chores
* upgrade to newest version of camelcase ([#87](https://github.com/yargs/yargs-parser/issues/87)) ([f1903aa](https://github.com/yargs/yargs-parser/commit/f1903aa))
### Features
* add -- option which allows arguments after the -- flag to be returned separated from positional arguments ([#84](https://github.com/yargs/yargs-parser/issues/84)) ([2572ca8](https://github.com/yargs/yargs-parser/commit/2572ca8))
* when parsing stops, we now populate "--" by default ([#88](https://github.com/yargs/yargs-parser/issues/88)) ([cd666db](https://github.com/yargs/yargs-parser/commit/cd666db))
### BREAKING CHANGES
* rather than placing arguments in "_", when parsing is stopped via "--"; we now populate an array called "--" by default.
* camelcase now requires Node 4+.
* environment variables will now override config files (args, env, config-file, config-object)
<a name="5.0.0"></a>
# [5.0.0](https://github.com/yargs/yargs-parser/compare/v4.2.1...v5.0.0) (2017-02-18)
### Bug Fixes
* environment variables should take precedence over config file ([#81](https://github.com/yargs/yargs-parser/issues/81)) ([76cee1f](https://github.com/yargs/yargs-parser/commit/76cee1f))
### BREAKING CHANGES
* environment variables will now override config files (args, env, config-file, config-object)
<a name="4.2.1"></a>
## [4.2.1](https://github.com/yargs/yargs-parser/compare/v4.2.0...v4.2.1) (2017-01-02)
### Bug Fixes
* flatten/duplicate regression ([#75](https://github.com/yargs/yargs-parser/issues/75)) ([68d68a0](https://github.com/yargs/yargs-parser/commit/68d68a0))
<a name="4.2.0"></a>
# [4.2.0](https://github.com/yargs/yargs-parser/compare/v4.1.0...v4.2.0) (2016-12-01)
### Bug Fixes
* inner objects in configs had their keys appended to top-level key when dot-notation was disabled ([#72](https://github.com/yargs/yargs-parser/issues/72)) ([0b1b5f9](https://github.com/yargs/yargs-parser/commit/0b1b5f9))
### Features
* allow multiple arrays to be provided, rather than always combining ([#71](https://github.com/yargs/yargs-parser/issues/71)) ([0f0fb2d](https://github.com/yargs/yargs-parser/commit/0f0fb2d))
<a name="4.1.0"></a>
# [4.1.0](https://github.com/yargs/yargs-parser/compare/v4.0.2...v4.1.0) (2016-11-07)
### Features
* apply coercions to default options ([#65](https://github.com/yargs/yargs-parser/issues/65)) ([c79052b](https://github.com/yargs/yargs-parser/commit/c79052b))
* handle dot notation boolean options ([#63](https://github.com/yargs/yargs-parser/issues/63)) ([02c3545](https://github.com/yargs/yargs-parser/commit/02c3545))
<a name="4.0.2"></a>
## [4.0.2](https://github.com/yargs/yargs-parser/compare/v4.0.1...v4.0.2) (2016-09-30)
### Bug Fixes
* whoops, let's make the assign not change the Object key order ([29d069a](https://github.com/yargs/yargs-parser/commit/29d069a))
<a name="4.0.1"></a>
## [4.0.1](https://github.com/yargs/yargs-parser/compare/v4.0.0...v4.0.1) (2016-09-30)
### Bug Fixes
* lodash.assign was deprecated ([#59](https://github.com/yargs/yargs-parser/issues/59)) ([5e7eb11](https://github.com/yargs/yargs-parser/commit/5e7eb11))
<a name="4.0.0"></a>
# [4.0.0](https://github.com/yargs/yargs-parser/compare/v3.2.0...v4.0.0) (2016-09-26)
### Bug Fixes
* coerce should be applied to the final objects and arrays created ([#57](https://github.com/yargs/yargs-parser/issues/57)) ([4ca69da](https://github.com/yargs/yargs-parser/commit/4ca69da))
### BREAKING CHANGES
* coerce is no longer applied to individual arguments in an implicit array.
<a name="3.2.0"></a>
# [3.2.0](https://github.com/yargs/yargs-parser/compare/v3.1.0...v3.2.0) (2016-08-13)
### Features
* coerce full array instead of each element ([#51](https://github.com/yargs/yargs-parser/issues/51)) ([cc4dc56](https://github.com/yargs/yargs-parser/commit/cc4dc56))
<a name="3.1.0"></a>
# [3.1.0](https://github.com/yargs/yargs-parser/compare/v3.0.0...v3.1.0) (2016-08-09)
### Bug Fixes
* address pkgConf parsing bug outlined in [#37](https://github.com/yargs/yargs-parser/issues/37) ([#45](https://github.com/yargs/yargs-parser/issues/45)) ([be76ee6](https://github.com/yargs/yargs-parser/commit/be76ee6))
* better parsing of negative values ([#44](https://github.com/yargs/yargs-parser/issues/44)) ([2e43692](https://github.com/yargs/yargs-parser/commit/2e43692))
* check aliases when guessing defaults for arguments fixes [#41](https://github.com/yargs/yargs-parser/issues/41) ([#43](https://github.com/yargs/yargs-parser/issues/43)) ([f3e4616](https://github.com/yargs/yargs-parser/commit/f3e4616))
### Features
* added coerce option, for providing specialized argument parsing ([#42](https://github.com/yargs/yargs-parser/issues/42)) ([7b49cd2](https://github.com/yargs/yargs-parser/commit/7b49cd2))
<a name="3.0.0"></a>
# [3.0.0](https://github.com/yargs/yargs-parser/compare/v2.4.1...v3.0.0) (2016-08-07)
### Bug Fixes
* parsing issue with numeric character in group of options ([#19](https://github.com/yargs/yargs-parser/issues/19)) ([f743236](https://github.com/yargs/yargs-parser/commit/f743236))
* upgraded lodash.assign ([5d7fdf4](https://github.com/yargs/yargs-parser/commit/5d7fdf4))
### BREAKING CHANGES
* subtle change to how values are parsed in a group of single-character arguments.
* _first released in 3.1.0, better handling of negative values should be considered a breaking change._
<a name="2.4.1"></a>
## [2.4.1](https://github.com/yargs/yargs-parser/compare/v2.4.0...v2.4.1) (2016-07-16)
### Bug Fixes
* **count:** do not increment a default value ([#39](https://github.com/yargs/yargs-parser/issues/39)) ([b04a189](https://github.com/yargs/yargs-parser/commit/b04a189))
<a name="2.4.0"></a>
# [2.4.0](https://github.com/yargs/yargs-parser/compare/v2.3.0...v2.4.0) (2016-04-11)
### Features
* **environment:** Support nested options in environment variables ([#26](https://github.com/yargs/yargs-parser/issues/26)) thanks [@elas7](https://github.com/elas7) \o/ ([020778b](https://github.com/yargs/yargs-parser/commit/020778b))
<a name="2.3.0"></a>
# [2.3.0](https://github.com/yargs/yargs-parser/compare/v2.2.0...v2.3.0) (2016-04-09)
### Bug Fixes
* **boolean:** fix for boolean options with non boolean defaults (#20) ([2dbe86b](https://github.com/yargs/yargs-parser/commit/2dbe86b)), closes [(#20](https://github.com/(/issues/20)
* **package:** remove tests from tarball ([0353c0d](https://github.com/yargs/yargs-parser/commit/0353c0d))
* **parsing:** handle calling short option with an empty string as the next value. ([a867165](https://github.com/yargs/yargs-parser/commit/a867165))
* boolean flag when next value contains the strings 'true' or 'false'. ([69941a6](https://github.com/yargs/yargs-parser/commit/69941a6))
* update dependencies; add standard-version bin for next release (#24) ([822d9d5](https://github.com/yargs/yargs-parser/commit/822d9d5))
### Features
* **configuration:** Allow to pass configuration objects to yargs-parser ([0780900](https://github.com/yargs/yargs-parser/commit/0780900))
* **normalize:** allow normalize to work with arrays ([e0eaa1a](https://github.com/yargs/yargs-parser/commit/e0eaa1a))

View File

@@ -0,0 +1,14 @@
Copyright (c) 2016, 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.

308
node_modules/jest/node_modules/yargs-parser/README.md generated vendored Normal file
View File

@@ -0,0 +1,308 @@
# yargs-parser
[![Build Status](https://travis-ci.org/yargs/yargs-parser.png)](https://travis-ci.org/yargs/yargs-parser)
[![Coverage Status](https://coveralls.io/repos/yargs/yargs-parser/badge.svg?branch=)](https://coveralls.io/r/yargs/yargs-parser?branch=master)
[![NPM version](https://img.shields.io/npm/v/yargs-parser.svg)](https://www.npmjs.com/package/yargs-parser)
[![Windows Tests](https://img.shields.io/appveyor/ci/bcoe/yargs-parser/master.svg?label=Windows%20Tests)](https://ci.appveyor.com/project/bcoe/yargs-parser)
[![Standard Version](https://img.shields.io/badge/release-standard%20version-brightgreen.svg)](https://github.com/conventional-changelog/standard-version)
The mighty option parser used by [yargs](https://github.com/yargs/yargs).
visit the [yargs website](http://yargs.js.org/) for more examples, and thorough usage instructions.
<img width="250" src="https://raw.githubusercontent.com/yargs/yargs-parser/master/yargs-logo.png">
## Example
```sh
npm i yargs-parser --save
```
```js
var argv = require('yargs-parser')(process.argv.slice(2))
console.log(argv)
```
```sh
node example.js --foo=33 --bar hello
{ _: [], foo: 33, bar: 'hello' }
```
_or parse a string!_
```js
var argv = require('./')('--foo=99 --bar=33')
console.log(argv)
```
```sh
{ _: [], foo: 99, bar: 33 }
```
Convert an array of mixed types before passing to `yargs-parser`:
```js
var parse = require('yargs-parser')
parse(['-f', 11, '--zoom', 55].join(' ')) // <-- array to string
parse(['-f', 11, '--zoom', 55].map(String)) // <-- array of strings
```
## API
### require('yargs-parser')(args, opts={})
Parses command line arguments returning a simple mapping of keys and values.
**expects:**
* `args`: a string or array of strings representing the options to parse.
* `opts`: provide a set of hints indicating how `args` should be parsed:
* `opts.alias`: an object representing the set of aliases for a key: `{alias: {foo: ['f']}}`.
* `opts.array`: indicate that keys should be parsed as an array: `{array: ['foo', 'bar']}`.
* `opts.boolean`: arguments should be parsed as booleans: `{boolean: ['x', 'y']}`.
* `opts.config`: indicate a key that represents a path to a configuration file (this file will be loaded and parsed).
* `opts.coerce`: provide a custom synchronous function that returns a coerced value from the argument provided
(or throws an error), e.g. `{coerce: {foo: function (arg) {return modifiedArg}}}`.
* `opts.count`: indicate a key that should be used as a counter, e.g., `-vvv` = `{v: 3}`.
* `opts.default`: provide default values for keys: `{default: {x: 33, y: 'hello world!'}}`.
* `opts.envPrefix`: environment variables (`process.env`) with the prefix provided should be parsed.
* `opts.narg`: specify that a key requires `n` arguments: `{narg: {x: 2}}`.
* `opts.normalize`: `path.normalize()` will be applied to values set to this key.
* `opts.string`: keys should be treated as strings (even if they resemble a number `-x 33`).
* `opts.configuration`: provide configuration options to the yargs-parser (see: [configuration](#configuration)).
* `opts.number`: keys should be treated as numbers.
* `opts['--']`: arguments after the end-of-options flag `--` will be set to the `argv.['--']` array instead of being set to the `argv._` array.
**returns:**
* `obj`: an object representing the parsed value of `args`
* `key/value`: key value pairs for each argument and their aliases.
* `_`: an array representing the positional arguments.
* [optional] `--`: an array with arguments after the end-of-options flag `--`.
### require('yargs-parser').detailed(args, opts={})
Parses a command line string, returning detailed information required by the
yargs engine.
**expects:**
* `args`: a string or array of strings representing options to parse.
* `opts`: provide a set of hints indicating how `args`, inputs are identical to `require('yargs-parser')(args, opts={})`.
**returns:**
* `argv`: an object representing the parsed value of `args`
* `key/value`: key value pairs for each argument and their aliases.
* `_`: an array representing the positional arguments.
* `error`: populated with an error object if an exception occurred during parsing.
* `aliases`: the inferred list of aliases built by combining lists in `opts.alias`.
* `newAliases`: any new aliases added via camel-case expansion.
* `configuration`: the configuration loaded from the `yargs` stanza in package.json.
<a name="configuration"></a>
### Configuration
The yargs-parser applies several automated transformations on the keys provided
in `args`. These features can be turned on and off using the `configuration` field
of `opts`.
```js
var parsed = parser(['--no-dice'], {
configuration: {
'boolean-negation': false
}
})
```
### short option groups
* default: `true`.
* key: `short-option-groups`.
Should a group of short-options be treated as boolean flags?
```sh
node example.js -abc
{ _: [], a: true, b: true, c: true }
```
_if disabled:_
```sh
node example.js -abc
{ _: [], abc: true }
```
### camel-case expansion
* default: `true`.
* key: `camel-case-expansion`.
Should hyphenated arguments be expanded into camel-case aliases?
```sh
node example.js --foo-bar
{ _: [], 'foo-bar': true, fooBar: true }
```
_if disabled:_
```sh
node example.js --foo-bar
{ _: [], 'foo-bar': true }
```
### dot-notation
* default: `true`
* key: `dot-notation`
Should keys that contain `.` be treated as objects?
```sh
node example.js --foo.bar
{ _: [], foo: { bar: true } }
```
_if disabled:_
```sh
node example.js --foo.bar
{ _: [], "foo.bar": true }
```
### parse numbers
* default: `true`
* key: `parse-numbers`
Should keys that look like numbers be treated as such?
```sh
node example.js --foo=99.3
{ _: [], foo: 99.3 }
```
_if disabled:_
```sh
node example.js --foo=99.3
{ _: [], foo: "99.3" }
```
### boolean negation
* default: `true`
* key: `boolean-negation`
Should variables prefixed with `--no` be treated as negations?
```sh
node example.js --no-foo
{ _: [], foo: false }
```
_if disabled:_
```sh
node example.js --no-foo
{ _: [], "no-foo": true }
```
### combine arrays
* default: `false`
* key: `combine-arrays`
Should arrays be combined when provided by both command line arguments and
a configuration file.
### duplicate arguments array
* default: `true`
* key: `duplicate-arguments-array`
Should arguments be coerced into an array when duplicated:
```sh
node example.js -x 1 -x 2
{ _: [], x: [1, 2] }
```
_if disabled:_
```sh
node example.js -x 1 -x 2
{ _: [], x: 2 }
```
### flatten duplicate arrays
* default: `true`
* key: `flatten-duplicate-arrays`
Should array arguments be coerced into a single array when duplicated:
```sh
node example.js -x 1 2 -x 3 4
{ _: [], x: [1, 2, 3, 4] }
```
_if disabled:_
```sh
node example.js -x 1 2 -x 3 4
{ _: [], x: [[1, 2], [3, 4]] }
```
### negation prefix
* default: `no-`
* key: `negation-prefix`
The prefix to use for negated boolean variables.
```sh
node example.js --no-foo
{ _: [], foo: false }
```
_if set to `quux`:_
```sh
node example.js --quuxfoo
{ _: [], foo: false }
```
### populate --
* default: `false`.
* key: `populate--`
Should unparsed flags be stored in `--` or `_`.
_If disabled:_
```sh
node example.js a -b -- x y
{ _: [ 'a', 'x', 'y' ], b: true }
```
_If enabled:_
```sh
node example.js a -b -- x y
{ _: [ 'a' ], '--': [ 'x', 'y' ], b: true }
```
## Special Thanks
The yargs project evolves from optimist and minimist. It owes its
existence to a lot of James Halliday's hard work. Thanks [substack](https://github.com/substack) **beep** **boop** \o/
## License
ISC

Some files were not shown because too many files have changed in this diff Show More