Add node modules and compiled JavaScript from main (#57)

Co-authored-by: Oliver King <oking3@uncc.edu>
This commit is contained in:
github-actions[bot] 2022-06-21 12:18:30 -04:00 committed by GitHub
parent d893f27da9
commit 7f7e5ba5ea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6750 changed files with 1745644 additions and 10860 deletions

21
node_modules/@jest/console/LICENSE generated vendored Normal file
View file

@ -0,0 +1,21 @@
MIT License
Copyright (c) Facebook, Inc. and its affiliates.
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.

34
node_modules/@jest/console/build/BufferedConsole.d.ts generated vendored Normal file
View file

@ -0,0 +1,34 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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.
*/
import { Console } from 'console';
import type { ConsoleBuffer, LogMessage, LogType } from './types';
export default class BufferedConsole extends Console {
private _buffer;
private _counters;
private _timers;
private _groupDepth;
constructor();
static write(buffer: ConsoleBuffer, type: LogType, message: LogMessage, level?: number | null): ConsoleBuffer;
private _log;
assert(value: unknown, message?: string | Error): void;
count(label?: string): void;
countReset(label?: string): void;
debug(firstArg: unknown, ...rest: Array<unknown>): void;
dir(firstArg: unknown, ...rest: Array<unknown>): void;
dirxml(firstArg: unknown, ...rest: Array<unknown>): void;
error(firstArg: unknown, ...rest: Array<unknown>): void;
group(title?: string, ...rest: Array<unknown>): void;
groupCollapsed(title?: string, ...rest: Array<unknown>): void;
groupEnd(): void;
info(firstArg: unknown, ...rest: Array<unknown>): void;
log(firstArg: unknown, ...rest: Array<unknown>): void;
time(label?: string): void;
timeEnd(label?: string): void;
timeLog(label?: string, ...data: Array<unknown>): void;
warn(firstArg: unknown, ...rest: Array<unknown>): void;
getBuffer(): ConsoleBuffer | undefined;
}

260
node_modules/@jest/console/build/BufferedConsole.js generated vendored Normal file
View file

@ -0,0 +1,260 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = void 0;
function _assert() {
const data = _interopRequireDefault(require('assert'));
_assert = function () {
return data;
};
return data;
}
function _console() {
const data = require('console');
_console = function () {
return data;
};
return data;
}
function _util() {
const data = require('util');
_util = function () {
return data;
};
return data;
}
function _chalk() {
const data = _interopRequireDefault(require('chalk'));
_chalk = function () {
return data;
};
return data;
}
function _jestUtil() {
const data = require('jest-util');
_jestUtil = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
class BufferedConsole extends _console().Console {
constructor() {
const buffer = [];
super({
write: message => {
BufferedConsole.write(buffer, 'log', message, null);
return true;
}
});
_defineProperty(this, '_buffer', void 0);
_defineProperty(this, '_counters', void 0);
_defineProperty(this, '_timers', void 0);
_defineProperty(this, '_groupDepth', void 0);
this._buffer = buffer;
this._counters = {};
this._timers = {};
this._groupDepth = 0;
}
static write(buffer, type, message, level) {
const stackLevel = level != null ? level : 2;
const rawStack = new (_jestUtil().ErrorWithStack)(
undefined,
BufferedConsole.write
).stack;
invariant(rawStack, 'always have a stack trace');
const origin = rawStack
.split('\n')
.slice(stackLevel)
.filter(Boolean)
.join('\n');
buffer.push({
message,
origin,
type
});
return buffer;
}
_log(type, message) {
BufferedConsole.write(
this._buffer,
type,
' '.repeat(this._groupDepth) + message,
3
);
}
assert(value, message) {
try {
(0, _assert().default)(value, message);
} catch (error) {
this._log('assert', error.toString());
}
}
count(label = 'default') {
if (!this._counters[label]) {
this._counters[label] = 0;
}
this._log(
'count',
(0, _util().format)(`${label}: ${++this._counters[label]}`)
);
}
countReset(label = 'default') {
this._counters[label] = 0;
}
debug(firstArg, ...rest) {
this._log('debug', (0, _util().format)(firstArg, ...rest));
}
dir(firstArg, ...rest) {
this._log('dir', (0, _util().format)(firstArg, ...rest));
}
dirxml(firstArg, ...rest) {
this._log('dirxml', (0, _util().format)(firstArg, ...rest));
}
error(firstArg, ...rest) {
this._log('error', (0, _util().format)(firstArg, ...rest));
}
group(title, ...rest) {
this._groupDepth++;
if (title || rest.length > 0) {
this._log(
'group',
_chalk().default.bold((0, _util().format)(title, ...rest))
);
}
}
groupCollapsed(title, ...rest) {
this._groupDepth++;
if (title || rest.length > 0) {
this._log(
'groupCollapsed',
_chalk().default.bold((0, _util().format)(title, ...rest))
);
}
}
groupEnd() {
if (this._groupDepth > 0) {
this._groupDepth--;
}
}
info(firstArg, ...rest) {
this._log('info', (0, _util().format)(firstArg, ...rest));
}
log(firstArg, ...rest) {
this._log('log', (0, _util().format)(firstArg, ...rest));
}
time(label = 'default') {
if (this._timers[label]) {
return;
}
this._timers[label] = new Date();
}
timeEnd(label = 'default') {
const startTime = this._timers[label];
if (startTime) {
const endTime = new Date();
const time = endTime.getTime() - startTime.getTime();
this._log(
'time',
(0, _util().format)(`${label}: ${(0, _jestUtil().formatTime)(time)}`)
);
delete this._timers[label];
}
}
timeLog(label = 'default', ...data) {
const startTime = this._timers[label];
if (startTime) {
const endTime = new Date();
const time = endTime.getTime() - startTime.getTime();
this._log(
'time',
(0, _util().format)(
`${label}: ${(0, _jestUtil().formatTime)(time)}`,
...data
)
);
}
}
warn(firstArg, ...rest) {
this._log('warn', (0, _util().format)(firstArg, ...rest));
}
getBuffer() {
return this._buffer.length ? this._buffer : undefined;
}
}
exports.default = BufferedConsole;
function invariant(condition, message) {
if (!condition) {
throw new Error(message);
}
}

39
node_modules/@jest/console/build/CustomConsole.d.ts generated vendored Normal file
View file

@ -0,0 +1,39 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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.
*/
/// <reference types="node" />
import { Console } from 'console';
import type { LogMessage, LogType } from './types';
declare type Formatter = (type: LogType, message: LogMessage) => string;
export default class CustomConsole extends Console {
private _stdout;
private _stderr;
private _formatBuffer;
private _counters;
private _timers;
private _groupDepth;
constructor(stdout: NodeJS.WriteStream, stderr: NodeJS.WriteStream, formatBuffer?: Formatter);
private _log;
private _logError;
assert(value: unknown, message?: string | Error): asserts value;
count(label?: string): void;
countReset(label?: string): void;
debug(firstArg: unknown, ...args: Array<unknown>): void;
dir(firstArg: unknown, ...args: Array<unknown>): void;
dirxml(firstArg: unknown, ...args: Array<unknown>): void;
error(firstArg: unknown, ...args: Array<unknown>): void;
group(title?: string, ...args: Array<unknown>): void;
groupCollapsed(title?: string, ...args: Array<unknown>): void;
groupEnd(): void;
info(firstArg: unknown, ...args: Array<unknown>): void;
log(firstArg: unknown, ...args: Array<unknown>): void;
time(label?: string): void;
timeEnd(label?: string): void;
timeLog(label?: string, ...data: Array<unknown>): void;
warn(firstArg: unknown, ...args: Array<unknown>): void;
getBuffer(): undefined;
}
export {};

239
node_modules/@jest/console/build/CustomConsole.js generated vendored Normal file
View file

@ -0,0 +1,239 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = void 0;
function _assert() {
const data = _interopRequireDefault(require('assert'));
_assert = function () {
return data;
};
return data;
}
function _util() {
const data = require('util');
_util = function () {
return data;
};
return data;
}
function _console() {
const data = require('console');
_console = function () {
return data;
};
return data;
}
function _chalk() {
const data = _interopRequireDefault(require('chalk'));
_chalk = function () {
return data;
};
return data;
}
function _jestUtil() {
const data = require('jest-util');
_jestUtil = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
class CustomConsole extends _console().Console {
constructor(stdout, stderr, formatBuffer = (_type, message) => message) {
super(stdout, stderr);
_defineProperty(this, '_stdout', void 0);
_defineProperty(this, '_stderr', void 0);
_defineProperty(this, '_formatBuffer', void 0);
_defineProperty(this, '_counters', void 0);
_defineProperty(this, '_timers', void 0);
_defineProperty(this, '_groupDepth', void 0);
this._stdout = stdout;
this._stderr = stderr;
this._formatBuffer = formatBuffer;
this._counters = {};
this._timers = {};
this._groupDepth = 0;
}
_log(type, message) {
(0, _jestUtil().clearLine)(this._stdout);
super.log(
this._formatBuffer(type, ' '.repeat(this._groupDepth) + message)
);
}
_logError(type, message) {
(0, _jestUtil().clearLine)(this._stderr);
super.error(
this._formatBuffer(type, ' '.repeat(this._groupDepth) + message)
);
}
assert(value, message) {
try {
(0, _assert().default)(value, message);
} catch (error) {
this._logError('assert', error.toString());
}
}
count(label = 'default') {
if (!this._counters[label]) {
this._counters[label] = 0;
}
this._log(
'count',
(0, _util().format)(`${label}: ${++this._counters[label]}`)
);
}
countReset(label = 'default') {
this._counters[label] = 0;
}
debug(firstArg, ...args) {
this._log('debug', (0, _util().format)(firstArg, ...args));
}
dir(firstArg, ...args) {
this._log('dir', (0, _util().format)(firstArg, ...args));
}
dirxml(firstArg, ...args) {
this._log('dirxml', (0, _util().format)(firstArg, ...args));
}
error(firstArg, ...args) {
this._logError('error', (0, _util().format)(firstArg, ...args));
}
group(title, ...args) {
this._groupDepth++;
if (title || args.length > 0) {
this._log(
'group',
_chalk().default.bold((0, _util().format)(title, ...args))
);
}
}
groupCollapsed(title, ...args) {
this._groupDepth++;
if (title || args.length > 0) {
this._log(
'groupCollapsed',
_chalk().default.bold((0, _util().format)(title, ...args))
);
}
}
groupEnd() {
if (this._groupDepth > 0) {
this._groupDepth--;
}
}
info(firstArg, ...args) {
this._log('info', (0, _util().format)(firstArg, ...args));
}
log(firstArg, ...args) {
this._log('log', (0, _util().format)(firstArg, ...args));
}
time(label = 'default') {
if (this._timers[label]) {
return;
}
this._timers[label] = new Date();
}
timeEnd(label = 'default') {
const startTime = this._timers[label];
if (startTime) {
const endTime = new Date().getTime();
const time = endTime - startTime.getTime();
this._log(
'time',
(0, _util().format)(`${label}: ${(0, _jestUtil().formatTime)(time)}`)
);
delete this._timers[label];
}
}
timeLog(label = 'default', ...data) {
const startTime = this._timers[label];
if (startTime) {
const endTime = new Date();
const time = endTime.getTime() - startTime.getTime();
this._log(
'time',
(0, _util().format)(
`${label}: ${(0, _jestUtil().formatTime)(time)}`,
...data
)
);
}
}
warn(firstArg, ...args) {
this._logError('warn', (0, _util().format)(firstArg, ...args));
}
getBuffer() {
return undefined;
}
}
exports.default = CustomConsole;

23
node_modules/@jest/console/build/NullConsole.d.ts generated vendored Normal file
View file

@ -0,0 +1,23 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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.
*/
import CustomConsole from './CustomConsole';
export default class NullConsole extends CustomConsole {
assert(): void;
debug(): void;
dir(): void;
error(): void;
info(): void;
log(): void;
time(): void;
timeEnd(): void;
timeLog(): void;
trace(): void;
warn(): void;
group(): void;
groupCollapsed(): void;
groupEnd(): void;
}

50
node_modules/@jest/console/build/NullConsole.js generated vendored Normal file
View file

@ -0,0 +1,50 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = void 0;
var _CustomConsole = _interopRequireDefault(require('./CustomConsole'));
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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 NullConsole extends _CustomConsole.default {
assert() {}
debug() {}
dir() {}
error() {}
info() {}
log() {}
time() {}
timeEnd() {}
timeLog() {}
trace() {}
warn() {}
group() {}
groupCollapsed() {}
groupEnd() {}
}
exports.default = NullConsole;

11
node_modules/@jest/console/build/getConsoleOutput.d.ts generated vendored Normal file
View file

@ -0,0 +1,11 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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.
*/
import { StackTraceConfig } from 'jest-message-util';
import type { Config } from '@jest/types';
import type { ConsoleBuffer } from './types';
declare const _default: (root: string, verbose: boolean, buffer: ConsoleBuffer, config?: StackTraceConfig, globalConfig?: Config.GlobalConfig | undefined) => string;
export default _default;

112
node_modules/@jest/console/build/getConsoleOutput.js generated vendored Normal file
View file

@ -0,0 +1,112 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = void 0;
function _chalk() {
const data = _interopRequireDefault(require('chalk'));
_chalk = function () {
return data;
};
return data;
}
function _jestMessageUtil() {
const data = require('jest-message-util');
_jestMessageUtil = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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 _default = (
root,
verbose,
buffer, // TODO: make mandatory and take Config.ProjectConfig in 27
config = {
rootDir: root,
testMatch: []
},
globalConfig
) => {
const TITLE_INDENT = verbose ? ' ' : ' ';
const CONSOLE_INDENT = TITLE_INDENT + ' ';
const logEntries = buffer.reduce((output, {type, message, origin}) => {
message = message
.split(/\n/)
.map(line => CONSOLE_INDENT + line)
.join('\n');
let typeMessage = 'console.' + type;
let noStackTrace = true;
let noCodeFrame = true;
if (type === 'warn') {
var _globalConfig$noStack;
message = _chalk().default.yellow(message);
typeMessage = _chalk().default.yellow(typeMessage);
noStackTrace =
(_globalConfig$noStack =
globalConfig === null || globalConfig === void 0
? void 0
: globalConfig.noStackTrace) !== null &&
_globalConfig$noStack !== void 0
? _globalConfig$noStack
: false;
noCodeFrame = false;
} else if (type === 'error') {
var _globalConfig$noStack2;
message = _chalk().default.red(message);
typeMessage = _chalk().default.red(typeMessage);
noStackTrace =
(_globalConfig$noStack2 =
globalConfig === null || globalConfig === void 0
? void 0
: globalConfig.noStackTrace) !== null &&
_globalConfig$noStack2 !== void 0
? _globalConfig$noStack2
: false;
noCodeFrame = false;
}
const options = {
noCodeFrame,
noStackTrace
};
const formattedStackTrace = (0, _jestMessageUtil().formatStackTrace)(
origin,
config,
options
);
return (
output +
TITLE_INDENT +
_chalk().default.dim(typeMessage) +
'\n' +
message.trimRight() +
'\n' +
_chalk().default.dim(formattedStackTrace.trimRight()) +
'\n\n'
);
}, '');
return logEntries.trimRight() + '\n';
};
exports.default = _default;

11
node_modules/@jest/console/build/index.d.ts generated vendored Normal file
View file

@ -0,0 +1,11 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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.
*/
export { default as BufferedConsole } from './BufferedConsole';
export { default as CustomConsole } from './CustomConsole';
export { default as NullConsole } from './NullConsole';
export { default as getConsoleOutput } from './getConsoleOutput';
export type { ConsoleBuffer, LogMessage, LogType } from './types';

41
node_modules/@jest/console/build/index.js generated vendored Normal file
View file

@ -0,0 +1,41 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
Object.defineProperty(exports, 'BufferedConsole', {
enumerable: true,
get: function () {
return _BufferedConsole.default;
}
});
Object.defineProperty(exports, 'CustomConsole', {
enumerable: true,
get: function () {
return _CustomConsole.default;
}
});
Object.defineProperty(exports, 'NullConsole', {
enumerable: true,
get: function () {
return _NullConsole.default;
}
});
Object.defineProperty(exports, 'getConsoleOutput', {
enumerable: true,
get: function () {
return _getConsoleOutput.default;
}
});
var _BufferedConsole = _interopRequireDefault(require('./BufferedConsole'));
var _CustomConsole = _interopRequireDefault(require('./CustomConsole'));
var _NullConsole = _interopRequireDefault(require('./NullConsole'));
var _getConsoleOutput = _interopRequireDefault(require('./getConsoleOutput'));
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}

20
node_modules/@jest/console/build/types.d.ts generated vendored Normal file
View file

@ -0,0 +1,20 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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.
*/
export declare type LogMessage = string;
export declare type LogEntry = {
message: LogMessage;
origin: string;
type: LogType;
};
export declare type LogCounters = {
[label: string]: number;
};
export declare type LogTimers = {
[label: string]: Date;
};
export declare type LogType = 'assert' | 'count' | 'debug' | 'dir' | 'dirxml' | 'error' | 'group' | 'groupCollapsed' | 'info' | 'log' | 'time' | 'warn';
export declare type ConsoleBuffer = Array<LogEntry>;

1
node_modules/@jest/console/build/types.js generated vendored Normal file
View file

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

30
node_modules/@jest/console/package.json generated vendored Normal file
View file

@ -0,0 +1,30 @@
{
"name": "@jest/console",
"version": "26.3.0",
"repository": {
"type": "git",
"url": "https://github.com/facebook/jest.git",
"directory": "packages/jest-console"
},
"license": "MIT",
"main": "build/index.js",
"types": "build/index.d.ts",
"dependencies": {
"@jest/types": "^26.3.0",
"@types/node": "*",
"chalk": "^4.0.0",
"jest-message-util": "^26.3.0",
"jest-util": "^26.3.0",
"slash": "^3.0.0"
},
"devDependencies": {
"@types/node": "*"
},
"engines": {
"node": ">= 10.14.2"
},
"publishConfig": {
"access": "public"
},
"gitHead": "3a7e06fe855515a848241bb06a6f6e117847443d"
}

21
node_modules/@jest/core/LICENSE generated vendored Normal file
View file

@ -0,0 +1,21 @@
MIT License
Copyright (c) Facebook, Inc. and its affiliates.
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.

3
node_modules/@jest/core/README.md generated vendored Normal file
View file

@ -0,0 +1,3 @@
# @jest/core
Jest is currently working on providing a programmatic API. This is under development, and usage of this package directly is currently not supported.

15
node_modules/@jest/core/build/FailedTestsCache.d.ts generated vendored Normal file
View file

@ -0,0 +1,15 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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.
*/
import type { Test } from 'jest-runner';
import type { Config } from '@jest/types';
import type { TestResult } from '@jest/test-result';
export default class FailedTestsCache {
private _enabledTestsMap?;
filterTests(tests: Array<Test>): Array<Test>;
setTestResults(testResults: Array<TestResult>): void;
updateConfig(globalConfig: Config.GlobalConfig): Config.GlobalConfig;
}

69
node_modules/@jest/core/build/FailedTestsCache.js generated vendored Normal file
View file

@ -0,0 +1,69 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = void 0;
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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 FailedTestsCache {
constructor() {
_defineProperty(this, '_enabledTestsMap', void 0);
}
filterTests(tests) {
const enabledTestsMap = this._enabledTestsMap;
if (!enabledTestsMap) {
return tests;
}
return tests.filter(testResult => 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;
}
const newConfig = {...globalConfig};
newConfig.enabledTestsMap = this._enabledTestsMap;
return Object.freeze(newConfig);
}
}
exports.default = FailedTestsCache;

23
node_modules/@jest/core/build/ReporterDispatcher.d.ts generated vendored Normal file
View file

@ -0,0 +1,23 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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.
*/
import type { AggregatedResult, TestCaseResult, TestResult } from '@jest/test-result';
import type { Test } from 'jest-runner';
import type { Context } from 'jest-runtime';
import type { Reporter, ReporterOnStartOptions } from '@jest/reporters';
export default class ReporterDispatcher {
private _reporters;
constructor();
register(reporter: Reporter): void;
unregister(ReporterClass: Function): void;
onTestFileResult(test: Test, testResult: TestResult, results: AggregatedResult): Promise<void>;
onTestFileStart(test: Test): Promise<void>;
onRunStart(results: AggregatedResult, options: ReporterOnStartOptions): Promise<void>;
onTestCaseResult(test: Test, testCaseResult: TestCaseResult): Promise<void>;
onRunComplete(contexts: Set<Context>, results: AggregatedResult): Promise<void>;
getErrors(): Array<Error>;
hasErrors(): boolean;
}

103
node_modules/@jest/core/build/ReporterDispatcher.js generated vendored Normal file
View file

@ -0,0 +1,103 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = void 0;
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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 ReporterDispatcher {
constructor() {
_defineProperty(this, '_reporters', void 0);
this._reporters = [];
}
register(reporter) {
this._reporters.push(reporter);
}
unregister(ReporterClass) {
this._reporters = this._reporters.filter(
reporter => !(reporter instanceof ReporterClass)
);
}
async onTestFileResult(test, testResult, results) {
for (const reporter of this._reporters) {
if (reporter.onTestFileResult) {
await reporter.onTestFileResult(test, testResult, results);
} else if (reporter.onTestResult) {
await reporter.onTestResult(test, testResult, results);
}
} // Release memory if unused later.
testResult.sourceMaps = undefined;
testResult.coverage = undefined;
testResult.console = undefined;
}
async onTestFileStart(test) {
for (const reporter of this._reporters) {
if (reporter.onTestFileStart) {
await reporter.onTestFileStart(test);
} else if (reporter.onTestStart) {
await reporter.onTestStart(test);
}
}
}
async onRunStart(results, options) {
for (const reporter of this._reporters) {
reporter.onRunStart && (await reporter.onRunStart(results, options));
}
}
async onTestCaseResult(test, testCaseResult) {
for (const reporter of this._reporters) {
if (reporter.onTestCaseResult) {
await reporter.onTestCaseResult(test, testCaseResult);
}
}
}
async onRunComplete(contexts, results) {
for (const reporter of this._reporters) {
if (reporter.onRunComplete) {
await 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;

45
node_modules/@jest/core/build/SearchSource.d.ts generated vendored Normal file
View file

@ -0,0 +1,45 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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.
*/
import type { Context } from 'jest-runtime';
import type { Config } from '@jest/types';
import type { Test } from 'jest-runner';
import type { ChangedFiles } from 'jest-changed-files';
import type { Filter, Stats } from './types';
export declare type SearchResult = {
noSCM?: boolean;
stats?: Stats;
collectCoverageFrom?: Set<string>;
tests: Array<Test>;
total?: number;
};
export declare type TestSelectionConfig = {
input?: string;
findRelatedTests?: boolean;
onlyChanged?: boolean;
paths?: Array<Config.Path>;
shouldTreatInputAsPattern?: boolean;
testPathPattern?: string;
watch?: boolean;
};
export default class SearchSource {
private _context;
private _dependencyResolver;
private _testPathCases;
constructor(context: Context);
private _getOrBuildDependencyResolver;
private _filterTestPathsWithStats;
private _getAllTestPaths;
isTestFilePath(path: Config.Path): boolean;
findMatchingTests(testPathPattern?: string): SearchResult;
findRelatedTests(allPaths: Set<Config.Path>, collectCoverage: boolean): SearchResult;
findTestsByPaths(paths: Array<Config.Path>): SearchResult;
findRelatedTestsFromPattern(paths: Array<Config.Path>, collectCoverage: boolean): SearchResult;
findTestRelatedToChangedFiles(changedFilesInfo: ChangedFiles, collectCoverage: boolean): SearchResult;
private _getTestPaths;
getTestPaths(globalConfig: Config.GlobalConfig, changedFiles: ChangedFiles | undefined, filter?: Filter): Promise<SearchResult>;
findRelatedSourcesFromTestsInChangedFiles(changedFilesInfo: ChangedFiles): Array<string>;
}

480
node_modules/@jest/core/build/SearchSource.js generated vendored Normal file
View file

@ -0,0 +1,480 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = void 0;
function os() {
const data = _interopRequireWildcard(require('os'));
os = function () {
return data;
};
return data;
}
function path() {
const data = _interopRequireWildcard(require('path'));
path = function () {
return data;
};
return data;
}
function _micromatch() {
const data = _interopRequireDefault(require('micromatch'));
_micromatch = function () {
return data;
};
return data;
}
function _jestResolveDependencies() {
const data = _interopRequireDefault(require('jest-resolve-dependencies'));
_jestResolveDependencies = function () {
return data;
};
return data;
}
function _jestRegexUtil() {
const data = require('jest-regex-util');
_jestRegexUtil = function () {
return data;
};
return data;
}
function _jestConfig() {
const data = require('jest-config');
_jestConfig = function () {
return data;
};
return data;
}
function _jestSnapshot() {
const data = require('jest-snapshot');
_jestSnapshot = function () {
return data;
};
return data;
}
function _jestUtil() {
const data = require('jest-util');
_jestUtil = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
function _getRequireWildcardCache() {
if (typeof WeakMap !== 'function') return null;
var cache = new WeakMap();
_getRequireWildcardCache = function () {
return cache;
};
return cache;
}
function _interopRequireWildcard(obj) {
if (obj && obj.__esModule) {
return obj;
}
if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) {
return {default: obj};
}
var cache = _getRequireWildcardCache();
if (cache && cache.has(obj)) {
return cache.get(obj);
}
var newObj = {};
var hasPropertyDescriptor =
Object.defineProperty && Object.getOwnPropertyDescriptor;
for (var key in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = hasPropertyDescriptor
? Object.getOwnPropertyDescriptor(obj, key)
: null;
if (desc && (desc.get || desc.set)) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
newObj.default = obj;
if (cache) {
cache.set(obj, newObj);
}
return newObj;
}
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
const regexToMatcher = testRegex => {
const regexes = testRegex.map(testRegex => new RegExp(testRegex));
return path =>
regexes.some(regex => {
const result = regex.test(path); // prevent stateful regexes from breaking, just in case
regex.lastIndex = 0;
return result;
});
};
const toTests = (context, tests) =>
tests.map(path => ({
context,
duration: undefined,
path
}));
const hasSCM = changedFilesInfo => {
const {repos} = changedFilesInfo; // no SCM (git/hg/...) is found in any of the roots.
const noSCM = Object.values(repos).every(scm => scm.size === 0);
return !noSCM;
};
class SearchSource {
constructor(context) {
_defineProperty(this, '_context', void 0);
_defineProperty(this, '_dependencyResolver', void 0);
_defineProperty(this, '_testPathCases', []);
const {config} = context;
this._context = context;
this._dependencyResolver = null;
const rootPattern = new RegExp(
config.roots
.map(dir => (0, _jestRegexUtil().escapePathForRegex)(dir + path().sep))
.join('|')
);
this._testPathCases.push({
isMatch: path => rootPattern.test(path),
stat: 'roots'
});
if (config.testMatch.length) {
this._testPathCases.push({
isMatch: (0, _jestUtil().globsToMatcher)(config.testMatch),
stat: 'testMatch'
});
}
if (config.testPathIgnorePatterns.length) {
const testIgnorePatternsRegex = new RegExp(
config.testPathIgnorePatterns.join('|')
);
this._testPathCases.push({
isMatch: path => !testIgnorePatternsRegex.test(path),
stat: 'testPathIgnorePatterns'
});
}
if (config.testRegex.length) {
this._testPathCases.push({
isMatch: regexToMatcher(config.testRegex),
stat: 'testRegex'
});
}
}
_getOrBuildDependencyResolver() {
if (!this._dependencyResolver) {
this._dependencyResolver = new (_jestResolveDependencies().default)(
this._context.resolver,
this._context.hasteFS,
(0, _jestSnapshot().buildSnapshotResolver)(this._context.config)
);
}
return this._dependencyResolver;
}
_filterTestPathsWithStats(allPaths, testPathPattern) {
const data = {
stats: {
roots: 0,
testMatch: 0,
testPathIgnorePatterns: 0,
testRegex: 0
},
tests: [],
total: allPaths.length
};
const testCases = Array.from(this._testPathCases); // clone
if (testPathPattern) {
const regex = (0, _jestUtil().testPathPatternToRegExp)(testPathPattern);
testCases.push({
isMatch: path => regex.test(path),
stat: 'testPathPattern'
});
data.stats.testPathPattern = 0;
}
data.tests = allPaths.filter(test => {
let filterResult = true;
for (const {isMatch, stat} of testCases) {
if (isMatch(test.path)) {
data.stats[stat]++;
} else {
filterResult = false;
}
}
return filterResult;
});
return data;
}
_getAllTestPaths(testPathPattern) {
return this._filterTestPathsWithStats(
toTests(this._context, this._context.hasteFS.getAllFiles()),
testPathPattern
);
}
isTestFilePath(path) {
return this._testPathCases.every(testCase => testCase.isMatch(path));
}
findMatchingTests(testPathPattern) {
return this._getAllTestPaths(testPathPattern);
}
findRelatedTests(allPaths, collectCoverage) {
const dependencyResolver = this._getOrBuildDependencyResolver();
if (!collectCoverage) {
return {
tests: toTests(
this._context,
dependencyResolver.resolveInverse(
allPaths,
this.isTestFilePath.bind(this),
{
skipNodeResolution: this._context.config.skipNodeResolution
}
)
)
};
}
const testModulesMap = dependencyResolver.resolveInverseModuleMap(
allPaths,
this.isTestFilePath.bind(this),
{
skipNodeResolution: this._context.config.skipNodeResolution
}
);
const allPathsAbsolute = Array.from(allPaths).map(p => path().resolve(p));
const collectCoverageFrom = new Set();
testModulesMap.forEach(testModule => {
if (!testModule.dependencies) {
return;
}
testModule.dependencies.forEach(p => {
if (!allPathsAbsolute.includes(p)) {
return;
}
const filename = (0, _jestConfig().replaceRootDirInPath)(
this._context.config.rootDir,
p
);
collectCoverageFrom.add(
path().isAbsolute(filename)
? path().relative(this._context.config.rootDir, filename)
: filename
);
});
});
return {
collectCoverageFrom,
tests: toTests(
this._context,
testModulesMap.map(testModule => testModule.file)
)
};
}
findTestsByPaths(paths) {
return {
tests: toTests(
this._context,
paths
.map(p => path().resolve(this._context.config.cwd, p))
.filter(this.isTestFilePath.bind(this))
)
};
}
findRelatedTestsFromPattern(paths, collectCoverage) {
if (Array.isArray(paths) && paths.length) {
const resolvedPaths = paths.map(p =>
path().resolve(this._context.config.cwd, p)
);
return this.findRelatedTests(new Set(resolvedPaths), collectCoverage);
}
return {
tests: []
};
}
findTestRelatedToChangedFiles(changedFilesInfo, collectCoverage) {
if (!hasSCM(changedFilesInfo)) {
return {
noSCM: true,
tests: []
};
}
const {changedFiles} = changedFilesInfo;
return this.findRelatedTests(changedFiles, collectCoverage);
}
_getTestPaths(globalConfig, changedFiles) {
if (globalConfig.onlyChanged) {
if (!changedFiles) {
throw new Error('Changed files must be set when running with -o.');
}
return this.findTestRelatedToChangedFiles(
changedFiles,
globalConfig.collectCoverage
);
}
let paths = globalConfig.nonFlagArgs;
if (globalConfig.findRelatedTests && 'win32' === os().platform()) {
const allFiles = this._context.hasteFS.getAllFiles();
const options = {
nocase: true,
windows: false
};
paths = paths
.map(p => {
const relativePath = path()
.resolve(this._context.config.cwd, p)
.replace(/\\/g, '\\\\');
const match = (0, _micromatch().default)(
allFiles,
relativePath,
options
);
return match[0];
})
.filter(Boolean);
}
if (globalConfig.runTestsByPath && paths && paths.length) {
return this.findTestsByPaths(paths);
} else if (globalConfig.findRelatedTests && paths && paths.length) {
return this.findRelatedTestsFromPattern(
paths,
globalConfig.collectCoverage
);
} else if (globalConfig.testPathPattern != null) {
return this.findMatchingTests(globalConfig.testPathPattern);
} else {
return {
tests: []
};
}
}
async getTestPaths(globalConfig, changedFiles, filter) {
const searchResult = this._getTestPaths(globalConfig, changedFiles);
const filterPath = globalConfig.filter;
if (filter) {
const tests = searchResult.tests;
const filterResult = await filter(tests.map(test => test.path));
if (!Array.isArray(filterResult.filtered)) {
throw new Error(
`Filter ${filterPath} did not return a valid test list`
);
}
const filteredSet = new Set(
filterResult.filtered.map(result => result.test)
);
return {
...searchResult,
tests: tests.filter(test => filteredSet.has(test.path))
};
}
return searchResult;
}
findRelatedSourcesFromTestsInChangedFiles(changedFilesInfo) {
if (!hasSCM(changedFilesInfo)) {
return [];
}
const {changedFiles} = changedFilesInfo;
const dependencyResolver = this._getOrBuildDependencyResolver();
const relatedSourcesSet = new Set();
changedFiles.forEach(filePath => {
if (this.isTestFilePath(filePath)) {
const sourcePaths = dependencyResolver.resolve(filePath, {
skipNodeResolution: this._context.config.skipNodeResolution
});
sourcePaths.forEach(sourcePath => relatedSourcesSet.add(sourcePath));
}
});
return Array.from(relatedSourcesSet);
}
}
exports.default = SearchSource;

View file

@ -0,0 +1,30 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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.
*/
/// <reference types="node" />
import type { AggregatedResult, AssertionLocation } from '@jest/test-result';
export default class SnapshotInteractiveMode {
private _pipe;
private _isActive;
private _updateTestRunnerConfig;
private _testAssertions;
private _countPaths;
private _skippedNum;
constructor(pipe: NodeJS.WritableStream);
isActive(): boolean;
getSkippedNum(): number;
private _clearTestSummary;
private _drawUIProgress;
private _drawUIDoneWithSkipped;
private _drawUIDone;
private _drawUIOverlay;
put(key: string): void;
abort(): void;
restart(): void;
updateWithResults(results: AggregatedResult): void;
private _run;
run(failedSnapshotTestAssertions: Array<AssertionLocation>, onConfigChange: (assertion: AssertionLocation | null, shouldUpdateSnapshot: boolean) => unknown): void;
}

View file

@ -0,0 +1,327 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = void 0;
function _chalk() {
const data = _interopRequireDefault(require('chalk'));
_chalk = function () {
return data;
};
return data;
}
function _ansiEscapes() {
const data = _interopRequireDefault(require('ansi-escapes'));
_ansiEscapes = function () {
return data;
};
return data;
}
function _jestWatcher() {
const data = require('jest-watcher');
_jestWatcher = function () {
return data;
};
return data;
}
function _jestUtil() {
const data = require('jest-util');
_jestUtil = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
const {ARROW, CLEAR} = _jestUtil().specialChars;
class SnapshotInteractiveMode {
constructor(pipe) {
_defineProperty(this, '_pipe', void 0);
_defineProperty(this, '_isActive', void 0);
_defineProperty(this, '_updateTestRunnerConfig', void 0);
_defineProperty(this, '_testAssertions', void 0);
_defineProperty(this, '_countPaths', void 0);
_defineProperty(this, '_skippedNum', void 0);
this._pipe = pipe;
this._isActive = false;
this._skippedNum = 0;
}
isActive() {
return this._isActive;
}
getSkippedNum() {
return this._skippedNum;
}
_clearTestSummary() {
this._pipe.write(_ansiEscapes().default.cursorUp(6));
this._pipe.write(_ansiEscapes().default.eraseDown);
}
_drawUIProgress() {
this._clearTestSummary();
const numPass = this._countPaths - this._testAssertions.length;
const numRemaining = this._countPaths - numPass - this._skippedNum;
let stats = _chalk().default.bold.dim(
(0, _jestUtil().pluralize)('snapshot', numRemaining) + ' remaining'
);
if (numPass) {
stats +=
', ' +
_chalk().default.bold.green(
(0, _jestUtil().pluralize)('snapshot', numPass) + ' updated'
);
}
if (this._skippedNum) {
stats +=
', ' +
_chalk().default.bold.yellow(
(0, _jestUtil().pluralize)('snapshot', this._skippedNum) + ' skipped'
);
}
const messages = [
'\n' + _chalk().default.bold('Interactive Snapshot Progress'),
ARROW + stats,
'\n' + _chalk().default.bold('Watch Usage'),
_chalk().default.dim(ARROW + 'Press ') +
'u' +
_chalk().default.dim(' to update failing snapshots for this test.'),
_chalk().default.dim(ARROW + 'Press ') +
's' +
_chalk().default.dim(' to skip the current test.'),
_chalk().default.dim(ARROW + 'Press ') +
'q' +
_chalk().default.dim(' to quit Interactive Snapshot Mode.'),
_chalk().default.dim(ARROW + 'Press ') +
'Enter' +
_chalk().default.dim(' to trigger a test run.')
];
this._pipe.write(messages.filter(Boolean).join('\n') + '\n');
}
_drawUIDoneWithSkipped() {
this._pipe.write(CLEAR);
const numPass = this._countPaths - this._testAssertions.length;
let stats = _chalk().default.bold.dim(
(0, _jestUtil().pluralize)('snapshot', this._countPaths) + ' reviewed'
);
if (numPass) {
stats +=
', ' +
_chalk().default.bold.green(
(0, _jestUtil().pluralize)('snapshot', numPass) + ' updated'
);
}
if (this._skippedNum) {
stats +=
', ' +
_chalk().default.bold.yellow(
(0, _jestUtil().pluralize)('snapshot', this._skippedNum) + ' skipped'
);
}
const messages = [
'\n' + _chalk().default.bold('Interactive Snapshot Result'),
ARROW + stats,
'\n' + _chalk().default.bold('Watch Usage'),
_chalk().default.dim(ARROW + 'Press ') +
'r' +
_chalk().default.dim(' to restart Interactive Snapshot Mode.'),
_chalk().default.dim(ARROW + 'Press ') +
'q' +
_chalk().default.dim(' to quit Interactive Snapshot Mode.')
];
this._pipe.write(messages.filter(Boolean).join('\n') + '\n');
}
_drawUIDone() {
this._pipe.write(CLEAR);
const numPass = this._countPaths - this._testAssertions.length;
let stats = _chalk().default.bold.dim(
(0, _jestUtil().pluralize)('snapshot', this._countPaths) + ' reviewed'
);
if (numPass) {
stats +=
', ' +
_chalk().default.bold.green(
(0, _jestUtil().pluralize)('snapshot', numPass) + ' updated'
);
}
const messages = [
'\n' + _chalk().default.bold('Interactive Snapshot Result'),
ARROW + stats,
'\n' + _chalk().default.bold('Watch Usage'),
_chalk().default.dim(ARROW + 'Press ') +
'Enter' +
_chalk().default.dim(' to return to watch mode.')
];
this._pipe.write(messages.filter(Boolean).join('\n') + '\n');
}
_drawUIOverlay() {
if (this._testAssertions.length === 0) {
return this._drawUIDone();
}
if (this._testAssertions.length - this._skippedNum === 0) {
return this._drawUIDoneWithSkipped();
}
return this._drawUIProgress();
}
put(key) {
switch (key) {
case 's':
if (this._skippedNum === this._testAssertions.length) break;
this._skippedNum += 1; // move skipped test to the end
this._testAssertions.push(this._testAssertions.shift());
if (this._testAssertions.length - this._skippedNum > 0) {
this._run(false);
} else {
this._drawUIDoneWithSkipped();
}
break;
case 'u':
this._run(true);
break;
case 'q':
case _jestWatcher().KEYS.ESCAPE:
this.abort();
break;
case 'r':
this.restart();
break;
case _jestWatcher().KEYS.ENTER:
if (this._testAssertions.length === 0) {
this.abort();
} else {
this._run(false);
}
break;
default:
break;
}
}
abort() {
this._isActive = false;
this._skippedNum = 0;
this._updateTestRunnerConfig(null, false);
}
restart() {
this._skippedNum = 0;
this._countPaths = this._testAssertions.length;
this._run(false);
}
updateWithResults(results) {
const hasSnapshotFailure = !!results.snapshot.failure;
if (hasSnapshotFailure) {
this._drawUIOverlay();
return;
}
this._testAssertions.shift();
if (this._testAssertions.length - this._skippedNum === 0) {
this._drawUIOverlay();
return;
} // Go to the next test
this._run(false);
}
_run(shouldUpdateSnapshot) {
const testAssertion = this._testAssertions[0];
this._updateTestRunnerConfig(testAssertion, shouldUpdateSnapshot);
}
run(failedSnapshotTestAssertions, onConfigChange) {
if (!failedSnapshotTestAssertions.length) {
return;
}
this._testAssertions = [...failedSnapshotTestAssertions];
this._countPaths = this._testAssertions.length;
this._updateTestRunnerConfig = onConfigChange;
this._isActive = true;
this._run(false);
}
}
exports.default = SnapshotInteractiveMode;

View file

@ -0,0 +1,17 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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.
*/
/// <reference types="node" />
import { PatternPrompt, Prompt, ScrollOptions } from 'jest-watcher';
import type { TestResult } from '@jest/test-result';
export default class TestNamePatternPrompt extends PatternPrompt {
_cachedTestResults: Array<TestResult>;
constructor(pipe: NodeJS.WritableStream, prompt: Prompt);
_onChange(pattern: string, options: ScrollOptions): void;
_printPrompt(pattern: string): void;
_getMatchedTests(pattern: string): Array<string>;
updateCachedTestResults(testResults?: Array<TestResult>): void;
}

86
node_modules/@jest/core/build/TestNamePatternPrompt.js generated vendored Normal file
View file

@ -0,0 +1,86 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = void 0;
function _jestWatcher() {
const data = require('jest-watcher');
_jestWatcher = function () {
return data;
};
return data;
}
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
// TODO: Make underscored props `private`
class TestNamePatternPrompt extends _jestWatcher().PatternPrompt {
constructor(pipe, prompt) {
super(pipe, prompt);
_defineProperty(this, '_cachedTestResults', void 0);
this._entityName = 'tests';
this._cachedTestResults = [];
}
_onChange(pattern, options) {
super._onChange(pattern, options);
this._printPrompt(pattern);
}
_printPrompt(pattern) {
const pipe = this._pipe;
(0, _jestWatcher().printPatternCaret)(pattern, pipe);
(0, _jestWatcher().printRestoredPatternCaret)(
pattern,
this._currentUsageRows,
pipe
);
}
_getMatchedTests(pattern) {
let regex;
try {
regex = new RegExp(pattern, 'i');
} catch {
return [];
}
const matchedTests = [];
this._cachedTestResults.forEach(({testResults}) =>
testResults.forEach(({title}) => {
if (regex.test(title)) {
matchedTests.push(title);
}
})
);
return matchedTests;
}
updateCachedTestResults(testResults = []) {
this._cachedTestResults = testResults;
}
}
exports.default = TestNamePatternPrompt;

View file

@ -0,0 +1,24 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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.
*/
/// <reference types="node" />
import type { Context } from 'jest-runtime';
import type { Test } from 'jest-runner';
import { PatternPrompt, Prompt, ScrollOptions } from 'jest-watcher';
import type SearchSource from './SearchSource';
declare type SearchSources = Array<{
context: Context;
searchSource: SearchSource;
}>;
export default class TestPathPatternPrompt extends PatternPrompt {
_searchSources?: SearchSources;
constructor(pipe: NodeJS.WritableStream, prompt: Prompt);
_onChange(pattern: string, options: ScrollOptions): void;
_printPrompt(pattern: string): void;
_getMatchedTests(pattern: string): Array<Test>;
updateSearchSources(searchSources: SearchSources): void;
}
export {};

81
node_modules/@jest/core/build/TestPathPatternPrompt.js generated vendored Normal file
View file

@ -0,0 +1,81 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = void 0;
function _jestWatcher() {
const data = require('jest-watcher');
_jestWatcher = function () {
return data;
};
return data;
}
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
// TODO: Make underscored props `private`
class TestPathPatternPrompt extends _jestWatcher().PatternPrompt {
constructor(pipe, prompt) {
super(pipe, prompt);
_defineProperty(this, '_searchSources', void 0);
this._entityName = 'filenames';
}
_onChange(pattern, options) {
super._onChange(pattern, options);
this._printPrompt(pattern);
}
_printPrompt(pattern) {
const pipe = this._pipe;
(0, _jestWatcher().printPatternCaret)(pattern, pipe);
(0, _jestWatcher().printRestoredPatternCaret)(
pattern,
this._currentUsageRows,
pipe
);
}
_getMatchedTests(pattern) {
let regex;
try {
regex = new RegExp(pattern, 'i');
} catch {}
let tests = [];
if (regex && this._searchSources) {
this._searchSources.forEach(({searchSource}) => {
tests = tests.concat(searchSource.findMatchingTests(pattern).tests);
});
}
return tests;
}
updateSearchSources(searchSources) {
this._searchSources = searchSources;
}
}
exports.default = TestPathPatternPrompt;

41
node_modules/@jest/core/build/TestScheduler.d.ts generated vendored Normal file
View file

@ -0,0 +1,41 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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.
*/
import type { Config } from '@jest/types';
import TestRunner = require('jest-runner');
import { Reporter } from '@jest/reporters';
import { AggregatedResult } from '@jest/test-result';
import type TestWatcher from './TestWatcher';
export declare type TestSchedulerOptions = {
startRun: (globalConfig: Config.GlobalConfig) => void;
};
export declare type TestSchedulerContext = {
firstRun: boolean;
previousSuccess: boolean;
changedFiles?: Set<Config.Path>;
sourcesRelatedToTestsInChangedFiles?: Set<Config.Path>;
};
export default class TestScheduler {
private readonly _dispatcher;
private readonly _globalConfig;
private readonly _options;
private readonly _context;
constructor(globalConfig: Config.GlobalConfig, options: TestSchedulerOptions, context: TestSchedulerContext);
addReporter(reporter: Reporter): void;
removeReporter(ReporterClass: Function): void;
scheduleTests(tests: Array<TestRunner.Test>, watcher: TestWatcher): Promise<AggregatedResult>;
private _partitionTests;
private _shouldAddDefaultReporters;
private _setupReporters;
private _setupDefaultReporters;
private _addCustomReporters;
/**
* Get properties of a reporter in an object
* to make dealing with them less painful.
*/
private _getReporterProps;
private _bailIfNeeded;
}

560
node_modules/@jest/core/build/TestScheduler.js generated vendored Normal file
View file

@ -0,0 +1,560 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = void 0;
function _chalk() {
const data = _interopRequireDefault(require('chalk'));
_chalk = function () {
return data;
};
return data;
}
function _jestMessageUtil() {
const data = require('jest-message-util');
_jestMessageUtil = function () {
return data;
};
return data;
}
function _jestSnapshot() {
const data = _interopRequireDefault(require('jest-snapshot'));
_jestSnapshot = function () {
return data;
};
return data;
}
function _jestRunner() {
const data = _interopRequireDefault(require('jest-runner'));
_jestRunner = function () {
return data;
};
return data;
}
function _reporters() {
const data = require('@jest/reporters');
_reporters = function () {
return data;
};
return data;
}
function _exit() {
const data = _interopRequireDefault(require('exit'));
_exit = function () {
return data;
};
return data;
}
function _testResult() {
const data = require('@jest/test-result');
_testResult = function () {
return data;
};
return data;
}
function _jestUtil() {
const data = require('jest-util');
_jestUtil = function () {
return data;
};
return data;
}
var _ReporterDispatcher = _interopRequireDefault(
require('./ReporterDispatcher')
);
var _testSchedulerHelper = require('./testSchedulerHelper');
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
// The default jest-runner is required because it is the default test runner
// and required implicitly through the `runner` ProjectConfig option.
_jestRunner().default;
class TestScheduler {
constructor(globalConfig, options, context) {
_defineProperty(this, '_dispatcher', void 0);
_defineProperty(this, '_globalConfig', void 0);
_defineProperty(this, '_options', void 0);
_defineProperty(this, '_context', void 0);
this._dispatcher = new _ReporterDispatcher.default();
this._globalConfig = globalConfig;
this._options = options;
this._context = context;
this._setupReporters();
}
addReporter(reporter) {
this._dispatcher.register(reporter);
}
removeReporter(ReporterClass) {
this._dispatcher.unregister(ReporterClass);
}
async scheduleTests(tests, watcher) {
const onTestFileStart = this._dispatcher.onTestFileStart.bind(
this._dispatcher
);
const timings = [];
const contexts = new Set();
tests.forEach(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
);
const runInBand = (0, _testSchedulerHelper.shouldRunInBand)(
tests,
timings,
this._globalConfig
);
const onResult = async (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 executing a test.
if (testResult.leaks) {
const message =
_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, _testResult().addResult)(aggregatedResults, testResult);
await this._dispatcher.onTestFileResult(
test,
testResult,
aggregatedResults
);
return this._bailIfNeeded(contexts, aggregatedResults, watcher);
};
const onFailure = async (test, error) => {
if (watcher.isInterrupted()) {
return;
}
const testResult = (0, _testResult().buildFailureTestResult)(
test.path,
error
);
testResult.failureMessage = (0, _jestMessageUtil().formatExecError)(
testResult.testExecError,
test.context.config,
this._globalConfig,
test.path
);
(0, _testResult().addResult)(aggregatedResults, testResult);
await this._dispatcher.onTestFileResult(
test,
testResult,
aggregatedResults
);
};
const updateSnapshotState = () => {
contexts.forEach(context => {
const status = _jestSnapshot().default.cleanup(
context.hasteFS,
this._globalConfig.updateSnapshot,
_jestSnapshot().default.buildSnapshotResolver(context.config),
context.config.testPathIgnorePatterns
);
aggregatedResults.snapshot.filesRemoved += status.filesRemoved;
aggregatedResults.snapshot.filesRemovedList = (
aggregatedResults.snapshot.filesRemovedList || []
).concat(status.filesRemovedList);
});
const updateAll = this._globalConfig.updateSnapshot === 'all';
aggregatedResults.snapshot.didUpdate = updateAll;
aggregatedResults.snapshot.failure = !!(
!updateAll &&
(aggregatedResults.snapshot.unchecked ||
aggregatedResults.snapshot.unmatched ||
aggregatedResults.snapshot.filesRemoved)
);
};
await this._dispatcher.onRunStart(aggregatedResults, {
estimatedTime,
showStatus: !runInBand
});
const testRunners = Object.create(null);
const contextsByTestRunner = new WeakMap();
contexts.forEach(context => {
const {config} = context;
if (!testRunners[config.runner]) {
var _this$_context, _this$_context2;
const Runner = require(config.runner);
const runner = new Runner(this._globalConfig, {
changedFiles:
(_this$_context = this._context) === null ||
_this$_context === void 0
? void 0
: _this$_context.changedFiles,
sourcesRelatedToTestsInChangedFiles:
(_this$_context2 = this._context) === null ||
_this$_context2 === void 0
? void 0
: _this$_context2.sourcesRelatedToTestsInChangedFiles
});
testRunners[config.runner] = runner;
contextsByTestRunner.set(runner, context);
}
});
const testsByRunner = this._partitionTests(testRunners, tests);
if (testsByRunner) {
try {
for (const runner of Object.keys(testRunners)) {
const testRunner = testRunners[runner];
const context = contextsByTestRunner.get(testRunner);
invariant(context);
const tests = testsByRunner[runner];
const testRunnerOptions = {
serial: runInBand || Boolean(testRunner.isSerial)
};
/**
* Test runners with event emitters are still not supported
* for third party test runners.
*/
if (testRunner.__PRIVATE_UNSTABLE_API_supportsEventEmitters__) {
const unsubscribes = [
testRunner.on('test-file-start', ([test]) =>
onTestFileStart(test)
),
testRunner.on('test-file-success', ([test, testResult]) =>
onResult(test, testResult)
),
testRunner.on('test-file-failure', ([test, error]) =>
onFailure(test, error)
),
testRunner.on(
'test-case-result',
([testPath, testCaseResult]) => {
const test = {
context,
path: testPath
};
this._dispatcher.onTestCaseResult(test, testCaseResult);
}
)
];
await testRunner.runTests(
tests,
watcher,
undefined,
undefined,
undefined,
testRunnerOptions
);
unsubscribes.forEach(sub => sub());
} else {
await testRunner.runTests(
tests,
watcher,
onTestFileStart,
onResult,
onFailure,
testRunnerOptions
);
}
}
} catch (error) {
if (!watcher.isInterrupted()) {
throw error;
}
}
}
updateSnapshotState();
aggregatedResults.wasInterrupted = watcher.isInterrupted();
await 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(
reporter => this._getReporterProps(reporter).path === 'default'
)
);
}
_setupReporters() {
const {collectCoverage, notify, reporters} = this._globalConfig;
const isDefault = this._shouldAddDefaultReporters(reporters);
if (isDefault) {
this._setupDefaultReporters(collectCoverage);
}
if (!isDefault && collectCoverage) {
var _this$_context3, _this$_context4;
this.addReporter(
new (_reporters().CoverageReporter)(this._globalConfig, {
changedFiles:
(_this$_context3 = this._context) === null ||
_this$_context3 === void 0
? void 0
: _this$_context3.changedFiles,
sourcesRelatedToTestsInChangedFiles:
(_this$_context4 = this._context) === null ||
_this$_context4 === void 0
? void 0
: _this$_context4.sourcesRelatedToTestsInChangedFiles
})
);
}
if (notify) {
this.addReporter(
new (_reporters().NotifyReporter)(
this._globalConfig,
this._options.startRun,
this._context
)
);
}
if (reporters && Array.isArray(reporters)) {
this._addCustomReporters(reporters);
}
}
_setupDefaultReporters(collectCoverage) {
this.addReporter(
this._globalConfig.verbose
? new (_reporters().VerboseReporter)(this._globalConfig)
: new (_reporters().DefaultReporter)(this._globalConfig)
);
if (collectCoverage) {
var _this$_context5, _this$_context6;
this.addReporter(
new (_reporters().CoverageReporter)(this._globalConfig, {
changedFiles:
(_this$_context5 = this._context) === null ||
_this$_context5 === void 0
? void 0
: _this$_context5.changedFiles,
sourcesRelatedToTestsInChangedFiles:
(_this$_context6 = this._context) === null ||
_this$_context6 === void 0
? void 0
: _this$_context6.sourcesRelatedToTestsInChangedFiles
})
);
}
this.addReporter(new (_reporters().SummaryReporter)(this._globalConfig));
}
_addCustomReporters(reporters) {
reporters.forEach(reporter => {
const {options, path} = this._getReporterProps(reporter);
if (path === 'default') return;
try {
// TODO: Use `requireAndTranspileModule` for Jest 26
const Reporter = (0, _jestUtil().interopRequireDefault)(require(path))
.default;
this.addReporter(new Reporter(this._globalConfig, options));
} catch (error) {
error.message =
'An error occurred while adding the reporter at path "' +
_chalk().default.bold(path) +
'".' +
error.message;
throw error;
}
});
}
/**
* 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)) {
const [path, options] = reporter;
return {
options,
path
};
}
throw new Error('Reporter should be either a string or an array');
}
_bailIfNeeded(contexts, aggregatedResults, watcher) {
if (
this._globalConfig.bail !== 0 &&
aggregatedResults.numFailedTests >= this._globalConfig.bail
) {
if (watcher.isWatchMode()) {
watcher.setState({
interrupted: true
});
} else {
const failureExit = () => (0, _exit().default)(1);
return this._dispatcher
.onRunComplete(contexts, aggregatedResults)
.then(failureExit)
.catch(failureExit);
}
}
return Promise.resolve();
}
}
exports.default = TestScheduler;
function invariant(condition, message) {
if (!condition) {
throw new Error(message);
}
}
const createAggregatedResults = numTotalTestSuites => {
const result = (0, _testResult().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);
};

22
node_modules/@jest/core/build/TestWatcher.d.ts generated vendored Normal file
View file

@ -0,0 +1,22 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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.
*/
/// <reference types="node" />
import { EventEmitter } from 'events';
declare type State = {
interrupted: boolean;
};
export default class TestWatcher extends EventEmitter {
state: State;
private _isWatchMode;
constructor({ isWatchMode }: {
isWatchMode: boolean;
});
setState(state: State): void;
isInterrupted(): boolean;
isWatchMode(): boolean;
}
export {};

60
node_modules/@jest/core/build/TestWatcher.js generated vendored Normal file
View file

@ -0,0 +1,60 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = void 0;
function _events() {
const data = require('events');
_events = function () {
return data;
};
return data;
}
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
class TestWatcher extends _events().EventEmitter {
constructor({isWatchMode}) {
super();
_defineProperty(this, 'state', void 0);
_defineProperty(this, '_isWatchMode', void 0);
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;

BIN
node_modules/@jest/core/build/assets/jest_logo.png generated vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

12
node_modules/@jest/core/build/cli/index.d.ts generated vendored Normal file
View file

@ -0,0 +1,12 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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.
*/
import type { Config } from '@jest/types';
import type { AggregatedResult } from '@jest/test-result';
export declare function runCLI(argv: Config.Argv, projects: Array<Config.Path>): Promise<{
results: AggregatedResult;
globalConfig: Config.GlobalConfig;
}>;

495
node_modules/@jest/core/build/cli/index.js generated vendored Normal file
View file

@ -0,0 +1,495 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.runCLI = runCLI;
function _console() {
const data = require('@jest/console');
_console = function () {
return data;
};
return data;
}
function _jestUtil() {
const data = require('jest-util');
_jestUtil = function () {
return data;
};
return data;
}
function _jestConfig() {
const data = require('jest-config');
_jestConfig = function () {
return data;
};
return data;
}
function _jestRuntime() {
const data = _interopRequireDefault(require('jest-runtime'));
_jestRuntime = function () {
return data;
};
return data;
}
function _jestHasteMap() {
const data = _interopRequireDefault(require('jest-haste-map'));
_jestHasteMap = function () {
return data;
};
return data;
}
function _chalk() {
const data = _interopRequireDefault(require('chalk'));
_chalk = function () {
return data;
};
return data;
}
function _rimraf() {
const data = _interopRequireDefault(require('rimraf'));
_rimraf = function () {
return data;
};
return data;
}
function _exit() {
const data = _interopRequireDefault(require('exit'));
_exit = function () {
return data;
};
return data;
}
function _create_context() {
const data = _interopRequireDefault(require('../lib/create_context'));
_create_context = function () {
return data;
};
return data;
}
function _getChangedFilesPromise() {
const data = _interopRequireDefault(require('../getChangedFilesPromise'));
_getChangedFilesPromise = function () {
return data;
};
return data;
}
function _collectHandles() {
const data = require('../collectHandles');
_collectHandles = function () {
return data;
};
return data;
}
function _handle_deprecation_warnings() {
const data = _interopRequireDefault(
require('../lib/handle_deprecation_warnings')
);
_handle_deprecation_warnings = function () {
return data;
};
return data;
}
function _runJest() {
const data = _interopRequireDefault(require('../runJest'));
_runJest = function () {
return data;
};
return data;
}
function _TestWatcher() {
const data = _interopRequireDefault(require('../TestWatcher'));
_TestWatcher = function () {
return data;
};
return data;
}
function _watch() {
const data = _interopRequireDefault(require('../watch'));
_watch = function () {
return data;
};
return data;
}
function _pluralize() {
const data = _interopRequireDefault(require('../pluralize'));
_pluralize = function () {
return data;
};
return data;
}
function _log_debug_messages() {
const data = _interopRequireDefault(require('../lib/log_debug_messages'));
_log_debug_messages = function () {
return data;
};
return data;
}
function _getConfigsOfProjectsToRun() {
const data = _interopRequireDefault(require('../getConfigsOfProjectsToRun'));
_getConfigsOfProjectsToRun = function () {
return data;
};
return data;
}
function _getProjectNamesMissingWarning() {
const data = _interopRequireDefault(
require('../getProjectNamesMissingWarning')
);
_getProjectNamesMissingWarning = function () {
return data;
};
return data;
}
function _getSelectProjectsMessage() {
const data = _interopRequireDefault(require('../getSelectProjectsMessage'));
_getSelectProjectsMessage = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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: preRunMessagePrint} = _jestUtil().preRunMessage;
async function runCLI(argv, projects) {
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;
const {globalConfig, configs, hasDeprecationWarnings} = await (0,
_jestConfig().readConfigs)(argv, projects);
if (argv.debug) {
(0, _log_debug_messages().default)(globalConfig, configs, outputStream);
}
if (argv.showConfig) {
(0, _log_debug_messages().default)(globalConfig, configs, process.stdout);
(0, _exit().default)(0);
}
if (argv.clearCache) {
configs.forEach(config => {
_rimraf().default.sync(config.cacheDirectory);
process.stdout.write(`Cleared ${config.cacheDirectory}\n`);
});
(0, _exit().default)(0);
}
let configsOfProjectsToRun = configs;
if (argv.selectProjects) {
const namesMissingWarning = (0, _getProjectNamesMissingWarning().default)(
configs
);
if (namesMissingWarning) {
outputStream.write(namesMissingWarning);
}
configsOfProjectsToRun = (0, _getConfigsOfProjectsToRun().default)(
argv.selectProjects,
configs
);
outputStream.write(
(0, _getSelectProjectsMessage().default)(configsOfProjectsToRun)
);
}
await _run10000(
globalConfig,
configsOfProjectsToRun,
hasDeprecationWarnings,
outputStream,
r => (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(() => {});
}
if (!results) {
throw new Error(
'AggregatedResult must be present after test run is complete'
);
}
const {openHandles} = results;
if (openHandles && openHandles.length) {
const formatted = (0, _collectHandles().formatHandleErrors)(
openHandles,
configs[0]
);
const openHandlesString = (0, _pluralize().default)(
'open handle',
formatted.length,
's'
);
const message =
_chalk().default.red(
`\nJest has detected the following ${openHandlesString} potentially keeping Jest from exiting:\n\n`
) + formatted.join('\n\n');
console.error(message);
}
return {
globalConfig,
results
};
}
const buildContextsAndHasteMaps = async (
configs,
globalConfig,
outputStream
) => {
const hasteMapInstances = Array(configs.length);
const contexts = await Promise.all(
configs.map(async (config, index) => {
(0, _jestUtil().createDirectory)(config.cacheDirectory);
const hasteMapInstance = _jestRuntime().default.createHasteMap(config, {
console: new (_console().CustomConsole)(outputStream, outputStream),
maxWorkers: Math.max(
1,
Math.floor(globalConfig.maxWorkers / configs.length)
),
resetCache: !config.cache,
watch: globalConfig.watch || globalConfig.watchAll,
watchman: globalConfig.watchman
});
hasteMapInstances[index] = hasteMapInstance;
return (0, _create_context().default)(
config,
await hasteMapInstance.build()
);
})
);
return {
contexts,
hasteMapInstances
};
};
const _run10000 = async (
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, _getChangedFilesPromise().default)(
globalConfig,
configs
); // Filter may need to do an HTTP call or something similar to setup.
// We will wait on an async response from this before using the filter.
let filter;
if (globalConfig.filter && !globalConfig.skipFilter) {
const rawFilter = require(globalConfig.filter);
let filterSetupPromise;
if (rawFilter.setup) {
// Wrap filter setup Promise to avoid "uncaught Promise" error.
// If an error is returned, we surface it in the return value.
filterSetupPromise = (async () => {
try {
await rawFilter.setup();
} catch (err) {
return err;
}
return undefined;
})();
}
filter = async testPaths => {
if (filterSetupPromise) {
// Expect an undefined return value unless there was an error.
const err = await filterSetupPromise;
if (err) {
throw err;
}
}
return rawFilter(testPaths);
};
}
const {contexts, hasteMapInstances} = await buildContextsAndHasteMaps(
configs,
globalConfig,
outputStream
);
globalConfig.watch || globalConfig.watchAll
? await runWatch(
contexts,
configs,
hasDeprecationWarnings,
globalConfig,
outputStream,
hasteMapInstances,
filter
)
: await runWithoutWatch(
globalConfig,
contexts,
outputStream,
onComplete,
changedFilesPromise,
filter
);
};
const runWatch = async (
contexts,
_configs,
hasDeprecationWarnings,
globalConfig,
outputStream,
hasteMapInstances,
filter
) => {
if (hasDeprecationWarnings) {
try {
await (0, _handle_deprecation_warnings().default)(
outputStream,
process.stdin
);
return (0, _watch().default)(
globalConfig,
contexts,
outputStream,
hasteMapInstances,
undefined,
undefined,
filter
);
} catch {
(0, _exit().default)(0);
}
}
return (0, _watch().default)(
globalConfig,
contexts,
outputStream,
hasteMapInstances,
undefined,
undefined,
filter
);
};
const runWithoutWatch = async (
globalConfig,
contexts,
outputStream,
onComplete,
changedFilesPromise,
filter
) => {
const startRun = async () => {
if (!globalConfig.listTests) {
preRunMessagePrint(outputStream);
}
return (0, _runJest().default)({
changedFilesPromise,
contexts,
failedTestsCache: undefined,
filter,
globalConfig,
onComplete,
outputStream,
startRun,
testWatcher: new (_TestWatcher().default)({
isWatchMode: false
})
});
};
return startRun();
};

9
node_modules/@jest/core/build/collectHandles.d.ts generated vendored Normal file
View file

@ -0,0 +1,9 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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.
*/
import type { Config } from '@jest/types';
export default function collectHandles(): () => Array<Error>;
export declare function formatHandleErrors(errors: Array<Error>, config: Config.ProjectConfig): Array<string>;

212
node_modules/@jest/core/build/collectHandles.js generated vendored Normal file
View file

@ -0,0 +1,212 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = collectHandles;
exports.formatHandleErrors = formatHandleErrors;
function asyncHooks() {
const data = _interopRequireWildcard(require('async_hooks'));
asyncHooks = function () {
return data;
};
return data;
}
function _jestMessageUtil() {
const data = require('jest-message-util');
_jestMessageUtil = function () {
return data;
};
return data;
}
function _jestUtil() {
const data = require('jest-util');
_jestUtil = function () {
return data;
};
return data;
}
function _stripAnsi() {
const data = _interopRequireDefault(require('strip-ansi'));
_stripAnsi = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
function _getRequireWildcardCache() {
if (typeof WeakMap !== 'function') return null;
var cache = new WeakMap();
_getRequireWildcardCache = function () {
return cache;
};
return cache;
}
function _interopRequireWildcard(obj) {
if (obj && obj.__esModule) {
return obj;
}
if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) {
return {default: obj};
}
var cache = _getRequireWildcardCache();
if (cache && cache.has(obj)) {
return cache.get(obj);
}
var newObj = {};
var hasPropertyDescriptor =
Object.defineProperty && Object.getOwnPropertyDescriptor;
for (var key in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = hasPropertyDescriptor
? Object.getOwnPropertyDescriptor(obj, key)
: null;
if (desc && (desc.get || desc.set)) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
newObj.default = obj;
if (cache) {
cache.set(obj, newObj);
}
return newObj;
}
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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 stackIsFromUser(stack) {
// Either the test file, or something required by it
if (stack.includes('Runtime.requireModule')) {
return true;
} // jest-jasmine it or describe call
if (stack.includes('asyncJestTest') || stack.includes('asyncJestLifecycle')) {
return true;
} // An async function call from within circus
if (stack.includes('callAsyncCircusFn')) {
// jest-circus it or describe call
return (
stack.includes('_callCircusTest') || stack.includes('_callCircusHook')
);
}
return false;
}
const alwaysActive = () => true; // Inspired by https://github.com/mafintosh/why-is-node-running/blob/master/index.js
// Extracted as we want to format the result ourselves
function collectHandles() {
const activeHandles = new Map();
const hook = asyncHooks().createHook({
destroy(asyncId) {
activeHandles.delete(asyncId);
},
init: function initHook(asyncId, type, _triggerAsyncId, resource) {
if (
type === 'PROMISE' ||
type === 'TIMERWRAP' ||
type === 'ELDHISTOGRAM'
) {
return;
}
const error = new (_jestUtil().ErrorWithStack)(type, initHook);
if (stackIsFromUser(error.stack || '')) {
let isActive;
if (type === 'Timeout' || type === 'Immediate') {
if ('hasRef' in resource) {
// Timer that supports hasRef (Node v11+)
// @ts-expect-error: doesn't exist in v10 typings
isActive = resource.hasRef.bind(resource);
} else {
// Timer that doesn't support hasRef
isActive = alwaysActive;
}
} else {
// Any other async resource
isActive = alwaysActive;
}
activeHandles.set(asyncId, {
error,
isActive
});
}
}
});
hook.enable();
return () => {
hook.disable(); // Get errors for every async resource still referenced at this moment
const result = Array.from(activeHandles.values())
.filter(({isActive}) => isActive())
.map(({error}) => error);
activeHandles.clear();
return result;
};
}
function formatHandleErrors(errors, config) {
const stacks = new Set();
return (
errors
.map(err =>
(0, _jestMessageUtil().formatExecError)(
err,
config,
{
noStackTrace: false
},
undefined,
true
)
) // E.g. timeouts might give multiple traces to the same line of code
// This hairy filtering tries to remove entries with duplicate stack traces
.filter(handle => {
const ansiFree = (0, _stripAnsi().default)(handle);
const match = ansiFree.match(/\s+at(.*)/);
if (!match || match.length < 2) {
return true;
}
const stack = ansiFree.substr(ansiFree.indexOf(match[1])).trim();
if (stacks.has(stack)) {
return false;
}
stacks.add(stack);
return true;
})
);
}

View file

@ -0,0 +1,10 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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.
*/
import type { Config } from '@jest/types';
import { ChangedFilesPromise } from 'jest-changed-files';
declare const _default: (globalConfig: Config.GlobalConfig, configs: Array<Config.ProjectConfig>) => ChangedFilesPromise | undefined;
export default _default;

View file

@ -0,0 +1,79 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = void 0;
function _jestChangedFiles() {
const data = require('jest-changed-files');
_jestChangedFiles = function () {
return data;
};
return data;
}
function _jestMessageUtil() {
const data = require('jest-message-util');
_jestMessageUtil = function () {
return data;
};
return data;
}
function _chalk() {
const data = _interopRequireDefault(require('chalk'));
_chalk = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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 _default = (globalConfig, configs) => {
if (globalConfig.onlyChanged) {
const allRootsForAllProjects = configs.reduce((roots, config) => {
if (config.roots) {
roots.push(...config.roots);
}
return roots;
}, []);
return (0, _jestChangedFiles().getChangedFilesForRoots)(
allRootsForAllProjects,
{
changedSince: globalConfig.changedSince,
lastCommit: globalConfig.lastCommit,
withAncestor: globalConfig.changedFilesWithAncestor
}
).catch(e => {
const message = (0, _jestMessageUtil().formatExecError)(e, configs[0], {
noStackTrace: true
})
.split('\n')
.filter(line => !line.includes('Command failed:'))
.join('\n');
console.error(_chalk().default.red(`\n\n${message}`));
process.exit(1);
});
}
return undefined;
};
exports.default = _default;

View file

@ -0,0 +1,8 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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.
*/
import type { Config } from '@jest/types';
export default function getConfigsOfProjectsToRun(namesOfProjectsToRun: Array<string>, projectConfigs: Array<Config.ProjectConfig>): Array<Config.ProjectConfig>;

View file

@ -0,0 +1,28 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = getConfigsOfProjectsToRun;
var _getProjectDisplayName = _interopRequireDefault(
require('./getProjectDisplayName')
);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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 getConfigsOfProjectsToRun(namesOfProjectsToRun, projectConfigs) {
const setOfProjectsToRun = new Set(namesOfProjectsToRun);
return projectConfigs.filter(config => {
const name = (0, _getProjectDisplayName.default)(config);
return name && setOfProjectsToRun.has(name);
});
}

9
node_modules/@jest/core/build/getNoTestFound.d.ts generated vendored Normal file
View file

@ -0,0 +1,9 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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.
*/
import type { Config } from '@jest/types';
import type { TestRunData } from './types';
export default function getNoTestFound(testRunData: TestRunData, globalConfig: Config.GlobalConfig): string;

63
node_modules/@jest/core/build/getNoTestFound.js generated vendored Normal file
View file

@ -0,0 +1,63 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = getNoTestFound;
function _chalk() {
const data = _interopRequireDefault(require('chalk'));
_chalk = function () {
return data;
};
return data;
}
var _pluralize = _interopRequireDefault(require('./pluralize'));
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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 getNoTestFound(testRunData, globalConfig) {
const testFiles = testRunData.reduce(
(current, testRun) => current + (testRun.matches.total || 0),
0
);
let dataMessage;
if (globalConfig.runTestsByPath) {
dataMessage = `Files: ${globalConfig.nonFlagArgs
.map(p => `"${p}"`)
.join(', ')}`;
} else {
dataMessage = `Pattern: ${_chalk().default.yellow(
globalConfig.testPathPattern
)} - 0 matches`;
}
return (
_chalk().default.bold('No tests found, exiting with code 1') +
'\n' +
'Run with `--passWithNoTests` to exit with code 0' +
'\n' +
`In ${_chalk().default.bold(globalConfig.rootDir)}` +
'\n' +
` ${(0, _pluralize.default)('file', testFiles, 's')} checked across ${(0,
_pluralize.default)(
'project',
testRunData.length,
's'
)}. Run with \`--verbose\` for more details.` +
'\n' +
dataMessage
);
}

View file

@ -0,0 +1,7 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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.
*/
export default function getNoTestFoundFailed(): string;

33
node_modules/@jest/core/build/getNoTestFoundFailed.js generated vendored Normal file
View file

@ -0,0 +1,33 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = getNoTestFoundFailed;
function _chalk() {
const data = _interopRequireDefault(require('chalk'));
_chalk = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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 getNoTestFoundFailed() {
return (
_chalk().default.bold('No failed test found.\n') +
_chalk().default.dim('Press `f` to quit "only failed tests" mode.')
);
}

View file

@ -0,0 +1,7 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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.
*/
export default function getNoTestFoundPassWithNoTests(): string;

View file

@ -0,0 +1,30 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = getNoTestFoundPassWithNoTests;
function _chalk() {
const data = _interopRequireDefault(require('chalk'));
_chalk = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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 getNoTestFoundPassWithNoTests() {
return _chalk().default.bold('No tests found, exiting with code 0');
}

View file

@ -0,0 +1,8 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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.
*/
import type { Config } from '@jest/types';
export default function getNoTestFoundRelatedToChangedFiles(globalConfig: Config.GlobalConfig): string;

View file

@ -0,0 +1,57 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = getNoTestFoundRelatedToChangedFiles;
function _chalk() {
const data = _interopRequireDefault(require('chalk'));
_chalk = function () {
return data;
};
return data;
}
function _jestUtil() {
const data = require('jest-util');
_jestUtil = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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 getNoTestFoundRelatedToChangedFiles(globalConfig) {
const ref = globalConfig.changedSince
? `"${globalConfig.changedSince}"`
: 'last commit';
let msg = _chalk().default.bold(
`No tests found related to files changed since ${ref}.`
);
if (_jestUtil().isInteractive) {
msg += _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,9 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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.
*/
import type { Config } from '@jest/types';
import type { TestRunData } from './types';
export default function getNoTestFoundVerbose(testRunData: TestRunData, globalConfig: Config.GlobalConfig): string;

95
node_modules/@jest/core/build/getNoTestFoundVerbose.js generated vendored Normal file
View file

@ -0,0 +1,95 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = getNoTestFoundVerbose;
function _chalk() {
const data = _interopRequireDefault(require('chalk'));
_chalk = function () {
return data;
};
return data;
}
var _pluralize = _interopRequireDefault(require('./pluralize'));
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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 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 valueAsString = Array.isArray(value)
? value.join(', ')
: String(value);
const matches = (0, _pluralize.default)(
'match',
stats[key] || 0,
'es'
);
return ` ${key}: ${_chalk().default.yellow(
valueAsString
)} - ${matches}`;
}
return null;
})
.filter(line => line)
.join('\n');
return testRun.matches.total
? `In ${_chalk().default.bold(config.rootDir)}\n` +
` ${(0, _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().default.yellow(
globalConfig.testPathPattern
)} - 0 matches`;
}
return (
_chalk().default.bold('No tests found, exiting with code 1') +
'\n' +
'Run with `--passWithNoTests` to exit with code 0' +
'\n' +
individualResults.join('\n') +
'\n' +
dataMessage
);
}

View file

@ -0,0 +1,9 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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.
*/
import type { Config } from '@jest/types';
import type { TestRunData } from './types';
export default function getNoTestsFoundMessage(testRunData: TestRunData, globalConfig: Config.GlobalConfig): string;

View file

@ -0,0 +1,52 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = getNoTestsFoundMessage;
var _getNoTestFound = _interopRequireDefault(require('./getNoTestFound'));
var _getNoTestFoundRelatedToChangedFiles = _interopRequireDefault(
require('./getNoTestFoundRelatedToChangedFiles')
);
var _getNoTestFoundVerbose = _interopRequireDefault(
require('./getNoTestFoundVerbose')
);
var _getNoTestFoundFailed = _interopRequireDefault(
require('./getNoTestFoundFailed')
);
var _getNoTestFoundPassWithNoTests = _interopRequireDefault(
require('./getNoTestFoundPassWithNoTests')
);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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 getNoTestsFoundMessage(testRunData, globalConfig) {
if (globalConfig.onlyFailures) {
return (0, _getNoTestFoundFailed.default)();
}
if (globalConfig.onlyChanged) {
return (0, _getNoTestFoundRelatedToChangedFiles.default)(globalConfig);
}
if (globalConfig.passWithNoTests) {
return (0, _getNoTestFoundPassWithNoTests.default)();
}
return testRunData.length === 1 || globalConfig.verbose
? (0, _getNoTestFoundVerbose.default)(testRunData, globalConfig)
: (0, _getNoTestFound.default)(testRunData, globalConfig);
}

View file

@ -0,0 +1,8 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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.
*/
import type { Config } from '@jest/types';
export default function getProjectDisplayName(projectConfig: Config.ProjectConfig): string | undefined;

22
node_modules/@jest/core/build/getProjectDisplayName.js generated vendored Normal file
View file

@ -0,0 +1,22 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = getProjectDisplayName;
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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 getProjectDisplayName(projectConfig) {
const {displayName} = projectConfig;
if (!displayName) {
return undefined;
}
return displayName.name;
}

View file

@ -0,0 +1,8 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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.
*/
import type { Config } from '@jest/types';
export default function getProjectNamesMissingWarning(projectConfigs: Array<Config.ProjectConfig>): string | undefined;

View file

@ -0,0 +1,49 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = getProjectNamesMissingWarning;
function _chalk() {
const data = _interopRequireDefault(require('chalk'));
_chalk = function () {
return data;
};
return data;
}
var _getProjectDisplayName = _interopRequireDefault(
require('./getProjectDisplayName')
);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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 getProjectNamesMissingWarning(projectConfigs) {
const numberOfProjectsWithoutAName = projectConfigs.filter(
config => !(0, _getProjectDisplayName.default)(config)
).length;
if (numberOfProjectsWithoutAName === 0) {
return undefined;
}
return _chalk().default.yellow(
`You provided values for --selectProjects but ${
numberOfProjectsWithoutAName === 1
? 'a project does not have a name'
: `${numberOfProjectsWithoutAName} projects do not have a name`
}.\n` +
'Set displayName in the config of all projects in order to disable this warning.\n'
);
}

View file

@ -0,0 +1,8 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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.
*/
import type { Config } from '@jest/types';
export default function getSelectProjectsMessage(projectConfigs: Array<Config.ProjectConfig>): string;

View file

@ -0,0 +1,65 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = getSelectProjectsMessage;
function _chalk() {
const data = _interopRequireDefault(require('chalk'));
_chalk = function () {
return data;
};
return data;
}
var _getProjectDisplayName = _interopRequireDefault(
require('./getProjectDisplayName')
);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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 getSelectProjectsMessage(projectConfigs) {
if (projectConfigs.length === 0) {
return getNoSelectionWarning();
}
return getProjectsRunningMessage(projectConfigs);
}
function getNoSelectionWarning() {
return _chalk().default.yellow(
'You provided values for --selectProjects but no projects were found matching the selection.\n'
);
}
function getProjectsRunningMessage(projectConfigs) {
if (projectConfigs.length === 1) {
const name = (0, _getProjectDisplayName.default)(projectConfigs[0]);
return `Running one project: ${_chalk().default.bold(name)}\n`;
}
const projectsList = projectConfigs
.map(getProjectNameListElement)
.sort()
.join('\n');
return `Running ${projectConfigs.length} projects:\n${projectsList}\n`;
}
function getProjectNameListElement(projectConfig) {
const name = (0, _getProjectDisplayName.default)(projectConfig);
const elementContent = name
? _chalk().default.bold(name)
: '<unnamed project>';
return `- ${elementContent}`;
}

11
node_modules/@jest/core/build/jest.d.ts generated vendored Normal file
View file

@ -0,0 +1,11 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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.
*/
export { default as SearchSource } from './SearchSource';
export { default as TestScheduler } from './TestScheduler';
export { default as TestWatcher } from './TestWatcher';
export { runCLI } from './cli';
export { default as getVersion } from './version';

49
node_modules/@jest/core/build/jest.js generated vendored Normal file
View file

@ -0,0 +1,49 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
Object.defineProperty(exports, 'SearchSource', {
enumerable: true,
get: function () {
return _SearchSource.default;
}
});
Object.defineProperty(exports, 'TestScheduler', {
enumerable: true,
get: function () {
return _TestScheduler.default;
}
});
Object.defineProperty(exports, 'TestWatcher', {
enumerable: true,
get: function () {
return _TestWatcher.default;
}
});
Object.defineProperty(exports, 'runCLI', {
enumerable: true,
get: function () {
return _cli.runCLI;
}
});
Object.defineProperty(exports, 'getVersion', {
enumerable: true,
get: function () {
return _version.default;
}
});
var _SearchSource = _interopRequireDefault(require('./SearchSource'));
var _TestScheduler = _interopRequireDefault(require('./TestScheduler'));
var _TestWatcher = _interopRequireDefault(require('./TestWatcher'));
var _cli = require('./cli');
var _version = _interopRequireDefault(require('./version'));
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}

View file

@ -0,0 +1,9 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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.
*/
import type { Config } from '@jest/types';
declare const activeFilters: (globalConfig: Config.GlobalConfig, delimiter?: string) => string;
export default activeFilters;

View file

@ -0,0 +1,54 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = void 0;
function _chalk() {
const data = _interopRequireDefault(require('chalk'));
_chalk = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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 = (globalConfig, delimiter = '\n') => {
const {testNamePattern, testPathPattern} = globalConfig;
if (testNamePattern || testPathPattern) {
const filters = [
testPathPattern
? _chalk().default.dim('filename ') +
_chalk().default.yellow('/' + testPathPattern + '/')
: null,
testNamePattern
? _chalk().default.dim('test name ') +
_chalk().default.yellow('/' + testNamePattern + '/')
: null
]
.filter(f => f)
.join(', ');
const messages = [
'\n' + _chalk().default.bold('Active Filters: ') + filters
];
return messages.filter(message => !!message).join(delimiter);
}
return '';
};
var _default = activeFilters;
exports.default = _default;

11
node_modules/@jest/core/build/lib/create_context.d.ts generated vendored Normal file
View file

@ -0,0 +1,11 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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.
*/
import type { Config } from '@jest/types';
import Runtime = require('jest-runtime');
import type { HasteMapObject } from 'jest-haste-map';
declare const _default: (config: Config.ProjectConfig, { hasteFS, moduleMap }: HasteMapObject) => Runtime.Context;
export default _default;

35
node_modules/@jest/core/build/lib/create_context.js generated vendored Normal file
View file

@ -0,0 +1,35 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = void 0;
function _jestRuntime() {
const data = _interopRequireDefault(require('jest-runtime'));
_jestRuntime = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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 _default = (config, {hasteFS, moduleMap}) => ({
config,
hasteFS,
moduleMap,
resolver: _jestRuntime().default.createResolver(config, moduleMap)
});
exports.default = _default;

View file

@ -0,0 +1,9 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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.
*/
/// <reference types="node" />
declare const _default: (pipe: NodeJS.WriteStream, stdin?: NodeJS.ReadStream) => Promise<void>;
export default _default;

View file

@ -0,0 +1,73 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = void 0;
function _chalk() {
const data = _interopRequireDefault(require('chalk'));
_chalk = function () {
return data;
};
return data;
}
function _jestWatcher() {
const data = require('jest-watcher');
_jestWatcher = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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 _default = (pipe, stdin = process.stdin) =>
new Promise((resolve, reject) => {
if (typeof stdin.setRawMode === 'function') {
const messages = [
_chalk().default.red('There are deprecation warnings.\n'),
_chalk().default.dim(' \u203A Press ') +
'Enter' +
_chalk().default.dim(' to continue.'),
_chalk().default.dim(' \u203A Press ') +
'Esc' +
_chalk().default.dim(' to exit.')
];
pipe.write(messages.join('\n'));
stdin.setRawMode(true);
stdin.resume();
stdin.setEncoding('utf8'); // this is a string since we set encoding above
stdin.on('data', key => {
if (key === _jestWatcher().KEYS.ENTER) {
resolve();
} else if (
[
_jestWatcher().KEYS.ESCAPE,
_jestWatcher().KEYS.CONTROL_C,
_jestWatcher().KEYS.CONTROL_D
].indexOf(key) !== -1
) {
reject();
}
});
} else {
resolve();
}
});
exports.default = _default;

8
node_modules/@jest/core/build/lib/is_valid_path.d.ts generated vendored Normal file
View file

@ -0,0 +1,8 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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.
*/
import type { Config } from '@jest/types';
export default function isValidPath(globalConfig: Config.GlobalConfig, filePath: Config.Path): boolean;

29
node_modules/@jest/core/build/lib/is_valid_path.js generated vendored Normal file
View file

@ -0,0 +1,29 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = isValidPath;
function _jestSnapshot() {
const data = require('jest-snapshot');
_jestSnapshot = function () {
return data;
};
return data;
}
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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, filePath) {
return (
!filePath.includes(globalConfig.coverageDirectory) &&
!(0, _jestSnapshot().isSnapshotPath)(filePath)
);
}

View file

@ -0,0 +1,9 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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.
*/
/// <reference types="node" />
import type { Config } from '@jest/types';
export default function logDebugMessages(globalConfig: Config.GlobalConfig, configs: Array<Config.ProjectConfig> | Config.ProjectConfig, outputStream: NodeJS.WriteStream): void;

View file

@ -0,0 +1,23 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = logDebugMessages;
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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 VERSION = require('../../package.json').version; // if the output here changes, update `getConfig` in e2e/runJest.ts
function logDebugMessages(globalConfig, configs, outputStream) {
const output = {
configs,
globalConfig,
version: VERSION
};
outputStream.write(JSON.stringify(output, null, ' ') + '\n');
}

View file

@ -0,0 +1,11 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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.
*/
import type { Config } from '@jest/types';
import type { AllowedConfigOptions } from 'jest-watcher';
declare type ExtraConfigOptions = Partial<Pick<Config.GlobalConfig, 'noSCM' | 'passWithNoTests'>>;
declare const _default: (globalConfig: Config.GlobalConfig, options?: AllowedConfigOptions & ExtraConfigOptions) => Config.GlobalConfig;
export default _default;

View file

@ -0,0 +1,116 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = void 0;
function _jestRegexUtil() {
const data = require('jest-regex-util');
_jestRegexUtil = function () {
return data;
};
return data;
}
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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 _default = (globalConfig, options = {}) => {
const newConfig = {...globalConfig};
if (options.mode === 'watch') {
newConfig.watch = true;
newConfig.watchAll = false;
} else if (options.mode === 'watchAll') {
newConfig.watch = false;
newConfig.watchAll = true;
}
if (options.testNamePattern !== undefined) {
newConfig.testNamePattern = options.testNamePattern || '';
}
if (options.testPathPattern !== undefined) {
newConfig.testPathPattern =
(0, _jestRegexUtil().replacePathSepForRegex)(options.testPathPattern) ||
'';
}
newConfig.onlyChanged = false;
newConfig.onlyChanged =
!newConfig.watchAll &&
!newConfig.testNamePattern &&
!newConfig.testPathPattern;
if (typeof options.bail === 'boolean') {
newConfig.bail = options.bail ? 1 : 0;
} else if (options.bail !== undefined) {
newConfig.bail = options.bail;
}
if (options.changedSince !== undefined) {
newConfig.changedSince = options.changedSince;
}
if (options.collectCoverage !== undefined) {
newConfig.collectCoverage = options.collectCoverage || false;
}
if (options.collectCoverageFrom !== undefined) {
newConfig.collectCoverageFrom = options.collectCoverageFrom;
}
if (options.collectCoverageOnlyFrom !== undefined) {
newConfig.collectCoverageOnlyFrom = options.collectCoverageOnlyFrom;
}
if (options.coverageDirectory !== undefined) {
newConfig.coverageDirectory = options.coverageDirectory;
}
if (options.coverageReporters !== undefined) {
newConfig.coverageReporters = options.coverageReporters;
}
if (options.noSCM) {
newConfig.noSCM = true;
}
if (options.notify !== undefined) {
newConfig.notify = options.notify || false;
}
if (options.notifyMode !== undefined) {
newConfig.notifyMode = options.notifyMode;
}
if (options.onlyFailures !== undefined) {
newConfig.onlyFailures = options.onlyFailures || false;
}
if (options.passWithNoTests !== undefined) {
newConfig.passWithNoTests = true;
}
if (options.reporters !== undefined) {
newConfig.reporters = options.reporters;
}
if (options.updateSnapshot !== undefined) {
newConfig.updateSnapshot = options.updateSnapshot;
}
if (options.verbose !== undefined) {
newConfig.verbose = options.verbose || false;
}
return Object.freeze(newConfig);
};
exports.default = _default;

View file

@ -0,0 +1,10 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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.
*/
import type { Config } from '@jest/types';
import type { UsageData, WatchPlugin } from 'jest-watcher';
export declare const filterInteractivePlugins: (watchPlugins: Array<WatchPlugin>, globalConfig: Config.GlobalConfig) => Array<WatchPlugin>;
export declare const getSortedUsageRows: (watchPlugins: Array<WatchPlugin>, globalConfig: Config.GlobalConfig) => Array<UsageData>;

View file

@ -0,0 +1,62 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.getSortedUsageRows = exports.filterInteractivePlugins = void 0;
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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 filterInteractivePlugins = (watchPlugins, globalConfig) => {
const usageInfos = watchPlugins.map(
p => p.getUsageInfo && p.getUsageInfo(globalConfig)
);
return watchPlugins.filter((_plugin, i) => {
const usageInfo = usageInfos[i];
if (usageInfo) {
const {key} = usageInfo;
return !usageInfos.slice(i + 1).some(u => !!u && key === u.key);
}
return false;
});
};
exports.filterInteractivePlugins = filterInteractivePlugins;
function notEmpty(value) {
return value != null;
}
const getSortedUsageRows = (watchPlugins, globalConfig) =>
filterInteractivePlugins(watchPlugins, globalConfig)
.sort((a, b) => {
if (a.isInternal && b.isInternal) {
// internal plugins in the order we specify them
return 0;
}
if (a.isInternal !== b.isInternal) {
// external plugins afterwards
return a.isInternal ? -1 : 1;
}
const usageInfoA = a.getUsageInfo && a.getUsageInfo(globalConfig);
const usageInfoB = b.getUsageInfo && b.getUsageInfo(globalConfig);
if (usageInfoA && usageInfoB) {
// external plugins in alphabetical order
return usageInfoA.key.localeCompare(usageInfoB.key);
}
return 0;
})
.map(p => p.getUsageInfo && p.getUsageInfo(globalConfig))
.filter(notEmpty);
exports.getSortedUsageRows = getSortedUsageRows;

18
node_modules/@jest/core/build/plugins/quit.d.ts generated vendored Normal file
View file

@ -0,0 +1,18 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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.
*/
/// <reference types="node" />
import { BaseWatchPlugin, UsageData } from 'jest-watcher';
declare class QuitPlugin extends BaseWatchPlugin {
isInternal: true;
constructor(options: {
stdin: NodeJS.ReadStream;
stdout: NodeJS.WriteStream;
});
run(): Promise<void>;
getUsageInfo(): UsageData;
}
export default QuitPlugin;

60
node_modules/@jest/core/build/plugins/quit.js generated vendored Normal file
View file

@ -0,0 +1,60 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = void 0;
function _jestWatcher() {
const data = require('jest-watcher');
_jestWatcher = function () {
return data;
};
return data;
}
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
class QuitPlugin extends _jestWatcher().BaseWatchPlugin {
constructor(options) {
super(options);
_defineProperty(this, 'isInternal', void 0);
this.isInternal = true;
}
async run() {
if (typeof this._stdin.setRawMode === 'function') {
this._stdin.setRawMode(false);
}
this._stdout.write('\n');
process.exit(0);
}
getUsageInfo() {
return {
key: 'q',
prompt: 'quit watch mode'
};
}
}
var _default = QuitPlugin;
exports.default = _default;

View file

@ -0,0 +1,21 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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.
*/
/// <reference types="node" />
import type { Config } from '@jest/types';
import { BaseWatchPlugin, Prompt, UpdateConfigCallback, UsageData } from 'jest-watcher';
declare class TestNamePatternPlugin extends BaseWatchPlugin {
_prompt: Prompt;
isInternal: true;
constructor(options: {
stdin: NodeJS.ReadStream;
stdout: NodeJS.WriteStream;
});
getUsageInfo(): UsageData;
onKey(key: string): void;
run(globalConfig: Config.GlobalConfig, updateConfigAndRun: UpdateConfigCallback): Promise<void>;
}
export default TestNamePatternPlugin;

View file

@ -0,0 +1,103 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = void 0;
function _jestWatcher() {
const data = require('jest-watcher');
_jestWatcher = function () {
return data;
};
return data;
}
function _TestNamePatternPrompt() {
const data = _interopRequireDefault(require('../TestNamePatternPrompt'));
_TestNamePatternPrompt = function () {
return data;
};
return data;
}
function _active_filters_message() {
const data = _interopRequireDefault(require('../lib/active_filters_message'));
_active_filters_message = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
class TestNamePatternPlugin extends _jestWatcher().BaseWatchPlugin {
constructor(options) {
super(options);
_defineProperty(this, '_prompt', void 0);
_defineProperty(this, 'isInternal', void 0);
this._prompt = new (_jestWatcher().Prompt)();
this.isInternal = true;
}
getUsageInfo() {
return {
key: 't',
prompt: 'filter by a test name regex pattern'
};
}
onKey(key) {
this._prompt.put(key);
}
run(globalConfig, updateConfigAndRun) {
return new Promise((res, rej) => {
const testNamePatternPrompt = new (_TestNamePatternPrompt().default)(
this._stdout,
this._prompt
);
testNamePatternPrompt.run(
value => {
updateConfigAndRun({
mode: 'watch',
testNamePattern: value
});
res();
},
rej,
{
header: (0, _active_filters_message().default)(globalConfig)
}
);
});
}
}
var _default = TestNamePatternPlugin;
exports.default = _default;

View file

@ -0,0 +1,21 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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.
*/
/// <reference types="node" />
import type { Config } from '@jest/types';
import { BaseWatchPlugin, UpdateConfigCallback, UsageData } from 'jest-watcher';
declare class TestPathPatternPlugin extends BaseWatchPlugin {
private _prompt;
isInternal: true;
constructor(options: {
stdin: NodeJS.ReadStream;
stdout: NodeJS.WriteStream;
});
getUsageInfo(): UsageData;
onKey(key: string): void;
run(globalConfig: Config.GlobalConfig, updateConfigAndRun: UpdateConfigCallback): Promise<void>;
}
export default TestPathPatternPlugin;

View file

@ -0,0 +1,103 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = void 0;
function _jestWatcher() {
const data = require('jest-watcher');
_jestWatcher = function () {
return data;
};
return data;
}
function _TestPathPatternPrompt() {
const data = _interopRequireDefault(require('../TestPathPatternPrompt'));
_TestPathPatternPrompt = function () {
return data;
};
return data;
}
function _active_filters_message() {
const data = _interopRequireDefault(require('../lib/active_filters_message'));
_active_filters_message = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
class TestPathPatternPlugin extends _jestWatcher().BaseWatchPlugin {
constructor(options) {
super(options);
_defineProperty(this, '_prompt', void 0);
_defineProperty(this, 'isInternal', void 0);
this._prompt = new (_jestWatcher().Prompt)();
this.isInternal = true;
}
getUsageInfo() {
return {
key: 'p',
prompt: 'filter by a filename regex pattern'
};
}
onKey(key) {
this._prompt.put(key);
}
run(globalConfig, updateConfigAndRun) {
return new Promise((res, rej) => {
const testPathPatternPrompt = new (_TestPathPatternPrompt().default)(
this._stdout,
this._prompt
);
testPathPatternPrompt.run(
value => {
updateConfigAndRun({
mode: 'watch',
testPathPattern: value
});
res();
},
rej,
{
header: (0, _active_filters_message().default)(globalConfig)
}
);
});
}
}
var _default = TestPathPatternPlugin;
exports.default = _default;

View file

@ -0,0 +1,21 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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.
*/
/// <reference types="node" />
import type { Config } from '@jest/types';
import { BaseWatchPlugin, JestHookSubscriber, UpdateConfigCallback, UsageData } from 'jest-watcher';
declare class UpdateSnapshotsPlugin extends BaseWatchPlugin {
private _hasSnapshotFailure;
isInternal: true;
constructor(options: {
stdin: NodeJS.ReadStream;
stdout: NodeJS.WriteStream;
});
run(_globalConfig: Config.GlobalConfig, updateConfigAndRun: UpdateConfigCallback): Promise<boolean>;
apply(hooks: JestHookSubscriber): void;
getUsageInfo(): UsageData | null;
}
export default UpdateSnapshotsPlugin;

View file

@ -0,0 +1,70 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = void 0;
function _jestWatcher() {
const data = require('jest-watcher');
_jestWatcher = function () {
return data;
};
return data;
}
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
class UpdateSnapshotsPlugin extends _jestWatcher().BaseWatchPlugin {
constructor(options) {
super(options);
_defineProperty(this, '_hasSnapshotFailure', void 0);
_defineProperty(this, 'isInternal', void 0);
this.isInternal = true;
this._hasSnapshotFailure = false;
}
run(_globalConfig, updateConfigAndRun) {
updateConfigAndRun({
updateSnapshot: 'all'
});
return Promise.resolve(false);
}
apply(hooks) {
hooks.onTestRunComplete(results => {
this._hasSnapshotFailure = results.snapshot.failure;
});
}
getUsageInfo() {
if (this._hasSnapshotFailure) {
return {
key: 'u',
prompt: 'update failing snapshots'
};
}
return null;
}
}
var _default = UpdateSnapshotsPlugin;
exports.default = _default;

View file

@ -0,0 +1,20 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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.
*/
import type { Config } from '@jest/types';
import type { AggregatedResult, AssertionLocation } from '@jest/test-result';
import { BaseWatchPlugin, JestHookSubscriber, UsageData } from 'jest-watcher';
declare class UpdateSnapshotInteractivePlugin extends BaseWatchPlugin {
private _snapshotInteractiveMode;
private _failedSnapshotTestAssertions;
isInternal: true;
getFailedSnapshotTestAssertions(testResults: AggregatedResult): Array<AssertionLocation>;
apply(hooks: JestHookSubscriber): void;
onKey(key: string): void;
run(_globalConfig: Config.GlobalConfig, updateConfigAndRun: Function): Promise<void>;
getUsageInfo(): UsageData | null;
}
export default UpdateSnapshotInteractivePlugin;

View file

@ -0,0 +1,145 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = void 0;
function _jestWatcher() {
const data = require('jest-watcher');
_jestWatcher = function () {
return data;
};
return data;
}
function _SnapshotInteractiveMode() {
const data = _interopRequireDefault(require('../SnapshotInteractiveMode'));
_SnapshotInteractiveMode = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
class UpdateSnapshotInteractivePlugin extends _jestWatcher().BaseWatchPlugin {
constructor(...args) {
super(...args);
_defineProperty(
this,
'_snapshotInteractiveMode',
new (_SnapshotInteractiveMode().default)(this._stdout)
);
_defineProperty(this, '_failedSnapshotTestAssertions', []);
_defineProperty(this, 'isInternal', true);
}
getFailedSnapshotTestAssertions(testResults) {
const failedTestPaths = [];
if (testResults.numFailedTests === 0 || !testResults.testResults) {
return failedTestPaths;
}
testResults.testResults.forEach(testResult => {
if (testResult.snapshot && testResult.snapshot.unmatched) {
testResult.testResults.forEach(result => {
if (result.status === 'failed') {
failedTestPaths.push({
fullName: result.fullName,
path: testResult.testFilePath
});
}
});
}
});
return failedTestPaths;
}
apply(hooks) {
hooks.onTestRunComplete(results => {
this._failedSnapshotTestAssertions = this.getFailedSnapshotTestAssertions(
results
);
if (this._snapshotInteractiveMode.isActive()) {
this._snapshotInteractiveMode.updateWithResults(results);
}
});
}
onKey(key) {
if (this._snapshotInteractiveMode.isActive()) {
this._snapshotInteractiveMode.put(key);
}
}
run(_globalConfig, updateConfigAndRun) {
if (this._failedSnapshotTestAssertions.length) {
return new Promise(res => {
this._snapshotInteractiveMode.run(
this._failedSnapshotTestAssertions,
(assertion, shouldUpdateSnapshot) => {
updateConfigAndRun({
mode: 'watch',
testNamePattern: assertion ? `^${assertion.fullName}$` : '',
testPathPattern: assertion ? assertion.path : '',
updateSnapshot: shouldUpdateSnapshot ? 'all' : 'none'
});
if (!this._snapshotInteractiveMode.isActive()) {
res();
}
}
);
});
} else {
return Promise.resolve();
}
}
getUsageInfo() {
var _this$_failedSnapshot;
if (
((_this$_failedSnapshot = this._failedSnapshotTestAssertions) === null ||
_this$_failedSnapshot === void 0
? void 0
: _this$_failedSnapshot.length) > 0
) {
return {
key: 'i',
prompt: 'update failing snapshots interactively'
};
}
return null;
}
}
var _default = UpdateSnapshotInteractivePlugin;
exports.default = _default;

7
node_modules/@jest/core/build/pluralize.d.ts generated vendored Normal file
View file

@ -0,0 +1,7 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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.
*/
export default function pluralize(word: string, count: number, ending: string): string;

16
node_modules/@jest/core/build/pluralize.js generated vendored Normal file
View file

@ -0,0 +1,16 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = pluralize;
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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 pluralize(word, count, ending) {
return `${count} ${word}${count === 1 ? '' : ending}`;
}

14
node_modules/@jest/core/build/runGlobalHook.d.ts generated vendored Normal file
View file

@ -0,0 +1,14 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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.
*/
import type { Config } from '@jest/types';
import type { Test } from 'jest-runner';
declare const _default: ({ allTests, globalConfig, moduleName, }: {
allTests: Array<Test>;
globalConfig: Config.GlobalConfig;
moduleName: 'globalSetup' | 'globalTeardown';
}) => Promise<void>;
export default _default;

91
node_modules/@jest/core/build/runGlobalHook.js generated vendored Normal file
View file

@ -0,0 +1,91 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = void 0;
function _pEachSeries() {
const data = _interopRequireDefault(require('p-each-series'));
_pEachSeries = function () {
return data;
};
return data;
}
function _transform() {
const data = require('@jest/transform');
_transform = function () {
return data;
};
return data;
}
function _jestUtil() {
const data = require('jest-util');
_jestUtil = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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 _default = async ({allTests, globalConfig, moduleName}) => {
const globalModulePaths = new Set(
allTests.map(test => test.context.config[moduleName])
);
if (globalConfig[moduleName]) {
globalModulePaths.add(globalConfig[moduleName]);
}
if (globalModulePaths.size > 0) {
await (0, _pEachSeries().default)(
Array.from(globalModulePaths),
async modulePath => {
if (!modulePath) {
return;
}
const correctConfig = allTests.find(
t => t.context.config[moduleName] === modulePath
);
const projectConfig = correctConfig
? correctConfig.context.config // Fallback to first config
: allTests[0].context.config;
const transformer = new (_transform().ScriptTransformer)(projectConfig);
await transformer.requireAndTranspileModule(modulePath, async m => {
const globalModule = (0, _jestUtil().interopRequireDefault)(m)
.default;
if (typeof globalModule !== 'function') {
throw new TypeError(
`${moduleName} file must export a function at ${modulePath}`
);
}
await globalModule(globalConfig);
});
}
);
}
return Promise.resolve();
};
exports.default = _default;

27
node_modules/@jest/core/build/runJest.d.ts generated vendored Normal file
View file

@ -0,0 +1,27 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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.
*/
/// <reference types="node" />
import { JestHookEmitter } from 'jest-watcher';
import type { Context } from 'jest-runtime';
import type { Config } from '@jest/types';
import { AggregatedResult } from '@jest/test-result';
import type { ChangedFilesPromise } from 'jest-changed-files';
import type FailedTestsCache from './FailedTestsCache';
import type TestWatcher from './TestWatcher';
import type { Filter } from './types';
export default function runJest({ contexts, globalConfig, outputStream, testWatcher, jestHooks, startRun, changedFilesPromise, onComplete, failedTestsCache, filter, }: {
globalConfig: Config.GlobalConfig;
contexts: Array<Context>;
outputStream: NodeJS.WriteStream;
testWatcher: TestWatcher;
jestHooks?: JestHookEmitter;
startRun: (globalConfig: Config.GlobalConfig) => void;
changedFilesPromise?: ChangedFilesPromise;
onComplete: (testResults: AggregatedResult) => void;
failedTestsCache?: FailedTestsCache;
filter?: Filter;
}): Promise<void>;

397
node_modules/@jest/core/build/runJest.js generated vendored Normal file
View file

@ -0,0 +1,397 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = runJest;
function path() {
const data = _interopRequireWildcard(require('path'));
path = function () {
return data;
};
return data;
}
function _chalk() {
const data = _interopRequireDefault(require('chalk'));
_chalk = function () {
return data;
};
return data;
}
function _console() {
const data = require('@jest/console');
_console = function () {
return data;
};
return data;
}
function _jestUtil() {
const data = require('jest-util');
_jestUtil = function () {
return data;
};
return data;
}
function _exit() {
const data = _interopRequireDefault(require('exit'));
_exit = function () {
return data;
};
return data;
}
function fs() {
const data = _interopRequireWildcard(require('graceful-fs'));
fs = function () {
return data;
};
return data;
}
function _jestWatcher() {
const data = require('jest-watcher');
_jestWatcher = function () {
return data;
};
return data;
}
function _testResult() {
const data = require('@jest/test-result');
_testResult = function () {
return data;
};
return data;
}
var _getNoTestsFoundMessage = _interopRequireDefault(
require('./getNoTestsFoundMessage')
);
var _runGlobalHook = _interopRequireDefault(require('./runGlobalHook'));
var _SearchSource = _interopRequireDefault(require('./SearchSource'));
var _TestScheduler = _interopRequireDefault(require('./TestScheduler'));
var _collectHandles = _interopRequireDefault(require('./collectHandles'));
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
function _getRequireWildcardCache() {
if (typeof WeakMap !== 'function') return null;
var cache = new WeakMap();
_getRequireWildcardCache = function () {
return cache;
};
return cache;
}
function _interopRequireWildcard(obj) {
if (obj && obj.__esModule) {
return obj;
}
if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) {
return {default: obj};
}
var cache = _getRequireWildcardCache();
if (cache && cache.has(obj)) {
return cache.get(obj);
}
var newObj = {};
var hasPropertyDescriptor =
Object.defineProperty && Object.getOwnPropertyDescriptor;
for (var key in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = hasPropertyDescriptor
? Object.getOwnPropertyDescriptor(obj, key)
: null;
if (desc && (desc.get || desc.set)) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
newObj.default = obj;
if (cache) {
cache.set(obj, newObj);
}
return newObj;
}
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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 getTestPaths = async (
globalConfig,
source,
outputStream,
changedFiles,
jestHooks,
filter
) => {
const data = await source.getTestPaths(globalConfig, changedFiles, filter);
if (!data.tests.length && globalConfig.onlyChanged && data.noSCM) {
new (_console().CustomConsole)(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 = await Promise.all(
data.tests.map(test =>
jestHooks.shouldRunTestSuite({
config: test.context.config,
duration: test.duration,
testPath: test.path
})
)
);
const filteredTests = data.tests.filter((_test, i) => shouldTestArray[i]);
return {...data, allTests: filteredTests.length, tests: filteredTests};
};
const processResults = (runResults, options) => {
const {
outputFile,
json: isJSON,
onComplete,
outputStream,
testResultsProcessor,
collectHandles
} = options;
if (collectHandles) {
runResults.openHandles = collectHandles();
} else {
runResults.openHandles = [];
}
if (testResultsProcessor) {
runResults = require(testResultsProcessor)(runResults);
}
if (isJSON) {
if (outputFile) {
const cwd = (0, _jestUtil().tryRealpath)(process.cwd());
const filePath = path().resolve(cwd, outputFile);
fs().writeFileSync(
filePath,
JSON.stringify((0, _testResult().formatTestResults)(runResults))
);
outputStream.write(
`Test results written to: ${path().relative(cwd, filePath)}\n`
);
} else {
process.stdout.write(
JSON.stringify((0, _testResult().formatTestResults)(runResults))
);
}
}
return onComplete && onComplete(runResults);
};
const testSchedulerContext = {
firstRun: true,
previousSuccess: true
};
async function runJest({
contexts,
globalConfig,
outputStream,
testWatcher,
jestHooks = new (_jestWatcher().JestHook)().getEmitter(),
startRun,
changedFilesPromise,
onComplete,
failedTestsCache,
filter
}) {
const Sequencer = (0, _jestUtil().interopRequireDefault)(
require(globalConfig.testSequencer)
).default;
const sequencer = new Sequencer();
let allTests = [];
if (changedFilesPromise && globalConfig.watch) {
const {repos} = await changedFilesPromise;
const noSCM = Object.keys(repos).every(scm => repos[scm].size === 0);
if (noSCM) {
process.stderr.write(
'\n' +
_chalk().default.bold('--watch') +
' is not supported without git/hg, please use --watchAll ' +
'\n'
);
(0, _exit().default)(1);
}
}
const searchSources = contexts.map(
context => new _SearchSource.default(context)
);
const testRunData = await Promise.all(
contexts.map(async (context, index) => {
const searchSource = searchSources[index];
const matches = await getTestPaths(
globalConfig,
searchSource,
outputStream,
changedFilesPromise && (await changedFilesPromise),
jestHooks,
filter
);
allTests = allTests.concat(matches.tests);
return {
context,
matches
};
})
);
allTests = await sequencer.sort(allTests);
if (globalConfig.listTests) {
const testsPaths = Array.from(new Set(allTests.map(test => test.path)));
if (globalConfig.json) {
console.log(JSON.stringify(testsPaths));
} else {
console.log(testsPaths.join('\n'));
}
onComplete &&
onComplete((0, _testResult().makeEmptyAggregatedTestResult)());
return;
}
if (globalConfig.onlyFailures && failedTestsCache) {
allTests = failedTestsCache.filterTests(allTests);
globalConfig = failedTestsCache.updateConfig(globalConfig);
}
const hasTests = allTests.length > 0;
if (!hasTests) {
const noTestsFoundMessage = (0, _getNoTestsFoundMessage.default)(
testRunData,
globalConfig
);
if (
globalConfig.passWithNoTests ||
globalConfig.findRelatedTests ||
globalConfig.lastCommit ||
globalConfig.onlyChanged
) {
new (_console().CustomConsole)(outputStream, outputStream).log(
noTestsFoundMessage
);
} else {
new (_console().CustomConsole)(outputStream, outputStream).error(
noTestsFoundMessage
);
(0, _exit().default)(1);
}
} else if (
allTests.length === 1 &&
globalConfig.silent !== true &&
globalConfig.verbose !== false
) {
const newConfig = {...globalConfig, verbose: true};
globalConfig = Object.freeze(newConfig);
}
let collectHandles;
if (globalConfig.detectOpenHandles) {
collectHandles = (0, _collectHandles.default)();
}
if (hasTests) {
await (0, _runGlobalHook.default)({
allTests,
globalConfig,
moduleName: 'globalSetup'
});
}
if (changedFilesPromise) {
const changedFilesInfo = await changedFilesPromise;
if (changedFilesInfo.changedFiles) {
testSchedulerContext.changedFiles = changedFilesInfo.changedFiles;
const sourcesRelatedToTestsInChangedFilesArray = contexts
.map((_, index) => {
const searchSource = searchSources[index];
const relatedSourceFromTestsInChangedFiles = searchSource.findRelatedSourcesFromTestsInChangedFiles(
changedFilesInfo
);
return relatedSourceFromTestsInChangedFiles;
})
.reduce((total, paths) => total.concat(paths), []);
testSchedulerContext.sourcesRelatedToTestsInChangedFiles = new Set(
sourcesRelatedToTestsInChangedFilesArray
);
}
}
const results = await new _TestScheduler.default(
globalConfig,
{
startRun
},
testSchedulerContext
).scheduleTests(allTests, testWatcher);
sequencer.cacheResults(allTests, results);
if (hasTests) {
await (0, _runGlobalHook.default)({
allTests,
globalConfig,
moduleName: 'globalTeardown'
});
}
await processResults(results, {
collectHandles,
json: globalConfig.json,
onComplete,
outputFile: globalConfig.outputFile,
outputStream,
testResultsProcessor: globalConfig.testResultsProcessor
});
}

View file

@ -0,0 +1,9 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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.
*/
import type { Config } from '@jest/types';
import type { Test } from 'jest-runner';
export declare function shouldRunInBand(tests: Array<Test>, timings: Array<number>, { detectOpenHandles, maxWorkers, watch, watchAll }: Config.GlobalConfig): boolean;

51
node_modules/@jest/core/build/testSchedulerHelper.js generated vendored Normal file
View file

@ -0,0 +1,51 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.shouldRunInBand = shouldRunInBand;
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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 = 1000;
function shouldRunInBand(
tests,
timings,
{detectOpenHandles, maxWorkers, watch, watchAll}
) {
// detectOpenHandles makes no sense without runInBand, because it cannot detect leaks in workers
if (detectOpenHandles) {
return true;
}
/*
* Run in band if we only have one test or one worker available, unless we
* are using the watch mode, in which case the TTY has to be responsive and
* we cannot schedule anything in the main thread. Same logic applies to
* watchAll.
* Also, 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.
* Finally, the user can provide the runInBand argument in the CLI to
* force running in band.
* https://github.com/facebook/jest/blob/700e0dadb85f5dc8ff5dac6c7e98956690049734/packages/jest-config/src/getMaxWorkers.js#L14-L17
*/
const isWatchMode = watch || watchAll;
const areFastTests = timings.every(timing => timing < SLOW_TEST_TIME);
const oneWorkerOrLess = maxWorkers <= 1;
const oneTestOrLess = tests.length <= 1;
if (isWatchMode) {
return oneWorkerOrLess || (oneTestOrLess && areFastTests);
}
return (
oneWorkerOrLess ||
oneTestOrLess ||
(tests.length <= 20 && timings.length > 0 && areFastTests)
);
}

39
node_modules/@jest/core/build/types.d.ts generated vendored Normal file
View file

@ -0,0 +1,39 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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.
*/
import type { Context } from 'jest-runtime';
import type { Test } from 'jest-runner';
import type { Config } from '@jest/types';
export declare type Stats = {
roots: number;
testMatch: number;
testPathIgnorePatterns: number;
testRegex: number;
testPathPattern?: number;
};
export declare type TestRunData = Array<{
context: Context;
matches: {
allTests: number;
tests: Array<Test>;
total?: number;
stats?: Stats;
};
}>;
export declare type TestPathCases = Array<{
stat: keyof Stats;
isMatch: (path: Config.Path) => boolean;
}>;
export declare type TestPathCasesWithPathPattern = TestPathCases & {
testPathPattern: (path: Config.Path) => boolean;
};
export declare type FilterResult = {
test: string;
message: string;
};
export declare type Filter = (testPaths: Array<string>) => Promise<{
filtered: Array<FilterResult>;
}>;

1
node_modules/@jest/core/build/types.js generated vendored Normal file
View file

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

7
node_modules/@jest/core/build/version.d.ts generated vendored Normal file
View file

@ -0,0 +1,7 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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.
*/
export default function getVersion(): string;

19
node_modules/@jest/core/build/version.js generated vendored Normal file
View file

@ -0,0 +1,19 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = getVersion;
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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.
*/
// Cannot be `import` as it's not under TS root dir
const {version: VERSION} = require('../package.json');
function getVersion() {
return VERSION;
}

13
node_modules/@jest/core/build/watch.d.ts generated vendored Normal file
View file

@ -0,0 +1,13 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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.
*/
/// <reference types="node" />
import HasteMap = require('jest-haste-map');
import type { Context } from 'jest-runtime';
import type { Config } from '@jest/types';
import { JestHook } from 'jest-watcher';
import type { Filter } from './types';
export default function watch(initialGlobalConfig: Config.GlobalConfig, contexts: Array<Context>, outputStream: NodeJS.WriteStream, hasteMapInstances: Array<HasteMap>, stdin?: NodeJS.ReadStream, hooks?: JestHook, filter?: Filter): Promise<void>;

781
node_modules/@jest/core/build/watch.js generated vendored Normal file
View file

@ -0,0 +1,781 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = watch;
function path() {
const data = _interopRequireWildcard(require('path'));
path = function () {
return data;
};
return data;
}
function _ansiEscapes() {
const data = _interopRequireDefault(require('ansi-escapes'));
_ansiEscapes = function () {
return data;
};
return data;
}
function _chalk() {
const data = _interopRequireDefault(require('chalk'));
_chalk = function () {
return data;
};
return data;
}
function _exit() {
const data = _interopRequireDefault(require('exit'));
_exit = function () {
return data;
};
return data;
}
function _slash() {
const data = _interopRequireDefault(require('slash'));
_slash = function () {
return data;
};
return data;
}
function _jestHasteMap() {
const data = _interopRequireDefault(require('jest-haste-map'));
_jestHasteMap = function () {
return data;
};
return data;
}
function _jestMessageUtil() {
const data = require('jest-message-util');
_jestMessageUtil = function () {
return data;
};
return data;
}
function _jestUtil() {
const data = require('jest-util');
_jestUtil = function () {
return data;
};
return data;
}
function _jestValidate() {
const data = require('jest-validate');
_jestValidate = function () {
return data;
};
return data;
}
function _jestResolve() {
const data = _interopRequireDefault(require('jest-resolve'));
_jestResolve = function () {
return data;
};
return data;
}
function _jestWatcher() {
const data = require('jest-watcher');
_jestWatcher = function () {
return data;
};
return data;
}
var _getChangedFilesPromise = _interopRequireDefault(
require('./getChangedFilesPromise')
);
var _is_valid_path = _interopRequireDefault(require('./lib/is_valid_path'));
var _create_context = _interopRequireDefault(require('./lib/create_context'));
var _runJest = _interopRequireDefault(require('./runJest'));
var _update_global_config = _interopRequireDefault(
require('./lib/update_global_config')
);
var _SearchSource = _interopRequireDefault(require('./SearchSource'));
var _TestWatcher = _interopRequireDefault(require('./TestWatcher'));
var _FailedTestsCache = _interopRequireDefault(require('./FailedTestsCache'));
var _test_path_pattern = _interopRequireDefault(
require('./plugins/test_path_pattern')
);
var _test_name_pattern = _interopRequireDefault(
require('./plugins/test_name_pattern')
);
var _update_snapshots = _interopRequireDefault(
require('./plugins/update_snapshots')
);
var _update_snapshots_interactive = _interopRequireDefault(
require('./plugins/update_snapshots_interactive')
);
var _quit = _interopRequireDefault(require('./plugins/quit'));
var _watch_plugins_helpers = require('./lib/watch_plugins_helpers');
var _active_filters_message = _interopRequireDefault(
require('./lib/active_filters_message')
);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
function _getRequireWildcardCache() {
if (typeof WeakMap !== 'function') return null;
var cache = new WeakMap();
_getRequireWildcardCache = function () {
return cache;
};
return cache;
}
function _interopRequireWildcard(obj) {
if (obj && obj.__esModule) {
return obj;
}
if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) {
return {default: obj};
}
var cache = _getRequireWildcardCache();
if (cache && cache.has(obj)) {
return cache.get(obj);
}
var newObj = {};
var hasPropertyDescriptor =
Object.defineProperty && Object.getOwnPropertyDescriptor;
for (var key in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = hasPropertyDescriptor
? Object.getOwnPropertyDescriptor(obj, key)
: null;
if (desc && (desc.get || desc.set)) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
newObj.default = obj;
if (cache) {
cache.set(obj, newObj);
}
return newObj;
}
/**
* Copyright (c) Facebook, Inc. and its affiliates. 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: preRunMessagePrint} = _jestUtil().preRunMessage;
let hasExitListener = false;
const INTERNAL_PLUGINS = [
_test_path_pattern.default,
_test_name_pattern.default,
_update_snapshots.default,
_update_snapshots_interactive.default,
_quit.default
];
const RESERVED_KEY_PLUGINS = new Map([
[
_update_snapshots.default,
{
forbiddenOverwriteMessage: 'updating snapshots',
key: 'u'
}
],
[
_update_snapshots_interactive.default,
{
forbiddenOverwriteMessage: 'updating snapshots interactively',
key: 'i'
}
],
[
_quit.default,
{
forbiddenOverwriteMessage: 'quitting watch mode'
}
]
]);
function watch(
initialGlobalConfig,
contexts,
outputStream,
hasteMapInstances,
stdin = process.stdin,
hooks = new (_jestWatcher().JestHook)(),
filter
) {
// `globalConfig` will be constantly updated and reassigned as a result of
// watch mode interactions.
let globalConfig = initialGlobalConfig;
let activePlugin;
globalConfig = (0, _update_global_config.default)(globalConfig, {
mode: globalConfig.watch ? 'watch' : 'watchAll',
passWithNoTests: true
});
const updateConfigAndRun = ({
bail,
changedSince,
collectCoverage,
collectCoverageFrom,
collectCoverageOnlyFrom,
coverageDirectory,
coverageReporters,
mode,
notify,
notifyMode,
onlyFailures,
reporters,
testNamePattern,
testPathPattern,
updateSnapshot,
verbose
} = {}) => {
const previousUpdateSnapshot = globalConfig.updateSnapshot;
globalConfig = (0, _update_global_config.default)(globalConfig, {
bail,
changedSince,
collectCoverage,
collectCoverageFrom,
collectCoverageOnlyFrom,
coverageDirectory,
coverageReporters,
mode,
notify,
notifyMode,
onlyFailures,
reporters,
testNamePattern,
testPathPattern,
updateSnapshot,
verbose
});
startRun(globalConfig);
globalConfig = (0, _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) {
const watchPluginKeys = new Map();
for (const plugin of watchPlugins) {
const reservedInfo = RESERVED_KEY_PLUGINS.get(plugin.constructor) || {};
const key = reservedInfo.key || getPluginKey(plugin, globalConfig);
if (!key) {
continue;
}
const {forbiddenOverwriteMessage} = reservedInfo;
watchPluginKeys.set(key, {
forbiddenOverwriteMessage,
overwritable: forbiddenOverwriteMessage == null,
plugin
});
}
for (const pluginWithConfig of globalConfig.watchPlugins) {
let plugin;
try {
const ThirdPartyPlugin = require(pluginWithConfig.path);
plugin = new ThirdPartyPlugin({
config: pluginWithConfig.config,
stdin,
stdout: outputStream
});
} catch (error) {
const errorWithContext = new Error(
`Failed to initialize watch plugin "${_chalk().default.bold(
(0, _slash().default)(
path().relative(process.cwd(), pluginWithConfig.path)
)
)}":\n\n${(0, _jestMessageUtil().formatExecError)(
error,
contexts[0].config,
{
noStackTrace: false
}
)}`
);
delete errorWithContext.stack;
return Promise.reject(errorWithContext);
}
checkForConflicts(watchPluginKeys, plugin, globalConfig);
const hookSubscriber = hooks.getSubscriber();
if (plugin.apply) {
plugin.apply(hookSubscriber);
}
watchPlugins.push(plugin);
}
}
const failedTestsCache = new _FailedTestsCache.default();
let searchSources = contexts.map(context => ({
context,
searchSource: new _SearchSource.default(context)
}));
let isRunning = false;
let testWatcher;
let shouldDisplayWatchUsage = true;
let isWatchUsageDisplayed = false;
const emitFileChange = () => {
if (hooks.isUsed('onFileChange')) {
const projects = searchSources.map(({context, searchSource}) => ({
config: context.config,
testPaths: searchSource.findMatchingTests('').tests.map(t => t.path)
}));
hooks.getEmitter().onFileChange({
projects
});
}
};
emitFileChange();
hasteMapInstances.forEach((hasteMapInstance, index) => {
hasteMapInstance.on('change', ({eventsQueue, hasteFS, moduleMap}) => {
const validPaths = eventsQueue.filter(({filePath}) =>
(0, _is_valid_path.default)(globalConfig, filePath)
);
if (validPaths.length) {
const context = (contexts[index] = (0, _create_context.default)(
contexts[index].config,
{
hasteFS,
moduleMap
}
));
activePlugin = null;
searchSources = searchSources.slice();
searchSources[index] = {
context,
searchSource: new _SearchSource.default(context)
};
emitFileChange();
startRun(globalConfig);
}
});
});
if (!hasExitListener) {
hasExitListener = true;
process.on('exit', () => {
if (activePlugin) {
outputStream.write(_ansiEscapes().default.cursorDown());
outputStream.write(_ansiEscapes().default.eraseDown);
}
});
}
const startRun = globalConfig => {
if (isRunning) {
return Promise.resolve(null);
}
testWatcher = new _TestWatcher.default({
isWatchMode: true
});
_jestUtil().isInteractive &&
outputStream.write(_jestUtil().specialChars.CLEAR);
preRunMessagePrint(outputStream);
isRunning = true;
const configs = contexts.map(context => context.config);
const changedFilesPromise = (0, _getChangedFilesPromise.default)(
globalConfig,
configs
); // Clear cache for required modules
_jestResolve().default.clearDefaultResolverCache();
return (0, _runJest.default)({
changedFilesPromise,
contexts,
failedTestsCache,
filter,
globalConfig,
jestHooks: hooks.getEmitter(),
onComplete: results => {
isRunning = false;
hooks.getEmitter().onTestRunComplete(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 _TestWatcher.default({
isWatchMode: true
}); // Do not show any Watch Usage related stuff when running in a
// non-interactive environment
if (_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 // Errors thrown inside `runJest`, e.g. by resolvers, are caught here for
) =>
// continuous watch mode execution. We need to reprint them to the
// terminal and give just a little bit of extra space so they fit below
// `preRunMessagePrint` message nicely.
console.error(
'\n\n' +
(0, _jestMessageUtil().formatExecError)(error, contexts[0].config, {
noStackTrace: false
})
)
);
};
const onKeypress = key => {
if (
key === _jestWatcher().KEYS.CONTROL_C ||
key === _jestWatcher().KEYS.CONTROL_D
) {
if (typeof stdin.setRawMode === 'function') {
stdin.setRawMode(false);
}
outputStream.write('\n');
(0, _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 = (0, _watch_plugins_helpers.getSortedUsageRows)(
watchPlugins,
globalConfig
).map(usage => Number(usage.key).toString(16));
if (
isRunning &&
testWatcher &&
['q', _jestWatcher().KEYS.ENTER, 'a', 'o', 'f']
.concat(pluginKeys)
.includes(key)
) {
testWatcher.setState({
interrupted: true
});
return;
}
const matchingWatchPlugin = (0,
_watch_plugins_helpers.filterInteractivePlugins)(
watchPlugins,
globalConfig
).find(plugin => getPluginKey(plugin, globalConfig) === key);
if (matchingWatchPlugin != null) {
if (isRunning) {
testWatcher.setState({
interrupted: true
});
return;
} // "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 _jestWatcher().KEYS.ENTER:
startRun(globalConfig);
break;
case 'a':
globalConfig = (0, _update_global_config.default)(globalConfig, {
mode: 'watchAll',
testNamePattern: '',
testPathPattern: ''
});
startRun(globalConfig);
break;
case 'c':
updateConfigAndRun({
mode: 'watch',
testNamePattern: '',
testPathPattern: ''
});
break;
case 'f':
globalConfig = (0, _update_global_config.default)(globalConfig, {
onlyFailures: !globalConfig.onlyFailures
});
startRun(globalConfig);
break;
case 'o':
globalConfig = (0, _update_global_config.default)(globalConfig, {
mode: 'watch',
testNamePattern: '',
testPathPattern: ''
});
startRun(globalConfig);
break;
case '?':
break;
case 'w':
if (!shouldDisplayWatchUsage && !isWatchUsageDisplayed) {
outputStream.write(_ansiEscapes().default.cursorUp());
outputStream.write(_ansiEscapes().default.eraseDown);
outputStream.write(usage(globalConfig, watchPlugins));
isWatchUsageDisplayed = true;
shouldDisplayWatchUsage = false;
}
break;
}
};
const onCancelPatternPrompt = () => {
outputStream.write(_ansiEscapes().default.cursorHide);
outputStream.write(_jestUtil().specialChars.CLEAR);
outputStream.write(usage(globalConfig, watchPlugins));
outputStream.write(_ansiEscapes().default.cursorShow);
};
if (typeof stdin.setRawMode === 'function') {
stdin.setRawMode(true);
stdin.resume();
stdin.setEncoding('utf8');
stdin.on('data', onKeypress);
}
startRun(globalConfig);
return Promise.resolve();
}
const checkForConflicts = (watchPluginKeys, plugin, globalConfig) => {
const key = getPluginKey(plugin, globalConfig);
if (!key) {
return;
}
const conflictor = watchPluginKeys.get(key);
if (!conflictor || conflictor.overwritable) {
watchPluginKeys.set(key, {
overwritable: false,
plugin
});
return;
}
let error;
if (conflictor.forbiddenOverwriteMessage) {
error = `
Watch plugin ${_chalk().default.bold.red(
getPluginIdentifier(plugin)
)} attempted to register key ${_chalk().default.bold.red(`<${key}>`)},
that is reserved internally for ${_chalk().default.bold.red(
conflictor.forbiddenOverwriteMessage
)}.
Please change the configuration key for this plugin.`.trim();
} else {
const plugins = [conflictor.plugin, plugin]
.map(p => _chalk().default.bold.red(getPluginIdentifier(p)))
.join(' and ');
error = `
Watch plugins ${plugins} both attempted to register key ${_chalk().default.bold.red(
`<${key}>`
)}.
Please change the key configuration for one of the conflicting plugins to avoid overlap.`.trim();
}
throw new (_jestValidate().ValidationError)(
'Watch plugin configuration error',
error
);
};
const getPluginIdentifier = (
plugin // This breaks as `displayName` is not defined as a static, but since
) =>
// WatchPlugin is an interface, and it is my understanding interface
// static fields are not definable anymore, no idea how to circumvent
// this :-(
// @ts-expect-error: leave `displayName` be.
plugin.constructor.displayName || plugin.constructor.name;
const getPluginKey = (plugin, globalConfig) => {
if (typeof plugin.getUsageInfo === 'function') {
return (
plugin.getUsageInfo(globalConfig) || {
key: null
}
).key;
}
return null;
};
const usage = (globalConfig, watchPlugins, delimiter = '\n') => {
const messages = [
(0, _active_filters_message.default)(globalConfig),
globalConfig.testPathPattern || globalConfig.testNamePattern
? _chalk().default.dim(' \u203A Press ') +
'c' +
_chalk().default.dim(' to clear filters.')
: null,
'\n' + _chalk().default.bold('Watch Usage'),
globalConfig.watch
? _chalk().default.dim(' \u203A Press ') +
'a' +
_chalk().default.dim(' to run all tests.')
: null,
globalConfig.onlyFailures
? _chalk().default.dim(' \u203A Press ') +
'f' +
_chalk().default.dim(' to quit "only failed tests" mode.')
: _chalk().default.dim(' \u203A Press ') +
'f' +
_chalk().default.dim(' to run only failed tests.'),
(globalConfig.watchAll ||
globalConfig.testPathPattern ||
globalConfig.testNamePattern) &&
!globalConfig.noSCM
? _chalk().default.dim(' \u203A Press ') +
'o' +
_chalk().default.dim(' to only run tests related to changed files.')
: null,
...(0, _watch_plugins_helpers.getSortedUsageRows)(
watchPlugins,
globalConfig
).map(
plugin =>
_chalk().default.dim(' \u203A Press') +
' ' +
plugin.key +
' ' +
_chalk().default.dim(`to ${plugin.prompt}.`)
),
_chalk().default.dim(' \u203A Press ') +
'Enter' +
_chalk().default.dim(' to trigger a test run.')
];
return messages.filter(message => !!message).join(delimiter) + '\n';
};
const showToggleUsagePrompt = () =>
'\n' +
_chalk().default.bold('Watch Usage: ') +
_chalk().default.dim('Press ') +
'w' +
_chalk().default.dim(' to show more.');

88
node_modules/@jest/core/package.json generated vendored Normal file
View file

@ -0,0 +1,88 @@
{
"name": "@jest/core",
"description": "Delightful JavaScript Testing.",
"version": "26.4.2",
"main": "build/jest.js",
"types": "build/jest.d.ts",
"dependencies": {
"@jest/console": "^26.3.0",
"@jest/reporters": "^26.4.1",
"@jest/test-result": "^26.3.0",
"@jest/transform": "^26.3.0",
"@jest/types": "^26.3.0",
"@types/node": "*",
"ansi-escapes": "^4.2.1",
"chalk": "^4.0.0",
"exit": "^0.1.2",
"graceful-fs": "^4.2.4",
"jest-changed-files": "^26.3.0",
"jest-config": "^26.4.2",
"jest-haste-map": "^26.3.0",
"jest-message-util": "^26.3.0",
"jest-regex-util": "^26.0.0",
"jest-resolve": "^26.4.0",
"jest-resolve-dependencies": "^26.4.2",
"jest-runner": "^26.4.2",
"jest-runtime": "^26.4.2",
"jest-snapshot": "^26.4.2",
"jest-util": "^26.3.0",
"jest-validate": "^26.4.2",
"jest-watcher": "^26.3.0",
"micromatch": "^4.0.2",
"p-each-series": "^2.1.0",
"rimraf": "^3.0.0",
"slash": "^3.0.0",
"strip-ansi": "^6.0.0"
},
"devDependencies": {
"@jest/test-sequencer": "^26.4.2",
"@types/exit": "^0.1.30",
"@types/graceful-fs": "^4.1.2",
"@types/micromatch": "^4.0.0",
"@types/rimraf": "^3.0.0",
"jest-snapshot-serializer-raw": "^1.1.0"
},
"engines": {
"node": ">= 10.14.2"
},
"repository": {
"type": "git",
"url": "https://github.com/facebook/jest",
"directory": "packages/jest-core"
},
"bugs": {
"url": "https://github.com/facebook/jest/issues"
},
"homepage": "https://jestjs.io/",
"license": "MIT",
"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"
],
"publishConfig": {
"access": "public"
},
"gitHead": "2586a798260886c28b6d28256cdfe354e039d5d1"
}

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