Socket
Socket
Sign inDemoInstall

jest-message-util

Package Overview
Dependencies
32
Maintainers
6
Versions
200
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 29.4.2 to 29.4.3

5

build/index.d.ts
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
* Copyright (c) Meta Platforms, Inc. and affiliates.
*

@@ -12,3 +12,3 @@ * This source code is licensed under the MIT license found in the

export declare const formatExecError: (
error: Error | TestResult.SerializableError | string | undefined,
error: Error | TestResult.SerializableError | string | number | undefined,
config: StackTraceConfig,

@@ -18,2 +18,3 @@ options: StackTraceOptions,

reuseMessage?: boolean,
noTitle?: boolean,
) => string;

@@ -20,0 +21,0 @@

43

build/index.js

@@ -17,2 +17,3 @@ 'use strict';

var _url = require('url');
var _util = require('util');
var _codeFrame = require('@babel/code-frame');

@@ -158,3 +159,10 @@ var _chalk = _interopRequireDefault(require('chalk'));

// are executed.
const formatExecError = (error, config, options, testPath, reuseMessage) => {
const formatExecError = (
error,
config,
options,
testPath,
reuseMessage,
noTitle
) => {
if (!error || typeof error === 'number') {

@@ -165,2 +173,3 @@ error = new Error(`Expected an Error, but "${String(error)}" was thrown`);

let message, stack;
let cause = '';
if (typeof error === 'string' || !error) {

@@ -178,3 +187,30 @@ error || (error = 'EMPTY ERROR');

})}`;
if ('cause' in error) {
const prefix = '\n\nCause:\n';
if (typeof error.cause === 'string' || typeof error.cause === 'number') {
cause += `${prefix}${error.cause}`;
} else if (
_util.types.isNativeError(error.cause) ||
error.cause instanceof Error
) {
/* `isNativeError` is used, because the error might come from another realm.
`instanceof Error` is used because `isNativeError` does return `false` for some
things that are `instanceof Error` like the errors provided in
[verror](https://www.npmjs.com/package/verror) or [axios](https://axios-http.com).
*/
const formatted = formatExecError(
error.cause,
config,
options,
testPath,
reuseMessage,
true
);
cause += `${prefix}${formatted}`;
}
}
}
if (cause !== '') {
cause = indentAllLines(cause);
}
const separated = separateMessageFromStack(stack || '');

@@ -202,3 +238,3 @@ stack = separated.stack;

let messageToUse;
if (reuseMessage) {
if (reuseMessage || noTitle) {
messageToUse = ` ${message.trim()}`;

@@ -208,3 +244,4 @@ } else {

}
return `${TITLE_INDENT + TITLE_BULLET + messageToUse + stack}\n`;
const title = noTitle ? '' : `${TITLE_INDENT + TITLE_BULLET}`;
return `${title + messageToUse + stack + cause}\n`;
};

@@ -211,0 +248,0 @@ exports.formatExecError = formatExecError;

{
"name": "jest-message-util",
"version": "29.4.2",
"version": "29.4.3",
"repository": {

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

"@babel/code-frame": "^7.12.13",
"@jest/types": "^29.4.2",
"@jest/types": "^29.4.3",
"@types/stack-utils": "^2.0.0",

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

"micromatch": "^4.0.4",
"pretty-format": "^29.4.2",
"pretty-format": "^29.4.3",
"slash": "^3.0.0",

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

},
"gitHead": "f0fc92e8443f09546c7ec0472bf9bce44fe5898f"
"gitHead": "a49c88610e49a3242576160740a32a2fe11161e1"
}

Sorry, the diff of this file is not supported yet

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