Socket
Socket
Sign inDemoInstall

jest-util

Package Overview
Dependencies
17
Maintainers
6
Versions
258
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    jest-util


Version published
Weekly downloads
54M
decreased by-3.57%
Maintainers
6
Install size
1.99 MB
Created
Weekly downloads
ย 

Package description

What is jest-util?

The jest-util package provides utility functions for Jest, a popular JavaScript testing framework. It includes a variety of helpers and tools that are used internally by Jest but can also be useful for developers working with or extending Jest tests.

What are jest-util's main functionalities?

Console Replacement

This feature allows for the creation of a custom console that buffers all logs. This is useful for controlling and testing console output during test runs.

const { BufferedConsole } = require('jest-util');
const customConsole = new BufferedConsole();
customConsole.log('Hello, this is a buffered log.');

Error Formatting

This function formats execution errors for display in Jest's output, providing a standardized view of test errors, including stack traces.

const { formatExecError } = require('jest-util');
const error = new Error('Test error');
const config = {rootDir: '/path/to/project', testMatch: []};
console.log(formatExecError(error, config, {noStackTrace: false}, undefined, true));

Test Path Normalization

This utility normalizes file paths for glob matching, which is particularly useful on Windows where path separators differ.

const { replacePathSepForGlob } = require('jest-util');
const path = 'path\to\test\file.js';
console.log(replacePathSepForGlob(path));

Other packages similar to jest-util

Changelog

Source

27.4.0

Features

  • [expect] Enhancing the toHaveProperty matcher to support array selection (#12092)
  • [jest-core] Add support for testResultsProcessor written in ESM (#12006)
  • [jest-diff, pretty-format] Add compareKeys option for custom sorting of object keys (#11992)
  • [jest-mock] Add ts-jest mock util functions (#12089)

Fixes

  • [expect] Allow again expect.Matchers generic with single value (#11986)
  • [jest-circus, jest-jasmine2] Avoid false concurrent test failures due to unhandled promise rejections (#11987)
  • [jest-config] Add missing slash dependency to package.json (#12080)
  • [jest-core] Incorrect detection of open ZLIB handles (#12022)
  • [jest-diff] Break dependency cycle (#10818)
  • [jest-environment-jsdom] Add @types/jsdom dependency (#11999)
  • [jest-environment-jsdom] Do not reset the global.document too early on teardown (#11871)
  • [jest-transform] Improve error and warning messages (#11998)
  • [jest-worker] Pass execArgv correctly to worker_threads worker (#12069)

Chore & Maintenance

  • [docs] CLI options alphabetized (#11586)
  • [jest-runner] Add info regarding timers to forcedExit message(#12083)
  • [*] Replaced substr method with substring (#12066)
  • [*] Add types entry to all export maps (#12073)

FAQs

Last updated on 29 Nov 2021

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with โšก๏ธ by Socket Inc