
Security News
rv Is a New Rust-Powered Ruby Version Manager Inspired by Python's uv
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
expect-predicate
Advanced tools
An extension for expect that lets you test values against arbitrary predicates
expect-predicate is an extension for expect that lets you test values against arbitrary predicates.
A value "passes" a predicate if the predicate returns a truthy value.
Using npm:
$ npm install --save-dev expect expect-predicate
Then, use as you would anything else:
// using ES6 modules
import expect from 'expect'
import expectPredicate from 'expect-predicate'
expect.extend(expectPredicate)
// using CommonJS modules
var expect = require('expect')
var expectPredicate = require('expect-predicate')
expect.extend(expectPredicate)
expect(value).toPass(predicate, [message])
Asserts the given value passes the given predicate. If you provide a message, it will be used when reporting the failure.
expect(age).toPass(n => n >= 18) // check age is 18 or older
expect(userList).toPass(array => array.length) // check that userList is not empty
expect(value).toNotPass(predicate, [message])
Asserts the given value does NOT pass the given predicate. If you provide a message, it will be used when reporting the failure.
expect(age).toNotPass(n => n < 18) // check age is not under 18
expect(userList).toNotPass(array => array.length) // check that userList is empty
FAQs
An extension for expect that lets you test values against arbitrary predicates
The npm package expect-predicate receives a total of 418 weekly downloads. As such, expect-predicate popularity was classified as not popular.
We found that expect-predicate demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.
Security News
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.