![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
rapid-check
Advanced tools
Yet another implementation of property based testing framework with support for async properties.
Yet another implementation of property based testing framework with support for async properties.
npm install rapid-check
Works with any testing framework, here's example using jest:
it('tests Set.has function', () => {
const s = new Set([1, 2, 3])
const prop = (v) => s.has(v)
const [result, _] = forAll(choose(1, 3), prop)
expect(result).toBe(true)
})
it('tests async Set.has function', async () => {
const s = new Set([1, 2, 3])
const prop = (v) => Promise.resolve(s.has(v))
const [result, _] = await asyncForAll(choose(1, 3), prop)
expect(result).toBe(true)
})
sample(constantly(4))
// [4, 4, 4, 4, ...]
sample(choose(1, 3))
// [2, 1, 3, 1, ...]
sample(bool)
// [true, true, false, true, ...]
sample(int)
// [0, 1, -2, 3, ...]
sample(uint)
// [0, 1, 0, 3, ...]
sample(tuple(uint, uint))
// [[0, 0], [1, 0], [1, 2], [0, 1], ...]
sample(array(uint, 1, 3))
// [[0], [1], [2, 0], [1, 1], [0], [0, 3, 3], ...]
sample(oneOf(bool, uint))
// [true, 1, 2, false, ...]
Where f: a -> b
const negate = (n) => -n
sample(fmap(negate, uint))
// [0, -1, -1, -3, ...]
Where f: a -> Gen b
const f = (n) => ap(tuple, repeat(bool, n))
sample(mbind(f, uint))
// [[], [true], [false, false], [false], ... [true, false, false, true, false], [false]]
FAQs
Yet another implementation of property based testing framework with support for async properties.
The npm package rapid-check receives a total of 6 weekly downloads. As such, rapid-check popularity was classified as not popular.
We found that rapid-check 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
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.