Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@artkravchenko/fast-check

artkravchenko8MIT2.3.0-SNAPSHOT.2TypeScript support: included

Property based testing framework for JavaScript (like QuickCheck)

property-based testing, end-to-end testing, unit testing, testing, quickcheck, jscheck, jsverify

readme

fast-check logo

Property based testing framework for JavaScript/TypeScript

Build Status npm version monthly downloads

Coverage Status dependencies Status devDependencies Status

PRs Welcome License Twitter

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 as precondition(x, y, ...) holds property(x, y, ...) is true.

Install the module with: yarn add fast-check --dev or npm install fast-check --save-dev

Example of integration in mocha:

const fc = require('fast-check');

// Code under test
const contains = (text, pattern) => text.indexOf(pattern) >= 0;

// Properties
describe('properties', () => {
    // string text always contains itself
    it('should always contain itself', () => {
        fc.assert(fc.property(fc.string(), text => contains(text, text)));
    });
    // string a + b + c always contains b, whatever the values of a, b and c
    it('should always contain its substrings', () => {
        fc.assert(fc.property(fc.string(), fc.string(), fc.string(), (a,b,c) => {
            // Alternatively: no return statement and direct usage of expect or assert
            return contains(a+b+c, b);
        }));
    });
});

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:

1) should always contain its substrings
    Error: Property failed after 1 tests (seed: 1527422598337, path: 0:0): ["","",""]
    Shrunk 1 time(s)
    Got error: Property failed by returning false

    Hint: Enable verbose mode in order to have the list of all failing values encountered during the run

Integration with other test frameworks: ava, jasmine, jest, mocha and tape.

More examples: simple examples, fuzzing and against various algorithms.

Useful documentations:

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 map 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 chain [more] - able to bind the output of an arbitrary as input of another one while keeping the shrink working
  • Extendable: precondition checks with fc.pre(...) [more] - filtering invalid entries can be done directly inside the check function if needed
  • Smart: ability to shrink on fc.oneof [more] - surprisingly some frameworks don't
  • Smart: biased by default [more] - 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] - easier troubleshooting with verbose mode enabled
  • Debug: replay directly on the minimal counterexample [more] - 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] - shuffle the way your promises and async calls resolve using the power of property based testing to detect races

For more details, refer to the documentation in the links above.

Compatibility

Here are the minimal requirements to use fast-check properly without any polyfills:

fast-check node ECMAScript version TypeScript (optional)
2.x ≥8(1) ES2017 ≥3.2
1.x ≥0.12(1) ES3 ≥3.0

(1) Except for features that cannot be polyfilled - such as bigint-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.

Issues found by fast-check in famous packages

fast-check has been able to find some unexpected behaviour among famous npm packages. Here are some of the errors detected using fast-check:

jest

Issue detected: toStrictEqual fails to distinguish 0 from 5e-324 [more]

Code example: expect(0).toStrictEqual(5e-324) succeeds

js-yaml

Issue detected: enabling !!int: binary style when dumping negative integers produces invalid content [more]

Code example: yaml.dump({toto: -10}, {styles:{'!!int':'binary'}}) produces toto: 0b-1010 not toto: -0b1010

query-string

Issue detected: enabling the bracket setting when exporting arrays containing null values produces an invalid output for the parser [more]

Code example:

m.stringify({bar: ['a', null, 'b']}, {arrayFormat: 'bracket'}) //=> "bar[]=a&bar&bar[]=b"
m.parse('bar[]=a&bar&bar[]=b', {arrayFormat: 'bracket'})       //=> {bar: [null, 'b']}

MORE: Issues detected thanks of fast-check

Credits

Code Contributors

This project would not be the same without them 💖 - Become one of them

Backers

Thank you to all our backers! 🙏 [Become a backer] and help us sustain our community.

Sponsors

Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor]

changelog

2.3.0

Add global beforeEach and afterEach hooks [Code][Diff]

