CheckOps
fast-check
fast-check is an MIT-licensed property-based testing framework for JavaScript and TypeScript, with rich arbitraries, shrinking, replayable seeds, model-based testing and race-condition detection.
Latest public signals
Not refreshed yet. Refresh reads the public site and, when the entry has a GitHub repository, the latest release.
Introduction
fast-check is a property-based testing framework for JavaScript and TypeScript created by Nicolas Dubien. Its README defines a property as a statement like “for all (x, y, …) such that precondition(x, y, …) holds, predicate(x, y, …) is true”, and fast-check’s job is to check that statement against many generated inputs. It is MIT-licensed with about 5,200 GitHub stars; v4.10.2 was released on 19 September 2026.
Instead of writing a few hand-picked examples, you describe the shape of valid input with arbitraries (fc.integer(), fc.string(), fc.array(...), fc.record(...) and many more) and assert a property. When fast-check finds a counterexample, it shrinks it to a minimal failing case and prints the seed and path so the exact failure can be replayed deterministically.
fast-check works with any test runner. The README shows Mocha integration, and dedicated packages such as @fast-check/vitest and @fast-check/jest add a test.prop style API. Beyond simple properties, it supports model-based (command-based) testing, where it generates sequences of operations against a simplified model of your system, and a scheduler for detecting race conditions in asynchronous code by controlling the order in which promises resolve.
Properties that work well in practice include round trips (parse after serialise returns the original), invariants (sorting keeps the same length and elements), idempotence (normalising twice equals normalising once), and comparison with a simpler reference implementation.
How it compares: fast-check fills the same role in JavaScript as Hypothesis in Python, jqwik on the JVM and proptest in Rust. Within JavaScript, fast-check is the actively maintained, TypeScript-first option with a broad feature set.
In the quality loop, fast-check strengthens unit tests for parsers, validators, data transformations, state machines and asynchronous logic, often finding edge cases such as empty strings, Unicode surrogates, negative zero or very large arrays.
The source code is at dubzzz/fast-check on GitHub under the MIT licence, with about 5,200 stars; the most recent commit was on 11 November 2026.
A practical way to start is to pick one pure function with a clear invariant, such as an encode and decode round trip, and write a single property for it before adding more.
Asynchronous code is handled with fc.asyncProperty, whose predicate can return a promise. Preconditions are expressed with fc.pre(...), which discards generated values that do not meet them. To understand what your arbitraries actually produce, fc.sample prints example values and fc.statistics reports how generated values are distributed across labels you define, which helps you spot generators that rarely hit interesting cases.
The README links to a separate fast-check-examples repository with ready-made integrations for AVA, Jasmine, Jest, Mocha and tape, so teams can copy a working setup for their runner rather than starting from scratch. Teams can then adapt that setup to their own conventions, runner options and CI configuration.
Features
- Arbitraries: Built-in generators for primitives, strings, objects, arrays, dates, JSON, records and more, composable with
map,filterandchain. - Shrinking: Counterexamples are reduced to the smallest failing input.
- Replay: Seeds and paths reproduce failures exactly.
- Runner integrations: Works with Jest, Vitest, Mocha and others; dedicated packages for Jest and Vitest.
- Model-based testing: Generate command sequences against a model to test stateful systems.
- Race-condition detection: A scheduler explores different orderings of async operations.
- Configurable runs: Control the number of runs, timeouts, seeds and verbosity.
- TypeScript-first: Strong typing for arbitraries and inferred property arguments.
Pros
- Finds the unexpected: Generated inputs uncover edge cases example tests miss.
- Deterministic debugging: Seeds and shrinking make failures easy to reproduce and understand.
- Free to use: Open source under the MIT licence, so the core tool costs nothing to use.
- Actively maintained: The repository had commits as recent as 11 November 2026.
- Community: About 5,200 GitHub stars.
Cons
- Writing properties takes practice: Good properties need thought; weak ones test little.
- Longer test times: Each property runs many times; tune
numRunsfor CI. - Filter overuse: Heavy filtering can make generation inefficient.
- JavaScript only: Use language-specific libraries elsewhere.
Usage and Links (Example)
Install and write a property (Vitest example):
npm install --save-dev fast-check
import { test, expect } from "vitest";
import fc from "fast-check";
import { encode, decode } from "./codec";
test("decode(encode(x)) returns x", () => {
fc.assert(
fc.property(fc.string(), (s) => {
expect(decode(encode(s))).toBe(s);
})
);
});
Replay a failure printed by fast-check:
fc.assert(fc.property(fc.string(), check), { seed: 1234, path: "0:1", endOnFailure: true });
Practical tips:
- Start with round-trip and invariant properties; they are simple and effective.
- Lower
numRunsfor pull requests and raise it in nightly runs. - Save interesting counterexamples as regular example tests once fixed.
Resources:
Pricing
fast-check is free and open source under the MIT licence.
Recommended for?
- JavaScript and TypeScript developers testing parsers, validators and data logic.
- Teams with tricky async code, using the scheduler to find race conditions.
- Library authors wanting broader input coverage than examples provide.
- Not a fit for tests dominated by slow external services.
Conclusion
fast-check is the leading property-based testing library for JavaScript and TypeScript, with excellent shrinking, replay and advanced model-based and race-condition testing.
A few well-chosen properties alongside your example tests can catch bugs that would otherwise reach production.
Alternatives
Other tools on CheckOps that cover similar ground. Open a page, or compare one with fast-check side by side.
HHypothesisHypothesis is the MPL-2.0 property-based testing library for Python: describe the range of inputs, let it generate cases including edge cases, and get the simplest failing example when a property breaks.Compare with fast-check
JJestJest is a free, open-source JavaScript test runner with zero-config defaults, mocks, and snapshot testing.Compare with fast-check
VVitestVitest is a free, open-source unit test runner that reuses a Vite project's config, transforms, and plugins.Compare with fast-check
MMochaMocha is a long-running, MIT-licensed JavaScript test framework for Node.js and browsers, with BDD and TDD interfaces, async support, hooks, parallel mode and a large reporter ecosystem.Compare with fast-check
SStrykerJSStrykerJS is the Apache-2.0 mutation testing framework for JavaScript and TypeScript, part of the Stryker Mutator family (with Stryker.NET and Stryker4s), supporting Jest, Vitest, Mocha, Karma and more.Compare with fast-check
Jjqwikjqwik is an EPL-2.0 property-based testing engine for the JUnit Platform, letting Java and Kotlin developers write properties with generated, shrinking inputs alongside regular JUnit 5 tests.Compare with fast-check