yeet
This commit is contained in:
21
node_modules/@jest/console/LICENSE
generated
vendored
Normal file
21
node_modules/@jest/console/LICENSE
generated
vendored
Normal 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.
|
33
node_modules/@jest/console/build/BufferedConsole.d.ts
generated
vendored
Normal file
33
node_modules/@jest/console/build/BufferedConsole.d.ts
generated
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
/**
|
||||
* 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;
|
||||
warn(firstArg: unknown, ...rest: Array<unknown>): void;
|
||||
getBuffer(): ConsoleBuffer | undefined;
|
||||
}
|
240
node_modules/@jest/console/build/BufferedConsole.js
generated
vendored
Normal file
240
node_modules/@jest/console/build/BufferedConsole.js
generated
vendored
Normal file
@ -0,0 +1,240 @@
|
||||
'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}: ${time}ms`));
|
||||
|
||||
delete this._timers[label];
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
38
node_modules/@jest/console/build/CustomConsole.d.ts
generated
vendored
Normal file
38
node_modules/@jest/console/build/CustomConsole.d.ts
generated
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
/**
|
||||
* 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): void;
|
||||
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;
|
||||
warn(firstArg: unknown, ...args: Array<unknown>): void;
|
||||
getBuffer(): undefined;
|
||||
}
|
||||
export {};
|
219
node_modules/@jest/console/build/CustomConsole.js
generated
vendored
Normal file
219
node_modules/@jest/console/build/CustomConsole.js
generated
vendored
Normal file
@ -0,0 +1,219 @@
|
||||
'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)
|
||||
);
|
||||
} // use `asserts` when https://github.com/sandersn/downlevel-dts/issues/32 is fixed
|
||||
|
||||
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}: ${time}ms`));
|
||||
|
||||
delete this._timers[label];
|
||||
}
|
||||
}
|
||||
|
||||
warn(firstArg, ...args) {
|
||||
this._logError('warn', (0, _util().format)(firstArg, ...args));
|
||||
}
|
||||
|
||||
getBuffer() {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
exports.default = CustomConsole;
|
22
node_modules/@jest/console/build/NullConsole.d.ts
generated
vendored
Normal file
22
node_modules/@jest/console/build/NullConsole.d.ts
generated
vendored
Normal 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.
|
||||
*/
|
||||
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;
|
||||
trace(): void;
|
||||
warn(): void;
|
||||
group(): void;
|
||||
groupCollapsed(): void;
|
||||
groupEnd(): void;
|
||||
}
|
48
node_modules/@jest/console/build/NullConsole.js
generated
vendored
Normal file
48
node_modules/@jest/console/build/NullConsole.js
generated
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
'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() {}
|
||||
|
||||
trace() {}
|
||||
|
||||
warn() {}
|
||||
|
||||
group() {}
|
||||
|
||||
groupCollapsed() {}
|
||||
|
||||
groupEnd() {}
|
||||
}
|
||||
|
||||
exports.default = NullConsole;
|
9
node_modules/@jest/console/build/getConsoleOutput.d.ts
generated
vendored
Normal file
9
node_modules/@jest/console/build/getConsoleOutput.d.ts
generated
vendored
Normal 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 { ConsoleBuffer } from './types';
|
||||
declare const _default: (root: string, verbose: boolean, buffer: ConsoleBuffer, config?: Pick<import("@jest/types/build/Config").ProjectConfig, "rootDir" | "testMatch">) => string;
|
||||
export default _default;
|
93
node_modules/@jest/console/build/getConsoleOutput.js
generated
vendored
Normal file
93
node_modules/@jest/console/build/getConsoleOutput.js
generated
vendored
Normal file
@ -0,0 +1,93 @@
|
||||
'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 26
|
||||
config = {
|
||||
rootDir: root,
|
||||
testMatch: []
|
||||
}
|
||||
) => {
|
||||
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') {
|
||||
message = _chalk().default.yellow(message);
|
||||
typeMessage = _chalk().default.yellow(typeMessage);
|
||||
noStackTrace = false;
|
||||
noCodeFrame = false;
|
||||
} else if (type === 'error') {
|
||||
message = _chalk().default.red(message);
|
||||
typeMessage = _chalk().default.red(typeMessage);
|
||||
noStackTrace = 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
11
node_modules/@jest/console/build/index.d.ts
generated
vendored
Normal 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
41
node_modules/@jest/console/build/index.js
generated
vendored
Normal 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};
|
||||
}
|
33
node_modules/@jest/console/build/ts3.4/BufferedConsole.d.ts
generated
vendored
Normal file
33
node_modules/@jest/console/build/ts3.4/BufferedConsole.d.ts
generated
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
/**
|
||||
* 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 { 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;
|
||||
warn(firstArg: unknown, ...rest: Array<unknown>): void;
|
||||
getBuffer(): ConsoleBuffer | undefined;
|
||||
}
|
39
node_modules/@jest/console/build/ts3.4/CustomConsole.d.ts
generated
vendored
Normal file
39
node_modules/@jest/console/build/ts3.4/CustomConsole.d.ts
generated
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
/// <reference types="node" />
|
||||
/**
|
||||
* 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 { 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): void;
|
||||
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;
|
||||
warn(firstArg: unknown, ...args: Array<unknown>): void;
|
||||
getBuffer(): undefined;
|
||||
}
|
||||
export {};
|
22
node_modules/@jest/console/build/ts3.4/NullConsole.d.ts
generated
vendored
Normal file
22
node_modules/@jest/console/build/ts3.4/NullConsole.d.ts
generated
vendored
Normal 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.
|
||||
*/
|
||||
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;
|
||||
trace(): void;
|
||||
warn(): void;
|
||||
group(): void;
|
||||
groupCollapsed(): void;
|
||||
groupEnd(): void;
|
||||
}
|
9
node_modules/@jest/console/build/ts3.4/getConsoleOutput.d.ts
generated
vendored
Normal file
9
node_modules/@jest/console/build/ts3.4/getConsoleOutput.d.ts
generated
vendored
Normal 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 { ConsoleBuffer } from './types';
|
||||
declare const _default: (root: string, verbose: boolean, buffer: ConsoleBuffer, config?: Pick<import("@jest/types/build/Config").ProjectConfig, "rootDir" | "testMatch">) => string;
|
||||
export default _default;
|
11
node_modules/@jest/console/build/ts3.4/index.d.ts
generated
vendored
Normal file
11
node_modules/@jest/console/build/ts3.4/index.d.ts
generated
vendored
Normal 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 { ConsoleBuffer, LogMessage, LogType } from './types';
|
20
node_modules/@jest/console/build/ts3.4/types.d.ts
generated
vendored
Normal file
20
node_modules/@jest/console/build/ts3.4/types.d.ts
generated
vendored
Normal 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>;
|
20
node_modules/@jest/console/build/types.d.ts
generated
vendored
Normal file
20
node_modules/@jest/console/build/types.d.ts
generated
vendored
Normal 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
1
node_modules/@jest/console/build/types.js
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
'use strict';
|
345
node_modules/@jest/console/node_modules/ansi-styles/index.d.ts
generated
vendored
Normal file
345
node_modules/@jest/console/node_modules/ansi-styles/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,345 @@
|
||||
declare type CSSColor =
|
||||
| 'aliceblue'
|
||||
| 'antiquewhite'
|
||||
| 'aqua'
|
||||
| 'aquamarine'
|
||||
| 'azure'
|
||||
| 'beige'
|
||||
| 'bisque'
|
||||
| 'black'
|
||||
| 'blanchedalmond'
|
||||
| 'blue'
|
||||
| 'blueviolet'
|
||||
| 'brown'
|
||||
| 'burlywood'
|
||||
| 'cadetblue'
|
||||
| 'chartreuse'
|
||||
| 'chocolate'
|
||||
| 'coral'
|
||||
| 'cornflowerblue'
|
||||
| 'cornsilk'
|
||||
| 'crimson'
|
||||
| 'cyan'
|
||||
| 'darkblue'
|
||||
| 'darkcyan'
|
||||
| 'darkgoldenrod'
|
||||
| 'darkgray'
|
||||
| 'darkgreen'
|
||||
| 'darkgrey'
|
||||
| 'darkkhaki'
|
||||
| 'darkmagenta'
|
||||
| 'darkolivegreen'
|
||||
| 'darkorange'
|
||||
| 'darkorchid'
|
||||
| 'darkred'
|
||||
| 'darksalmon'
|
||||
| 'darkseagreen'
|
||||
| 'darkslateblue'
|
||||
| 'darkslategray'
|
||||
| 'darkslategrey'
|
||||
| 'darkturquoise'
|
||||
| 'darkviolet'
|
||||
| 'deeppink'
|
||||
| 'deepskyblue'
|
||||
| 'dimgray'
|
||||
| 'dimgrey'
|
||||
| 'dodgerblue'
|
||||
| 'firebrick'
|
||||
| 'floralwhite'
|
||||
| 'forestgreen'
|
||||
| 'fuchsia'
|
||||
| 'gainsboro'
|
||||
| 'ghostwhite'
|
||||
| 'gold'
|
||||
| 'goldenrod'
|
||||
| 'gray'
|
||||
| 'green'
|
||||
| 'greenyellow'
|
||||
| 'grey'
|
||||
| 'honeydew'
|
||||
| 'hotpink'
|
||||
| 'indianred'
|
||||
| 'indigo'
|
||||
| 'ivory'
|
||||
| 'khaki'
|
||||
| 'lavender'
|
||||
| 'lavenderblush'
|
||||
| 'lawngreen'
|
||||
| 'lemonchiffon'
|
||||
| 'lightblue'
|
||||
| 'lightcoral'
|
||||
| 'lightcyan'
|
||||
| 'lightgoldenrodyellow'
|
||||
| 'lightgray'
|
||||
| 'lightgreen'
|
||||
| 'lightgrey'
|
||||
| 'lightpink'
|
||||
| 'lightsalmon'
|
||||
| 'lightseagreen'
|
||||
| 'lightskyblue'
|
||||
| 'lightslategray'
|
||||
| 'lightslategrey'
|
||||
| 'lightsteelblue'
|
||||
| 'lightyellow'
|
||||
| 'lime'
|
||||
| 'limegreen'
|
||||
| 'linen'
|
||||
| 'magenta'
|
||||
| 'maroon'
|
||||
| 'mediumaquamarine'
|
||||
| 'mediumblue'
|
||||
| 'mediumorchid'
|
||||
| 'mediumpurple'
|
||||
| 'mediumseagreen'
|
||||
| 'mediumslateblue'
|
||||
| 'mediumspringgreen'
|
||||
| 'mediumturquoise'
|
||||
| 'mediumvioletred'
|
||||
| 'midnightblue'
|
||||
| 'mintcream'
|
||||
| 'mistyrose'
|
||||
| 'moccasin'
|
||||
| 'navajowhite'
|
||||
| 'navy'
|
||||
| 'oldlace'
|
||||
| 'olive'
|
||||
| 'olivedrab'
|
||||
| 'orange'
|
||||
| 'orangered'
|
||||
| 'orchid'
|
||||
| 'palegoldenrod'
|
||||
| 'palegreen'
|
||||
| 'paleturquoise'
|
||||
| 'palevioletred'
|
||||
| 'papayawhip'
|
||||
| 'peachpuff'
|
||||
| 'peru'
|
||||
| 'pink'
|
||||
| 'plum'
|
||||
| 'powderblue'
|
||||
| 'purple'
|
||||
| 'rebeccapurple'
|
||||
| 'red'
|
||||
| 'rosybrown'
|
||||
| 'royalblue'
|
||||
| 'saddlebrown'
|
||||
| 'salmon'
|
||||
| 'sandybrown'
|
||||
| 'seagreen'
|
||||
| 'seashell'
|
||||
| 'sienna'
|
||||
| 'silver'
|
||||
| 'skyblue'
|
||||
| 'slateblue'
|
||||
| 'slategray'
|
||||
| 'slategrey'
|
||||
| 'snow'
|
||||
| 'springgreen'
|
||||
| 'steelblue'
|
||||
| 'tan'
|
||||
| 'teal'
|
||||
| 'thistle'
|
||||
| 'tomato'
|
||||
| 'turquoise'
|
||||
| 'violet'
|
||||
| 'wheat'
|
||||
| 'white'
|
||||
| 'whitesmoke'
|
||||
| 'yellow'
|
||||
| 'yellowgreen';
|
||||
|
||||
declare namespace ansiStyles {
|
||||
interface ColorConvert {
|
||||
/**
|
||||
The RGB color space.
|
||||
|
||||
@param red - (`0`-`255`)
|
||||
@param green - (`0`-`255`)
|
||||
@param blue - (`0`-`255`)
|
||||
*/
|
||||
rgb(red: number, green: number, blue: number): string;
|
||||
|
||||
/**
|
||||
The RGB HEX color space.
|
||||
|
||||
@param hex - A hexadecimal string containing RGB data.
|
||||
*/
|
||||
hex(hex: string): string;
|
||||
|
||||
/**
|
||||
@param keyword - A CSS color name.
|
||||
*/
|
||||
keyword(keyword: CSSColor): string;
|
||||
|
||||
/**
|
||||
The HSL color space.
|
||||
|
||||
@param hue - (`0`-`360`)
|
||||
@param saturation - (`0`-`100`)
|
||||
@param lightness - (`0`-`100`)
|
||||
*/
|
||||
hsl(hue: number, saturation: number, lightness: number): string;
|
||||
|
||||
/**
|
||||
The HSV color space.
|
||||
|
||||
@param hue - (`0`-`360`)
|
||||
@param saturation - (`0`-`100`)
|
||||
@param value - (`0`-`100`)
|
||||
*/
|
||||
hsv(hue: number, saturation: number, value: number): string;
|
||||
|
||||
/**
|
||||
The HSV color space.
|
||||
|
||||
@param hue - (`0`-`360`)
|
||||
@param whiteness - (`0`-`100`)
|
||||
@param blackness - (`0`-`100`)
|
||||
*/
|
||||
hwb(hue: number, whiteness: number, blackness: number): string;
|
||||
|
||||
/**
|
||||
Use a [4-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#3/4-bit) to set text color.
|
||||
*/
|
||||
ansi(ansi: number): string;
|
||||
|
||||
/**
|
||||
Use an [8-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) to set text color.
|
||||
*/
|
||||
ansi256(ansi: number): string;
|
||||
}
|
||||
|
||||
interface CSPair {
|
||||
/**
|
||||
The ANSI terminal control sequence for starting this style.
|
||||
*/
|
||||
readonly open: string;
|
||||
|
||||
/**
|
||||
The ANSI terminal control sequence for ending this style.
|
||||
*/
|
||||
readonly close: string;
|
||||
}
|
||||
|
||||
interface ColorBase {
|
||||
readonly ansi: ColorConvert;
|
||||
readonly ansi256: ColorConvert;
|
||||
readonly ansi16m: ColorConvert;
|
||||
|
||||
/**
|
||||
The ANSI terminal control sequence for ending this color.
|
||||
*/
|
||||
readonly close: string;
|
||||
}
|
||||
|
||||
interface Modifier {
|
||||
/**
|
||||
Resets the current color chain.
|
||||
*/
|
||||
readonly reset: CSPair;
|
||||
|
||||
/**
|
||||
Make text bold.
|
||||
*/
|
||||
readonly bold: CSPair;
|
||||
|
||||
/**
|
||||
Emitting only a small amount of light.
|
||||
*/
|
||||
readonly dim: CSPair;
|
||||
|
||||
/**
|
||||
Make text italic. (Not widely supported)
|
||||
*/
|
||||
readonly italic: CSPair;
|
||||
|
||||
/**
|
||||
Make text underline. (Not widely supported)
|
||||
*/
|
||||
readonly underline: CSPair;
|
||||
|
||||
/**
|
||||
Inverse background and foreground colors.
|
||||
*/
|
||||
readonly inverse: CSPair;
|
||||
|
||||
/**
|
||||
Prints the text, but makes it invisible.
|
||||
*/
|
||||
readonly hidden: CSPair;
|
||||
|
||||
/**
|
||||
Puts a horizontal line through the center of the text. (Not widely supported)
|
||||
*/
|
||||
readonly strikethrough: CSPair;
|
||||
}
|
||||
|
||||
interface ForegroundColor {
|
||||
readonly black: CSPair;
|
||||
readonly red: CSPair;
|
||||
readonly green: CSPair;
|
||||
readonly yellow: CSPair;
|
||||
readonly blue: CSPair;
|
||||
readonly cyan: CSPair;
|
||||
readonly magenta: CSPair;
|
||||
readonly white: CSPair;
|
||||
|
||||
/**
|
||||
Alias for `blackBright`.
|
||||
*/
|
||||
readonly gray: CSPair;
|
||||
|
||||
/**
|
||||
Alias for `blackBright`.
|
||||
*/
|
||||
readonly grey: CSPair;
|
||||
|
||||
readonly blackBright: CSPair;
|
||||
readonly redBright: CSPair;
|
||||
readonly greenBright: CSPair;
|
||||
readonly yellowBright: CSPair;
|
||||
readonly blueBright: CSPair;
|
||||
readonly cyanBright: CSPair;
|
||||
readonly magentaBright: CSPair;
|
||||
readonly whiteBright: CSPair;
|
||||
}
|
||||
|
||||
interface BackgroundColor {
|
||||
readonly bgBlack: CSPair;
|
||||
readonly bgRed: CSPair;
|
||||
readonly bgGreen: CSPair;
|
||||
readonly bgYellow: CSPair;
|
||||
readonly bgBlue: CSPair;
|
||||
readonly bgCyan: CSPair;
|
||||
readonly bgMagenta: CSPair;
|
||||
readonly bgWhite: CSPair;
|
||||
|
||||
/**
|
||||
Alias for `bgBlackBright`.
|
||||
*/
|
||||
readonly bgGray: CSPair;
|
||||
|
||||
/**
|
||||
Alias for `bgBlackBright`.
|
||||
*/
|
||||
readonly bgGrey: CSPair;
|
||||
|
||||
readonly bgBlackBright: CSPair;
|
||||
readonly bgRedBright: CSPair;
|
||||
readonly bgGreenBright: CSPair;
|
||||
readonly bgYellowBright: CSPair;
|
||||
readonly bgBlueBright: CSPair;
|
||||
readonly bgCyanBright: CSPair;
|
||||
readonly bgMagentaBright: CSPair;
|
||||
readonly bgWhiteBright: CSPair;
|
||||
}
|
||||
}
|
||||
|
||||
declare const ansiStyles: {
|
||||
readonly modifier: ansiStyles.Modifier;
|
||||
readonly color: ansiStyles.ForegroundColor & ansiStyles.ColorBase;
|
||||
readonly bgColor: ansiStyles.BackgroundColor & ansiStyles.ColorBase;
|
||||
readonly codes: ReadonlyMap<number, number>;
|
||||
} & ansiStyles.BackgroundColor & ansiStyles.ForegroundColor & ansiStyles.Modifier;
|
||||
|
||||
export = ansiStyles;
|
163
node_modules/@jest/console/node_modules/ansi-styles/index.js
generated
vendored
Normal file
163
node_modules/@jest/console/node_modules/ansi-styles/index.js
generated
vendored
Normal file
@ -0,0 +1,163 @@
|
||||
'use strict';
|
||||
|
||||
const wrapAnsi16 = (fn, offset) => (...args) => {
|
||||
const code = fn(...args);
|
||||
return `\u001B[${code + offset}m`;
|
||||
};
|
||||
|
||||
const wrapAnsi256 = (fn, offset) => (...args) => {
|
||||
const code = fn(...args);
|
||||
return `\u001B[${38 + offset};5;${code}m`;
|
||||
};
|
||||
|
||||
const wrapAnsi16m = (fn, offset) => (...args) => {
|
||||
const rgb = fn(...args);
|
||||
return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
|
||||
};
|
||||
|
||||
const ansi2ansi = n => n;
|
||||
const rgb2rgb = (r, g, b) => [r, g, b];
|
||||
|
||||
const setLazyProperty = (object, property, get) => {
|
||||
Object.defineProperty(object, property, {
|
||||
get: () => {
|
||||
const value = get();
|
||||
|
||||
Object.defineProperty(object, property, {
|
||||
value,
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
return value;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
};
|
||||
|
||||
/** @type {typeof import('color-convert')} */
|
||||
let colorConvert;
|
||||
const makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => {
|
||||
if (colorConvert === undefined) {
|
||||
colorConvert = require('color-convert');
|
||||
}
|
||||
|
||||
const offset = isBackground ? 10 : 0;
|
||||
const styles = {};
|
||||
|
||||
for (const [sourceSpace, suite] of Object.entries(colorConvert)) {
|
||||
const name = sourceSpace === 'ansi16' ? 'ansi' : sourceSpace;
|
||||
if (sourceSpace === targetSpace) {
|
||||
styles[name] = wrap(identity, offset);
|
||||
} else if (typeof suite === 'object') {
|
||||
styles[name] = wrap(suite[targetSpace], offset);
|
||||
}
|
||||
}
|
||||
|
||||
return styles;
|
||||
};
|
||||
|
||||
function assembleStyles() {
|
||||
const codes = new Map();
|
||||
const styles = {
|
||||
modifier: {
|
||||
reset: [0, 0],
|
||||
// 21 isn't widely supported and 22 does the same thing
|
||||
bold: [1, 22],
|
||||
dim: [2, 22],
|
||||
italic: [3, 23],
|
||||
underline: [4, 24],
|
||||
inverse: [7, 27],
|
||||
hidden: [8, 28],
|
||||
strikethrough: [9, 29]
|
||||
},
|
||||
color: {
|
||||
black: [30, 39],
|
||||
red: [31, 39],
|
||||
green: [32, 39],
|
||||
yellow: [33, 39],
|
||||
blue: [34, 39],
|
||||
magenta: [35, 39],
|
||||
cyan: [36, 39],
|
||||
white: [37, 39],
|
||||
|
||||
// Bright color
|
||||
blackBright: [90, 39],
|
||||
redBright: [91, 39],
|
||||
greenBright: [92, 39],
|
||||
yellowBright: [93, 39],
|
||||
blueBright: [94, 39],
|
||||
magentaBright: [95, 39],
|
||||
cyanBright: [96, 39],
|
||||
whiteBright: [97, 39]
|
||||
},
|
||||
bgColor: {
|
||||
bgBlack: [40, 49],
|
||||
bgRed: [41, 49],
|
||||
bgGreen: [42, 49],
|
||||
bgYellow: [43, 49],
|
||||
bgBlue: [44, 49],
|
||||
bgMagenta: [45, 49],
|
||||
bgCyan: [46, 49],
|
||||
bgWhite: [47, 49],
|
||||
|
||||
// Bright color
|
||||
bgBlackBright: [100, 49],
|
||||
bgRedBright: [101, 49],
|
||||
bgGreenBright: [102, 49],
|
||||
bgYellowBright: [103, 49],
|
||||
bgBlueBright: [104, 49],
|
||||
bgMagentaBright: [105, 49],
|
||||
bgCyanBright: [106, 49],
|
||||
bgWhiteBright: [107, 49]
|
||||
}
|
||||
};
|
||||
|
||||
// Alias bright black as gray (and grey)
|
||||
styles.color.gray = styles.color.blackBright;
|
||||
styles.bgColor.bgGray = styles.bgColor.bgBlackBright;
|
||||
styles.color.grey = styles.color.blackBright;
|
||||
styles.bgColor.bgGrey = styles.bgColor.bgBlackBright;
|
||||
|
||||
for (const [groupName, group] of Object.entries(styles)) {
|
||||
for (const [styleName, style] of Object.entries(group)) {
|
||||
styles[styleName] = {
|
||||
open: `\u001B[${style[0]}m`,
|
||||
close: `\u001B[${style[1]}m`
|
||||
};
|
||||
|
||||
group[styleName] = styles[styleName];
|
||||
|
||||
codes.set(style[0], style[1]);
|
||||
}
|
||||
|
||||
Object.defineProperty(styles, groupName, {
|
||||
value: group,
|
||||
enumerable: false
|
||||
});
|
||||
}
|
||||
|
||||
Object.defineProperty(styles, 'codes', {
|
||||
value: codes,
|
||||
enumerable: false
|
||||
});
|
||||
|
||||
styles.color.close = '\u001B[39m';
|
||||
styles.bgColor.close = '\u001B[49m';
|
||||
|
||||
setLazyProperty(styles.color, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, false));
|
||||
setLazyProperty(styles.color, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, false));
|
||||
setLazyProperty(styles.color, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, false));
|
||||
setLazyProperty(styles.bgColor, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, true));
|
||||
setLazyProperty(styles.bgColor, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, true));
|
||||
setLazyProperty(styles.bgColor, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, true));
|
||||
|
||||
return styles;
|
||||
}
|
||||
|
||||
// Make the export immutable
|
||||
Object.defineProperty(module, 'exports', {
|
||||
enumerable: true,
|
||||
get: assembleStyles
|
||||
});
|
9
node_modules/@jest/console/node_modules/ansi-styles/license
generated
vendored
Normal file
9
node_modules/@jest/console/node_modules/ansi-styles/license
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
56
node_modules/@jest/console/node_modules/ansi-styles/package.json
generated
vendored
Normal file
56
node_modules/@jest/console/node_modules/ansi-styles/package.json
generated
vendored
Normal file
@ -0,0 +1,56 @@
|
||||
{
|
||||
"name": "ansi-styles",
|
||||
"version": "4.3.0",
|
||||
"description": "ANSI escape codes for styling strings in the terminal",
|
||||
"license": "MIT",
|
||||
"repository": "chalk/ansi-styles",
|
||||
"funding": "https://github.com/chalk/ansi-styles?sponsor=1",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd",
|
||||
"screenshot": "svg-term --command='node screenshot' --out=screenshot.svg --padding=3 --width=55 --height=3 --at=1000 --no-cursor"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"ansi",
|
||||
"styles",
|
||||
"color",
|
||||
"colour",
|
||||
"colors",
|
||||
"terminal",
|
||||
"console",
|
||||
"cli",
|
||||
"string",
|
||||
"tty",
|
||||
"escape",
|
||||
"formatting",
|
||||
"rgb",
|
||||
"256",
|
||||
"shell",
|
||||
"xterm",
|
||||
"log",
|
||||
"logging",
|
||||
"command-line",
|
||||
"text"
|
||||
],
|
||||
"dependencies": {
|
||||
"color-convert": "^2.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/color-convert": "^1.9.0",
|
||||
"ava": "^2.3.0",
|
||||
"svg-term-cli": "^2.1.1",
|
||||
"tsd": "^0.11.0",
|
||||
"xo": "^0.25.3"
|
||||
}
|
||||
}
|
152
node_modules/@jest/console/node_modules/ansi-styles/readme.md
generated
vendored
Normal file
152
node_modules/@jest/console/node_modules/ansi-styles/readme.md
generated
vendored
Normal file
@ -0,0 +1,152 @@
|
||||
# ansi-styles [](https://travis-ci.org/chalk/ansi-styles)
|
||||
|
||||
> [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) for styling strings in the terminal
|
||||
|
||||
You probably want the higher-level [chalk](https://github.com/chalk/chalk) module for styling your strings.
|
||||
|
||||
<img src="screenshot.svg" width="900">
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install ansi-styles
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const style = require('ansi-styles');
|
||||
|
||||
console.log(`${style.green.open}Hello world!${style.green.close}`);
|
||||
|
||||
|
||||
// Color conversion between 16/256/truecolor
|
||||
// NOTE: If conversion goes to 16 colors or 256 colors, the original color
|
||||
// may be degraded to fit that color palette. This means terminals
|
||||
// that do not support 16 million colors will best-match the
|
||||
// original color.
|
||||
console.log(style.bgColor.ansi.hsl(120, 80, 72) + 'Hello world!' + style.bgColor.close);
|
||||
console.log(style.color.ansi256.rgb(199, 20, 250) + 'Hello world!' + style.color.close);
|
||||
console.log(style.color.ansi16m.hex('#abcdef') + 'Hello world!' + style.color.close);
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
Each style has an `open` and `close` property.
|
||||
|
||||
## Styles
|
||||
|
||||
### Modifiers
|
||||
|
||||
- `reset`
|
||||
- `bold`
|
||||
- `dim`
|
||||
- `italic` *(Not widely supported)*
|
||||
- `underline`
|
||||
- `inverse`
|
||||
- `hidden`
|
||||
- `strikethrough` *(Not widely supported)*
|
||||
|
||||
### Colors
|
||||
|
||||
- `black`
|
||||
- `red`
|
||||
- `green`
|
||||
- `yellow`
|
||||
- `blue`
|
||||
- `magenta`
|
||||
- `cyan`
|
||||
- `white`
|
||||
- `blackBright` (alias: `gray`, `grey`)
|
||||
- `redBright`
|
||||
- `greenBright`
|
||||
- `yellowBright`
|
||||
- `blueBright`
|
||||
- `magentaBright`
|
||||
- `cyanBright`
|
||||
- `whiteBright`
|
||||
|
||||
### Background colors
|
||||
|
||||
- `bgBlack`
|
||||
- `bgRed`
|
||||
- `bgGreen`
|
||||
- `bgYellow`
|
||||
- `bgBlue`
|
||||
- `bgMagenta`
|
||||
- `bgCyan`
|
||||
- `bgWhite`
|
||||
- `bgBlackBright` (alias: `bgGray`, `bgGrey`)
|
||||
- `bgRedBright`
|
||||
- `bgGreenBright`
|
||||
- `bgYellowBright`
|
||||
- `bgBlueBright`
|
||||
- `bgMagentaBright`
|
||||
- `bgCyanBright`
|
||||
- `bgWhiteBright`
|
||||
|
||||
## Advanced usage
|
||||
|
||||
By default, you get a map of styles, but the styles are also available as groups. They are non-enumerable so they don't show up unless you access them explicitly. This makes it easier to expose only a subset in a higher-level module.
|
||||
|
||||
- `style.modifier`
|
||||
- `style.color`
|
||||
- `style.bgColor`
|
||||
|
||||
###### Example
|
||||
|
||||
```js
|
||||
console.log(style.color.green.open);
|
||||
```
|
||||
|
||||
Raw escape codes (i.e. without the CSI escape prefix `\u001B[` and render mode postfix `m`) are available under `style.codes`, which returns a `Map` with the open codes as keys and close codes as values.
|
||||
|
||||
###### Example
|
||||
|
||||
```js
|
||||
console.log(style.codes.get(36));
|
||||
//=> 39
|
||||
```
|
||||
|
||||
## [256 / 16 million (TrueColor) support](https://gist.github.com/XVilka/8346728)
|
||||
|
||||
`ansi-styles` uses the [`color-convert`](https://github.com/Qix-/color-convert) package to allow for converting between various colors and ANSI escapes, with support for 256 and 16 million colors.
|
||||
|
||||
The following color spaces from `color-convert` are supported:
|
||||
|
||||
- `rgb`
|
||||
- `hex`
|
||||
- `keyword`
|
||||
- `hsl`
|
||||
- `hsv`
|
||||
- `hwb`
|
||||
- `ansi`
|
||||
- `ansi256`
|
||||
|
||||
To use these, call the associated conversion function with the intended output, for example:
|
||||
|
||||
```js
|
||||
style.color.ansi.rgb(100, 200, 15); // RGB to 16 color ansi foreground code
|
||||
style.bgColor.ansi.rgb(100, 200, 15); // RGB to 16 color ansi background code
|
||||
|
||||
style.color.ansi256.hsl(120, 100, 60); // HSL to 256 color ansi foreground code
|
||||
style.bgColor.ansi256.hsl(120, 100, 60); // HSL to 256 color ansi foreground code
|
||||
|
||||
style.color.ansi16m.hex('#C0FFEE'); // Hex (RGB) to 16 million color foreground code
|
||||
style.bgColor.ansi16m.hex('#C0FFEE'); // Hex (RGB) to 16 million color background code
|
||||
```
|
||||
|
||||
## Related
|
||||
|
||||
- [ansi-escapes](https://github.com/sindresorhus/ansi-escapes) - ANSI escape codes for manipulating the terminal
|
||||
|
||||
## Maintainers
|
||||
|
||||
- [Sindre Sorhus](https://github.com/sindresorhus)
|
||||
- [Josh Junon](https://github.com/qix-)
|
||||
|
||||
## For enterprise
|
||||
|
||||
Available as part of the Tidelift Subscription.
|
||||
|
||||
The maintainers of `ansi-styles` and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-ansi-styles?utm_source=npm-ansi-styles&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
|
411
node_modules/@jest/console/node_modules/chalk/index.d.ts
generated
vendored
Normal file
411
node_modules/@jest/console/node_modules/chalk/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,411 @@
|
||||
declare const enum LevelEnum {
|
||||
/**
|
||||
All colors disabled.
|
||||
*/
|
||||
None = 0,
|
||||
|
||||
/**
|
||||
Basic 16 colors support.
|
||||
*/
|
||||
Basic = 1,
|
||||
|
||||
/**
|
||||
ANSI 256 colors support.
|
||||
*/
|
||||
Ansi256 = 2,
|
||||
|
||||
/**
|
||||
Truecolor 16 million colors support.
|
||||
*/
|
||||
TrueColor = 3
|
||||
}
|
||||
|
||||
/**
|
||||
Basic foreground colors.
|
||||
|
||||
[More colors here.](https://github.com/chalk/chalk/blob/master/readme.md#256-and-truecolor-color-support)
|
||||
*/
|
||||
declare type ForegroundColor =
|
||||
| 'black'
|
||||
| 'red'
|
||||
| 'green'
|
||||
| 'yellow'
|
||||
| 'blue'
|
||||
| 'magenta'
|
||||
| 'cyan'
|
||||
| 'white'
|
||||
| 'gray'
|
||||
| 'grey'
|
||||
| 'blackBright'
|
||||
| 'redBright'
|
||||
| 'greenBright'
|
||||
| 'yellowBright'
|
||||
| 'blueBright'
|
||||
| 'magentaBright'
|
||||
| 'cyanBright'
|
||||
| 'whiteBright';
|
||||
|
||||
/**
|
||||
Basic background colors.
|
||||
|
||||
[More colors here.](https://github.com/chalk/chalk/blob/master/readme.md#256-and-truecolor-color-support)
|
||||
*/
|
||||
declare type BackgroundColor =
|
||||
| 'bgBlack'
|
||||
| 'bgRed'
|
||||
| 'bgGreen'
|
||||
| 'bgYellow'
|
||||
| 'bgBlue'
|
||||
| 'bgMagenta'
|
||||
| 'bgCyan'
|
||||
| 'bgWhite'
|
||||
| 'bgGray'
|
||||
| 'bgGrey'
|
||||
| 'bgBlackBright'
|
||||
| 'bgRedBright'
|
||||
| 'bgGreenBright'
|
||||
| 'bgYellowBright'
|
||||
| 'bgBlueBright'
|
||||
| 'bgMagentaBright'
|
||||
| 'bgCyanBright'
|
||||
| 'bgWhiteBright';
|
||||
|
||||
/**
|
||||
Basic colors.
|
||||
|
||||
[More colors here.](https://github.com/chalk/chalk/blob/master/readme.md#256-and-truecolor-color-support)
|
||||
*/
|
||||
declare type Color = ForegroundColor | BackgroundColor;
|
||||
|
||||
declare type Modifiers =
|
||||
| 'reset'
|
||||
| 'bold'
|
||||
| 'dim'
|
||||
| 'italic'
|
||||
| 'underline'
|
||||
| 'inverse'
|
||||
| 'hidden'
|
||||
| 'strikethrough'
|
||||
| 'visible';
|
||||
|
||||
declare namespace chalk {
|
||||
type Level = LevelEnum;
|
||||
|
||||
interface Options {
|
||||
/**
|
||||
Specify the color support for Chalk.
|
||||
By default, color support is automatically detected based on the environment.
|
||||
*/
|
||||
level?: Level;
|
||||
}
|
||||
|
||||
interface Instance {
|
||||
/**
|
||||
Return a new Chalk instance.
|
||||
*/
|
||||
new (options?: Options): Chalk;
|
||||
}
|
||||
|
||||
/**
|
||||
Detect whether the terminal supports color.
|
||||
*/
|
||||
interface ColorSupport {
|
||||
/**
|
||||
The color level used by Chalk.
|
||||
*/
|
||||
level: Level;
|
||||
|
||||
/**
|
||||
Return whether Chalk supports basic 16 colors.
|
||||
*/
|
||||
hasBasic: boolean;
|
||||
|
||||
/**
|
||||
Return whether Chalk supports ANSI 256 colors.
|
||||
*/
|
||||
has256: boolean;
|
||||
|
||||
/**
|
||||
Return whether Chalk supports Truecolor 16 million colors.
|
||||
*/
|
||||
has16m: boolean;
|
||||
}
|
||||
|
||||
interface ChalkFunction {
|
||||
/**
|
||||
Use a template string.
|
||||
|
||||
@remarks Template literals are unsupported for nested calls (see [issue #341](https://github.com/chalk/chalk/issues/341))
|
||||
|
||||
@example
|
||||
```
|
||||
import chalk = require('chalk');
|
||||
|
||||
log(chalk`
|
||||
CPU: {red ${cpu.totalPercent}%}
|
||||
RAM: {green ${ram.used / ram.total * 100}%}
|
||||
DISK: {rgb(255,131,0) ${disk.used / disk.total * 100}%}
|
||||
`);
|
||||
```
|
||||
*/
|
||||
(text: TemplateStringsArray, ...placeholders: unknown[]): string;
|
||||
|
||||
(...text: unknown[]): string;
|
||||
}
|
||||
|
||||
interface Chalk extends ChalkFunction {
|
||||
/**
|
||||
Return a new Chalk instance.
|
||||
*/
|
||||
Instance: Instance;
|
||||
|
||||
/**
|
||||
The color support for Chalk.
|
||||
By default, color support is automatically detected based on the environment.
|
||||
*/
|
||||
level: Level;
|
||||
|
||||
/**
|
||||
Use HEX value to set text color.
|
||||
|
||||
@param color - Hexadecimal value representing the desired color.
|
||||
|
||||
@example
|
||||
```
|
||||
import chalk = require('chalk');
|
||||
|
||||
chalk.hex('#DEADED');
|
||||
```
|
||||
*/
|
||||
hex(color: string): Chalk;
|
||||
|
||||
/**
|
||||
Use keyword color value to set text color.
|
||||
|
||||
@param color - Keyword value representing the desired color.
|
||||
|
||||
@example
|
||||
```
|
||||
import chalk = require('chalk');
|
||||
|
||||
chalk.keyword('orange');
|
||||
```
|
||||
*/
|
||||
keyword(color: string): Chalk;
|
||||
|
||||
/**
|
||||
Use RGB values to set text color.
|
||||
*/
|
||||
rgb(red: number, green: number, blue: number): Chalk;
|
||||
|
||||
/**
|
||||
Use HSL values to set text color.
|
||||
*/
|
||||
hsl(hue: number, saturation: number, lightness: number): Chalk;
|
||||
|
||||
/**
|
||||
Use HSV values to set text color.
|
||||
*/
|
||||
hsv(hue: number, saturation: number, value: number): Chalk;
|
||||
|
||||
/**
|
||||
Use HWB values to set text color.
|
||||
*/
|
||||
hwb(hue: number, whiteness: number, blackness: number): Chalk;
|
||||
|
||||
/**
|
||||
Use a [Select/Set Graphic Rendition](https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters) (SGR) [color code number](https://en.wikipedia.org/wiki/ANSI_escape_code#3/4_bit) to set text color.
|
||||
|
||||
30 <= code && code < 38 || 90 <= code && code < 98
|
||||
For example, 31 for red, 91 for redBright.
|
||||
*/
|
||||
ansi(code: number): Chalk;
|
||||
|
||||
/**
|
||||
Use a [8-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) to set text color.
|
||||
*/
|
||||
ansi256(index: number): Chalk;
|
||||
|
||||
/**
|
||||
Use HEX value to set background color.
|
||||
|
||||
@param color - Hexadecimal value representing the desired color.
|
||||
|
||||
@example
|
||||
```
|
||||
import chalk = require('chalk');
|
||||
|
||||
chalk.bgHex('#DEADED');
|
||||
```
|
||||
*/
|
||||
bgHex(color: string): Chalk;
|
||||
|
||||
/**
|
||||
Use keyword color value to set background color.
|
||||
|
||||
@param color - Keyword value representing the desired color.
|
||||
|
||||
@example
|
||||
```
|
||||
import chalk = require('chalk');
|
||||
|
||||
chalk.bgKeyword('orange');
|
||||
```
|
||||
*/
|
||||
bgKeyword(color: string): Chalk;
|
||||
|
||||
/**
|
||||
Use RGB values to set background color.
|
||||
*/
|
||||
bgRgb(red: number, green: number, blue: number): Chalk;
|
||||
|
||||
/**
|
||||
Use HSL values to set background color.
|
||||
*/
|
||||
bgHsl(hue: number, saturation: number, lightness: number): Chalk;
|
||||
|
||||
/**
|
||||
Use HSV values to set background color.
|
||||
*/
|
||||
bgHsv(hue: number, saturation: number, value: number): Chalk;
|
||||
|
||||
/**
|
||||
Use HWB values to set background color.
|
||||
*/
|
||||
bgHwb(hue: number, whiteness: number, blackness: number): Chalk;
|
||||
|
||||
/**
|
||||
Use a [Select/Set Graphic Rendition](https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters) (SGR) [color code number](https://en.wikipedia.org/wiki/ANSI_escape_code#3/4_bit) to set background color.
|
||||
|
||||
30 <= code && code < 38 || 90 <= code && code < 98
|
||||
For example, 31 for red, 91 for redBright.
|
||||
Use the foreground code, not the background code (for example, not 41, nor 101).
|
||||
*/
|
||||
bgAnsi(code: number): Chalk;
|
||||
|
||||
/**
|
||||
Use a [8-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) to set background color.
|
||||
*/
|
||||
bgAnsi256(index: number): Chalk;
|
||||
|
||||
/**
|
||||
Modifier: Resets the current color chain.
|
||||
*/
|
||||
readonly reset: Chalk;
|
||||
|
||||
/**
|
||||
Modifier: Make text bold.
|
||||
*/
|
||||
readonly bold: Chalk;
|
||||
|
||||
/**
|
||||
Modifier: Emitting only a small amount of light.
|
||||
*/
|
||||
readonly dim: Chalk;
|
||||
|
||||
/**
|
||||
Modifier: Make text italic. (Not widely supported)
|
||||
*/
|
||||
readonly italic: Chalk;
|
||||
|
||||
/**
|
||||
Modifier: Make text underline. (Not widely supported)
|
||||
*/
|
||||
readonly underline: Chalk;
|
||||
|
||||
/**
|
||||
Modifier: Inverse background and foreground colors.
|
||||
*/
|
||||
readonly inverse: Chalk;
|
||||
|
||||
/**
|
||||
Modifier: Prints the text, but makes it invisible.
|
||||
*/
|
||||
readonly hidden: Chalk;
|
||||
|
||||
/**
|
||||
Modifier: Puts a horizontal line through the center of the text. (Not widely supported)
|
||||
*/
|
||||
readonly strikethrough: Chalk;
|
||||
|
||||
/**
|
||||
Modifier: Prints the text only when Chalk has a color support level > 0.
|
||||
Can be useful for things that are purely cosmetic.
|
||||
*/
|
||||
readonly visible: Chalk;
|
||||
|
||||
readonly black: Chalk;
|
||||
readonly red: Chalk;
|
||||
readonly green: Chalk;
|
||||
readonly yellow: Chalk;
|
||||
readonly blue: Chalk;
|
||||
readonly magenta: Chalk;
|
||||
readonly cyan: Chalk;
|
||||
readonly white: Chalk;
|
||||
|
||||
/*
|
||||
Alias for `blackBright`.
|
||||
*/
|
||||
readonly gray: Chalk;
|
||||
|
||||
/*
|
||||
Alias for `blackBright`.
|
||||
*/
|
||||
readonly grey: Chalk;
|
||||
|
||||
readonly blackBright: Chalk;
|
||||
readonly redBright: Chalk;
|
||||
readonly greenBright: Chalk;
|
||||
readonly yellowBright: Chalk;
|
||||
readonly blueBright: Chalk;
|
||||
readonly magentaBright: Chalk;
|
||||
readonly cyanBright: Chalk;
|
||||
readonly whiteBright: Chalk;
|
||||
|
||||
readonly bgBlack: Chalk;
|
||||
readonly bgRed: Chalk;
|
||||
readonly bgGreen: Chalk;
|
||||
readonly bgYellow: Chalk;
|
||||
readonly bgBlue: Chalk;
|
||||
readonly bgMagenta: Chalk;
|
||||
readonly bgCyan: Chalk;
|
||||
readonly bgWhite: Chalk;
|
||||
|
||||
/*
|
||||
Alias for `bgBlackBright`.
|
||||
*/
|
||||
readonly bgGray: Chalk;
|
||||
|
||||
/*
|
||||
Alias for `bgBlackBright`.
|
||||
*/
|
||||
readonly bgGrey: Chalk;
|
||||
|
||||
readonly bgBlackBright: Chalk;
|
||||
readonly bgRedBright: Chalk;
|
||||
readonly bgGreenBright: Chalk;
|
||||
readonly bgYellowBright: Chalk;
|
||||
readonly bgBlueBright: Chalk;
|
||||
readonly bgMagentaBright: Chalk;
|
||||
readonly bgCyanBright: Chalk;
|
||||
readonly bgWhiteBright: Chalk;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Main Chalk object that allows to chain styles together.
|
||||
Call the last one as a method with a string argument.
|
||||
Order doesn't matter, and later styles take precedent in case of a conflict.
|
||||
This simply means that `chalk.red.yellow.green` is equivalent to `chalk.green`.
|
||||
*/
|
||||
declare const chalk: chalk.Chalk & chalk.ChalkFunction & {
|
||||
supportsColor: chalk.ColorSupport | false;
|
||||
Level: typeof LevelEnum;
|
||||
Color: Color;
|
||||
ForegroundColor: ForegroundColor;
|
||||
BackgroundColor: BackgroundColor;
|
||||
Modifiers: Modifiers;
|
||||
stderr: chalk.Chalk & {supportsColor: chalk.ColorSupport | false};
|
||||
};
|
||||
|
||||
export = chalk;
|
9
node_modules/@jest/console/node_modules/chalk/license
generated
vendored
Normal file
9
node_modules/@jest/console/node_modules/chalk/license
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
63
node_modules/@jest/console/node_modules/chalk/package.json
generated
vendored
Normal file
63
node_modules/@jest/console/node_modules/chalk/package.json
generated
vendored
Normal file
@ -0,0 +1,63 @@
|
||||
{
|
||||
"name": "chalk",
|
||||
"version": "3.0.0",
|
||||
"description": "Terminal string styling done right",
|
||||
"license": "MIT",
|
||||
"repository": "chalk/chalk",
|
||||
"main": "source",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && nyc ava && tsd",
|
||||
"bench": "matcha benchmark.js"
|
||||
},
|
||||
"files": [
|
||||
"source",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"color",
|
||||
"colour",
|
||||
"colors",
|
||||
"terminal",
|
||||
"console",
|
||||
"cli",
|
||||
"string",
|
||||
"str",
|
||||
"ansi",
|
||||
"style",
|
||||
"styles",
|
||||
"tty",
|
||||
"formatting",
|
||||
"rgb",
|
||||
"256",
|
||||
"shell",
|
||||
"xterm",
|
||||
"log",
|
||||
"logging",
|
||||
"command-line",
|
||||
"text"
|
||||
],
|
||||
"dependencies": {
|
||||
"ansi-styles": "^4.1.0",
|
||||
"supports-color": "^7.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "^2.4.0",
|
||||
"coveralls": "^3.0.7",
|
||||
"execa": "^3.2.0",
|
||||
"import-fresh": "^3.1.0",
|
||||
"matcha": "^0.7.0",
|
||||
"nyc": "^14.1.1",
|
||||
"resolve-from": "^5.0.0",
|
||||
"tsd": "^0.7.4",
|
||||
"xo": "^0.25.3"
|
||||
},
|
||||
"xo": {
|
||||
"rules": {
|
||||
"unicorn/prefer-string-slice": "off",
|
||||
"unicorn/prefer-includes": "off"
|
||||
}
|
||||
}
|
||||
}
|
304
node_modules/@jest/console/node_modules/chalk/readme.md
generated
vendored
Normal file
304
node_modules/@jest/console/node_modules/chalk/readme.md
generated
vendored
Normal file
@ -0,0 +1,304 @@
|
||||
<h1 align="center">
|
||||
<br>
|
||||
<br>
|
||||
<img width="320" src="media/logo.svg" alt="Chalk">
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
</h1>
|
||||
|
||||
> Terminal string styling done right
|
||||
|
||||
[](https://travis-ci.org/chalk/chalk) [](https://coveralls.io/github/chalk/chalk?branch=master) [](https://www.npmjs.com/package/chalk?activeTab=dependents) [](https://www.npmjs.com/package/chalk) [](https://www.youtube.com/watch?v=9auOCbH5Ns4) [](https://github.com/xojs/xo) 
|
||||
|
||||
<img src="https://cdn.jsdelivr.net/gh/chalk/ansi-styles@8261697c95bf34b6c7767e2cbe9941a851d59385/screenshot.svg" width="900">
|
||||
|
||||
|
||||
## Highlights
|
||||
|
||||
- Expressive API
|
||||
- Highly performant
|
||||
- Ability to nest styles
|
||||
- [256/Truecolor color support](#256-and-truecolor-color-support)
|
||||
- Auto-detects color support
|
||||
- Doesn't extend `String.prototype`
|
||||
- Clean and focused
|
||||
- Actively maintained
|
||||
- [Used by ~46,000 packages](https://www.npmjs.com/browse/depended/chalk) as of October 1, 2019
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```console
|
||||
$ npm install chalk
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const chalk = require('chalk');
|
||||
|
||||
console.log(chalk.blue('Hello world!'));
|
||||
```
|
||||
|
||||
Chalk comes with an easy to use composable API where you just chain and nest the styles you want.
|
||||
|
||||
```js
|
||||
const chalk = require('chalk');
|
||||
const log = console.log;
|
||||
|
||||
// Combine styled and normal strings
|
||||
log(chalk.blue('Hello') + ' World' + chalk.red('!'));
|
||||
|
||||
// Compose multiple styles using the chainable API
|
||||
log(chalk.blue.bgRed.bold('Hello world!'));
|
||||
|
||||
// Pass in multiple arguments
|
||||
log(chalk.blue('Hello', 'World!', 'Foo', 'bar', 'biz', 'baz'));
|
||||
|
||||
// Nest styles
|
||||
log(chalk.red('Hello', chalk.underline.bgBlue('world') + '!'));
|
||||
|
||||
// Nest styles of the same type even (color, underline, background)
|
||||
log(chalk.green(
|
||||
'I am a green line ' +
|
||||
chalk.blue.underline.bold('with a blue substring') +
|
||||
' that becomes green again!'
|
||||
));
|
||||
|
||||
// ES2015 template literal
|
||||
log(`
|
||||
CPU: ${chalk.red('90%')}
|
||||
RAM: ${chalk.green('40%')}
|
||||
DISK: ${chalk.yellow('70%')}
|
||||
`);
|
||||
|
||||
// ES2015 tagged template literal
|
||||
log(chalk`
|
||||
CPU: {red ${cpu.totalPercent}%}
|
||||
RAM: {green ${ram.used / ram.total * 100}%}
|
||||
DISK: {rgb(255,131,0) ${disk.used / disk.total * 100}%}
|
||||
`);
|
||||
|
||||
// Use RGB colors in terminal emulators that support it.
|
||||
log(chalk.keyword('orange')('Yay for orange colored text!'));
|
||||
log(chalk.rgb(123, 45, 67).underline('Underlined reddish color'));
|
||||
log(chalk.hex('#DEADED').bold('Bold gray!'));
|
||||
```
|
||||
|
||||
Easily define your own themes:
|
||||
|
||||
```js
|
||||
const chalk = require('chalk');
|
||||
|
||||
const error = chalk.bold.red;
|
||||
const warning = chalk.keyword('orange');
|
||||
|
||||
console.log(error('Error!'));
|
||||
console.log(warning('Warning!'));
|
||||
```
|
||||
|
||||
Take advantage of console.log [string substitution](https://nodejs.org/docs/latest/api/console.html#console_console_log_data_args):
|
||||
|
||||
```js
|
||||
const name = 'Sindre';
|
||||
console.log(chalk.green('Hello %s'), name);
|
||||
//=> 'Hello Sindre'
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### chalk.`<style>[.<style>...](string, [string...])`
|
||||
|
||||
Example: `chalk.red.bold.underline('Hello', 'world');`
|
||||
|
||||
Chain [styles](#styles) and call the last one as a method with a string argument. Order doesn't matter, and later styles take precedent in case of a conflict. This simply means that `chalk.red.yellow.green` is equivalent to `chalk.green`.
|
||||
|
||||
Multiple arguments will be separated by space.
|
||||
|
||||
### chalk.level
|
||||
|
||||
Specifies the level of color support.
|
||||
|
||||
Color support is automatically detected, but you can override it by setting the `level` property. You should however only do this in your own code as it applies globally to all Chalk consumers.
|
||||
|
||||
If you need to change this in a reusable module, create a new instance:
|
||||
|
||||
```js
|
||||
const ctx = new chalk.Instance({level: 0});
|
||||
```
|
||||
|
||||
| Level | Description |
|
||||
| :---: | :--- |
|
||||
| `0` | All colors disabled |
|
||||
| `1` | Basic color support (16 colors) |
|
||||
| `2` | 256 color support |
|
||||
| `3` | Truecolor support (16 million colors) |
|
||||
|
||||
### chalk.supportsColor
|
||||
|
||||
Detect whether the terminal [supports color](https://github.com/chalk/supports-color). Used internally and handled for you, but exposed for convenience.
|
||||
|
||||
Can be overridden by the user with the flags `--color` and `--no-color`. For situations where using `--color` is not possible, use the environment variable `FORCE_COLOR=1` (level 1), `FORCE_COLOR=2` (level 2), or `FORCE_COLOR=3` (level 3) to forcefully enable color, or `FORCE_COLOR=0` to forcefully disable. The use of `FORCE_COLOR` overrides all other color support checks.
|
||||
|
||||
Explicit 256/Truecolor mode can be enabled using the `--color=256` and `--color=16m` flags, respectively.
|
||||
|
||||
### chalk.stderr and chalk.stderr.supportsColor
|
||||
|
||||
`chalk.stderr` contains a separate instance configured with color support detected for `stderr` stream instead of `stdout`. Override rules from `chalk.supportsColor` apply to this too. `chalk.stderr.supportsColor` is exposed for convenience.
|
||||
|
||||
|
||||
## Styles
|
||||
|
||||
### Modifiers
|
||||
|
||||
- `reset` - Resets the current color chain.
|
||||
- `bold` - Make text bold.
|
||||
- `dim` - Emitting only a small amount of light.
|
||||
- `italic` - Make text italic. *(Not widely supported)*
|
||||
- `underline` - Make text underline. *(Not widely supported)*
|
||||
- `inverse`- Inverse background and foreground colors.
|
||||
- `hidden` - Prints the text, but makes it invisible.
|
||||
- `strikethrough` - Puts a horizontal line through the center of the text. *(Not widely supported)*
|
||||
- `visible`- Prints the text only when Chalk has a color level > 0. Can be useful for things that are purely cosmetic.
|
||||
|
||||
### Colors
|
||||
|
||||
- `black`
|
||||
- `red`
|
||||
- `green`
|
||||
- `yellow`
|
||||
- `blue`
|
||||
- `magenta`
|
||||
- `cyan`
|
||||
- `white`
|
||||
- `blackBright` (alias: `gray`, `grey`)
|
||||
- `redBright`
|
||||
- `greenBright`
|
||||
- `yellowBright`
|
||||
- `blueBright`
|
||||
- `magentaBright`
|
||||
- `cyanBright`
|
||||
- `whiteBright`
|
||||
|
||||
### Background colors
|
||||
|
||||
- `bgBlack`
|
||||
- `bgRed`
|
||||
- `bgGreen`
|
||||
- `bgYellow`
|
||||
- `bgBlue`
|
||||
- `bgMagenta`
|
||||
- `bgCyan`
|
||||
- `bgWhite`
|
||||
- `bgBlackBright` (alias: `bgGray`, `bgGrey`)
|
||||
- `bgRedBright`
|
||||
- `bgGreenBright`
|
||||
- `bgYellowBright`
|
||||
- `bgBlueBright`
|
||||
- `bgMagentaBright`
|
||||
- `bgCyanBright`
|
||||
- `bgWhiteBright`
|
||||
|
||||
|
||||
## Tagged template literal
|
||||
|
||||
Chalk can be used as a [tagged template literal](http://exploringjs.com/es6/ch_template-literals.html#_tagged-template-literals).
|
||||
|
||||
```js
|
||||
const chalk = require('chalk');
|
||||
|
||||
const miles = 18;
|
||||
const calculateFeet = miles => miles * 5280;
|
||||
|
||||
console.log(chalk`
|
||||
There are {bold 5280 feet} in a mile.
|
||||
In {bold ${miles} miles}, there are {green.bold ${calculateFeet(miles)} feet}.
|
||||
`);
|
||||
```
|
||||
|
||||
Blocks are delimited by an opening curly brace (`{`), a style, some content, and a closing curly brace (`}`).
|
||||
|
||||
Template styles are chained exactly like normal Chalk styles. The following two statements are equivalent:
|
||||
|
||||
```js
|
||||
console.log(chalk.bold.rgb(10, 100, 200)('Hello!'));
|
||||
console.log(chalk`{bold.rgb(10,100,200) Hello!}`);
|
||||
```
|
||||
|
||||
Note that function styles (`rgb()`, `hsl()`, `keyword()`, etc.) may not contain spaces between parameters.
|
||||
|
||||
All interpolated values (`` chalk`${foo}` ``) are converted to strings via the `.toString()` method. All curly braces (`{` and `}`) in interpolated value strings are escaped.
|
||||
|
||||
|
||||
## 256 and Truecolor color support
|
||||
|
||||
Chalk supports 256 colors and [Truecolor](https://gist.github.com/XVilka/8346728) (16 million colors) on supported terminal apps.
|
||||
|
||||
Colors are downsampled from 16 million RGB values to an ANSI color format that is supported by the terminal emulator (or by specifying `{level: n}` as a Chalk option). For example, Chalk configured to run at level 1 (basic color support) will downsample an RGB value of #FF0000 (red) to 31 (ANSI escape for red).
|
||||
|
||||
Examples:
|
||||
|
||||
- `chalk.hex('#DEADED').underline('Hello, world!')`
|
||||
- `chalk.keyword('orange')('Some orange text')`
|
||||
- `chalk.rgb(15, 100, 204).inverse('Hello!')`
|
||||
|
||||
Background versions of these models are prefixed with `bg` and the first level of the module capitalized (e.g. `keyword` for foreground colors and `bgKeyword` for background colors).
|
||||
|
||||
- `chalk.bgHex('#DEADED').underline('Hello, world!')`
|
||||
- `chalk.bgKeyword('orange')('Some orange text')`
|
||||
- `chalk.bgRgb(15, 100, 204).inverse('Hello!')`
|
||||
|
||||
The following color models can be used:
|
||||
|
||||
- [`rgb`](https://en.wikipedia.org/wiki/RGB_color_model) - Example: `chalk.rgb(255, 136, 0).bold('Orange!')`
|
||||
- [`hex`](https://en.wikipedia.org/wiki/Web_colors#Hex_triplet) - Example: `chalk.hex('#FF8800').bold('Orange!')`
|
||||
- [`keyword`](https://www.w3.org/wiki/CSS/Properties/color/keywords) (CSS keywords) - Example: `chalk.keyword('orange').bold('Orange!')`
|
||||
- [`hsl`](https://en.wikipedia.org/wiki/HSL_and_HSV) - Example: `chalk.hsl(32, 100, 50).bold('Orange!')`
|
||||
- [`hsv`](https://en.wikipedia.org/wiki/HSL_and_HSV) - Example: `chalk.hsv(32, 100, 100).bold('Orange!')`
|
||||
- [`hwb`](https://en.wikipedia.org/wiki/HWB_color_model) - Example: `chalk.hwb(32, 0, 50).bold('Orange!')`
|
||||
- [`ansi`](https://en.wikipedia.org/wiki/ANSI_escape_code#3/4_bit) - Example: `chalk.ansi(31).bgAnsi(93)('red on yellowBright')`
|
||||
- [`ansi256`](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) - Example: `chalk.bgAnsi256(194)('Honeydew, more or less')`
|
||||
|
||||
|
||||
## Windows
|
||||
|
||||
If you're on Windows, do yourself a favor and use [Windows Terminal](https://github.com/microsoft/terminal) instead of `cmd.exe`.
|
||||
|
||||
|
||||
## Origin story
|
||||
|
||||
[colors.js](https://github.com/Marak/colors.js) used to be the most popular string styling module, but it has serious deficiencies like extending `String.prototype` which causes all kinds of [problems](https://github.com/yeoman/yo/issues/68) and the package is unmaintained. Although there are other packages, they either do too much or not enough. Chalk is a clean and focused alternative.
|
||||
|
||||
|
||||
## chalk for enterprise
|
||||
|
||||
Available as part of the Tidelift Subscription.
|
||||
|
||||
The maintainers of chalk and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-chalk?utm_source=npm-chalk&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [chalk-cli](https://github.com/chalk/chalk-cli) - CLI for this module
|
||||
- [ansi-styles](https://github.com/chalk/ansi-styles) - ANSI escape codes for styling strings in the terminal
|
||||
- [supports-color](https://github.com/chalk/supports-color) - Detect whether a terminal supports color
|
||||
- [strip-ansi](https://github.com/chalk/strip-ansi) - Strip ANSI escape codes
|
||||
- [strip-ansi-stream](https://github.com/chalk/strip-ansi-stream) - Strip ANSI escape codes from a stream
|
||||
- [has-ansi](https://github.com/chalk/has-ansi) - Check if a string has ANSI escape codes
|
||||
- [ansi-regex](https://github.com/chalk/ansi-regex) - Regular expression for matching ANSI escape codes
|
||||
- [wrap-ansi](https://github.com/chalk/wrap-ansi) - Wordwrap a string with ANSI escape codes
|
||||
- [slice-ansi](https://github.com/chalk/slice-ansi) - Slice a string with ANSI escape codes
|
||||
- [color-convert](https://github.com/qix-/color-convert) - Converts colors between different models
|
||||
- [chalk-animation](https://github.com/bokub/chalk-animation) - Animate strings in the terminal
|
||||
- [gradient-string](https://github.com/bokub/gradient-string) - Apply color gradients to strings
|
||||
- [chalk-pipe](https://github.com/LitoMore/chalk-pipe) - Create chalk style schemes with simpler style strings
|
||||
- [terminal-link](https://github.com/sindresorhus/terminal-link) - Create clickable links in the terminal
|
||||
|
||||
|
||||
## Maintainers
|
||||
|
||||
- [Sindre Sorhus](https://github.com/sindresorhus)
|
||||
- [Josh Junon](https://github.com/qix-)
|
233
node_modules/@jest/console/node_modules/chalk/source/index.js
generated
vendored
Normal file
233
node_modules/@jest/console/node_modules/chalk/source/index.js
generated
vendored
Normal file
@ -0,0 +1,233 @@
|
||||
'use strict';
|
||||
const ansiStyles = require('ansi-styles');
|
||||
const {stdout: stdoutColor, stderr: stderrColor} = require('supports-color');
|
||||
const {
|
||||
stringReplaceAll,
|
||||
stringEncaseCRLFWithFirstIndex
|
||||
} = require('./util');
|
||||
|
||||
// `supportsColor.level` → `ansiStyles.color[name]` mapping
|
||||
const levelMapping = [
|
||||
'ansi',
|
||||
'ansi',
|
||||
'ansi256',
|
||||
'ansi16m'
|
||||
];
|
||||
|
||||
const styles = Object.create(null);
|
||||
|
||||
const applyOptions = (object, options = {}) => {
|
||||
if (options.level > 3 || options.level < 0) {
|
||||
throw new Error('The `level` option should be an integer from 0 to 3');
|
||||
}
|
||||
|
||||
// Detect level if not set manually
|
||||
const colorLevel = stdoutColor ? stdoutColor.level : 0;
|
||||
object.level = options.level === undefined ? colorLevel : options.level;
|
||||
};
|
||||
|
||||
class ChalkClass {
|
||||
constructor(options) {
|
||||
return chalkFactory(options);
|
||||
}
|
||||
}
|
||||
|
||||
const chalkFactory = options => {
|
||||
const chalk = {};
|
||||
applyOptions(chalk, options);
|
||||
|
||||
chalk.template = (...arguments_) => chalkTag(chalk.template, ...arguments_);
|
||||
|
||||
Object.setPrototypeOf(chalk, Chalk.prototype);
|
||||
Object.setPrototypeOf(chalk.template, chalk);
|
||||
|
||||
chalk.template.constructor = () => {
|
||||
throw new Error('`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.');
|
||||
};
|
||||
|
||||
chalk.template.Instance = ChalkClass;
|
||||
|
||||
return chalk.template;
|
||||
};
|
||||
|
||||
function Chalk(options) {
|
||||
return chalkFactory(options);
|
||||
}
|
||||
|
||||
for (const [styleName, style] of Object.entries(ansiStyles)) {
|
||||
styles[styleName] = {
|
||||
get() {
|
||||
const builder = createBuilder(this, createStyler(style.open, style.close, this._styler), this._isEmpty);
|
||||
Object.defineProperty(this, styleName, {value: builder});
|
||||
return builder;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
styles.visible = {
|
||||
get() {
|
||||
const builder = createBuilder(this, this._styler, true);
|
||||
Object.defineProperty(this, 'visible', {value: builder});
|
||||
return builder;
|
||||
}
|
||||
};
|
||||
|
||||
const usedModels = ['rgb', 'hex', 'keyword', 'hsl', 'hsv', 'hwb', 'ansi', 'ansi256'];
|
||||
|
||||
for (const model of usedModels) {
|
||||
styles[model] = {
|
||||
get() {
|
||||
const {level} = this;
|
||||
return function (...arguments_) {
|
||||
const styler = createStyler(ansiStyles.color[levelMapping[level]][model](...arguments_), ansiStyles.color.close, this._styler);
|
||||
return createBuilder(this, styler, this._isEmpty);
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
for (const model of usedModels) {
|
||||
const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1);
|
||||
styles[bgModel] = {
|
||||
get() {
|
||||
const {level} = this;
|
||||
return function (...arguments_) {
|
||||
const styler = createStyler(ansiStyles.bgColor[levelMapping[level]][model](...arguments_), ansiStyles.bgColor.close, this._styler);
|
||||
return createBuilder(this, styler, this._isEmpty);
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
const proto = Object.defineProperties(() => {}, {
|
||||
...styles,
|
||||
level: {
|
||||
enumerable: true,
|
||||
get() {
|
||||
return this._generator.level;
|
||||
},
|
||||
set(level) {
|
||||
this._generator.level = level;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const createStyler = (open, close, parent) => {
|
||||
let openAll;
|
||||
let closeAll;
|
||||
if (parent === undefined) {
|
||||
openAll = open;
|
||||
closeAll = close;
|
||||
} else {
|
||||
openAll = parent.openAll + open;
|
||||
closeAll = close + parent.closeAll;
|
||||
}
|
||||
|
||||
return {
|
||||
open,
|
||||
close,
|
||||
openAll,
|
||||
closeAll,
|
||||
parent
|
||||
};
|
||||
};
|
||||
|
||||
const createBuilder = (self, _styler, _isEmpty) => {
|
||||
const builder = (...arguments_) => {
|
||||
// Single argument is hot path, implicit coercion is faster than anything
|
||||
// eslint-disable-next-line no-implicit-coercion
|
||||
return applyStyle(builder, (arguments_.length === 1) ? ('' + arguments_[0]) : arguments_.join(' '));
|
||||
};
|
||||
|
||||
// `__proto__` is used because we must return a function, but there is
|
||||
// no way to create a function with a different prototype
|
||||
builder.__proto__ = proto; // eslint-disable-line no-proto
|
||||
|
||||
builder._generator = self;
|
||||
builder._styler = _styler;
|
||||
builder._isEmpty = _isEmpty;
|
||||
|
||||
return builder;
|
||||
};
|
||||
|
||||
const applyStyle = (self, string) => {
|
||||
if (self.level <= 0 || !string) {
|
||||
return self._isEmpty ? '' : string;
|
||||
}
|
||||
|
||||
let styler = self._styler;
|
||||
|
||||
if (styler === undefined) {
|
||||
return string;
|
||||
}
|
||||
|
||||
const {openAll, closeAll} = styler;
|
||||
if (string.indexOf('\u001B') !== -1) {
|
||||
while (styler !== undefined) {
|
||||
// Replace any instances already present with a re-opening code
|
||||
// otherwise only the part of the string until said closing code
|
||||
// will be colored, and the rest will simply be 'plain'.
|
||||
string = stringReplaceAll(string, styler.close, styler.open);
|
||||
|
||||
styler = styler.parent;
|
||||
}
|
||||
}
|
||||
|
||||
// We can move both next actions out of loop, because remaining actions in loop won't have
|
||||
// any/visible effect on parts we add here. Close the styling before a linebreak and reopen
|
||||
// after next line to fix a bleed issue on macOS: https://github.com/chalk/chalk/pull/92
|
||||
const lfIndex = string.indexOf('\n');
|
||||
if (lfIndex !== -1) {
|
||||
string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
|
||||
}
|
||||
|
||||
return openAll + string + closeAll;
|
||||
};
|
||||
|
||||
let template;
|
||||
const chalkTag = (chalk, ...strings) => {
|
||||
const [firstString] = strings;
|
||||
|
||||
if (!Array.isArray(firstString)) {
|
||||
// If chalk() was called by itself or with a string,
|
||||
// return the string itself as a string.
|
||||
return strings.join(' ');
|
||||
}
|
||||
|
||||
const arguments_ = strings.slice(1);
|
||||
const parts = [firstString.raw[0]];
|
||||
|
||||
for (let i = 1; i < firstString.length; i++) {
|
||||
parts.push(
|
||||
String(arguments_[i - 1]).replace(/[{}\\]/g, '\\$&'),
|
||||
String(firstString.raw[i])
|
||||
);
|
||||
}
|
||||
|
||||
if (template === undefined) {
|
||||
template = require('./templates');
|
||||
}
|
||||
|
||||
return template(chalk, parts.join(''));
|
||||
};
|
||||
|
||||
Object.defineProperties(Chalk.prototype, styles);
|
||||
|
||||
const chalk = Chalk(); // eslint-disable-line new-cap
|
||||
chalk.supportsColor = stdoutColor;
|
||||
chalk.stderr = Chalk({level: stderrColor ? stderrColor.level : 0}); // eslint-disable-line new-cap
|
||||
chalk.stderr.supportsColor = stderrColor;
|
||||
|
||||
// For TypeScript
|
||||
chalk.Level = {
|
||||
None: 0,
|
||||
Basic: 1,
|
||||
Ansi256: 2,
|
||||
TrueColor: 3,
|
||||
0: 'None',
|
||||
1: 'Basic',
|
||||
2: 'Ansi256',
|
||||
3: 'TrueColor'
|
||||
};
|
||||
|
||||
module.exports = chalk;
|
134
node_modules/@jest/console/node_modules/chalk/source/templates.js
generated
vendored
Normal file
134
node_modules/@jest/console/node_modules/chalk/source/templates.js
generated
vendored
Normal file
@ -0,0 +1,134 @@
|
||||
'use strict';
|
||||
const TEMPLATE_REGEX = /(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
|
||||
const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
|
||||
const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
|
||||
const ESCAPE_REGEX = /\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.)|([^\\])/gi;
|
||||
|
||||
const ESCAPES = new Map([
|
||||
['n', '\n'],
|
||||
['r', '\r'],
|
||||
['t', '\t'],
|
||||
['b', '\b'],
|
||||
['f', '\f'],
|
||||
['v', '\v'],
|
||||
['0', '\0'],
|
||||
['\\', '\\'],
|
||||
['e', '\u001B'],
|
||||
['a', '\u0007']
|
||||
]);
|
||||
|
||||
function unescape(c) {
|
||||
const u = c[0] === 'u';
|
||||
const bracket = c[1] === '{';
|
||||
|
||||
if ((u && !bracket && c.length === 5) || (c[0] === 'x' && c.length === 3)) {
|
||||
return String.fromCharCode(parseInt(c.slice(1), 16));
|
||||
}
|
||||
|
||||
if (u && bracket) {
|
||||
return String.fromCodePoint(parseInt(c.slice(2, -1), 16));
|
||||
}
|
||||
|
||||
return ESCAPES.get(c) || c;
|
||||
}
|
||||
|
||||
function parseArguments(name, arguments_) {
|
||||
const results = [];
|
||||
const chunks = arguments_.trim().split(/\s*,\s*/g);
|
||||
let matches;
|
||||
|
||||
for (const chunk of chunks) {
|
||||
const number = Number(chunk);
|
||||
if (!Number.isNaN(number)) {
|
||||
results.push(number);
|
||||
} else if ((matches = chunk.match(STRING_REGEX))) {
|
||||
results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, character) => escape ? unescape(escape) : character));
|
||||
} else {
|
||||
throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`);
|
||||
}
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
function parseStyle(style) {
|
||||
STYLE_REGEX.lastIndex = 0;
|
||||
|
||||
const results = [];
|
||||
let matches;
|
||||
|
||||
while ((matches = STYLE_REGEX.exec(style)) !== null) {
|
||||
const name = matches[1];
|
||||
|
||||
if (matches[2]) {
|
||||
const args = parseArguments(name, matches[2]);
|
||||
results.push([name].concat(args));
|
||||
} else {
|
||||
results.push([name]);
|
||||
}
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
function buildStyle(chalk, styles) {
|
||||
const enabled = {};
|
||||
|
||||
for (const layer of styles) {
|
||||
for (const style of layer.styles) {
|
||||
enabled[style[0]] = layer.inverse ? null : style.slice(1);
|
||||
}
|
||||
}
|
||||
|
||||
let current = chalk;
|
||||
for (const [styleName, styles] of Object.entries(enabled)) {
|
||||
if (!Array.isArray(styles)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!(styleName in current)) {
|
||||
throw new Error(`Unknown Chalk style: ${styleName}`);
|
||||
}
|
||||
|
||||
current = styles.length > 0 ? current[styleName](...styles) : current[styleName];
|
||||
}
|
||||
|
||||
return current;
|
||||
}
|
||||
|
||||
module.exports = (chalk, temporary) => {
|
||||
const styles = [];
|
||||
const chunks = [];
|
||||
let chunk = [];
|
||||
|
||||
// eslint-disable-next-line max-params
|
||||
temporary.replace(TEMPLATE_REGEX, (m, escapeCharacter, inverse, style, close, character) => {
|
||||
if (escapeCharacter) {
|
||||
chunk.push(unescape(escapeCharacter));
|
||||
} else if (style) {
|
||||
const string = chunk.join('');
|
||||
chunk = [];
|
||||
chunks.push(styles.length === 0 ? string : buildStyle(chalk, styles)(string));
|
||||
styles.push({inverse, styles: parseStyle(style)});
|
||||
} else if (close) {
|
||||
if (styles.length === 0) {
|
||||
throw new Error('Found extraneous } in Chalk template literal');
|
||||
}
|
||||
|
||||
chunks.push(buildStyle(chalk, styles)(chunk.join('')));
|
||||
chunk = [];
|
||||
styles.pop();
|
||||
} else {
|
||||
chunk.push(character);
|
||||
}
|
||||
});
|
||||
|
||||
chunks.push(chunk.join(''));
|
||||
|
||||
if (styles.length > 0) {
|
||||
const errMsg = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? '' : 's'} (\`}\`)`;
|
||||
throw new Error(errMsg);
|
||||
}
|
||||
|
||||
return chunks.join('');
|
||||
};
|
39
node_modules/@jest/console/node_modules/chalk/source/util.js
generated
vendored
Normal file
39
node_modules/@jest/console/node_modules/chalk/source/util.js
generated
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
'use strict';
|
||||
|
||||
const stringReplaceAll = (string, substring, replacer) => {
|
||||
let index = string.indexOf(substring);
|
||||
if (index === -1) {
|
||||
return string;
|
||||
}
|
||||
|
||||
const substringLength = substring.length;
|
||||
let endIndex = 0;
|
||||
let returnValue = '';
|
||||
do {
|
||||
returnValue += string.substr(endIndex, index - endIndex) + substring + replacer;
|
||||
endIndex = index + substringLength;
|
||||
index = string.indexOf(substring, endIndex);
|
||||
} while (index !== -1);
|
||||
|
||||
returnValue += string.substr(endIndex);
|
||||
return returnValue;
|
||||
};
|
||||
|
||||
const stringEncaseCRLFWithFirstIndex = (string, prefix, postfix, index) => {
|
||||
let endIndex = 0;
|
||||
let returnValue = '';
|
||||
do {
|
||||
const gotCR = string[index - 1] === '\r';
|
||||
returnValue += string.substr(endIndex, (gotCR ? index - 1 : index) - endIndex) + prefix + (gotCR ? '\r\n' : '\n') + postfix;
|
||||
endIndex = index + 1;
|
||||
index = string.indexOf('\n', endIndex);
|
||||
} while (index !== -1);
|
||||
|
||||
returnValue += string.substr(endIndex);
|
||||
return returnValue;
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
stringReplaceAll,
|
||||
stringEncaseCRLFWithFirstIndex
|
||||
};
|
54
node_modules/@jest/console/node_modules/color-convert/CHANGELOG.md
generated
vendored
Normal file
54
node_modules/@jest/console/node_modules/color-convert/CHANGELOG.md
generated
vendored
Normal file
@ -0,0 +1,54 @@
|
||||
# 1.0.0 - 2016-01-07
|
||||
|
||||
- Removed: unused speed test
|
||||
- Added: Automatic routing between previously unsupported conversions
|
||||
([#27](https://github.com/Qix-/color-convert/pull/27))
|
||||
- Removed: `xxx2xxx()` and `xxx2xxxRaw()` functions
|
||||
([#27](https://github.com/Qix-/color-convert/pull/27))
|
||||
- Removed: `convert()` class
|
||||
([#27](https://github.com/Qix-/color-convert/pull/27))
|
||||
- Changed: all functions to lookup dictionary
|
||||
([#27](https://github.com/Qix-/color-convert/pull/27))
|
||||
- Changed: `ansi` to `ansi256`
|
||||
([#27](https://github.com/Qix-/color-convert/pull/27))
|
||||
- Fixed: argument grouping for functions requiring only one argument
|
||||
([#27](https://github.com/Qix-/color-convert/pull/27))
|
||||
|
||||
# 0.6.0 - 2015-07-23
|
||||
|
||||
- Added: methods to handle
|
||||
[ANSI](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors) 16/256 colors:
|
||||
- rgb2ansi16
|
||||
- rgb2ansi
|
||||
- hsl2ansi16
|
||||
- hsl2ansi
|
||||
- hsv2ansi16
|
||||
- hsv2ansi
|
||||
- hwb2ansi16
|
||||
- hwb2ansi
|
||||
- cmyk2ansi16
|
||||
- cmyk2ansi
|
||||
- keyword2ansi16
|
||||
- keyword2ansi
|
||||
- ansi162rgb
|
||||
- ansi162hsl
|
||||
- ansi162hsv
|
||||
- ansi162hwb
|
||||
- ansi162cmyk
|
||||
- ansi162keyword
|
||||
- ansi2rgb
|
||||
- ansi2hsl
|
||||
- ansi2hsv
|
||||
- ansi2hwb
|
||||
- ansi2cmyk
|
||||
- ansi2keyword
|
||||
([#18](https://github.com/harthur/color-convert/pull/18))
|
||||
|
||||
# 0.5.3 - 2015-06-02
|
||||
|
||||
- Fixed: hsl2hsv does not return `NaN` anymore when using `[0,0,0]`
|
||||
([#15](https://github.com/harthur/color-convert/issues/15))
|
||||
|
||||
---
|
||||
|
||||
Check out commit logs for older releases
|
21
node_modules/@jest/console/node_modules/color-convert/LICENSE
generated
vendored
Normal file
21
node_modules/@jest/console/node_modules/color-convert/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
Copyright (c) 2011-2016 Heather Arthur <fayearthur@gmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
68
node_modules/@jest/console/node_modules/color-convert/README.md
generated
vendored
Normal file
68
node_modules/@jest/console/node_modules/color-convert/README.md
generated
vendored
Normal file
@ -0,0 +1,68 @@
|
||||
# color-convert
|
||||
|
||||
[](https://travis-ci.org/Qix-/color-convert)
|
||||
|
||||
Color-convert is a color conversion library for JavaScript and node.
|
||||
It converts all ways between `rgb`, `hsl`, `hsv`, `hwb`, `cmyk`, `ansi`, `ansi16`, `hex` strings, and CSS `keyword`s (will round to closest):
|
||||
|
||||
```js
|
||||
var convert = require('color-convert');
|
||||
|
||||
convert.rgb.hsl(140, 200, 100); // [96, 48, 59]
|
||||
convert.keyword.rgb('blue'); // [0, 0, 255]
|
||||
|
||||
var rgbChannels = convert.rgb.channels; // 3
|
||||
var cmykChannels = convert.cmyk.channels; // 4
|
||||
var ansiChannels = convert.ansi16.channels; // 1
|
||||
```
|
||||
|
||||
# Install
|
||||
|
||||
```console
|
||||
$ npm install color-convert
|
||||
```
|
||||
|
||||
# API
|
||||
|
||||
Simply get the property of the _from_ and _to_ conversion that you're looking for.
|
||||
|
||||
All functions have a rounded and unrounded variant. By default, return values are rounded. To get the unrounded (raw) results, simply tack on `.raw` to the function.
|
||||
|
||||
All 'from' functions have a hidden property called `.channels` that indicates the number of channels the function expects (not including alpha).
|
||||
|
||||
```js
|
||||
var convert = require('color-convert');
|
||||
|
||||
// Hex to LAB
|
||||
convert.hex.lab('DEADBF'); // [ 76, 21, -2 ]
|
||||
convert.hex.lab.raw('DEADBF'); // [ 75.56213190997677, 20.653827952644754, -2.290532499330533 ]
|
||||
|
||||
// RGB to CMYK
|
||||
convert.rgb.cmyk(167, 255, 4); // [ 35, 0, 98, 0 ]
|
||||
convert.rgb.cmyk.raw(167, 255, 4); // [ 34.509803921568626, 0, 98.43137254901961, 0 ]
|
||||
```
|
||||
|
||||
### Arrays
|
||||
All functions that accept multiple arguments also support passing an array.
|
||||
|
||||
Note that this does **not** apply to functions that convert from a color that only requires one value (e.g. `keyword`, `ansi256`, `hex`, etc.)
|
||||
|
||||
```js
|
||||
var convert = require('color-convert');
|
||||
|
||||
convert.rgb.hex(123, 45, 67); // '7B2D43'
|
||||
convert.rgb.hex([123, 45, 67]); // '7B2D43'
|
||||
```
|
||||
|
||||
## Routing
|
||||
|
||||
Conversions that don't have an _explicitly_ defined conversion (in [conversions.js](conversions.js)), but can be converted by means of sub-conversions (e.g. XYZ -> **RGB** -> CMYK), are automatically routed together. This allows just about any color model supported by `color-convert` to be converted to any other model, so long as a sub-conversion path exists. This is also true for conversions requiring more than one step in between (e.g. LCH -> **LAB** -> **XYZ** -> **RGB** -> Hex).
|
||||
|
||||
Keep in mind that extensive conversions _may_ result in a loss of precision, and exist only to be complete. For a list of "direct" (single-step) conversions, see [conversions.js](conversions.js).
|
||||
|
||||
# Contribute
|
||||
|
||||
If there is a new model you would like to support, or want to add a direct conversion between two existing models, please send us a pull request.
|
||||
|
||||
# License
|
||||
Copyright © 2011-2016, Heather Arthur and Josh Junon. Licensed under the [MIT License](LICENSE).
|
839
node_modules/@jest/console/node_modules/color-convert/conversions.js
generated
vendored
Normal file
839
node_modules/@jest/console/node_modules/color-convert/conversions.js
generated
vendored
Normal file
@ -0,0 +1,839 @@
|
||||
/* MIT license */
|
||||
/* eslint-disable no-mixed-operators */
|
||||
const cssKeywords = require('color-name');
|
||||
|
||||
// NOTE: conversions should only return primitive values (i.e. arrays, or
|
||||
// values that give correct `typeof` results).
|
||||
// do not use box values types (i.e. Number(), String(), etc.)
|
||||
|
||||
const reverseKeywords = {};
|
||||
for (const key of Object.keys(cssKeywords)) {
|
||||
reverseKeywords[cssKeywords[key]] = key;
|
||||
}
|
||||
|
||||
const convert = {
|
||||
rgb: {channels: 3, labels: 'rgb'},
|
||||
hsl: {channels: 3, labels: 'hsl'},
|
||||
hsv: {channels: 3, labels: 'hsv'},
|
||||
hwb: {channels: 3, labels: 'hwb'},
|
||||
cmyk: {channels: 4, labels: 'cmyk'},
|
||||
xyz: {channels: 3, labels: 'xyz'},
|
||||
lab: {channels: 3, labels: 'lab'},
|
||||
lch: {channels: 3, labels: 'lch'},
|
||||
hex: {channels: 1, labels: ['hex']},
|
||||
keyword: {channels: 1, labels: ['keyword']},
|
||||
ansi16: {channels: 1, labels: ['ansi16']},
|
||||
ansi256: {channels: 1, labels: ['ansi256']},
|
||||
hcg: {channels: 3, labels: ['h', 'c', 'g']},
|
||||
apple: {channels: 3, labels: ['r16', 'g16', 'b16']},
|
||||
gray: {channels: 1, labels: ['gray']}
|
||||
};
|
||||
|
||||
module.exports = convert;
|
||||
|
||||
// Hide .channels and .labels properties
|
||||
for (const model of Object.keys(convert)) {
|
||||
if (!('channels' in convert[model])) {
|
||||
throw new Error('missing channels property: ' + model);
|
||||
}
|
||||
|
||||
if (!('labels' in convert[model])) {
|
||||
throw new Error('missing channel labels property: ' + model);
|
||||
}
|
||||
|
||||
if (convert[model].labels.length !== convert[model].channels) {
|
||||
throw new Error('channel and label counts mismatch: ' + model);
|
||||
}
|
||||
|
||||
const {channels, labels} = convert[model];
|
||||
delete convert[model].channels;
|
||||
delete convert[model].labels;
|
||||
Object.defineProperty(convert[model], 'channels', {value: channels});
|
||||
Object.defineProperty(convert[model], 'labels', {value: labels});
|
||||
}
|
||||
|
||||
convert.rgb.hsl = function (rgb) {
|
||||
const r = rgb[0] / 255;
|
||||
const g = rgb[1] / 255;
|
||||
const b = rgb[2] / 255;
|
||||
const min = Math.min(r, g, b);
|
||||
const max = Math.max(r, g, b);
|
||||
const delta = max - min;
|
||||
let h;
|
||||
let s;
|
||||
|
||||
if (max === min) {
|
||||
h = 0;
|
||||
} else if (r === max) {
|
||||
h = (g - b) / delta;
|
||||
} else if (g === max) {
|
||||
h = 2 + (b - r) / delta;
|
||||
} else if (b === max) {
|
||||
h = 4 + (r - g) / delta;
|
||||
}
|
||||
|
||||
h = Math.min(h * 60, 360);
|
||||
|
||||
if (h < 0) {
|
||||
h += 360;
|
||||
}
|
||||
|
||||
const l = (min + max) / 2;
|
||||
|
||||
if (max === min) {
|
||||
s = 0;
|
||||
} else if (l <= 0.5) {
|
||||
s = delta / (max + min);
|
||||
} else {
|
||||
s = delta / (2 - max - min);
|
||||
}
|
||||
|
||||
return [h, s * 100, l * 100];
|
||||
};
|
||||
|
||||
convert.rgb.hsv = function (rgb) {
|
||||
let rdif;
|
||||
let gdif;
|
||||
let bdif;
|
||||
let h;
|
||||
let s;
|
||||
|
||||
const r = rgb[0] / 255;
|
||||
const g = rgb[1] / 255;
|
||||
const b = rgb[2] / 255;
|
||||
const v = Math.max(r, g, b);
|
||||
const diff = v - Math.min(r, g, b);
|
||||
const diffc = function (c) {
|
||||
return (v - c) / 6 / diff + 1 / 2;
|
||||
};
|
||||
|
||||
if (diff === 0) {
|
||||
h = 0;
|
||||
s = 0;
|
||||
} else {
|
||||
s = diff / v;
|
||||
rdif = diffc(r);
|
||||
gdif = diffc(g);
|
||||
bdif = diffc(b);
|
||||
|
||||
if (r === v) {
|
||||
h = bdif - gdif;
|
||||
} else if (g === v) {
|
||||
h = (1 / 3) + rdif - bdif;
|
||||
} else if (b === v) {
|
||||
h = (2 / 3) + gdif - rdif;
|
||||
}
|
||||
|
||||
if (h < 0) {
|
||||
h += 1;
|
||||
} else if (h > 1) {
|
||||
h -= 1;
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
h * 360,
|
||||
s * 100,
|
||||
v * 100
|
||||
];
|
||||
};
|
||||
|
||||
convert.rgb.hwb = function (rgb) {
|
||||
const r = rgb[0];
|
||||
const g = rgb[1];
|
||||
let b = rgb[2];
|
||||
const h = convert.rgb.hsl(rgb)[0];
|
||||
const w = 1 / 255 * Math.min(r, Math.min(g, b));
|
||||
|
||||
b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
|
||||
|
||||
return [h, w * 100, b * 100];
|
||||
};
|
||||
|
||||
convert.rgb.cmyk = function (rgb) {
|
||||
const r = rgb[0] / 255;
|
||||
const g = rgb[1] / 255;
|
||||
const b = rgb[2] / 255;
|
||||
|
||||
const k = Math.min(1 - r, 1 - g, 1 - b);
|
||||
const c = (1 - r - k) / (1 - k) || 0;
|
||||
const m = (1 - g - k) / (1 - k) || 0;
|
||||
const y = (1 - b - k) / (1 - k) || 0;
|
||||
|
||||
return [c * 100, m * 100, y * 100, k * 100];
|
||||
};
|
||||
|
||||
function comparativeDistance(x, y) {
|
||||
/*
|
||||
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
||||
*/
|
||||
return (
|
||||
((x[0] - y[0]) ** 2) +
|
||||
((x[1] - y[1]) ** 2) +
|
||||
((x[2] - y[2]) ** 2)
|
||||
);
|
||||
}
|
||||
|
||||
convert.rgb.keyword = function (rgb) {
|
||||
const reversed = reverseKeywords[rgb];
|
||||
if (reversed) {
|
||||
return reversed;
|
||||
}
|
||||
|
||||
let currentClosestDistance = Infinity;
|
||||
let currentClosestKeyword;
|
||||
|
||||
for (const keyword of Object.keys(cssKeywords)) {
|
||||
const value = cssKeywords[keyword];
|
||||
|
||||
// Compute comparative distance
|
||||
const distance = comparativeDistance(rgb, value);
|
||||
|
||||
// Check if its less, if so set as closest
|
||||
if (distance < currentClosestDistance) {
|
||||
currentClosestDistance = distance;
|
||||
currentClosestKeyword = keyword;
|
||||
}
|
||||
}
|
||||
|
||||
return currentClosestKeyword;
|
||||
};
|
||||
|
||||
convert.keyword.rgb = function (keyword) {
|
||||
return cssKeywords[keyword];
|
||||
};
|
||||
|
||||
convert.rgb.xyz = function (rgb) {
|
||||
let r = rgb[0] / 255;
|
||||
let g = rgb[1] / 255;
|
||||
let b = rgb[2] / 255;
|
||||
|
||||
// Assume sRGB
|
||||
r = r > 0.04045 ? (((r + 0.055) / 1.055) ** 2.4) : (r / 12.92);
|
||||
g = g > 0.04045 ? (((g + 0.055) / 1.055) ** 2.4) : (g / 12.92);
|
||||
b = b > 0.04045 ? (((b + 0.055) / 1.055) ** 2.4) : (b / 12.92);
|
||||
|
||||
const x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805);
|
||||
const y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722);
|
||||
const z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505);
|
||||
|
||||
return [x * 100, y * 100, z * 100];
|
||||
};
|
||||
|
||||
convert.rgb.lab = function (rgb) {
|
||||
const xyz = convert.rgb.xyz(rgb);
|
||||
let x = xyz[0];
|
||||
let y = xyz[1];
|
||||
let z = xyz[2];
|
||||
|
||||
x /= 95.047;
|
||||
y /= 100;
|
||||
z /= 108.883;
|
||||
|
||||
x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116);
|
||||
y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116);
|
||||
z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116);
|
||||
|
||||
const l = (116 * y) - 16;
|
||||
const a = 500 * (x - y);
|
||||
const b = 200 * (y - z);
|
||||
|
||||
return [l, a, b];
|
||||
};
|
||||
|
||||
convert.hsl.rgb = function (hsl) {
|
||||
const h = hsl[0] / 360;
|
||||
const s = hsl[1] / 100;
|
||||
const l = hsl[2] / 100;
|
||||
let t2;
|
||||
let t3;
|
||||
let val;
|
||||
|
||||
if (s === 0) {
|
||||
val = l * 255;
|
||||
return [val, val, val];
|
||||
}
|
||||
|
||||
if (l < 0.5) {
|
||||
t2 = l * (1 + s);
|
||||
} else {
|
||||
t2 = l + s - l * s;
|
||||
}
|
||||
|
||||
const t1 = 2 * l - t2;
|
||||
|
||||
const rgb = [0, 0, 0];
|
||||
for (let i = 0; i < 3; i++) {
|
||||
t3 = h + 1 / 3 * -(i - 1);
|
||||
if (t3 < 0) {
|
||||
t3++;
|
||||
}
|
||||
|
||||
if (t3 > 1) {
|
||||
t3--;
|
||||
}
|
||||
|
||||
if (6 * t3 < 1) {
|
||||
val = t1 + (t2 - t1) * 6 * t3;
|
||||
} else if (2 * t3 < 1) {
|
||||
val = t2;
|
||||
} else if (3 * t3 < 2) {
|
||||
val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
|
||||
} else {
|
||||
val = t1;
|
||||
}
|
||||
|
||||
rgb[i] = val * 255;
|
||||
}
|
||||
|
||||
return rgb;
|
||||
};
|
||||
|
||||
convert.hsl.hsv = function (hsl) {
|
||||
const h = hsl[0];
|
||||
let s = hsl[1] / 100;
|
||||
let l = hsl[2] / 100;
|
||||
let smin = s;
|
||||
const lmin = Math.max(l, 0.01);
|
||||
|
||||
l *= 2;
|
||||
s *= (l <= 1) ? l : 2 - l;
|
||||
smin *= lmin <= 1 ? lmin : 2 - lmin;
|
||||
const v = (l + s) / 2;
|
||||
const sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s);
|
||||
|
||||
return [h, sv * 100, v * 100];
|
||||
};
|
||||
|
||||
convert.hsv.rgb = function (hsv) {
|
||||
const h = hsv[0] / 60;
|
||||
const s = hsv[1] / 100;
|
||||
let v = hsv[2] / 100;
|
||||
const hi = Math.floor(h) % 6;
|
||||
|
||||
const f = h - Math.floor(h);
|
||||
const p = 255 * v * (1 - s);
|
||||
const q = 255 * v * (1 - (s * f));
|
||||
const t = 255 * v * (1 - (s * (1 - f)));
|
||||
v *= 255;
|
||||
|
||||
switch (hi) {
|
||||
case 0:
|
||||
return [v, t, p];
|
||||
case 1:
|
||||
return [q, v, p];
|
||||
case 2:
|
||||
return [p, v, t];
|
||||
case 3:
|
||||
return [p, q, v];
|
||||
case 4:
|
||||
return [t, p, v];
|
||||
case 5:
|
||||
return [v, p, q];
|
||||
}
|
||||
};
|
||||
|
||||
convert.hsv.hsl = function (hsv) {
|
||||
const h = hsv[0];
|
||||
const s = hsv[1] / 100;
|
||||
const v = hsv[2] / 100;
|
||||
const vmin = Math.max(v, 0.01);
|
||||
let sl;
|
||||
let l;
|
||||
|
||||
l = (2 - s) * v;
|
||||
const lmin = (2 - s) * vmin;
|
||||
sl = s * vmin;
|
||||
sl /= (lmin <= 1) ? lmin : 2 - lmin;
|
||||
sl = sl || 0;
|
||||
l /= 2;
|
||||
|
||||
return [h, sl * 100, l * 100];
|
||||
};
|
||||
|
||||
// http://dev.w3.org/csswg/css-color/#hwb-to-rgb
|
||||
convert.hwb.rgb = function (hwb) {
|
||||
const h = hwb[0] / 360;
|
||||
let wh = hwb[1] / 100;
|
||||
let bl = hwb[2] / 100;
|
||||
const ratio = wh + bl;
|
||||
let f;
|
||||
|
||||
// Wh + bl cant be > 1
|
||||
if (ratio > 1) {
|
||||
wh /= ratio;
|
||||
bl /= ratio;
|
||||
}
|
||||
|
||||
const i = Math.floor(6 * h);
|
||||
const v = 1 - bl;
|
||||
f = 6 * h - i;
|
||||
|
||||
if ((i & 0x01) !== 0) {
|
||||
f = 1 - f;
|
||||
}
|
||||
|
||||
const n = wh + f * (v - wh); // Linear interpolation
|
||||
|
||||
let r;
|
||||
let g;
|
||||
let b;
|
||||
/* eslint-disable max-statements-per-line,no-multi-spaces */
|
||||
switch (i) {
|
||||
default:
|
||||
case 6:
|
||||
case 0: r = v; g = n; b = wh; break;
|
||||
case 1: r = n; g = v; b = wh; break;
|
||||
case 2: r = wh; g = v; b = n; break;
|
||||
case 3: r = wh; g = n; b = v; break;
|
||||
case 4: r = n; g = wh; b = v; break;
|
||||
case 5: r = v; g = wh; b = n; break;
|
||||
}
|
||||
/* eslint-enable max-statements-per-line,no-multi-spaces */
|
||||
|
||||
return [r * 255, g * 255, b * 255];
|
||||
};
|
||||
|
||||
convert.cmyk.rgb = function (cmyk) {
|
||||
const c = cmyk[0] / 100;
|
||||
const m = cmyk[1] / 100;
|
||||
const y = cmyk[2] / 100;
|
||||
const k = cmyk[3] / 100;
|
||||
|
||||
const r = 1 - Math.min(1, c * (1 - k) + k);
|
||||
const g = 1 - Math.min(1, m * (1 - k) + k);
|
||||
const b = 1 - Math.min(1, y * (1 - k) + k);
|
||||
|
||||
return [r * 255, g * 255, b * 255];
|
||||
};
|
||||
|
||||
convert.xyz.rgb = function (xyz) {
|
||||
const x = xyz[0] / 100;
|
||||
const y = xyz[1] / 100;
|
||||
const z = xyz[2] / 100;
|
||||
let r;
|
||||
let g;
|
||||
let b;
|
||||
|
||||
r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986);
|
||||
g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415);
|
||||
b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570);
|
||||
|
||||
// Assume sRGB
|
||||
r = r > 0.0031308
|
||||
? ((1.055 * (r ** (1.0 / 2.4))) - 0.055)
|
||||
: r * 12.92;
|
||||
|
||||
g = g > 0.0031308
|
||||
? ((1.055 * (g ** (1.0 / 2.4))) - 0.055)
|
||||
: g * 12.92;
|
||||
|
||||
b = b > 0.0031308
|
||||
? ((1.055 * (b ** (1.0 / 2.4))) - 0.055)
|
||||
: b * 12.92;
|
||||
|
||||
r = Math.min(Math.max(0, r), 1);
|
||||
g = Math.min(Math.max(0, g), 1);
|
||||
b = Math.min(Math.max(0, b), 1);
|
||||
|
||||
return [r * 255, g * 255, b * 255];
|
||||
};
|
||||
|
||||
convert.xyz.lab = function (xyz) {
|
||||
let x = xyz[0];
|
||||
let y = xyz[1];
|
||||
let z = xyz[2];
|
||||
|
||||
x /= 95.047;
|
||||
y /= 100;
|
||||
z /= 108.883;
|
||||
|
||||
x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116);
|
||||
y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116);
|
||||
z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116);
|
||||
|
||||
const l = (116 * y) - 16;
|
||||
const a = 500 * (x - y);
|
||||
const b = 200 * (y - z);
|
||||
|
||||
return [l, a, b];
|
||||
};
|
||||
|
||||
convert.lab.xyz = function (lab) {
|
||||
const l = lab[0];
|
||||
const a = lab[1];
|
||||
const b = lab[2];
|
||||
let x;
|
||||
let y;
|
||||
let z;
|
||||
|
||||
y = (l + 16) / 116;
|
||||
x = a / 500 + y;
|
||||
z = y - b / 200;
|
||||
|
||||
const y2 = y ** 3;
|
||||
const x2 = x ** 3;
|
||||
const z2 = z ** 3;
|
||||
y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;
|
||||
x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;
|
||||
z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;
|
||||
|
||||
x *= 95.047;
|
||||
y *= 100;
|
||||
z *= 108.883;
|
||||
|
||||
return [x, y, z];
|
||||
};
|
||||
|
||||
convert.lab.lch = function (lab) {
|
||||
const l = lab[0];
|
||||
const a = lab[1];
|
||||
const b = lab[2];
|
||||
let h;
|
||||
|
||||
const hr = Math.atan2(b, a);
|
||||
h = hr * 360 / 2 / Math.PI;
|
||||
|
||||
if (h < 0) {
|
||||
h += 360;
|
||||
}
|
||||
|
||||
const c = Math.sqrt(a * a + b * b);
|
||||
|
||||
return [l, c, h];
|
||||
};
|
||||
|
||||
convert.lch.lab = function (lch) {
|
||||
const l = lch[0];
|
||||
const c = lch[1];
|
||||
const h = lch[2];
|
||||
|
||||
const hr = h / 360 * 2 * Math.PI;
|
||||
const a = c * Math.cos(hr);
|
||||
const b = c * Math.sin(hr);
|
||||
|
||||
return [l, a, b];
|
||||
};
|
||||
|
||||
convert.rgb.ansi16 = function (args, saturation = null) {
|
||||
const [r, g, b] = args;
|
||||
let value = saturation === null ? convert.rgb.hsv(args)[2] : saturation; // Hsv -> ansi16 optimization
|
||||
|
||||
value = Math.round(value / 50);
|
||||
|
||||
if (value === 0) {
|
||||
return 30;
|
||||
}
|
||||
|
||||
let ansi = 30
|
||||
+ ((Math.round(b / 255) << 2)
|
||||
| (Math.round(g / 255) << 1)
|
||||
| Math.round(r / 255));
|
||||
|
||||
if (value === 2) {
|
||||
ansi += 60;
|
||||
}
|
||||
|
||||
return ansi;
|
||||
};
|
||||
|
||||
convert.hsv.ansi16 = function (args) {
|
||||
// Optimization here; we already know the value and don't need to get
|
||||
// it converted for us.
|
||||
return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
|
||||
};
|
||||
|
||||
convert.rgb.ansi256 = function (args) {
|
||||
const r = args[0];
|
||||
const g = args[1];
|
||||
const b = args[2];
|
||||
|
||||
// We use the extended greyscale palette here, with the exception of
|
||||
// black and white. normal palette only has 4 greyscale shades.
|
||||
if (r === g && g === b) {
|
||||
if (r < 8) {
|
||||
return 16;
|
||||
}
|
||||
|
||||
if (r > 248) {
|
||||
return 231;
|
||||
}
|
||||
|
||||
return Math.round(((r - 8) / 247) * 24) + 232;
|
||||
}
|
||||
|
||||
const ansi = 16
|
||||
+ (36 * Math.round(r / 255 * 5))
|
||||
+ (6 * Math.round(g / 255 * 5))
|
||||
+ Math.round(b / 255 * 5);
|
||||
|
||||
return ansi;
|
||||
};
|
||||
|
||||
convert.ansi16.rgb = function (args) {
|
||||
let color = args % 10;
|
||||
|
||||
// Handle greyscale
|
||||
if (color === 0 || color === 7) {
|
||||
if (args > 50) {
|
||||
color += 3.5;
|
||||
}
|
||||
|
||||
color = color / 10.5 * 255;
|
||||
|
||||
return [color, color, color];
|
||||
}
|
||||
|
||||
const mult = (~~(args > 50) + 1) * 0.5;
|
||||
const r = ((color & 1) * mult) * 255;
|
||||
const g = (((color >> 1) & 1) * mult) * 255;
|
||||
const b = (((color >> 2) & 1) * mult) * 255;
|
||||
|
||||
return [r, g, b];
|
||||
};
|
||||
|
||||
convert.ansi256.rgb = function (args) {
|
||||
// Handle greyscale
|
||||
if (args >= 232) {
|
||||
const c = (args - 232) * 10 + 8;
|
||||
return [c, c, c];
|
||||
}
|
||||
|
||||
args -= 16;
|
||||
|
||||
let rem;
|
||||
const r = Math.floor(args / 36) / 5 * 255;
|
||||
const g = Math.floor((rem = args % 36) / 6) / 5 * 255;
|
||||
const b = (rem % 6) / 5 * 255;
|
||||
|
||||
return [r, g, b];
|
||||
};
|
||||
|
||||
convert.rgb.hex = function (args) {
|
||||
const integer = ((Math.round(args[0]) & 0xFF) << 16)
|
||||
+ ((Math.round(args[1]) & 0xFF) << 8)
|
||||
+ (Math.round(args[2]) & 0xFF);
|
||||
|
||||
const string = integer.toString(16).toUpperCase();
|
||||
return '000000'.substring(string.length) + string;
|
||||
};
|
||||
|
||||
convert.hex.rgb = function (args) {
|
||||
const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
|
||||
if (!match) {
|
||||
return [0, 0, 0];
|
||||
}
|
||||
|
||||
let colorString = match[0];
|
||||
|
||||
if (match[0].length === 3) {
|
||||
colorString = colorString.split('').map(char => {
|
||||
return char + char;
|
||||
}).join('');
|
||||
}
|
||||
|
||||
const integer = parseInt(colorString, 16);
|
||||
const r = (integer >> 16) & 0xFF;
|
||||
const g = (integer >> 8) & 0xFF;
|
||||
const b = integer & 0xFF;
|
||||
|
||||
return [r, g, b];
|
||||
};
|
||||
|
||||
convert.rgb.hcg = function (rgb) {
|
||||
const r = rgb[0] / 255;
|
||||
const g = rgb[1] / 255;
|
||||
const b = rgb[2] / 255;
|
||||
const max = Math.max(Math.max(r, g), b);
|
||||
const min = Math.min(Math.min(r, g), b);
|
||||
const chroma = (max - min);
|
||||
let grayscale;
|
||||
let hue;
|
||||
|
||||
if (chroma < 1) {
|
||||
grayscale = min / (1 - chroma);
|
||||
} else {
|
||||
grayscale = 0;
|
||||
}
|
||||
|
||||
if (chroma <= 0) {
|
||||
hue = 0;
|
||||
} else
|
||||
if (max === r) {
|
||||
hue = ((g - b) / chroma) % 6;
|
||||
} else
|
||||
if (max === g) {
|
||||
hue = 2 + (b - r) / chroma;
|
||||
} else {
|
||||
hue = 4 + (r - g) / chroma;
|
||||
}
|
||||
|
||||
hue /= 6;
|
||||
hue %= 1;
|
||||
|
||||
return [hue * 360, chroma * 100, grayscale * 100];
|
||||
};
|
||||
|
||||
convert.hsl.hcg = function (hsl) {
|
||||
const s = hsl[1] / 100;
|
||||
const l = hsl[2] / 100;
|
||||
|
||||
const c = l < 0.5 ? (2.0 * s * l) : (2.0 * s * (1.0 - l));
|
||||
|
||||
let f = 0;
|
||||
if (c < 1.0) {
|
||||
f = (l - 0.5 * c) / (1.0 - c);
|
||||
}
|
||||
|
||||
return [hsl[0], c * 100, f * 100];
|
||||
};
|
||||
|
||||
convert.hsv.hcg = function (hsv) {
|
||||
const s = hsv[1] / 100;
|
||||
const v = hsv[2] / 100;
|
||||
|
||||
const c = s * v;
|
||||
let f = 0;
|
||||
|
||||
if (c < 1.0) {
|
||||
f = (v - c) / (1 - c);
|
||||
}
|
||||
|
||||
return [hsv[0], c * 100, f * 100];
|
||||
};
|
||||
|
||||
convert.hcg.rgb = function (hcg) {
|
||||
const h = hcg[0] / 360;
|
||||
const c = hcg[1] / 100;
|
||||
const g = hcg[2] / 100;
|
||||
|
||||
if (c === 0.0) {
|
||||
return [g * 255, g * 255, g * 255];
|
||||
}
|
||||
|
||||
const pure = [0, 0, 0];
|
||||
const hi = (h % 1) * 6;
|
||||
const v = hi % 1;
|
||||
const w = 1 - v;
|
||||
let mg = 0;
|
||||
|
||||
/* eslint-disable max-statements-per-line */
|
||||
switch (Math.floor(hi)) {
|
||||
case 0:
|
||||
pure[0] = 1; pure[1] = v; pure[2] = 0; break;
|
||||
case 1:
|
||||
pure[0] = w; pure[1] = 1; pure[2] = 0; break;
|
||||
case 2:
|
||||
pure[0] = 0; pure[1] = 1; pure[2] = v; break;
|
||||
case 3:
|
||||
pure[0] = 0; pure[1] = w; pure[2] = 1; break;
|
||||
case 4:
|
||||
pure[0] = v; pure[1] = 0; pure[2] = 1; break;
|
||||
default:
|
||||
pure[0] = 1; pure[1] = 0; pure[2] = w;
|
||||
}
|
||||
/* eslint-enable max-statements-per-line */
|
||||
|
||||
mg = (1.0 - c) * g;
|
||||
|
||||
return [
|
||||
(c * pure[0] + mg) * 255,
|
||||
(c * pure[1] + mg) * 255,
|
||||
(c * pure[2] + mg) * 255
|
||||
];
|
||||
};
|
||||
|
||||
convert.hcg.hsv = function (hcg) {
|
||||
const c = hcg[1] / 100;
|
||||
const g = hcg[2] / 100;
|
||||
|
||||
const v = c + g * (1.0 - c);
|
||||
let f = 0;
|
||||
|
||||
if (v > 0.0) {
|
||||
f = c / v;
|
||||
}
|
||||
|
||||
return [hcg[0], f * 100, v * 100];
|
||||
};
|
||||
|
||||
convert.hcg.hsl = function (hcg) {
|
||||
const c = hcg[1] / 100;
|
||||
const g = hcg[2] / 100;
|
||||
|
||||
const l = g * (1.0 - c) + 0.5 * c;
|
||||
let s = 0;
|
||||
|
||||
if (l > 0.0 && l < 0.5) {
|
||||
s = c / (2 * l);
|
||||
} else
|
||||
if (l >= 0.5 && l < 1.0) {
|
||||
s = c / (2 * (1 - l));
|
||||
}
|
||||
|
||||
return [hcg[0], s * 100, l * 100];
|
||||
};
|
||||
|
||||
convert.hcg.hwb = function (hcg) {
|
||||
const c = hcg[1] / 100;
|
||||
const g = hcg[2] / 100;
|
||||
const v = c + g * (1.0 - c);
|
||||
return [hcg[0], (v - c) * 100, (1 - v) * 100];
|
||||
};
|
||||
|
||||
convert.hwb.hcg = function (hwb) {
|
||||
const w = hwb[1] / 100;
|
||||
const b = hwb[2] / 100;
|
||||
const v = 1 - b;
|
||||
const c = v - w;
|
||||
let g = 0;
|
||||
|
||||
if (c < 1) {
|
||||
g = (v - c) / (1 - c);
|
||||
}
|
||||
|
||||
return [hwb[0], c * 100, g * 100];
|
||||
};
|
||||
|
||||
convert.apple.rgb = function (apple) {
|
||||
return [(apple[0] / 65535) * 255, (apple[1] / 65535) * 255, (apple[2] / 65535) * 255];
|
||||
};
|
||||
|
||||
convert.rgb.apple = function (rgb) {
|
||||
return [(rgb[0] / 255) * 65535, (rgb[1] / 255) * 65535, (rgb[2] / 255) * 65535];
|
||||
};
|
||||
|
||||
convert.gray.rgb = function (args) {
|
||||
return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
|
||||
};
|
||||
|
||||
convert.gray.hsl = function (args) {
|
||||
return [0, 0, args[0]];
|
||||
};
|
||||
|
||||
convert.gray.hsv = convert.gray.hsl;
|
||||
|
||||
convert.gray.hwb = function (gray) {
|
||||
return [0, 100, gray[0]];
|
||||
};
|
||||
|
||||
convert.gray.cmyk = function (gray) {
|
||||
return [0, 0, 0, gray[0]];
|
||||
};
|
||||
|
||||
convert.gray.lab = function (gray) {
|
||||
return [gray[0], 0, 0];
|
||||
};
|
||||
|
||||
convert.gray.hex = function (gray) {
|
||||
const val = Math.round(gray[0] / 100 * 255) & 0xFF;
|
||||
const integer = (val << 16) + (val << 8) + val;
|
||||
|
||||
const string = integer.toString(16).toUpperCase();
|
||||
return '000000'.substring(string.length) + string;
|
||||
};
|
||||
|
||||
convert.rgb.gray = function (rgb) {
|
||||
const val = (rgb[0] + rgb[1] + rgb[2]) / 3;
|
||||
return [val / 255 * 100];
|
||||
};
|
81
node_modules/@jest/console/node_modules/color-convert/index.js
generated
vendored
Normal file
81
node_modules/@jest/console/node_modules/color-convert/index.js
generated
vendored
Normal file
@ -0,0 +1,81 @@
|
||||
const conversions = require('./conversions');
|
||||
const route = require('./route');
|
||||
|
||||
const convert = {};
|
||||
|
||||
const models = Object.keys(conversions);
|
||||
|
||||
function wrapRaw(fn) {
|
||||
const wrappedFn = function (...args) {
|
||||
const arg0 = args[0];
|
||||
if (arg0 === undefined || arg0 === null) {
|
||||
return arg0;
|
||||
}
|
||||
|
||||
if (arg0.length > 1) {
|
||||
args = arg0;
|
||||
}
|
||||
|
||||
return fn(args);
|
||||
};
|
||||
|
||||
// Preserve .conversion property if there is one
|
||||
if ('conversion' in fn) {
|
||||
wrappedFn.conversion = fn.conversion;
|
||||
}
|
||||
|
||||
return wrappedFn;
|
||||
}
|
||||
|
||||
function wrapRounded(fn) {
|
||||
const wrappedFn = function (...args) {
|
||||
const arg0 = args[0];
|
||||
|
||||
if (arg0 === undefined || arg0 === null) {
|
||||
return arg0;
|
||||
}
|
||||
|
||||
if (arg0.length > 1) {
|
||||
args = arg0;
|
||||
}
|
||||
|
||||
const result = fn(args);
|
||||
|
||||
// We're assuming the result is an array here.
|
||||
// see notice in conversions.js; don't use box types
|
||||
// in conversion functions.
|
||||
if (typeof result === 'object') {
|
||||
for (let len = result.length, i = 0; i < len; i++) {
|
||||
result[i] = Math.round(result[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
// Preserve .conversion property if there is one
|
||||
if ('conversion' in fn) {
|
||||
wrappedFn.conversion = fn.conversion;
|
||||
}
|
||||
|
||||
return wrappedFn;
|
||||
}
|
||||
|
||||
models.forEach(fromModel => {
|
||||
convert[fromModel] = {};
|
||||
|
||||
Object.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels});
|
||||
Object.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels});
|
||||
|
||||
const routes = route(fromModel);
|
||||
const routeModels = Object.keys(routes);
|
||||
|
||||
routeModels.forEach(toModel => {
|
||||
const fn = routes[toModel];
|
||||
|
||||
convert[fromModel][toModel] = wrapRounded(fn);
|
||||
convert[fromModel][toModel].raw = wrapRaw(fn);
|
||||
});
|
||||
});
|
||||
|
||||
module.exports = convert;
|
48
node_modules/@jest/console/node_modules/color-convert/package.json
generated
vendored
Normal file
48
node_modules/@jest/console/node_modules/color-convert/package.json
generated
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
{
|
||||
"name": "color-convert",
|
||||
"description": "Plain color conversion functions",
|
||||
"version": "2.0.1",
|
||||
"author": "Heather Arthur <fayearthur@gmail.com>",
|
||||
"license": "MIT",
|
||||
"repository": "Qix-/color-convert",
|
||||
"scripts": {
|
||||
"pretest": "xo",
|
||||
"test": "node test/basic.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=7.0.0"
|
||||
},
|
||||
"keywords": [
|
||||
"color",
|
||||
"colour",
|
||||
"convert",
|
||||
"converter",
|
||||
"conversion",
|
||||
"rgb",
|
||||
"hsl",
|
||||
"hsv",
|
||||
"hwb",
|
||||
"cmyk",
|
||||
"ansi",
|
||||
"ansi16"
|
||||
],
|
||||
"files": [
|
||||
"index.js",
|
||||
"conversions.js",
|
||||
"route.js"
|
||||
],
|
||||
"xo": {
|
||||
"rules": {
|
||||
"default-case": 0,
|
||||
"no-inline-comments": 0,
|
||||
"operator-linebreak": 0
|
||||
}
|
||||
},
|
||||
"devDependencies": {
|
||||
"chalk": "^2.4.2",
|
||||
"xo": "^0.24.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"color-name": "~1.1.4"
|
||||
}
|
||||
}
|
97
node_modules/@jest/console/node_modules/color-convert/route.js
generated
vendored
Normal file
97
node_modules/@jest/console/node_modules/color-convert/route.js
generated
vendored
Normal file
@ -0,0 +1,97 @@
|
||||
const conversions = require('./conversions');
|
||||
|
||||
/*
|
||||
This function routes a model to all other models.
|
||||
|
||||
all functions that are routed have a property `.conversion` attached
|
||||
to the returned synthetic function. This property is an array
|
||||
of strings, each with the steps in between the 'from' and 'to'
|
||||
color models (inclusive).
|
||||
|
||||
conversions that are not possible simply are not included.
|
||||
*/
|
||||
|
||||
function buildGraph() {
|
||||
const graph = {};
|
||||
// https://jsperf.com/object-keys-vs-for-in-with-closure/3
|
||||
const models = Object.keys(conversions);
|
||||
|
||||
for (let len = models.length, i = 0; i < len; i++) {
|
||||
graph[models[i]] = {
|
||||
// http://jsperf.com/1-vs-infinity
|
||||
// micro-opt, but this is simple.
|
||||
distance: -1,
|
||||
parent: null
|
||||
};
|
||||
}
|
||||
|
||||
return graph;
|
||||
}
|
||||
|
||||
// https://en.wikipedia.org/wiki/Breadth-first_search
|
||||
function deriveBFS(fromModel) {
|
||||
const graph = buildGraph();
|
||||
const queue = [fromModel]; // Unshift -> queue -> pop
|
||||
|
||||
graph[fromModel].distance = 0;
|
||||
|
||||
while (queue.length) {
|
||||
const current = queue.pop();
|
||||
const adjacents = Object.keys(conversions[current]);
|
||||
|
||||
for (let len = adjacents.length, i = 0; i < len; i++) {
|
||||
const adjacent = adjacents[i];
|
||||
const node = graph[adjacent];
|
||||
|
||||
if (node.distance === -1) {
|
||||
node.distance = graph[current].distance + 1;
|
||||
node.parent = current;
|
||||
queue.unshift(adjacent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return graph;
|
||||
}
|
||||
|
||||
function link(from, to) {
|
||||
return function (args) {
|
||||
return to(from(args));
|
||||
};
|
||||
}
|
||||
|
||||
function wrapConversion(toModel, graph) {
|
||||
const path = [graph[toModel].parent, toModel];
|
||||
let fn = conversions[graph[toModel].parent][toModel];
|
||||
|
||||
let cur = graph[toModel].parent;
|
||||
while (graph[cur].parent) {
|
||||
path.unshift(graph[cur].parent);
|
||||
fn = link(conversions[graph[cur].parent][cur], fn);
|
||||
cur = graph[cur].parent;
|
||||
}
|
||||
|
||||
fn.conversion = path;
|
||||
return fn;
|
||||
}
|
||||
|
||||
module.exports = function (fromModel) {
|
||||
const graph = deriveBFS(fromModel);
|
||||
const conversion = {};
|
||||
|
||||
const models = Object.keys(graph);
|
||||
for (let len = models.length, i = 0; i < len; i++) {
|
||||
const toModel = models[i];
|
||||
const node = graph[toModel];
|
||||
|
||||
if (node.parent === null) {
|
||||
// No possible conversion, or this node is the source model.
|
||||
continue;
|
||||
}
|
||||
|
||||
conversion[toModel] = wrapConversion(toModel, graph);
|
||||
}
|
||||
|
||||
return conversion;
|
||||
};
|
||||
|
8
node_modules/@jest/console/node_modules/color-name/LICENSE
generated
vendored
Normal file
8
node_modules/@jest/console/node_modules/color-name/LICENSE
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
The MIT License (MIT)
|
||||
Copyright (c) 2015 Dmitry Ivanov
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
11
node_modules/@jest/console/node_modules/color-name/README.md
generated
vendored
Normal file
11
node_modules/@jest/console/node_modules/color-name/README.md
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
A JSON with color names and its values. Based on http://dev.w3.org/csswg/css-color/#named-colors.
|
||||
|
||||
[](https://nodei.co/npm/color-name/)
|
||||
|
||||
|
||||
```js
|
||||
var colors = require('color-name');
|
||||
colors.red //[255,0,0]
|
||||
```
|
||||
|
||||
<a href="LICENSE"><img src="https://upload.wikimedia.org/wikipedia/commons/0/0c/MIT_logo.svg" width="120"/></a>
|
152
node_modules/@jest/console/node_modules/color-name/index.js
generated
vendored
Normal file
152
node_modules/@jest/console/node_modules/color-name/index.js
generated
vendored
Normal file
@ -0,0 +1,152 @@
|
||||
'use strict'
|
||||
|
||||
module.exports = {
|
||||
"aliceblue": [240, 248, 255],
|
||||
"antiquewhite": [250, 235, 215],
|
||||
"aqua": [0, 255, 255],
|
||||
"aquamarine": [127, 255, 212],
|
||||
"azure": [240, 255, 255],
|
||||
"beige": [245, 245, 220],
|
||||
"bisque": [255, 228, 196],
|
||||
"black": [0, 0, 0],
|
||||
"blanchedalmond": [255, 235, 205],
|
||||
"blue": [0, 0, 255],
|
||||
"blueviolet": [138, 43, 226],
|
||||
"brown": [165, 42, 42],
|
||||
"burlywood": [222, 184, 135],
|
||||
"cadetblue": [95, 158, 160],
|
||||
"chartreuse": [127, 255, 0],
|
||||
"chocolate": [210, 105, 30],
|
||||
"coral": [255, 127, 80],
|
||||
"cornflowerblue": [100, 149, 237],
|
||||
"cornsilk": [255, 248, 220],
|
||||
"crimson": [220, 20, 60],
|
||||
"cyan": [0, 255, 255],
|
||||
"darkblue": [0, 0, 139],
|
||||
"darkcyan": [0, 139, 139],
|
||||
"darkgoldenrod": [184, 134, 11],
|
||||
"darkgray": [169, 169, 169],
|
||||
"darkgreen": [0, 100, 0],
|
||||
"darkgrey": [169, 169, 169],
|
||||
"darkkhaki": [189, 183, 107],
|
||||
"darkmagenta": [139, 0, 139],
|
||||
"darkolivegreen": [85, 107, 47],
|
||||
"darkorange": [255, 140, 0],
|
||||
"darkorchid": [153, 50, 204],
|
||||
"darkred": [139, 0, 0],
|
||||
"darksalmon": [233, 150, 122],
|
||||
"darkseagreen": [143, 188, 143],
|
||||
"darkslateblue": [72, 61, 139],
|
||||
"darkslategray": [47, 79, 79],
|
||||
"darkslategrey": [47, 79, 79],
|
||||
"darkturquoise": [0, 206, 209],
|
||||
"darkviolet": [148, 0, 211],
|
||||
"deeppink": [255, 20, 147],
|
||||
"deepskyblue": [0, 191, 255],
|
||||
"dimgray": [105, 105, 105],
|
||||
"dimgrey": [105, 105, 105],
|
||||
"dodgerblue": [30, 144, 255],
|
||||
"firebrick": [178, 34, 34],
|
||||
"floralwhite": [255, 250, 240],
|
||||
"forestgreen": [34, 139, 34],
|
||||
"fuchsia": [255, 0, 255],
|
||||
"gainsboro": [220, 220, 220],
|
||||
"ghostwhite": [248, 248, 255],
|
||||
"gold": [255, 215, 0],
|
||||
"goldenrod": [218, 165, 32],
|
||||
"gray": [128, 128, 128],
|
||||
"green": [0, 128, 0],
|
||||
"greenyellow": [173, 255, 47],
|
||||
"grey": [128, 128, 128],
|
||||
"honeydew": [240, 255, 240],
|
||||
"hotpink": [255, 105, 180],
|
||||
"indianred": [205, 92, 92],
|
||||
"indigo": [75, 0, 130],
|
||||
"ivory": [255, 255, 240],
|
||||
"khaki": [240, 230, 140],
|
||||
"lavender": [230, 230, 250],
|
||||
"lavenderblush": [255, 240, 245],
|
||||
"lawngreen": [124, 252, 0],
|
||||
"lemonchiffon": [255, 250, 205],
|
||||
"lightblue": [173, 216, 230],
|
||||
"lightcoral": [240, 128, 128],
|
||||
"lightcyan": [224, 255, 255],
|
||||
"lightgoldenrodyellow": [250, 250, 210],
|
||||
"lightgray": [211, 211, 211],
|
||||
"lightgreen": [144, 238, 144],
|
||||
"lightgrey": [211, 211, 211],
|
||||
"lightpink": [255, 182, 193],
|
||||
"lightsalmon": [255, 160, 122],
|
||||
"lightseagreen": [32, 178, 170],
|
||||
"lightskyblue": [135, 206, 250],
|
||||
"lightslategray": [119, 136, 153],
|
||||
"lightslategrey": [119, 136, 153],
|
||||
"lightsteelblue": [176, 196, 222],
|
||||
"lightyellow": [255, 255, 224],
|
||||
"lime": [0, 255, 0],
|
||||
"limegreen": [50, 205, 50],
|
||||
"linen": [250, 240, 230],
|
||||
"magenta": [255, 0, 255],
|
||||
"maroon": [128, 0, 0],
|
||||
"mediumaquamarine": [102, 205, 170],
|
||||
"mediumblue": [0, 0, 205],
|
||||
"mediumorchid": [186, 85, 211],
|
||||
"mediumpurple": [147, 112, 219],
|
||||
"mediumseagreen": [60, 179, 113],
|
||||
"mediumslateblue": [123, 104, 238],
|
||||
"mediumspringgreen": [0, 250, 154],
|
||||
"mediumturquoise": [72, 209, 204],
|
||||
"mediumvioletred": [199, 21, 133],
|
||||
"midnightblue": [25, 25, 112],
|
||||
"mintcream": [245, 255, 250],
|
||||
"mistyrose": [255, 228, 225],
|
||||
"moccasin": [255, 228, 181],
|
||||
"navajowhite": [255, 222, 173],
|
||||
"navy": [0, 0, 128],
|
||||
"oldlace": [253, 245, 230],
|
||||
"olive": [128, 128, 0],
|
||||
"olivedrab": [107, 142, 35],
|
||||
"orange": [255, 165, 0],
|
||||
"orangered": [255, 69, 0],
|
||||
"orchid": [218, 112, 214],
|
||||
"palegoldenrod": [238, 232, 170],
|
||||
"palegreen": [152, 251, 152],
|
||||
"paleturquoise": [175, 238, 238],
|
||||
"palevioletred": [219, 112, 147],
|
||||
"papayawhip": [255, 239, 213],
|
||||
"peachpuff": [255, 218, 185],
|
||||
"peru": [205, 133, 63],
|
||||
"pink": [255, 192, 203],
|
||||
"plum": [221, 160, 221],
|
||||
"powderblue": [176, 224, 230],
|
||||
"purple": [128, 0, 128],
|
||||
"rebeccapurple": [102, 51, 153],
|
||||
"red": [255, 0, 0],
|
||||
"rosybrown": [188, 143, 143],
|
||||
"royalblue": [65, 105, 225],
|
||||
"saddlebrown": [139, 69, 19],
|
||||
"salmon": [250, 128, 114],
|
||||
"sandybrown": [244, 164, 96],
|
||||
"seagreen": [46, 139, 87],
|
||||
"seashell": [255, 245, 238],
|
||||
"sienna": [160, 82, 45],
|
||||
"silver": [192, 192, 192],
|
||||
"skyblue": [135, 206, 235],
|
||||
"slateblue": [106, 90, 205],
|
||||
"slategray": [112, 128, 144],
|
||||
"slategrey": [112, 128, 144],
|
||||
"snow": [255, 250, 250],
|
||||
"springgreen": [0, 255, 127],
|
||||
"steelblue": [70, 130, 180],
|
||||
"tan": [210, 180, 140],
|
||||
"teal": [0, 128, 128],
|
||||
"thistle": [216, 191, 216],
|
||||
"tomato": [255, 99, 71],
|
||||
"turquoise": [64, 224, 208],
|
||||
"violet": [238, 130, 238],
|
||||
"wheat": [245, 222, 179],
|
||||
"white": [255, 255, 255],
|
||||
"whitesmoke": [245, 245, 245],
|
||||
"yellow": [255, 255, 0],
|
||||
"yellowgreen": [154, 205, 50]
|
||||
};
|
28
node_modules/@jest/console/node_modules/color-name/package.json
generated
vendored
Normal file
28
node_modules/@jest/console/node_modules/color-name/package.json
generated
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
{
|
||||
"name": "color-name",
|
||||
"version": "1.1.4",
|
||||
"description": "A list of color names and its values",
|
||||
"main": "index.js",
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"scripts": {
|
||||
"test": "node test.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git@github.com:colorjs/color-name.git"
|
||||
},
|
||||
"keywords": [
|
||||
"color-name",
|
||||
"color",
|
||||
"color-keyword",
|
||||
"keyword"
|
||||
],
|
||||
"author": "DY <dfcreative@gmail.com>",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/colorjs/color-name/issues"
|
||||
},
|
||||
"homepage": "https://github.com/colorjs/color-name"
|
||||
}
|
39
node_modules/@jest/console/node_modules/has-flag/index.d.ts
generated
vendored
Normal file
39
node_modules/@jest/console/node_modules/has-flag/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
/**
|
||||
Check if [`argv`](https://nodejs.org/docs/latest/api/process.html#process_process_argv) has a specific flag.
|
||||
|
||||
@param flag - CLI flag to look for. The `--` prefix is optional.
|
||||
@param argv - CLI arguments. Default: `process.argv`.
|
||||
@returns Whether the flag exists.
|
||||
|
||||
@example
|
||||
```
|
||||
// $ ts-node foo.ts -f --unicorn --foo=bar -- --rainbow
|
||||
|
||||
// foo.ts
|
||||
import hasFlag = require('has-flag');
|
||||
|
||||
hasFlag('unicorn');
|
||||
//=> true
|
||||
|
||||
hasFlag('--unicorn');
|
||||
//=> true
|
||||
|
||||
hasFlag('f');
|
||||
//=> true
|
||||
|
||||
hasFlag('-f');
|
||||
//=> true
|
||||
|
||||
hasFlag('foo=bar');
|
||||
//=> true
|
||||
|
||||
hasFlag('foo');
|
||||
//=> false
|
||||
|
||||
hasFlag('rainbow');
|
||||
//=> false
|
||||
```
|
||||
*/
|
||||
declare function hasFlag(flag: string, argv?: string[]): boolean;
|
||||
|
||||
export = hasFlag;
|
8
node_modules/@jest/console/node_modules/has-flag/index.js
generated
vendored
Normal file
8
node_modules/@jest/console/node_modules/has-flag/index.js
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = (flag, argv = process.argv) => {
|
||||
const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');
|
||||
const position = argv.indexOf(prefix + flag);
|
||||
const terminatorPosition = argv.indexOf('--');
|
||||
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
||||
};
|
9
node_modules/@jest/console/node_modules/has-flag/license
generated
vendored
Normal file
9
node_modules/@jest/console/node_modules/has-flag/license
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
46
node_modules/@jest/console/node_modules/has-flag/package.json
generated
vendored
Normal file
46
node_modules/@jest/console/node_modules/has-flag/package.json
generated
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
{
|
||||
"name": "has-flag",
|
||||
"version": "4.0.0",
|
||||
"description": "Check if argv has a specific flag",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/has-flag",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"has",
|
||||
"check",
|
||||
"detect",
|
||||
"contains",
|
||||
"find",
|
||||
"flag",
|
||||
"cli",
|
||||
"command-line",
|
||||
"argv",
|
||||
"process",
|
||||
"arg",
|
||||
"args",
|
||||
"argument",
|
||||
"arguments",
|
||||
"getopt",
|
||||
"minimist",
|
||||
"optimist"
|
||||
],
|
||||
"devDependencies": {
|
||||
"ava": "^1.4.1",
|
||||
"tsd": "^0.7.2",
|
||||
"xo": "^0.24.0"
|
||||
}
|
||||
}
|
89
node_modules/@jest/console/node_modules/has-flag/readme.md
generated
vendored
Normal file
89
node_modules/@jest/console/node_modules/has-flag/readme.md
generated
vendored
Normal file
@ -0,0 +1,89 @@
|
||||
# has-flag [](https://travis-ci.org/sindresorhus/has-flag)
|
||||
|
||||
> Check if [`argv`](https://nodejs.org/docs/latest/api/process.html#process_process_argv) has a specific flag
|
||||
|
||||
Correctly stops looking after an `--` argument terminator.
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<b>
|
||||
<a href="https://tidelift.com/subscription/pkg/npm-has-flag?utm_source=npm-has-flag&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
|
||||
</b>
|
||||
<br>
|
||||
<sub>
|
||||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
||||
</sub>
|
||||
</div>
|
||||
|
||||
---
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install has-flag
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
// foo.js
|
||||
const hasFlag = require('has-flag');
|
||||
|
||||
hasFlag('unicorn');
|
||||
//=> true
|
||||
|
||||
hasFlag('--unicorn');
|
||||
//=> true
|
||||
|
||||
hasFlag('f');
|
||||
//=> true
|
||||
|
||||
hasFlag('-f');
|
||||
//=> true
|
||||
|
||||
hasFlag('foo=bar');
|
||||
//=> true
|
||||
|
||||
hasFlag('foo');
|
||||
//=> false
|
||||
|
||||
hasFlag('rainbow');
|
||||
//=> false
|
||||
```
|
||||
|
||||
```
|
||||
$ node foo.js -f --unicorn --foo=bar -- --rainbow
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### hasFlag(flag, [argv])
|
||||
|
||||
Returns a boolean for whether the flag exists.
|
||||
|
||||
#### flag
|
||||
|
||||
Type: `string`
|
||||
|
||||
CLI flag to look for. The `--` prefix is optional.
|
||||
|
||||
#### argv
|
||||
|
||||
Type: `string[]`<br>
|
||||
Default: `process.argv`
|
||||
|
||||
CLI arguments.
|
||||
|
||||
|
||||
## Security
|
||||
|
||||
To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
5
node_modules/@jest/console/node_modules/supports-color/browser.js
generated
vendored
Normal file
5
node_modules/@jest/console/node_modules/supports-color/browser.js
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
'use strict';
|
||||
module.exports = {
|
||||
stdout: false,
|
||||
stderr: false
|
||||
};
|
135
node_modules/@jest/console/node_modules/supports-color/index.js
generated
vendored
Normal file
135
node_modules/@jest/console/node_modules/supports-color/index.js
generated
vendored
Normal file
@ -0,0 +1,135 @@
|
||||
'use strict';
|
||||
const os = require('os');
|
||||
const tty = require('tty');
|
||||
const hasFlag = require('has-flag');
|
||||
|
||||
const {env} = process;
|
||||
|
||||
let forceColor;
|
||||
if (hasFlag('no-color') ||
|
||||
hasFlag('no-colors') ||
|
||||
hasFlag('color=false') ||
|
||||
hasFlag('color=never')) {
|
||||
forceColor = 0;
|
||||
} else if (hasFlag('color') ||
|
||||
hasFlag('colors') ||
|
||||
hasFlag('color=true') ||
|
||||
hasFlag('color=always')) {
|
||||
forceColor = 1;
|
||||
}
|
||||
|
||||
if ('FORCE_COLOR' in env) {
|
||||
if (env.FORCE_COLOR === 'true') {
|
||||
forceColor = 1;
|
||||
} else if (env.FORCE_COLOR === 'false') {
|
||||
forceColor = 0;
|
||||
} else {
|
||||
forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
|
||||
}
|
||||
}
|
||||
|
||||
function translateLevel(level) {
|
||||
if (level === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return {
|
||||
level,
|
||||
hasBasic: true,
|
||||
has256: level >= 2,
|
||||
has16m: level >= 3
|
||||
};
|
||||
}
|
||||
|
||||
function supportsColor(haveStream, streamIsTTY) {
|
||||
if (forceColor === 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (hasFlag('color=16m') ||
|
||||
hasFlag('color=full') ||
|
||||
hasFlag('color=truecolor')) {
|
||||
return 3;
|
||||
}
|
||||
|
||||
if (hasFlag('color=256')) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
if (haveStream && !streamIsTTY && forceColor === undefined) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const min = forceColor || 0;
|
||||
|
||||
if (env.TERM === 'dumb') {
|
||||
return min;
|
||||
}
|
||||
|
||||
if (process.platform === 'win32') {
|
||||
// Windows 10 build 10586 is the first Windows release that supports 256 colors.
|
||||
// Windows 10 build 14931 is the first release that supports 16m/TrueColor.
|
||||
const osRelease = os.release().split('.');
|
||||
if (
|
||||
Number(osRelease[0]) >= 10 &&
|
||||
Number(osRelease[2]) >= 10586
|
||||
) {
|
||||
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ('CI' in env) {
|
||||
if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'GITHUB_ACTIONS', 'BUILDKITE'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return min;
|
||||
}
|
||||
|
||||
if ('TEAMCITY_VERSION' in env) {
|
||||
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
||||
}
|
||||
|
||||
if (env.COLORTERM === 'truecolor') {
|
||||
return 3;
|
||||
}
|
||||
|
||||
if ('TERM_PROGRAM' in env) {
|
||||
const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
|
||||
|
||||
switch (env.TERM_PROGRAM) {
|
||||
case 'iTerm.app':
|
||||
return version >= 3 ? 3 : 2;
|
||||
case 'Apple_Terminal':
|
||||
return 2;
|
||||
// No default
|
||||
}
|
||||
}
|
||||
|
||||
if (/-256(color)?$/i.test(env.TERM)) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ('COLORTERM' in env) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return min;
|
||||
}
|
||||
|
||||
function getSupportLevel(stream) {
|
||||
const level = supportsColor(stream, stream && stream.isTTY);
|
||||
return translateLevel(level);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
supportsColor: getSupportLevel,
|
||||
stdout: translateLevel(supportsColor(true, tty.isatty(1))),
|
||||
stderr: translateLevel(supportsColor(true, tty.isatty(2)))
|
||||
};
|
9
node_modules/@jest/console/node_modules/supports-color/license
generated
vendored
Normal file
9
node_modules/@jest/console/node_modules/supports-color/license
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
53
node_modules/@jest/console/node_modules/supports-color/package.json
generated
vendored
Normal file
53
node_modules/@jest/console/node_modules/supports-color/package.json
generated
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
{
|
||||
"name": "supports-color",
|
||||
"version": "7.2.0",
|
||||
"description": "Detect whether a terminal supports color",
|
||||
"license": "MIT",
|
||||
"repository": "chalk/supports-color",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"browser.js"
|
||||
],
|
||||
"keywords": [
|
||||
"color",
|
||||
"colour",
|
||||
"colors",
|
||||
"terminal",
|
||||
"console",
|
||||
"cli",
|
||||
"ansi",
|
||||
"styles",
|
||||
"tty",
|
||||
"rgb",
|
||||
"256",
|
||||
"shell",
|
||||
"xterm",
|
||||
"command-line",
|
||||
"support",
|
||||
"supports",
|
||||
"capability",
|
||||
"detect",
|
||||
"truecolor",
|
||||
"16m"
|
||||
],
|
||||
"dependencies": {
|
||||
"has-flag": "^4.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "^1.4.1",
|
||||
"import-fresh": "^3.0.0",
|
||||
"xo": "^0.24.0"
|
||||
},
|
||||
"browser": "browser.js"
|
||||
}
|
76
node_modules/@jest/console/node_modules/supports-color/readme.md
generated
vendored
Normal file
76
node_modules/@jest/console/node_modules/supports-color/readme.md
generated
vendored
Normal file
@ -0,0 +1,76 @@
|
||||
# supports-color [](https://travis-ci.org/chalk/supports-color)
|
||||
|
||||
> Detect whether a terminal supports color
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install supports-color
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const supportsColor = require('supports-color');
|
||||
|
||||
if (supportsColor.stdout) {
|
||||
console.log('Terminal stdout supports color');
|
||||
}
|
||||
|
||||
if (supportsColor.stdout.has256) {
|
||||
console.log('Terminal stdout supports 256 colors');
|
||||
}
|
||||
|
||||
if (supportsColor.stderr.has16m) {
|
||||
console.log('Terminal stderr supports 16 million colors (truecolor)');
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
Returns an `Object` with a `stdout` and `stderr` property for testing either streams. Each property is an `Object`, or `false` if color is not supported.
|
||||
|
||||
The `stdout`/`stderr` objects specifies a level of support for color through a `.level` property and a corresponding flag:
|
||||
|
||||
- `.level = 1` and `.hasBasic = true`: Basic color support (16 colors)
|
||||
- `.level = 2` and `.has256 = true`: 256 color support
|
||||
- `.level = 3` and `.has16m = true`: Truecolor support (16 million colors)
|
||||
|
||||
|
||||
## Info
|
||||
|
||||
It obeys the `--color` and `--no-color` CLI flags.
|
||||
|
||||
For situations where using `--color` is not possible, use the environment variable `FORCE_COLOR=1` (level 1), `FORCE_COLOR=2` (level 2), or `FORCE_COLOR=3` (level 3) to forcefully enable color, or `FORCE_COLOR=0` to forcefully disable. The use of `FORCE_COLOR` overrides all other color support checks.
|
||||
|
||||
Explicit 256/Truecolor mode can be enabled using the `--color=256` and `--color=16m` flags, respectively.
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [supports-color-cli](https://github.com/chalk/supports-color-cli) - CLI for this module
|
||||
- [chalk](https://github.com/chalk/chalk) - Terminal string styling done right
|
||||
|
||||
|
||||
## Maintainers
|
||||
|
||||
- [Sindre Sorhus](https://github.com/sindresorhus)
|
||||
- [Josh Junon](https://github.com/qix-)
|
||||
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<b>
|
||||
<a href="https://tidelift.com/subscription/pkg/npm-supports-color?utm_source=npm-supports-color&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
|
||||
</b>
|
||||
<br>
|
||||
<sub>
|
||||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
||||
</sub>
|
||||
</div>
|
||||
|
||||
---
|
36
node_modules/@jest/console/package.json
generated
vendored
Normal file
36
node_modules/@jest/console/package.json
generated
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
{
|
||||
"name": "@jest/console",
|
||||
"version": "25.5.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",
|
||||
"typesVersions": {
|
||||
"<3.8": {
|
||||
"build/*": [
|
||||
"build/ts3.4/*"
|
||||
]
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"@jest/types": "^25.5.0",
|
||||
"chalk": "^3.0.0",
|
||||
"jest-message-util": "^25.5.0",
|
||||
"jest-util": "^25.5.0",
|
||||
"slash": "^3.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "*"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 8.3"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"gitHead": "ddd73d18adfb982b9b0d94bad7d41c9f78567ca7"
|
||||
}
|
21
node_modules/@jest/core/LICENSE
generated
vendored
Normal file
21
node_modules/@jest/core/LICENSE
generated
vendored
Normal 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
3
node_modules/@jest/core/README.md
generated
vendored
Normal 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
15
node_modules/@jest/core/build/FailedTestsCache.d.ts
generated
vendored
Normal 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
69
node_modules/@jest/core/build/FailedTestsCache.js
generated
vendored
Normal 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;
|
22
node_modules/@jest/core/build/ReporterDispatcher.d.ts
generated
vendored
Normal file
22
node_modules/@jest/core/build/ReporterDispatcher.d.ts
generated
vendored
Normal 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.
|
||||
*/
|
||||
import type { AggregatedResult, 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;
|
||||
onTestResult(test: Test, testResult: TestResult, results: AggregatedResult): Promise<void>;
|
||||
onTestStart(test: Test): Promise<void>;
|
||||
onRunStart(results: AggregatedResult, options: ReporterOnStartOptions): Promise<void>;
|
||||
onRunComplete(contexts: Set<Context>, results: AggregatedResult): Promise<void>;
|
||||
getErrors(): Array<Error>;
|
||||
hasErrors(): boolean;
|
||||
}
|
87
node_modules/@jest/core/build/ReporterDispatcher.js
generated
vendored
Normal file
87
node_modules/@jest/core/build/ReporterDispatcher.js
generated
vendored
Normal file
@ -0,0 +1,87 @@
|
||||
'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 onTestResult(test, testResult, results) {
|
||||
for (const reporter of this._reporters) {
|
||||
reporter.onTestResult &&
|
||||
(await reporter.onTestResult(test, testResult, results));
|
||||
} // Release memory if unused later.
|
||||
|
||||
testResult.sourceMaps = undefined;
|
||||
testResult.coverage = undefined;
|
||||
testResult.console = undefined;
|
||||
}
|
||||
|
||||
async onTestStart(test) {
|
||||
for (const reporter of this._reporters) {
|
||||
reporter.onTestStart && (await reporter.onTestStart(test));
|
||||
}
|
||||
}
|
||||
|
||||
async onRunStart(results, options) {
|
||||
for (const reporter of this._reporters) {
|
||||
reporter.onRunStart && (await reporter.onRunStart(results, options));
|
||||
}
|
||||
}
|
||||
|
||||
async onRunComplete(contexts, results) {
|
||||
for (const reporter of this._reporters) {
|
||||
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
45
node_modules/@jest/core/build/SearchSource.d.ts
generated
vendored
Normal 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>;
|
||||
}
|
481
node_modules/@jest/core/build/SearchSource.js
generated
vendored
Normal file
481
node_modules/@jest/core/build/SearchSource.js
generated
vendored
Normal file
@ -0,0 +1,481 @@
|
||||
'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 globsToMatcher = globs => path =>
|
||||
(0, _micromatch().default)(
|
||||
[(0, _jestUtil().replacePathSepForGlob)(path)],
|
||||
globs,
|
||||
{
|
||||
dot: true
|
||||
}
|
||||
).length > 0;
|
||||
|
||||
const regexToMatcher = testRegex => path =>
|
||||
testRegex.some(testRegex => new RegExp(testRegex).test(path));
|
||||
|
||||
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: 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;
|
30
node_modules/@jest/core/build/SnapshotInteractiveMode.d.ts
generated
vendored
Normal file
30
node_modules/@jest/core/build/SnapshotInteractiveMode.d.ts
generated
vendored
Normal 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;
|
||||
}
|
327
node_modules/@jest/core/build/SnapshotInteractiveMode.js
generated
vendored
Normal file
327
node_modules/@jest/core/build/SnapshotInteractiveMode.js
generated
vendored
Normal 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;
|
17
node_modules/@jest/core/build/TestNamePatternPrompt.d.ts
generated
vendored
Normal file
17
node_modules/@jest/core/build/TestNamePatternPrompt.d.ts
generated
vendored
Normal 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
86
node_modules/@jest/core/build/TestNamePatternPrompt.js
generated
vendored
Normal 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 (e) {
|
||||
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;
|
24
node_modules/@jest/core/build/TestPathPatternPrompt.d.ts
generated
vendored
Normal file
24
node_modules/@jest/core/build/TestPathPatternPrompt.d.ts
generated
vendored
Normal 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
81
node_modules/@jest/core/build/TestPathPatternPrompt.js
generated
vendored
Normal 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 (e) {}
|
||||
|
||||
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
41
node_modules/@jest/core/build/TestScheduler.d.ts
generated
vendored
Normal 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 _dispatcher;
|
||||
private _globalConfig;
|
||||
private _options;
|
||||
private _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;
|
||||
}
|
495
node_modules/@jest/core/build/TestScheduler.js
generated
vendored
Normal file
495
node_modules/@jest/core/build/TestScheduler.js
generated
vendored
Normal file
@ -0,0 +1,495 @@
|
||||
'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 onStart = this._dispatcher.onTestStart.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.onTestResult(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.onTestResult(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);
|
||||
contexts.forEach(({config}) => {
|
||||
if (!testRunners[config.runner]) {
|
||||
var _this$_context, _this$_context2;
|
||||
|
||||
const Runner = require(config.runner);
|
||||
|
||||
testRunners[config.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
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
const testsByRunner = this._partitionTests(testRunners, tests);
|
||||
|
||||
if (testsByRunner) {
|
||||
try {
|
||||
for (const runner of Object.keys(testRunners)) {
|
||||
await testRunners[runner].runTests(
|
||||
testsByRunner[runner],
|
||||
watcher,
|
||||
onStart,
|
||||
onResult,
|
||||
onFailure,
|
||||
{
|
||||
serial: runInBand || Boolean(testRunners[runner].isSerial)
|
||||
}
|
||||
);
|
||||
}
|
||||
} 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;
|
||||
|
||||
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
22
node_modules/@jest/core/build/TestWatcher.d.ts
generated
vendored
Normal 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
60
node_modules/@jest/core/build/TestWatcher.js
generated
vendored
Normal 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
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
12
node_modules/@jest/core/build/cli/index.d.ts
generated
vendored
Normal 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;
|
||||
}>;
|
443
node_modules/@jest/core/build/cli/index.js
generated
vendored
Normal file
443
node_modules/@jest/core/build/cli/index.js
generated
vendored
Normal file
@ -0,0 +1,443 @@
|
||||
'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 _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);
|
||||
}
|
||||
|
||||
await _run(
|
||||
globalConfig,
|
||||
configs,
|
||||
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 _run = 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 (e) {
|
||||
(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
9
node_modules/@jest/core/build/collectHandles.d.ts
generated
vendored
Normal 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>;
|
207
node_modules/@jest/core/build/collectHandles.js
generated
vendored
Normal file
207
node_modules/@jest/core/build/collectHandles.js
generated
vendored
Normal file
@ -0,0 +1,207 @@
|
||||
'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') {
|
||||
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+)
|
||||
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;
|
||||
})
|
||||
);
|
||||
}
|
10
node_modules/@jest/core/build/getChangedFilesPromise.d.ts
generated
vendored
Normal file
10
node_modules/@jest/core/build/getChangedFilesPromise.d.ts
generated
vendored
Normal 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: Config.ProjectConfig[]) => ChangedFilesPromise | undefined;
|
||||
export default _default;
|
81
node_modules/@jest/core/build/getChangedFilesPromise.js
generated
vendored
Normal file
81
node_modules/@jest/core/build/getChangedFilesPromise.js
generated
vendored
Normal file
@ -0,0 +1,81 @@
|
||||
'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); // We do process.exit, so this is dead code
|
||||
|
||||
return Promise.reject(e);
|
||||
});
|
||||
}
|
||||
|
||||
return undefined;
|
||||
};
|
||||
|
||||
exports.default = _default;
|
9
node_modules/@jest/core/build/getNoTestFound.d.ts
generated
vendored
Normal file
9
node_modules/@jest/core/build/getNoTestFound.d.ts
generated
vendored
Normal 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
63
node_modules/@jest/core/build/getNoTestFound.js
generated
vendored
Normal 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
|
||||
);
|
||||
}
|
7
node_modules/@jest/core/build/getNoTestFoundFailed.d.ts
generated
vendored
Normal file
7
node_modules/@jest/core/build/getNoTestFoundFailed.d.ts
generated
vendored
Normal 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
33
node_modules/@jest/core/build/getNoTestFoundFailed.js
generated
vendored
Normal 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.')
|
||||
);
|
||||
}
|
7
node_modules/@jest/core/build/getNoTestFoundPassWithNoTests.d.ts
generated
vendored
Normal file
7
node_modules/@jest/core/build/getNoTestFoundPassWithNoTests.d.ts
generated
vendored
Normal 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;
|
30
node_modules/@jest/core/build/getNoTestFoundPassWithNoTests.js
generated
vendored
Normal file
30
node_modules/@jest/core/build/getNoTestFoundPassWithNoTests.js
generated
vendored
Normal 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');
|
||||
}
|
8
node_modules/@jest/core/build/getNoTestFoundRelatedToChangedFiles.d.ts
generated
vendored
Normal file
8
node_modules/@jest/core/build/getNoTestFoundRelatedToChangedFiles.d.ts
generated
vendored
Normal 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;
|
57
node_modules/@jest/core/build/getNoTestFoundRelatedToChangedFiles.js
generated
vendored
Normal file
57
node_modules/@jest/core/build/getNoTestFoundRelatedToChangedFiles.js
generated
vendored
Normal 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;
|
||||
}
|
9
node_modules/@jest/core/build/getNoTestFoundVerbose.d.ts
generated
vendored
Normal file
9
node_modules/@jest/core/build/getNoTestFoundVerbose.d.ts
generated
vendored
Normal 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
95
node_modules/@jest/core/build/getNoTestFoundVerbose.js
generated
vendored
Normal 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
|
||||
);
|
||||
}
|
9
node_modules/@jest/core/build/getNoTestsFoundMessage.d.ts
generated
vendored
Normal file
9
node_modules/@jest/core/build/getNoTestsFoundMessage.d.ts
generated
vendored
Normal 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;
|
52
node_modules/@jest/core/build/getNoTestsFoundMessage.js
generated
vendored
Normal file
52
node_modules/@jest/core/build/getNoTestsFoundMessage.js
generated
vendored
Normal 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);
|
||||
}
|
11
node_modules/@jest/core/build/jest.d.ts
generated
vendored
Normal file
11
node_modules/@jest/core/build/jest.d.ts
generated
vendored
Normal 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
49
node_modules/@jest/core/build/jest.js
generated
vendored
Normal 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};
|
||||
}
|
9
node_modules/@jest/core/build/lib/active_filters_message.d.ts
generated
vendored
Normal file
9
node_modules/@jest/core/build/lib/active_filters_message.d.ts
generated
vendored
Normal 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;
|
54
node_modules/@jest/core/build/lib/active_filters_message.js
generated
vendored
Normal file
54
node_modules/@jest/core/build/lib/active_filters_message.js
generated
vendored
Normal 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;
|
9
node_modules/@jest/core/build/lib/create_context.d.ts
generated
vendored
Normal file
9
node_modules/@jest/core/build/lib/create_context.d.ts
generated
vendored
Normal 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 _default: (config: Config.ProjectConfig, { hasteFS, moduleMap }: import("jest-haste-map/build/types").HasteMap) => import("jest-runtime/build/types").Context;
|
||||
export default _default;
|
35
node_modules/@jest/core/build/lib/create_context.js
generated
vendored
Normal file
35
node_modules/@jest/core/build/lib/create_context.js
generated
vendored
Normal 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;
|
9
node_modules/@jest/core/build/lib/handle_deprecation_warnings.d.ts
generated
vendored
Normal file
9
node_modules/@jest/core/build/lib/handle_deprecation_warnings.d.ts
generated
vendored
Normal 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;
|
73
node_modules/@jest/core/build/lib/handle_deprecation_warnings.js
generated
vendored
Normal file
73
node_modules/@jest/core/build/lib/handle_deprecation_warnings.js
generated
vendored
Normal 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
8
node_modules/@jest/core/build/lib/is_valid_path.d.ts
generated
vendored
Normal 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
29
node_modules/@jest/core/build/lib/is_valid_path.js
generated
vendored
Normal 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)
|
||||
);
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user