Socket
Socket
Sign inDemoInstall

jest-message-util

Package Overview
Dependencies
44
Maintainers
3
Versions
202
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    jest-message-util


Version published
Weekly downloads
38M
decreased by-0.64%
Maintainers
3
Install size
381 kB
Created
Weekly downloads
 

Package description

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

Last updated on 04 May 2017

Did you know?

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc