Updating NPM dependencies
This commit is contained in:
19
node_modules/jest-message-util/build/index.d.ts
generated
vendored
19
node_modules/jest-message-util/build/index.d.ts
generated
vendored
@@ -4,21 +4,20 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
import { Config } from '@jest/types';
|
||||
import { AssertionResult, SerializableError } from '@jest/test-result';
|
||||
import { Frame } from './types';
|
||||
export { Frame } from './types';
|
||||
import type { Config, TestResult } from '@jest/types';
|
||||
import type { Frame } from './types';
|
||||
export type { Frame } from './types';
|
||||
export declare type StackTraceConfig = Pick<Config.ProjectConfig, 'rootDir' | 'testMatch'>;
|
||||
export declare type StackTraceOptions = {
|
||||
noStackTrace: boolean;
|
||||
noCodeFrame?: boolean;
|
||||
};
|
||||
export declare const formatExecError: (error: string | Error | SerializableError | undefined, config: Pick<Config.ProjectConfig, "rootDir" | "testMatch">, options: StackTraceOptions, testPath?: string | undefined, reuseMessage?: boolean | undefined) => string;
|
||||
export declare const getStackTraceLines: (stack: string, options?: StackTraceOptions) => string[];
|
||||
export declare const getTopFrame: (lines: string[]) => Frame | null;
|
||||
export declare const formatStackTrace: (stack: string, config: Pick<Config.ProjectConfig, "rootDir" | "testMatch">, options: StackTraceOptions, testPath?: string | undefined) => string;
|
||||
export declare const formatResultsErrors: (testResults: AssertionResult[], config: Pick<Config.ProjectConfig, "rootDir" | "testMatch">, options: StackTraceOptions, testPath?: string | undefined) => string | null;
|
||||
export declare const formatExecError: (error: Error | TestResult.SerializableError | string | undefined, config: StackTraceConfig, options: StackTraceOptions, testPath?: string | undefined, reuseMessage?: boolean | undefined) => string;
|
||||
export declare const getStackTraceLines: (stack: string, options?: StackTraceOptions) => Array<string>;
|
||||
export declare const getTopFrame: (lines: Array<string>) => Frame | null;
|
||||
export declare const formatStackTrace: (stack: string, config: StackTraceConfig, options: StackTraceOptions, testPath?: string | undefined) => string;
|
||||
export declare const formatResultsErrors: (testResults: Array<TestResult.AssertionResult>, config: StackTraceConfig, options: StackTraceOptions, testPath?: string | undefined) => string | null;
|
||||
export declare const separateMessageFromStack: (content: string) => {
|
||||
message: string;
|
||||
stack: string;
|
||||
};
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
node_modules/jest-message-util/build/index.d.ts.map
generated
vendored
1
node_modules/jest-message-util/build/index.d.ts.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AACnC,OAAO,EAAC,eAAe,EAAE,iBAAiB,EAAC,MAAM,mBAAmB,CAAC;AAMrE,OAAO,EAAC,KAAK,EAAC,MAAM,SAAS,CAAC;AAE9B,OAAO,EAAC,KAAK,EAAC,MAAM,SAAS,CAAC;AAgB9B,oBAAY,gBAAgB,GAAG,IAAI,CACjC,MAAM,CAAC,aAAa,EACpB,SAAS,GAAG,WAAW,CACxB,CAAC;AAEF,oBAAY,iBAAiB,GAAG;IAC9B,YAAY,EAAE,OAAO,CAAC;CACvB,CAAC;AAwDF,eAAO,MAAM,eAAe,+NAoD3B,CAAC;AA6EF,eAAO,MAAM,kBAAkB,0DAG4B,CAAC;AAE5D,eAAO,MAAM,WAAW,mCAcvB,CAAC;AAEF,eAAO,MAAM,gBAAgB,mJAsC5B,CAAC;AAEF,eAAO,MAAM,mBAAmB,2KA8C/B,CAAC;AAeF,eAAO,MAAM,wBAAwB;;;CAmBpC,CAAC"}
|
||||
221
node_modules/jest-message-util/build/index.js
generated
vendored
221
node_modules/jest-message-util/build/index.js
generated
vendored
@@ -3,40 +3,74 @@
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, 'Frame', {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _types.Frame;
|
||||
}
|
||||
});
|
||||
exports.separateMessageFromStack = exports.formatResultsErrors = exports.formatStackTrace = exports.getTopFrame = exports.getStackTraceLines = exports.formatExecError = void 0;
|
||||
|
||||
var _fs = _interopRequireDefault(require('fs'));
|
||||
var path = _interopRequireWildcard(require('path'));
|
||||
|
||||
var _path = _interopRequireDefault(require('path'));
|
||||
var _codeFrame = require('@babel/code-frame');
|
||||
|
||||
var _chalk = _interopRequireDefault(require('chalk'));
|
||||
|
||||
var fs = _interopRequireWildcard(require('graceful-fs'));
|
||||
|
||||
var _micromatch = _interopRequireDefault(require('micromatch'));
|
||||
|
||||
var _slash = _interopRequireDefault(require('slash'));
|
||||
|
||||
var _codeFrame = require('@babel/code-frame');
|
||||
|
||||
var _stackUtils = _interopRequireDefault(require('stack-utils'));
|
||||
|
||||
var _types = require('./types');
|
||||
var _prettyFormat = _interopRequireDefault(require('pretty-format'));
|
||||
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
}
|
||||
|
||||
var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol;
|
||||
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;
|
||||
}
|
||||
|
||||
var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol;
|
||||
var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol;
|
||||
var jestReadFile =
|
||||
global[Symbol.for('jest-native-read-file')] || _fs.default.readFileSync;
|
||||
|
||||
var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol;
|
||||
global[Symbol.for('jest-native-read-file')] || fs.readFileSync;
|
||||
// stack utils tries to create pretty stack by making paths relative.
|
||||
const stackUtils = new _stackUtils.default({
|
||||
cwd: 'something which does not exist'
|
||||
@@ -44,14 +78,15 @@ const stackUtils = new _stackUtils.default({
|
||||
let nodeInternals = [];
|
||||
|
||||
try {
|
||||
nodeInternals = _stackUtils.default.nodeInternals();
|
||||
} catch (e) {
|
||||
// https://github.com/tapjs/stack-utils/issues/54
|
||||
nodeInternals = _stackUtils.default.nodeInternals().concat(/\s*\(node:/);
|
||||
} catch {
|
||||
// `StackUtils.nodeInternals()` fails in browsers. We don't need to remove
|
||||
// node internals in the browser though, so no issue.
|
||||
}
|
||||
|
||||
const PATH_NODE_MODULES = `${_path.default.sep}node_modules${_path.default.sep}`;
|
||||
const PATH_JEST_PACKAGES = `${_path.default.sep}jest${_path.default.sep}packages${_path.default.sep}`; // filter for noisy stack trace lines
|
||||
const PATH_NODE_MODULES = `${path.sep}node_modules${path.sep}`;
|
||||
const PATH_JEST_PACKAGES = `${path.sep}jest${path.sep}packages${path.sep}`; // filter for noisy stack trace lines
|
||||
|
||||
const JASMINE_IGNORE = /^\s+at(?:(?:.jasmine\-)|\s+jasmine\.buildExpectationResult)/;
|
||||
const JEST_INTERNALS_IGNORE = /^\s+at.*?jest(-.*?)?(\/|\\)(build|node_modules|packages)(\/|\\)/;
|
||||
@@ -100,7 +135,31 @@ const getRenderedCallsite = (fileContent, line, column) => {
|
||||
return renderedCallsite;
|
||||
};
|
||||
|
||||
const blankStringRegexp = /^\s*$/; // ExecError is an error thrown outside of the test suite (not inside an `it` or
|
||||
const blankStringRegexp = /^\s*$/;
|
||||
|
||||
function checkForCommonEnvironmentErrors(error) {
|
||||
if (
|
||||
error.includes('ReferenceError: document is not defined') ||
|
||||
error.includes('ReferenceError: window is not defined') ||
|
||||
error.includes('ReferenceError: navigator is not defined')
|
||||
) {
|
||||
return warnAboutWrongTestEnvironment(error, 'jsdom');
|
||||
} else if (error.includes('.unref is not a function')) {
|
||||
return warnAboutWrongTestEnvironment(error, 'node');
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
function warnAboutWrongTestEnvironment(error, env) {
|
||||
return (
|
||||
_chalk.default.bold.red(
|
||||
`The error below may be caused by using the wrong test environment, see ${_chalk.default.dim.underline(
|
||||
'https://jestjs.io/docs/en/configuration#testenvironment-string'
|
||||
)}.\nConsider using the "${env}" test environment.\n\n`
|
||||
) + error
|
||||
);
|
||||
} // ExecError is an error thrown outside of the test suite (not inside an `it` or
|
||||
// `before/after each` hooks). If it's thrown, none of the tests in the file
|
||||
// are executed.
|
||||
|
||||
@@ -118,7 +177,12 @@ const formatExecError = (error, config, options, testPath, reuseMessage) => {
|
||||
stack = error;
|
||||
} else {
|
||||
message = error.message;
|
||||
stack = error.stack;
|
||||
stack =
|
||||
typeof error.stack === 'string'
|
||||
? error.stack
|
||||
: `thrown: ${(0, _prettyFormat.default)(error, {
|
||||
maxDepth: 3
|
||||
})}`;
|
||||
}
|
||||
|
||||
const separated = separateMessageFromStack(stack || '');
|
||||
@@ -129,15 +193,21 @@ const formatExecError = (error, config, options, testPath, reuseMessage) => {
|
||||
message = separated.message;
|
||||
}
|
||||
|
||||
message = checkForCommonEnvironmentErrors(message);
|
||||
message = indentAllLines(message, MESSAGE_INDENT);
|
||||
stack =
|
||||
stack && !options.noStackTrace
|
||||
? '\n' + formatStackTrace(stack, config, options, testPath)
|
||||
: '';
|
||||
|
||||
if (blankStringRegexp.test(message) && blankStringRegexp.test(stack)) {
|
||||
if (
|
||||
typeof stack !== 'string' ||
|
||||
(blankStringRegexp.test(message) && blankStringRegexp.test(stack))
|
||||
) {
|
||||
// this can happen if an empty object is thrown.
|
||||
message = MESSAGE_INDENT + 'Error: No message was provided';
|
||||
message = `thrown: ${(0, _prettyFormat.default)(error, {
|
||||
maxDepth: 3
|
||||
})}`;
|
||||
}
|
||||
|
||||
let messageToUse;
|
||||
@@ -208,14 +278,12 @@ const formatPaths = (config, relativeTestPath, line) => {
|
||||
return line;
|
||||
}
|
||||
|
||||
let filePath = (0, _slash.default)(
|
||||
_path.default.relative(config.rootDir, match[2])
|
||||
); // highlight paths from the current test file
|
||||
let filePath = (0, _slash.default)(path.relative(config.rootDir, match[2])); // highlight paths from the current test file
|
||||
|
||||
if (
|
||||
(config.testMatch &&
|
||||
config.testMatch.length &&
|
||||
_micromatch.default.some(filePath, config.testMatch)) ||
|
||||
(0, _micromatch.default)([filePath], config.testMatch).length > 0) ||
|
||||
filePath === relativeTestPath
|
||||
) {
|
||||
filePath = _chalk.default.reset.cyan(filePath);
|
||||
@@ -227,6 +295,7 @@ const formatPaths = (config, relativeTestPath, line) => {
|
||||
const getStackTraceLines = (
|
||||
stack,
|
||||
options = {
|
||||
noCodeFrame: false,
|
||||
noStackTrace: false
|
||||
}
|
||||
) => removeInternalStackEntries(stack.split(/\n/), options);
|
||||
@@ -234,43 +303,15 @@ const getStackTraceLines = (
|
||||
exports.getStackTraceLines = getStackTraceLines;
|
||||
|
||||
const getTopFrame = lines => {
|
||||
var _iteratorNormalCompletion = true;
|
||||
var _didIteratorError = false;
|
||||
var _iteratorError = undefined;
|
||||
|
||||
try {
|
||||
for (
|
||||
var _iterator = lines[Symbol.iterator](), _step;
|
||||
!(_iteratorNormalCompletion = (_step = _iterator.next()).done);
|
||||
_iteratorNormalCompletion = true
|
||||
) {
|
||||
const line = _step.value;
|
||||
|
||||
if (
|
||||
line.includes(PATH_NODE_MODULES) ||
|
||||
line.includes(PATH_JEST_PACKAGES)
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const parsedFrame = stackUtils.parseLine(line.trim());
|
||||
|
||||
if (parsedFrame && parsedFrame.file) {
|
||||
return parsedFrame;
|
||||
}
|
||||
for (const line of lines) {
|
||||
if (line.includes(PATH_NODE_MODULES) || line.includes(PATH_JEST_PACKAGES)) {
|
||||
continue;
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError = true;
|
||||
_iteratorError = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
||||
_iterator.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError) {
|
||||
throw _iteratorError;
|
||||
}
|
||||
|
||||
const parsedFrame = stackUtils.parseLine(line.trim());
|
||||
|
||||
if (parsedFrame && parsedFrame.file) {
|
||||
return parsedFrame;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -281,27 +322,28 @@ exports.getTopFrame = getTopFrame;
|
||||
|
||||
const formatStackTrace = (stack, config, options, testPath) => {
|
||||
const lines = getStackTraceLines(stack, options);
|
||||
const topFrame = getTopFrame(lines);
|
||||
let renderedCallsite = '';
|
||||
const relativeTestPath = testPath
|
||||
? (0, _slash.default)(_path.default.relative(config.rootDir, testPath))
|
||||
? (0, _slash.default)(path.relative(config.rootDir, testPath))
|
||||
: null;
|
||||
|
||||
if (topFrame) {
|
||||
const column = topFrame.column,
|
||||
filename = topFrame.file,
|
||||
line = topFrame.line;
|
||||
if (!options.noStackTrace && !options.noCodeFrame) {
|
||||
const topFrame = getTopFrame(lines);
|
||||
|
||||
if (line && filename && _path.default.isAbsolute(filename)) {
|
||||
let fileContent;
|
||||
if (topFrame) {
|
||||
const {column, file: filename, line} = topFrame;
|
||||
|
||||
try {
|
||||
// TODO: check & read HasteFS instead of reading the filesystem:
|
||||
// see: https://github.com/facebook/jest/pull/5405#discussion_r164281696
|
||||
fileContent = jestReadFile(filename, 'utf8');
|
||||
renderedCallsite = getRenderedCallsite(fileContent, line, column);
|
||||
} catch (e) {
|
||||
// the file does not exist or is inaccessible, we ignore
|
||||
if (line && filename && path.isAbsolute(filename)) {
|
||||
let fileContent;
|
||||
|
||||
try {
|
||||
// TODO: check & read HasteFS instead of reading the filesystem:
|
||||
// see: https://github.com/facebook/jest/pull/5405#discussion_r164281696
|
||||
fileContent = jestReadFile(filename, 'utf8');
|
||||
renderedCallsite = getRenderedCallsite(fileContent, line, column);
|
||||
} catch {
|
||||
// the file does not exist or is inaccessible, we ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -313,19 +355,23 @@ const formatStackTrace = (stack, config, options, testPath) => {
|
||||
STACK_INDENT + formatPaths(config, relativeTestPath, trimPaths(line))
|
||||
)
|
||||
.join('\n');
|
||||
return `${renderedCallsite}\n${stacktrace}`;
|
||||
return renderedCallsite
|
||||
? `${renderedCallsite}\n${stacktrace}`
|
||||
: `\n${stacktrace}`;
|
||||
};
|
||||
|
||||
exports.formatStackTrace = formatStackTrace;
|
||||
|
||||
const formatResultsErrors = (testResults, config, options, testPath) => {
|
||||
const failedResults = testResults.reduce((errors, result) => {
|
||||
result.failureMessages.forEach(content =>
|
||||
errors.push({
|
||||
content,
|
||||
result
|
||||
})
|
||||
);
|
||||
result.failureMessages
|
||||
.map(checkForCommonEnvironmentErrors)
|
||||
.forEach(content =>
|
||||
errors.push({
|
||||
content,
|
||||
result
|
||||
})
|
||||
);
|
||||
return errors;
|
||||
}, []);
|
||||
|
||||
@@ -335,10 +381,7 @@ const formatResultsErrors = (testResults, config, options, testPath) => {
|
||||
|
||||
return failedResults
|
||||
.map(({result, content}) => {
|
||||
let _separateMessageFromS = separateMessageFromStack(content),
|
||||
message = _separateMessageFromS.message,
|
||||
stack = _separateMessageFromS.stack;
|
||||
|
||||
let {message, stack} = separateMessageFromStack(content);
|
||||
stack = options.noStackTrace
|
||||
? ''
|
||||
: STACK_TRACE_COLOR(
|
||||
|
||||
3
node_modules/jest-message-util/build/types.d.ts
generated
vendored
3
node_modules/jest-message-util/build/types.d.ts
generated
vendored
@@ -4,8 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
import { StackData } from 'stack-utils';
|
||||
import type { StackData } from 'stack-utils';
|
||||
export interface Frame extends StackData {
|
||||
file: string;
|
||||
}
|
||||
//# sourceMappingURL=types.d.ts.map
|
||||
1
node_modules/jest-message-util/build/types.d.ts.map
generated
vendored
1
node_modules/jest-message-util/build/types.d.ts.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAEtC,MAAM,WAAW,KAAM,SAAQ,SAAS;IACtC,IAAI,EAAE,MAAM,CAAC;CACd"}
|
||||
Reference in New Issue
Block a user