Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
jest-util
Advanced tools
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.
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));
Chai is an assertion library similar to jest-util in that it is used to help with testing JavaScript applications. Unlike jest-util, Chai focuses more on providing a rich set of assertions rather than utilities for managing Jest environments or outputs.
Mocha is a test framework that, like Jest, can utilize utility packages for enhanced testing capabilities. While jest-util specifically supports Jest, Mocha has its own set of utilities and plugins that serve a similar purpose but are tailored to Mocha's ecosystem.
Sinon provides standalone test spies, stubs, and mocks for JavaScript. It complements jest-util by offering more focused functionalities for creating and managing test doubles, which can be used alongside or independently of Jest.
27.1.0
[jest-haste-map]
Use watchman suffix-set option for faster file indexing. (#11784)[jest-cli]
Adds a new config options snapshotFormat
which offers a way to override any of the formatting settings which come with pretty-format. (#11654)[jest-reporters]
Expose the getSummary
util (#11695).[jest-resolver]
Support node:
prefix when importing Node core modules (#11331)[jest-each]
Relaxed the validation to allow multibyte characters in headings (#11575)[jest-environment-jsdom]
Add support for userAgent
option (#11773)[jest-environment-node]
Add Event
and EventTarget
to node global environment. (#11727)[jest-mock]
Fix spyOn
to use Object.prototype.hasOwnProperty
(#11721)[jest-resolver]
Add dependency on jest-haste-map
(#11759)[jest-types]
Compat with @types/node
v16 (#11645)[docs]
Correct expects.assertions
documentation by adding async/await for asynchronous function.FAQs
This packages is a collection of utilities and helper functions
The npm package jest-util receives a total of 23,944,643 weekly downloads. As such, jest-util popularity was classified as popular.
We found that jest-util demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
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.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.