Socket
Socket
Sign inDemoInstall

jest-message-util

Package Overview
Dependencies
34
Maintainers
6
Versions
200
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 30.0.0-alpha.2 to 30.0.0-alpha.3

10

build/index.d.ts

@@ -33,3 +33,3 @@ /**

export declare const formatStackTrace: (
export declare function formatStackTrace(
stack: string,

@@ -39,3 +39,3 @@ config: StackTraceConfig,

testPath?: string,
) => string;
): string;

@@ -46,8 +46,8 @@ export declare interface Frame extends StackData {

export declare const getStackTraceLines: (
export declare function getStackTraceLines(
stack: string,
options?: StackTraceOptions,
) => Array<string>;
): Array<string>;
export declare const getTopFrame: (lines: Array<string>) => Frame | null;
export declare function getTopFrame(lines: Array<string>): Frame | null;

@@ -54,0 +54,0 @@ export declare const indentAllLines: (lines: string) => string;

@@ -20,3 +20,7 @@ /*!

}));
exports.separateMessageFromStack = exports.indentAllLines = exports.getTopFrame = exports.getStackTraceLines = exports.formatStackTrace = exports.formatResultsErrors = exports.formatPath = exports.formatExecError = void 0;
exports.formatResultsErrors = exports.formatPath = exports.formatExecError = void 0;
exports.formatStackTrace = formatStackTrace;
exports.getStackTraceLines = getStackTraceLines;
exports.getTopFrame = getTopFrame;
exports.separateMessageFromStack = exports.indentAllLines = void 0;
var path = _interopRequireWildcard(require("path"));

@@ -69,3 +73,3 @@ var _url = require("url");

const ANCESTRY_SEPARATOR = ' \u203A ';
const TITLE_BULLET = _chalk.default.bold('\u25cf ');
const TITLE_BULLET = _chalk.default.bold('\u25CF ');
const STACK_TRACE_COLOR = _chalk.default.dim;

@@ -75,3 +79,3 @@ const STACK_PATH_REGEXP = /\s*at.*\(?(:\d*:\d*|native)\)?/;

const NOT_EMPTY_LINE_REGEXP = /^(?!$)/gm;
const indentAllLines = lines => lines.replace(NOT_EMPTY_LINE_REGEXP, MESSAGE_INDENT);
const indentAllLines = lines => lines.replaceAll(NOT_EMPTY_LINE_REGEXP, MESSAGE_INDENT);
exports.indentAllLines = indentAllLines;

@@ -84,3 +88,3 @@ const trim = string => (string || '').trim();

// which will get misaligned.
const trimPaths = string => string.match(STACK_PATH_REGEXP) ? trim(string) : string;
const trimPaths = string => STACK_PATH_REGEXP.test(string) ? trim(string) : string;
const getRenderedCallsite = (fileContent, line, column) => {

@@ -208,3 +212,2 @@ let renderedCallsite = (0, _codeFrame.codeFrameColumns)(fileContent, {

}
if (options.noStackTrace) {

@@ -221,3 +224,3 @@ return false;

// Extract the file path from the trace line.
const match = line.match(/(^\s*at .*?\(?)([^()]+)(:[0-9]+:[0-9]+\)?.*$)/);
const match = line.match(/(^\s*at .*?\(?)([^()]+)(:\d+:\d+\)?.*$)/);
if (!match) {

@@ -234,8 +237,11 @@ return line;

exports.formatPath = formatPath;
const getStackTraceLines = (stack, options = {
noCodeFrame: false,
noStackTrace: false
}) => removeInternalStackEntries(stack.split(/\n/), options);
exports.getStackTraceLines = getStackTraceLines;
const getTopFrame = lines => {
function getStackTraceLines(stack, options) {
options = {
noCodeFrame: false,
noStackTrace: false,
...options
};
return removeInternalStackEntries(stack.split(/\n/), options);
}
function getTopFrame(lines) {
for (const line of lines) {

@@ -254,5 +260,4 @@ if (line.includes(PATH_NODE_MODULES) || line.includes(PATH_JEST_PACKAGES)) {

return null;
};
exports.getTopFrame = getTopFrame;
const formatStackTrace = (stack, config, options, testPath) => {
}
function formatStackTrace(stack, config, options, testPath) {
const lines = getStackTraceLines(stack, options);

@@ -284,4 +289,3 @@ let renderedCallsite = '';

return renderedCallsite ? `${renderedCallsite}\n${stacktrace}` : `\n${stacktrace}`;
};
exports.formatStackTrace = formatStackTrace;
}
function isErrorOrStackWithCause(errorOrStack) {

@@ -315,7 +319,5 @@ return typeof errorOrStack !== 'string' && 'cause' in errorOrStack && (typeof errorOrStack.cause === 'string' || _util.types.isNativeError(errorOrStack.cause) || errorOrStack.cause instanceof Error);

}
if (typeof failureDetails === 'object' && 'error' in failureDetails && (_util.types.isNativeError(failureDetails.error) || failureDetails.error instanceof Error)) {
return failureDetails.error; // receiving instances of FailedAssertion for jest-jasmine
}
return content;

@@ -351,3 +353,3 @@ }

// Lines saying just `Error:` are useless
.filter(line => !errorRegexp.test(line)).join('\n').trimRight();
.filter(line => !errorRegexp.test(line)).join('\n').trimEnd();

@@ -369,3 +371,3 @@ // jasmine and worker farm sometimes don't give us access to the actual

// remove the prefix from the message because it is generally not useful.
const messageMatch = content.match(/^(?:Error: )?([\s\S]*?(?=\n\s*at\s.*:\d*:\d*)|\s*.*)([\s\S]*)$/);
const messageMatch = content.match(/^(?:Error: )?([\S\s]*?(?=\n\s*at\s.*:\d*:\d*)|\s*.*)([\S\s]*)$/);
if (!messageMatch) {

@@ -372,0 +374,0 @@ // For typescript

{
"name": "jest-message-util",
"version": "30.0.0-alpha.2",
"version": "30.0.0-alpha.3",
"repository": {

@@ -26,3 +26,3 @@ "type": "git",

"@babel/code-frame": "^7.12.13",
"@jest/types": "30.0.0-alpha.2",
"@jest/types": "30.0.0-alpha.3",
"@types/stack-utils": "^2.0.0",

@@ -32,3 +32,3 @@ "chalk": "^4.0.0",

"micromatch": "^4.0.4",
"pretty-format": "30.0.0-alpha.2",
"pretty-format": "30.0.0-alpha.3",
"slash": "^3.0.0",

@@ -46,3 +46,3 @@ "stack-utils": "^2.0.3"

},
"gitHead": "c04d13d7abd22e47b0997f6027886aed225c9ce4"
"gitHead": "e267aff33d105399f2134bad7c8f82285104f3da"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc