back to home

dubzzz / fast-check

Property based testing framework for JavaScript (like QuickCheck) written in TypeScript

4,831 stars
206 forks
72 issues
TypeScriptJavaScriptMDX

AI Architecture Analysis

This repository is indexed by RepoMind. By analyzing dubzzz/fast-check in our AI interface, you can instantly generate complete architecture diagrams, visualize control flows, and perform automated security audits across the entire codebase.

Our Agentic Context Augmented Generation (Agentic CAG) engine loads full source files into context on-demand, avoiding the fragmentation of traditional RAG systems. Ask questions about the architecture, dependencies, or specific features to see it in action.

Source files are only loaded when you start an analysis to optimize performance.

Embed this Badge

Showcase RepoMind's analysis directly in your repository's README.

[![Analyzed by RepoMind](https://img.shields.io/badge/Analyzed%20by-RepoMind-4F46E5?style=for-the-badge)](https://repomind.in/repo/dubzzz/fast-check)
Preview:Analyzed by RepoMind

Repository Overview (README excerpt)

Crawler view

Property based testing framework for JavaScript/TypeScript Getting started Hands-on tutorial and definition of Property Based Testing: 🏁 see tutorial. Or directly try it online on our pre-configured CodeSandbox. Property based testing frameworks check the truthfulness of properties. A property is a statement like: _for all (x, y, ...) such that precondition(x, y, ...) holds predicate(x, y, ...) is true_. Install the module with: or or Example of integration in mocha: In case of failure, the test raises a red flag. Its output should help you to diagnose what went wrong in your implementation. Example with a failing implementation of contain: Integration with other test frameworks: ava, jasmine, jest, mocha and tape. More examples: simple examples, fuzzing and against various algorithms. Useful documentations: β€’ 🏁 Introduction to Property Based & Hands On β€’ 🐣 Built-in arbitraries β€’ πŸ”§ Custom arbitraries β€’ πŸƒβ€β™‚οΈ Property based runners β€’ πŸ’₯ Tips β€’ πŸ”Œ API Reference β€’ ⭐ Awesome fast-check Why should I migrate to fast-check? fast-check has initially been designed in an attempt to cope with limitations I encountered while using other property based testing frameworks designed for JavaScript: β€’ **Types:** strong and up-to-date types - _thanks to TypeScript_ β€’ **Extendable:** easy method to derive existing arbitraries while keeping shrink \[more\] - _some frameworks ask the user to provide both a->b and b->a mappings in order to keep a shrinker_ β€’ **Extendable:** kind of flatMap-operation called \[more\] - _able to bind the output of an arbitrary as input of another one while keeping the shrink working_ β€’ **Extendable:** precondition checks with \[more\] - _filtering invalid entries can be done directly inside the check function if needed_ β€’ **Extendable:** easily switch from fake data in tests to property based with \[more\] - _generate random values within your predicates_ β€’ **Smart:** ability to shrink on \[more\] - _surprisingly some frameworks don't_ β€’ **Smart:** biased by default - _by default it generates both small and large values, making it easier to dig into counterexamples without having to tweak a size parameter manually_ β€’ **Debug:** verbose mode \[more\]\[tutorial\] - _easier troubleshooting with verbose mode enabled_ β€’ **Debug:** replay directly on the minimal counterexample \[tutorial\] - _no need to replay the whole sequence, you get directly the counterexample_ β€’ **Debug:** custom examples in addition of generated ones \[more\] - _no need to duplicate the code to play the property on custom examples_ β€’ **Debug:** logger per predicate run \[more\] - _simplify your troubleshoot with fc.context and its logging feature_ β€’ **Unique:** model based approach \[more\]\[article\] - _use the power of property based testing to test UI, APIs or state machines_ β€’ **Unique:** detect race conditions in your code \[more\]\[tutorial\] - _shuffle the way your promises and async calls resolve using the power of property based testing to detect races_ β€’ **Unique:** simplify user definable corner cases \[more\] - _simplify bug resolution by asking fast-check if it can find an even simpler corner case_ For more details, refer to the documentation in the links above. Trusted fast-check has been trusted for years by big projects like: jest, jasmine, fp-ts, io-ts, ramda, js-yaml, query-string... Powerful It also proved useful in finding bugs among major open source projects such as jest, query-string... and many others. Compatibility Here are the minimal requirements to use fast-check properly without any polyfills: | fast-check | node | ECMAScript version | _TypeScript (optional)_ | | ---------- | ---------------------- | ------------------ | ----------------------- | | **4.x** | β‰₯12.17.0 (1) | ES2020 | β‰₯5.0 | | **3.x** | β‰₯8 (2) | ES2017 | β‰₯4.1 (3) | | **2.x** | β‰₯8 (2) | ES2017 | β‰₯3.2 (4) | | **1.x** | β‰₯0.12 (2) | ES3 | β‰₯3.0 (4) | More details... β€’ Even if version 12.x should support most of the ES2020 features that will be leveraged by the version 4, we recommend relying at least on version 14.x of Node as it supports all the targeted specification. In addition, we highly encourage switching to still supported LTS versions of Node and not sticking to unsupported versions for too long. β€’ Except for features that cannot be polyfilled - such as -related ones - all the capabilities of fast-check should be usable given you use at least the minimal recommended version of node associated to your major of fast-check. β€’ Require either lib or target β‰₯ ES2020 or to be installed. β€’ Require either lib or target β‰₯ ES2015 or to be installed. Contributors ✨ Thanks goes to these wonderful people (emoji key): Nicolas DUBIEN πŸ’» πŸ“– ⚠️ πŸš‡ 🎨 🚧 Aaron Elligsen πŸ’» πŸ“– ⚠️ Will Heslam πŸ“– kazchimo πŸ’» πŸ“– Brandon Chinn πŸ’» πŸ“– Irakli Safareli πŸ“– Andrew Herron πŸ“– πŸ”Œ Eric Crosson πŸ“– πŸ’» burrscurr πŸ“– JC (Jonathan Chen) πŸ“– Larry Botha πŸ“– πŸ’» ⚠️ Roman Gusev πŸ“– Tim Wisniewski πŸ“– Brais PiΓ±eiro πŸ’» ⚠️ Renaud-Pierre Bordes 🎨 Jemma Nelson πŸ“– John Haugeland πŸ“– Trey Davis 🎨 Leon Si πŸ“– Gorgi Kosev πŸš‡ mayconsacht πŸ’» Simon Friis Vindum πŸ’» ⚠️ Richard Gibson <a href="https://g _...truncated for preview_