- Home
- Property-Based Testing Tools
- JSVerify
JSVerify
What it is
JSVerify is a free, open-source property-based testing library for JavaScript, inspired by QuickCheck. Rather than relying only on hand-picked examples, it generates many possible inputs and checks whether a stated property holds. If a property fails, it attempts to shrink the generated input to find a smaller counterexample. Properties may return Promises, allowing asynchronous methods to be tested. JSVerify is framework agnostic, with Mocha, nodeunit, and Jasmine named as examples. The project README instructs users to install it with `npm install jsverify` and points to the GitHub README for API and usage documentation. TypeScript typings are provided, although TypeScript specs cannot use the type DSL. The documented default is 100 tests with a maximum generated-value size of 50; options also control test count, size, quiet output, and random generator state. Generated values are deterministic when primitives from the random module are used. The project is maintained by phadej and licensed under MIT. Its README warns that exposed utility functions may change incompatibly, including in patch releases.
For and against
For
- Generates many inputs for property checks.
- Attempts to shrink failing cases.
- Properties can return Promises.
- Framework agnostic, with three named examples.
- MIT-licensed and free.
Against
- TypeScript specs cannot use the type DSL.
- Exposed utility functions may change incompatibly.
- Stateful testing is not supported.
The verdict
JSVerify provides generated-input testing, counterexample shrinking, and reproducible values for supported random primitives. Its TypeScript DSL limitation and utility-function stability warning are worth considering before adopting it.
Who it suits
JSVerify may suit JavaScript developers who want generated inputs to check function properties, including asynchronous methods. It can be used alongside frameworks such as Mocha, nodeunit, or Jasmine.
Plans and prices
JSVerify
Open-source JavaScript property-based testing library
Read 8 Oct 2026 · github.com
On the record
- Async tests
- Properties can be synchronous or return a Promise for asynchronous testing.github.com · read 8 Oct 2026
- Configuration
- The check API documents options for test count, maximum generated value size, quiet output, and random generator state.github.com · read 8 Oct 2026
- Counterexamples
- When a property fails, JSVerify attempts to find the smallest possible counterexample.jsverify.github.io · read 8 Oct 2026
- Default checks
- The documented default is 100 tests, with a maximum generated-value size of 50.github.com · read 7 Oct 2026
- Framework support
- It is framework agnostic and can be used with Mocha, nodeunit, Jasmine, or other testing frameworks.jsverify.github.io · read 8 Oct 2026
- Generated inputs
- JSVerify generates test data so properties can be checked across many possible inputs.jsverify.github.io · read 8 Oct 2026
- Generated tests
- It generates many possible inputs to check properties that should hold for a function.jsverify.github.io · read 7 Oct 2026
- Installation
- The project README instructs users to install the module with npm install jsverify.github.com · read 7 Oct 2026
- Integration
- The official site documents installation using npm install jsverify.jsverify.github.io · read 8 Oct 2026
- License
- The GitHub repository identifies the project license as MIT.github.com · read 8 Oct 2026
- Maintainer
- The official site says the project is maintained by phadej.jsverify.github.io · read 7 Oct 2026
- Maintenance
- The official site says the project is maintained by phadej.jsverify.github.io · read 8 Oct 2026
- Minimal counterexamples
- When a property fails, JSVerify attempts to find a smaller counterexample by shrinking the generated input.jsverify.github.io · read 7 Oct 2026
- Notable limitation
- The README warns that exposed utility functions are documented for contributions and may change incompatibly even in patch releases.github.com · read 8 Oct 2026
- Purpose
- JSVerify is a property-based testing library for JavaScript, inspired by QuickCheck.jsverify.github.io · read 8 Oct 2026
- Reproducibility
- The README says test runs can be reproduced using a particular random generator state.github.com · read 8 Oct 2026
- Support and documentation
- The official site points users to the GitHub README for API and usage documentation.jsverify.github.io · read 8 Oct 2026
- Test frameworks
- The library is framework agnostic, and its site names Mocha, nodeunit, and Jasmine as examples.jsverify.github.io · read 7 Oct 2026
The review
JSVerify is a free property-based testing library for JavaScript, suited to developers who want to check function behavior across generated inputs in an existing test runner. Its combination of input generation, shrinking, and repeatable failures makes it a focused choice for finding edge cases without changing frameworks.
Overview
Rather than checking only manually selected examples, JSVerify generates inputs and evaluates whether a stated property holds. When a check fails, it tries to shrink the input to a smaller counterexample, which can make the failure easier to diagnose. Shrinking is an aid, not a guarantee of the smallest possible case, and generated checks complement rather than replace example-based tests.
The default check runs 100 tests with a maximum generated-value size of 50. These are bounded checks, not an exhaustive proof; the API also lets users adjust test count and size, control quiet output, and set the random generator state.
Key features
- Generated property checks: Testing a property over generated inputs can expose cases a hand-picked suite misses, especially when a function accepts a broad range of values.
- Counterexample shrinking: On failure, JSVerify attempts to reduce the input. The resulting smaller case can clarify what broke, though a minimal result is not assured.
- Asynchronous properties: Properties may return Promises, so asynchronous methods can be checked with the same library.
- Repeatable runs: Values are deterministic when using primitives from JSVerify's random module, and an RNG state can be set. This helps reproduce a failure under those conditions.
- Runner flexibility: The library is framework agnostic; documented examples include Mocha, nodeunit, and Jasmine. That makes it suitable for teams that want property checks within an existing runner.
- TypeScript support with a caveat: TypeScript typings are provided, but TypeScript specs cannot use the type DSL. Teams relying on that DSL in TypeScript should account for the restriction.
Pricing
JSVerify — free. The free plan is the open-source JavaScript property-based testing library, identified under the MIT license. There are no paid tiers or plan-specific seat or quota terms to weigh; the documented default remains 100 tests with a maximum generated-value size of 50, and check options allow configuration.
Platforms
JSVerify is listed for self-hosted and web use, with JavaScript and TypeScript support. Installation uses npm install jsverify, fitting projects that can add an npm module. Its TypeScript DSL restriction matters for teams expecting the full DSL in TypeScript specs.
Who it's for
JSVerify is a good fit for JavaScript developers who want generated-input checks, smaller failure cases, and reproducibility while staying with Mocha, nodeunit, Jasmine, or another testing framework. It is less suitable for teams that require stateful testing, or for TypeScript users whose workflow depends on the type DSL. The project warns that exposed utility functions are documented for contributors and may change incompatibly even in patch releases, so applications depending on those utilities face a stability risk.
Pros and cons
- Pro: Generated inputs and shrinking help surface and inspect cases that example-only tests may not cover.
- Pro: Promise-returning properties and framework agnosticism let teams apply it to asynchronous code without committing to a particular runner.
- Pro: Deterministic values with random-module primitives and configurable RNG state support reproducing failures.
- Con: TypeScript specs cannot use the type DSL, limiting that part of the workflow for TypeScript-heavy projects.
- Con: Exposed utility functions may change incompatibly in patch releases, making them a poor foundation for stable application-facing dependencies.
- Con: Stateful testing is not supported, so projects needing that capability will need another tool or approach.
Alternatives
For a JavaScript project needing generated property checks with runner flexibility, JSVerify is the closest fit among these choices. Choose another option when its ecosystem or platform better matches the project:
- SwiftCheck is a free option for iOS and macOS projects.
- Gopter is a free, MIT-licensed Go property-testing package for Linux or self-hosted use.
- Scala Hedgehog is a free open-source Scala testing library for Linux, with no paid plans.
- ScalaCheck is a free BSD-3-Clause open-source library for Linux, macOS, and Windows.
- CsCheck is a free Apache 2 option for self-hosted use.
- FsCheck is a free BSD-licensed library with NuGet packages for Linux, macOS, and Windows.
- PropCheck is a free MIT-licensed Ruby gem for Linux or self-hosted use and requires Ruby 2.5.1 or later.
- QCheck is a free OCaml property-based testing library for Linux, under the BSD-2-Clause license.
See Property-Based Testing Tools for more options.
Verdict
Choose JSVerify if you want a free, JavaScript-oriented way to test properties across generated inputs, shrink failures, and replay supported random values within your existing runner. Look elsewhere if stateful testing is essential, if TypeScript specs must use the type DSL, or if your code would depend on utility functions whose compatibility may change in patch releases.