Features

  • (PR#900) Add global beforeEach/afterEach hooks

Fixes

  • (PR#970) Doc: Rewrite the documentation to better target JavaScript users

2.2.1

Fix infinite loop in fc.date when passing a NaN date [Code][Diff]

Fixes

  • (PR#938) Bug: Fix NaN passed to max in fc.date()
  • (PR#936) Doc: Switch to typedoc for the API Reference
  • (PR#939) Doc: Rename 'Documentation' badge into 'API Reference'
  • (PR#948) Doc: Mark TypeScript as an optional requirement in the README
  • (PR#919) Test: Reduce coverage flakiness on HostArbitrary.ts

2.2.0

Export missing typings and various cleaning around the tsdoc [Code][Diff]

Features

  • (PR#880) Publish missing constraints types (option, scheduler)
  • (PR#881) Add an interface to better type (Async)Property
  • (PR#902) Standardize exported typings and add missing ones :warning:
  • (PR#906) Prefer interfaces and functions for exported entities

Fixes

  • (PR#904) Bug: Asynchrorous properties should be able to use asyncReporter
  • (PR#850) CI: Ignore fast-check bumps for some directories
  • (PR#872) CI: Slow down dependabot frequency
  • (PR#879) CI: Remove unneeded before_install step on .travis.yml
  • (PR#882) CI: Apply post-build script before generating the doc
  • (PR#903) CI: Break CI whenever documentation compiles with warnings
  • (PR#905) CI: Enable protobot-stale
  • (PR#873) Doc: Remove snyk badge
  • (PR#878) Doc: Fix some of the warnings raised by API Extractor
  • (PR#883) Doc: Update the template for new Pull Requests
  • (PR#894) Doc: Fix warnings related to invalid references raised by api-extractor
  • (PR#907) Doc: Fix examples leaking in to functions table
  • (PR#908) Doc: Document non-documented sections
  • (PR#911) Doc: Remove useless "fast-check#" prefix in @link
  • (PR#848) Test: Do not use @testing-library/dom directly in examples/
  • (PR#851) Test: Reduce coverage flakiness on ReplayPath.ts
  • (PR#874) Test: Reduce coverage flakiness on hash.ts
  • (PR#893) Tool: Add script to serve the generated documentation locally

2.1.0

Better reported errors for func, compareFunc and compareBooleanFunc [Code][Diff]

Features

  • (PR#843) Report a valid function on func and compareFunc
  • (PR#844) Export internal hash function
  • (PR#845) Rewrite hash without using node specific APIs

Fixes

  • (PR#833) CI: Enable CodeQL Analysis
  • (PR#837) Clean: Remove usages of ! operator in ObjectArbitrary
  • (PR#838) Clean: Remove custom implementation of Array.prototype.find
  • (PR#816) Doc: Fix typos in migration guide
  • (PR#846) Doc: Update links for pika.dev to skypack.dev
  • (PR#819) Test: Better test coverage for fc.option
  • (PR#818) Test: Reduce flakiness of coverage

2.0.0

Hybrid and full support for both ES Modules and CommonJS [Code][Diff]

This new major of fast-check is:

  • lighter: 906kB with 385 files to 505kB with 287 files
  • faster: takes between -15% (sync) to -40% (async) less time to run properties (more)
  • es-module compatible: can be executed with type:module

Breaking changes

  • (PR#748) Drop support for old runtimes of JavaScript, requirements: node>=8 and ES2017+
  • (PR#747) Better typings of fc.constantFrom
  • (PR#749) Remove depreciated with_deleted_keys on fc.record
  • (PR#750) Drop support for TypeScript <3.2
  • (PR#751) Strip internal code at build time
  • (PR#753) Bump pure-rand package to use its hybrid build
  • (PR#755) Replace namespace ObjectConstraints by an type
  • (PR#752) Support ES Modules and CommonJS
  • (PR#756) Drop browser build

You may refer to our migration guide in case of issue: https://github.com/dubzzz/fast-check/blob/master/MIGRATION_1.X_TO_2.X.md

Fixes

  • (PR#752) Doc: Update compatibility table
  • (PR#730) Test: Reproducible tests by adding missing lockfiles

1.26.0

New arbitrary to generate falsy values [Code][Diff]

Features

  • (PR#627) New arbitrary to generate falsy values
  • (PR#719) Add withBigInt flag for fc.falsy
  • (PR#718) Add withBigInt flag for fc.anything

Fixes

  • (PR#632) Doc: Script generating the documentation compatible with Windows
  • (PR#652) Doc: Add note on chain shrink issues
  • (PR#658) Doc: Document how fast-check works under-the-hood
  • (PR#664) Doc: Add a compatibility section into the README
  • (PR#665) Doc: Fix some typos
  • (PR#700) Doc: Remove warnings related to badly set @param for ts-docs
  • (PR#729) Doc: Add links to commit diff into the CHANGELOG
  • (PR#630) Test: Enhance stability of e2e test for AsyncScheduler
  • (PR#636) Test: Ensure we can generate the documentation for each PR
  • (PR#637) Test: Add missing parameters in QualifiedParameters tests
  • (PR#661) Test: Compilation against old releases of TypeScript
  • (PR#720) Test: Remove useless CI stage (HEAD)

1.25.1

Scheduler was not putting the metadata into the generated report [Code][Diff]

Fixes

  • (PR#625) Bug: Scheduler forgets to pass the metadata when calling report

1.25.0

Add ability to customize reported errors [Code][Diff]

Features

  • (PR#622) Add the ability to provide a custom reporter
  • (PR#623) Report the configuration, that has been used, in RunDetails
  • (PR#621) Expose fc.defaultReportMessage
  • (PR#607) Better typings for fc.object and fc.dictionnary :warning:
  • (PR#600) Better typings for RunDetails :warning:
  • (PR#604) Introduce a report method on the scheduler
  • (PR#588) Easier replay of failing scheduler

Fixes

  • (PR#609) Clean: Generated typings where causing the doc generation to crash
  • (PR#608) Doc: Fix markdown section
  • (PR#602) Test: Check compatibility with node 12.x and >= 12.18
  • (PR#599) Doc: Document how to use fast-check in web using pika
  • (PR#596) Clean: Clean examples based on getByRole
  • (PR#585) Doc: Update README with Credits section
  • (PR#594) Clean: Add missing "private": true on package.json used for tests
  • (PR#592) Clean: Update travis configuration to use Node 14
  • (PR#587) Test: Check package can be properly imported
  • (PR#586) Clean: Rename build scripts to cjs

1.24.2

Fix constantFrom not compatible with older versions of node [Code][Diff]

Fixes

  • (PR#583) Bug: constantFrom not compatible with old browsers
  • (PR#569) Clean: Prebuild to cjs extension
  • (PR#568) Doc: Broken links
  • (PR#575) Doc: Invalid code in example of the README
  • (PR#578) Doc: Schedule native timers
  • (PR#576) Example: Fibonacci example
  • (PR#577) Example: Fix decompPrime example for CodeSandbox
  • (PR#581) Example: Fix wrong usages of userEvent.type
  • (PR#579) Example: Race conditions with timers

1.24.1

Fixes a code issue detected in fc.object() when using withNullPrototype [Code][Diff]

Fixes

  • (PR#567) Bug: Error in the code of fc.object() when using withNullPrototype

1.24.0

Model based testing and race condition detection [Code][Diff]

Features

  • (PR#491) Add ability to run commands in a scheduled context

Fixes

  • (PR#565) Doc: Broken documentation build
  • (PR#566) Doc: Document how race conditions can be detected

1.23.0

Better typings for filter and oneof plus support for null prototypes [Code][Diff]

Features

  • (PR#548) Stringify should distinguish {} from Object.create(null)
  • (PR#552) Add ability to generate objects without prototype
  • (PR#555) Support type guards while filtering :warning:
  • (PR#556) Better typings for oneof and frequency :warning:

Fixes

  • (PR#554) Doc: Add an example on atomic Counter for race conditions feature
  • (PR#557) Doc: Add example based on decomposition in prime numbers

1.22.2

Remove unused files from the final bundle [Code][Diff]

Fixes

  • (PR#550) Clean: Switch from npmignore to files to whitelist bundled files instead of blacklisting them
  • (PR#549) Clean: Various typos in letrec unit-test
  • (PR#551) Clean: CI was not considered as failed when examples failed

1.22.1

Fix broken bundle [Code][Diff]

1.22.0

Better random values and ability to shrink very large data-structures [Code][Diff]

Features

  • (PR#534) Better independance between generated values during a test suite :warning:
  • (PR#536) Exclude internationalized-like domains :warning: - (PR#538)
  • (PR#537) Add xoroshiro128plsu in the list of random generators
  • (PR#539) Add js extension onto esm files
  • (PR#540) Add metadata on the generated sources (see fc.__version)

Fixes

  • (PR#505) Bug: Fix stack overflow when shrinking large arrays
  • (PR#541) Bug: Fix stack overflow when shrinking large arrays of commands
  • (PR#511) Doc: Add Jest example in the README
  • (PR#542) Doc: Example with function arbitrary
  • (PR#518) Doc: Fix typos in Arbitraries.md
  • (PR#523) Doc: Fix typos in Arbitraries.md
  • (PR#533) Doc: Fix typos in Arbitraries.md
  • (PR#529) Doc: Tip explaining how to avoid timeouts
  • (PR#519) Clean: Add missing files in *ignore
  • (PR#535) Clean: Better logs for GenericArbitraryHelper

1.21.0

Better typings for beforeEach and afterEach and more options on fc.scheduler [Code][Diff]

Features

  • (PR#493) Automatically wrap tasks using an act function in fc.scheduler if provided
  • (PR#492) Also return the sequence task in fc.scheduleSequence
  • (PR#489) Allow looser types for beforeEach and afterEach, more accurate and stricter types :warning:

Fixes

  • (PR#509) Bug: letrec crashed when asking to generate __proto__
  • (PR#510) Bug: letrec crashed when builder instantiates an object having __proto__ set to null
  • (PR#503) Doc: Note on expect or assert

1.20.1

Reduce bundle size [Code][Diff]

Fixes

  • (PR#494) Clean: Remove tsbuildinfo files from the bundle
  • (PR#495) Clean: Remove unneeded @param in JSDoc of property and tuple

1.20.0

Built-in support for race condition detection [Code][Diff]

Features

  • (PR#479) Add fc.scheduler arbitrary

Fixes

  • (PR#487) Doc: Clean autocomplete example

1.19.0

Interrupt test-suites after a given delay while the number of runs have not been reached [Code][Diff]

Features

  • (PR#428) Implement interruptAfterTimeLimit
  • (PR#463) Adapt and expose IRawProperty, IProperty and IAsyncProperty types

Fixes

  • (PR#455) Clean: Add watch mode test and build scripts
  • (PR#456) Clean: Bump all dev dependencies
  • (PR#457) Clean: Use ts-jest/utils mocked instead of our own mockModule
  • (PR#449) Clean: Moving away from npm, switching to yarn
  • (PR#471) Clean: Minor fixes related to internal typings
  • (PR#473) Clean: Remove unused variables in units
  • (PR#474) Clean: Enable no-unused-vars eslint rule
  • (PR#465) Doc: Examples served by CodeSandbox and improvement of the examples - (PR#466), (PR#467), (PR#469), (PR#470), (PR#472), (PR#476)
  • (PR#475) Test: Do not run travis outside of master and PRs for master
  • (PR#464) Test: Add tests for typings based on tsd
  • (PR#481) Test: Configure CodeSandbox CI

1.18.1

Typings regression for fc.object [Code][Diff]

Fixes

  • Bug: Typing regression on fc.object

1.18.0

Support for global parameters with fc.configureGlobal(parameters) [Code][Diff]

Features

  • (PR#439) Support for global parameters

Fixes

  • (PR#438) Clean: Add sideEffects flag into package.json
  • (PR#440) Clean: Migrate from tslint to eslint - (PR#447), (PR#451)
  • (PR#443) Doc: Export missing WeightedArbitrary
  • (PR#444) Doc: Add missing documentation for fc.frequency
  • (PR#446) Doc: Add code contributors widget directly in README.md
  • (PR#436) Typings: Better typings for fc.anything-like arbitraries

1.17.0

Multiple new arbitraries: date, ipv4 extended, uuid, mixed case and many settings [Code][Diff]

Features

  • (PR#420) Add fc.date arbitrary
  • (PR#427) Add fc.mixedCase arbitrary
  • (PR#393) Support all the range of valid ipV4 with fc.ipV4Extended arbitrary
  • (PR#401) Add ability to customize the null value of fc.option
  • (PR#411) Add fc.uuid arbitrary
  • (PR#433) Add fc.uuidV to tackle specific version of uuid
  • (PR#400) Add withObjectString flag in fc.object/fc.anything

Fixes

  • (PR#425) Bug: skipAllAfterTimeLimit throws when it passes time limit
  • (PR#409) Bug: Web authority should not produce port outside 0-65535
  • (PR#418) Bug: Infinite loop when path is one level deep and all runs succeed
  • (PR#430) Bug: No timeout expiration on node blocks exit
  • (PR#396) Clean: Update dependencies and dev dependencies
  • (PR#432) Clean: Prepare code for ts3.7-pr33401
  • (PR#410) Contrib: Document how to add new arbitraries in fast-check
  • (PR#408) Doc: Usage in conjonction with faker
  • (PR#412) Doc: Diff format in shrinking example
  • (PR#414) Doc: Update ts-jest config (tsConfigFile -> tsConfig)
  • (PR#417) Doc: Add section "Migrate from jsverify to fast-check"
  • (PR#434) Doc: Add table of contents on top of the documentation
  • (PR#397) Test: Reduce flakyness of tests on letrec
  • (PR#422) Test: Rework unit tests of DateArbitrary

1.16.3

skipAllAfterTimeLimit throws when it passes time limit [Code][Diff]

Fixes

  • (PR#425) skipAllAfterTimeLimit throws when it passes time limit

1.16.2

Web authority ports should be within 0-65535 [Code][Diff]

Fixes

  • (PR#409) Web authority should not produce port outside 0-65535

1.16.1

Infinite loop on replays with one-level-deep path [Code][Diff]

Fixes

  • (PR#418) Infinite loop when path is one level deep and all runs succeed

1.16.0

Easier recursive data-structures [Code][Diff]

Features

  • (PR#377) Add fc.letrec arbitrary
  • (PR#378) Add fc.memo arbitrary
  • (PR#385) Add caching for withBias of fc.letrec arbitrary
  • (PR#370) Add minimum and maximum validation to integer and nat
  • (PR#382) Take fc.cloneMethod into account for commands
  • (PR#372) Stringify Date as valid JavaScript
  • (PR#371) Stringify Symbol as valid JavaScript

Fixes

  • (PR#375) Clean: Bump TypeScript to 3.5
  • (PR#384) Clean: Remove circular dependency in WebArbitrary file
  • (PR#389) Test: Check that fc.memo and fc.letrec are compatible with node 0.12
  • (PR#376) Test: Fix broken e2e tests
  • (PR#385) Test: Mark warnings as errors in rollup config
  • (PR#388) Type: Fix type inferrence bug in modelRun
  • (PR#379) Refactoring: Re-implement fc.object with fc.memo

1.15.4

skipAllAfterTimeLimit throws when it passes time limit [Code][Diff]

Fixes

  • (PR#425) skipAllAfterTimeLimit throws when it passes time limit

1.15.3

Web authority ports should be within 0-65535 [Code][Diff]

Fixes

  • (PR#409) Web authority should not produce port outside 0-65535

1.15.2

Infinite loop on replays with one-level-deep path [Code][Diff]

Fixes

  • (PR#418) Infinite loop when path is one level deep and all runs succeed

1.15.1

Documentation updates [Code][Diff]

Fixes

  • (PR#363) Clean: Bump dev dependencies
  • (PR#366) Clean: Incremental build
  • (PR#362) Clean: Test against node 12
  • (PR#361) Doc: Clarify replay of commands
  • (PR#368) Doc: Direct link to genrated documentation
  • (PR#364) Doc: Extra badges in README
  • (PR#358) Doc: Fix various typos
  • (PR#355) Test: Add no regression snapshot tests

1.15.0

Add auto-skip after time limit option for runners [Code][Diff]

Features

  • (PR#352) Ability to auto skip runs after time limit
  • (PR#348) Expose fc.stringify in the API

Fixes

  • (PR#354) Doc: Add examples of issues discovered using fast-check
  • (PR#353) Doc: Better logo
  • (PR#351) Size: Add dependency to tslib - should reduce size of the bundle
  • (PR#349) Test: No regression snapshot tests

1.14.2

Web authority ports should be within 0-65535 [Code][Diff]

Fixes

  • (PR#409) Web authority should not produce port outside 0-65535

1.14.1

Infinite loop on replays with one-level-deep path [Code][Diff]

Fixes

  • (PR#418) Infinite loop when path is one level deep and all runs succeed

1.14.0

New generated documentation and new arbitraries [Code][Diff]

Features

  • (PR#339) Add fc.ipV4() and fc.ipV6() arbitraries
  • (PR#340) Add fc.mapToConstant() arbitrary
  • (PR#344) Add fc.webUrl() and other web urls related arbitraries
  • (PR#345) Add fc.emailAddress() arbitrary

Fixes

  • (PR#343) Doc: Generate the API documentation with docsify

1.13.1

Infinite loop on replays with one-level-deep path [Code][Diff]

Fixes

  • (PR#418) Infinite loop when path is one level deep and all runs succeed

1.13.0

Remove dependency to lorem-ipsum and more control over fc.anything and fc.object [Code][Diff]

Features

  • (PR#336) Remove dependency to lorem-ipsum
  • (PR#337) fc.frequency() should be compatible with legacy node
  • (PR#338) Add parameter to customize size of fc.object() and fc.anything()

1.12.2

Infinite loop on replays with one-level-deep path [Code][Diff]

Fixes

  • (PR#418) Infinite loop when path is one level deep and all runs succeed

1.12.1

Lighter bundle [Code][Diff]

Fixes

  • (PR#327) Doc: Ability to copy-paste snippets in HandsOnPropertyBased.md
  • (PR#334) Size: Reduce the size of the bundle - Potential issue if your code directly references TupleArbitrary<T1...>, it should be replaced by Arbitrary<[T1,...]>

1.12.0

Better balance between values produced by fc.anything() [Code][Diff]

Features

  • (PR#325) Better balance between values produced by fc.anything()

1.11.1

Infinite loop on replays with one-level-deep path [Code][Diff]

Fixes

  • (PR#418) Infinite loop when path is one level deep and all runs succeed

1.11.0

Replay ability for commands and new arbitraries [Code][Diff]

Features

  • (PR#321) Add new flags for fc.anything and fc.object: withBoxedValues, withSet, withMap
  • (PR#320) Better string representation of failing values
  • (PR#317) Add fc.dedup arbitrary
  • (PR#294) Replay ability for commands
  • (PR#292) Flag to stop the test as soon as it fails
  • (PR#288) Add fc.maxSafeInteger and fc.maxSafeNat arbitraries

Fixes

  • (PR#295) Bug: Not shrinking commands themselves
  • (PR#290) Bug: ExecutionStatus defined as const enum
  • (PR#298) Clean: Factorize code of Runner
  • (PR#297) Clean: Takkle issues reported by codeclimate
  • (PR#306) Doc: Add issues discovered by fast-check
  • (PR#287) Doc: Add issues discovered by fast-check
  • (PR#322) Doc: Links next to features described in Readme
  • (PR#309) Test: Factorize Jest configurations
  • (PR#307) Test: Ensure web-build is correct
  • (PR#300) Perf: No more holey array in fc.array

1.10.2

Infinite loop on replays with one-level-deep path [Code][Diff]

Fixes

  • (PR#418) Infinite loop when path is one level deep and all runs succeed

1.10.1

Fix browser bundle [Code][Diff]

Fixes

1.10.0

Better shrinking of commands [Code][Diff]

Features

  • (PR#280) Better shrinking of commands

1.9.4

Infinite loop on replays with one-level-deep path [Code][Diff]

Fixes

  • (PR#418) Infinite loop when path is one level deep and all runs succeed

1.9.3

Fix browser bundle [Code][Diff]

Fixes

1.9.2

Adapt typings for older versions of TypeScript [Code][Diff]

Fixes

  • (PR#282) Bug: Cannot find name 'bigint'
  • (PR#282) Declare umd build in package.json

1.9.1

VerbosityLevel enum is accessible through fc.VerbosityLevel [Code][Diff]

Fixes

  • (PR#278) Bug: VerbosityLevel values not accessible

1.9.0

BigInt support and new verbosity level [Code][Diff]

Features

  • (PR#274) Add support for asynchronous check method in AsyncCommand
  • (PR#271) More verbose option
  • (PR#268) Add bigInt, bigIntN, bigUint, bigUintN arbitraries
  • (PR#263) Default seed based on random in addition of timestamp

Fixes

  • (PR#272) Bug: Commands partially cloned during the shrinking process
  • (PR#264) Bug: Non-integer seeds not using the full range of integers
  • (PR#269) Clean: Migrate tests to Jest
  • (PR#276) Clean: Unecessary try catch removed for modelRun

1.8.3

Infinite loop on replays with one-level-deep path [Code][Diff]

Fixes

  • (PR#418) Infinite loop when path is one level deep and all runs succeed

1.8.2

Fix regression introduced in the shrinking of cloneable [Code][Diff]

Fixes

  • (PR#262) Bug: Too many shrinks for commands
  • (PR#261) Bug: Unability to shrink mapped commands
  • (PR#259) Bug: Move cloning responsability at a single place in the code
  • (PR#258) Bug: Shrinker of commands failed to shrink twice (in depth)

1.8.1

Support asynchronous model setup [Code][Diff]

Fixes

  • (PR#249) Bug: asyncModelRun must accept asynchonous setup function

1.8.0

Native handling of stateful generated values [Code][Diff]

Features

  • (PR#245) seed can be any possible double value
  • (PR#229) Add context arbitrary
  • (PR#237) Add infiniteStream arbitrary
  • (PR#229) Add cloneable capabilities for stateful generated values

Fixes

  • (PR#241) Doc: Add an example for asyncProperty
  • (PR#238) Better logs for fc.func, fc.compareFunc and fc.compareBooleanFunc
  • (PR#235) Better handling of fc.commands

1.7.2

Infinite loop on replays with one-level-deep path [Code][Diff]

Fixes

  • (PR#418) Infinite loop when path is one level deep and all runs succeed

1.7.1

Fix import of loremIpsum library [Code][Diff]

Fixes

  • (PR#226) Fix import of loremIpsum library

1.7.0

Switch to another PRNG for better performances, better fc.commands [Code][Diff]

Features

  • (PR#221) Better shrink capabilities for fc.commands

Fixes

  • (PR#220) Switch to another PRNG as default random - more performances
  • (PR#217) Better typings for fc.record

1.6.3

Infinite loop on replays with one-level-deep path [Code][Diff]

Fixes

  • (PR#418) Infinite loop when path is one level deep and all runs succeed

1.6.2

Performance improvements [Code][Diff]

Fixes

1.6.1

Performance improvements [Code][Diff]

Fixes

  • (PR#207) Performance improvements done on pure-rand side

1.6.0

ESM version of the package published to npm, arbitraries to generate functions and more settings to be able to tweak the execution [Code][Diff]

Features

  • (PR#201) Add compareBooleanFunc, compareFunc and func arbitraries
  • (PR#200) Parameter randomType to choose the random generator
  • (PR#202) Property hooks for beforeEach and afterEach
  • (PR#196) Publish both cjs and esm versions of the package

Fixes

  • (PR#175) Characters must be biased by default
  • (PR#184) Update to latest lorem-ipsum

1.5.1

Infinite loop on replays with one-level-deep path [Code][Diff]

Fixes

  • (PR#418) Infinite loop when path is one level deep and all runs succeed

1.5.0

Property based test state machine: UI, automata. [Code][Diff] Addition of subarray and shuffledSubarray arbitraries

Features

  • (PR#177) Add subarray and shuffledSubarray arbitraries
  • (PR#157) Model based testing and commands
  • (PR#158) Characters shrink towards printable ascii

Fixes

  • (PR#170) Fix: fullUnicode and fullUnicodeString were failing on old releases of node
  • (PR#178) Doc: Update typedoc
  • (PR#161) Doc: Suggest bundle.run instead of jsdelivr

1.4.1

Infinite loop on replays with one-level-deep path [Code][Diff]

Fixes

  • (PR#418) Infinite loop when path is one level deep and all runs succeed

1.4.0

Suggest custom test values with examples [Code][Diff]

Features

  • (PR#148) Manually add concrete examples to test

Fixes

  • (PR#153) Edit npm project description
  • (PR#152) Add minimal supported node engine version in package.json
  • (PR#149) Bump npm dependencies

1.3.0

Filter invalid values directly in predicates using fc.pre [Code][Diff]

Features

  • (PR#140) Make seed and path copy pasteable
  • (PR#138) Remove core-js, no more global namespace pollution
  • (PR#118) Enable preconditions in predicate

1.2.3

Reduce package footprint and less restrictive API for oneof/frequency [Code][Diff]

Fixes

  • (PR#135) Do not force explicitly one parameter in oneof/frequency
  • (PR#134) Doc: Typos in README
  • (PR#132) Add missing exports for jsonObject and unicodeJsonObject
  • (PR#131) Reduce package size
  • (PR#130) Doc: Examples for generation of recursive structures

1.2.2

Less restrictive API for constantFrom [Code][Diff]

Fixes

  • (PR#123) Do not force explicitly one parameter in constantFrom

1.2.1

Readme update [Code][Diff]

Fixes

  • (b80b4f92) Doc: Model based testing example
  • (cc4f4f4f) Doc: Getting started tutorial

1.2.0

Built-in chaining of arbitraries [Code][Diff]

Features

  • (PR#103) Use the output of arbitraries to produce other ones with .chain(...)
  • (PR#114) Add shrink for fc.lorem
  • (PR#116) Throw exception in case of bad path when trying to replay a failure

Fixes:

  • (PR#117) Doc: Fully revamp the documentation
  • (a5dcd71c) Doc: New logo

1.1.4

Better performance for biased arbitraries (=default) [Code][Diff]

Fixes

  • (PR#107) Fix: Performance issue when using biased arbitraries
  • (743d7619) Fix: Bump to the latest version of pure-rand

1.1.3

Export missing fc.stringOf [Code][Diff]

Fixes

  • (63915033) Fix: Export missing fc.stringOf

1.1.2

Readme update [Code][Diff]

Fixes

  • (68893e99) Doc: Why should I migrate section? in README.md
  • (d779aa9e) Doc: Verbose mode explained in README.md
  • (eacc7f0e) Doc: Bug detected using property based testing and fast-check

1.1.1

Ability to use min and max boundaries outside of 32 bits integers for fc.integer [Code][Diff]

Fixes

  • (b45b90eb) Ability to use min and max boundaries outside of 32 bits integers: fc.integer(Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER)

1.1.0

Straight to corner cases and verbose mode [Code][Diff]

Features

  • (PR#91) Straight to corner cases by default, see unbiased option of assert to disable it
  • (PR#93) Verbose mode on failure to have the list of all failing values encountered, see verbose option of assert to enable it
  • (PR#94) Better typings for fc.record

1.0.4

TypeScript and JavaScript documentation of the code using TypeDoc [Code][Diff]

Features

Fixes

  • (959fb52b) Doc: Add a Tips section in the Readme
  • (0dd1e66a) Doc: Link towards the generated documentation in the Readme

1.0.3

Reduce risk of using an unimplemented method of Node (older releases <6) [Code][Diff]

Fixes

  • (55ff3ff) Clean: Switch to the latest ES standard to use its implementations
  • (ce75e4e) Fix: Safer polyfill for older version of node - rely on core-js

1.0.2

Readme update following removal of depreciated devDependencies [Code][Diff]

Fixes

  • (309a00b) Doc: Update README.md
  • (e13df27) Clean: Clean depreciated dependencies

1.0.1

Fix infinite loop when shrinking array having a minimal length defined [Code][Diff]

Fixes

  • (d6468dc) Fix: shrink an array with minimal length lead to infinite loop

1.0.0

Easier replay of failures [Code][Diff]

Faster shrinks

No recursion when shrinking

Features

  • (7dd6fdb) Add min/max parameters on fc.float and fc.double
  • (e294eed) Naming: lower camel case for settings keys
  • (6f35cdd) Check inputs provided to fc.property for easier troubleshoot
  • (b960938) Naming: rename generic_tuple into genericTuple
  • (d1dde51) Faster shrink of arrays (and must of others because built on top of arrays x integers)
  • (fc57174) Faster shrink of integers
  • (be038f0) Replay a failure by setting seed and path
  • (d25d233) Feature counterexamplePath in case of failure
  • (c7a1508) Update error message content in case of failure in fc.assert
  • (eb0d3c2) Better rendering of strings
  • (1e0a73d) Switch to pure-rand library to handle the random number generation

Fixes

  • (56f1e03) Clean: Bump versions of dependencies
  • (d0027d7) Clean: Do not throw raw strings but Error
  • (6af9e6b) Clean: Remove power-assert from devDependencies
  • (fe44db5) Fix: Avoid recursion during shrinking
  • (e3ecc3c) Fix: Bad number of shrinks in case of failure (offset by one)
  • (79c08f7) Fix: Export dictionary arbitrary

0.0.13

Readme update [Code][Diff]

Fixes

0.0.12

New arbitraries: constantFrom and record [Code][Diff]

Features:

  • (786e16e) Modify default values available for fc.object
  • (8984e78) Add flag to generate fc.record with missing keys
  • (850158b) Add fc.record Arbitrary
  • (262b809) Add fc.constantFrom Arbitrary

Fixes:

  • (6db53f2) Clean: Exclude example/ from npm package
  • (036cd2f) Doc: Documentation noShrink
  • (0ee3a03) Doc: Link towards jsDelivr

0.0.11

Bundled for web-browsers and node [Code][Diff]

Features:

  • Add bundle for web-browsers
  • Add code examples in the source code
  • Add minimal length parameter on all strings arbitraries
  • Add es3 support in order to support oldest versions of node
  • Add set, char16bits and fullUnicode arbitraries
  • Add timeout parameter on asychronous properties

Fixes:

  • Fix: unicode character generators

0.0.10

Fix shrink of async properties [Code][Diff]

Fixes:

  • Fix: bug in shrink of async properties

0.0.9

JSON arbitraries and shrinker kill switch [Code][Diff]

Features:

  • noShrink method can remove shrink from existing arbitraries
  • Add jsonObject and unicodeJsonObject arbitraries
  • Support higher number of arbitraies in tuples and properties

0.0.8

Code and documentation alignment [Code][Diff]

Fixes:

  • Doc: align documentation with code
  • Doc: missing parts in the documentation

0.0.7

Going async/await [Code][Diff]

Features:

  • Support async/await properties
  • Add frequency, anything, object, json, dictionary arbitraries
  • Accept min and max length on array

Fixes:

  • Clean: Better integration with modern tests frameworks (throw Error not strings)

0.0.6

Force ready to be used version [Code][Diff]

Features:

  • Add option, float, double, boolean arbitraries
  • Add function to extract generated values fc.sample and fc.statitistics

Fixes:

  • Doc: creation of a documentation