Security News
RubyGems.org Adds New Maintainer Role
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.
jest-matcher-utils
Advanced tools
A set of utility functions for jest-matchers and related packages
The jest-matcher-utils package provides utility functions for creating custom Jest matchers. It is designed to help developers write their own matchers that integrate seamlessly with Jest's built-in expectation system, offering a way to extend Jest's assertion capabilities with custom logic. The utilities provided by this package include formatting values for error messages, comparing values, and generating matcher error messages.
pretty-format
Formats any JavaScript value for pretty printing, which is useful for generating readable error messages in custom matchers.
const { prettyFormat } = require('jest-matcher-utils');
console.log(prettyFormat({ foo: 'bar' }));
matcherHint
Generates a hint string for a matcher, which can be used at the beginning of error messages to indicate which matcher failed.
const { matcherHint } = require('jest-matcher-utils');
console.log(matcherHint('.toBe'));
printExpected and printReceived
These functions format the expected and received values to be included in error messages, applying color highlighting to improve readability.
const { printExpected, printReceived } = require('jest-matcher-utils');
console.log(`Expected: ${printExpected(true)}
Received: ${printReceived(false)}`);
Chai is a BDD / TDD assertion library for node and the browser that can be delightfully paired with any javascript testing framework. It offers similar functionality to jest-matcher-utils in the sense that it provides a rich set of assertions and plugins to extend its capabilities. However, Chai is a standalone assertion library, not tied to any specific test runner like Jest.
Expect is a minimalist assertion library that comes with Jest but can also be used independently. It provides a similar API for writing test assertions as jest-matcher-utils, but jest-matcher-utils focuses more on the utilities for creating custom matchers rather than providing a comprehensive set of built-in matchers.
FAQs
A set of utility functions for expect and related packages
The npm package jest-matcher-utils receives a total of 15,804,639 weekly downloads. As such, jest-matcher-utils popularity was classified as popular.
We found that jest-matcher-utils demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 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
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.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.