fast-check
Property-based testing framework for JavaScript and TypeScript. Generates hundreds of random test cases automatically to find edge cases that example-based tests miss. Inspired by Haskell's QuickCheck. When a failure is found, fast-check automatically shrinks the input to the smallest failing case. Works with Jest, Vitest, Mocha, and any test runner. Used by companies like Docusaurus, material-ui, and fp-ts for invariant testing.
Score Breakdown
⚙ Agent Friendliness
🔒 Security
Local testing library. No external calls. Can help find security edge cases in parsers and validators.
⚡ Reliability
Best When
You want to find edge cases in pure functions, parsers, serializers, or data transformations that example-based tests would miss — fast-check generates the cases automatically.
Avoid When
You're testing integration, side effects, or specific business scenarios where exact inputs matter more than invariant coverage.
Use Cases
- • Find edge cases in parsing, serialization, and data transformation functions by generating thousands of random inputs automatically
- • Test mathematical invariants (commutativity, associativity, round-trip serialization) that are hard to express with example tests
- • Verify agent decision logic handles arbitrary inputs correctly without writing hundreds of manual test cases
- • Test TypeScript utility functions and type transformations with randomly generated values across all type boundaries
- • Fuzz test API input validation to find unexpected rejection patterns or acceptance of invalid data
Not For
- • Integration tests requiring specific database state — property-based testing is for pure functions and stateless logic
- • UI/visual testing — fast-check tests logic, not rendered output
- • Teams new to testing who need to learn unit testing first — property-based testing requires understanding invariants
Interface
Authentication
Testing library. No authentication required.
Pricing
MIT license.
Agent Metadata
Known Gotchas
- ⚠ Arbitrary generators (fc.integer, fc.string, fc.record) must match the function's expected input domain — generating out-of-domain values produces false failures
- ⚠ Property assertions must express true invariants — testing 'this specific input gives this output' is example testing, not property testing
- ⚠ Async properties require fc.asyncProperty and return a Promise — synchronous property wrapper does not handle async functions
- ⚠ Shrinking works by default but can be slow for complex arbitraries — use fast-check's built-in combinators rather than hand-rolling complex generators
- ⚠ Default numRuns (100) may miss rare edge cases — increase for critical security or parsing code, decrease for slow integration tests
- ⚠ Global seed can be set with fc.configureGlobal({ seed }) for deterministic CI runs — without seed, each run explores different cases
Alternatives
Full Evaluation Report
Detailed scoring breakdown, competitive positioning, security analysis, and improvement recommendations for fast-check.
Scores are editorial opinions as of 2026-03-06.