Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jest-message-util

Package Overview
Dependencies
Maintainers
5
Versions
203
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jest-message-util

  • 23.0.0-alpha.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
7.4M
decreased by-80.14%
Maintainers
5
Weekly downloads
 
Created

What is jest-message-util?

The jest-message-util package provides utilities for formatting and handling error messages in Jest, a popular JavaScript testing framework. It is particularly useful for creating custom error messages and enhancing the readability of test results.

What are jest-message-util's main functionalities?

formatStackTrace

The formatStackTrace function formats a stack trace to make it more readable. This is particularly useful for debugging and understanding where errors occur in your tests.

const { formatStackTrace } = require('jest-message-util');
const stack = new Error().stack;
const formattedStack = formatStackTrace(stack, { rootDir: process.cwd(), testMatch: [] });
console.log(formattedStack);

formatExecError

The formatExecError function formats execution errors to provide more context and readability. This helps in quickly identifying the cause of test failures.

const { formatExecError } = require('jest-message-util');
const error = new Error('Test error');
const formattedError = formatExecError(error, { rootDir: process.cwd(), testMatch: [] });
console.log(formattedError);

getTopFrame

The getTopFrame function extracts the top frame from a stack trace. This is useful for pinpointing the exact location of an error in your code.

const { getTopFrame } = require('jest-message-util');
const stack = new Error().stack;
const topFrame = getTopFrame(stack);
console.log(topFrame);

Other packages similar to jest-message-util

FAQs

Package last updated on 26 Mar 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc