API Reference
Enumerations
| Enumeration | Description |
|---|---|
| ExecutionStatus | Status of the execution of the property |
| VerbosityLevel | Verbosity level |
Classes
| Class | Description |
|---|---|
| Arbitrary | Abstract class able to generate values on type T |
| PreconditionFailure | Error type produced whenever a precondition fails |
| Random | Wrapper around an instance of a pure-rand's random number generator offering a simpler interface to deal with random with impure patterns |
| Stream | Wrapper around IterableIterator interface offering a set of helpers to deal with iterations in a simple way |
| Value | A Value<T, TShrink = T> holds an internal value of type T and its associated context |
Interfaces
| Interface | Description |
|---|---|
| ArrayConstraints | Constraints to be applied on array |
| AsyncCommand | Interface that should be implemented in order to define an asynchronous command |
| BigIntConstraints | Constraints to be applied on bigInt |
| Command | Interface that should be implemented in order to define a synchronous command |
| CommandsContraints | Parameters for commands |
| ContextValue | Execution context attached to one predicate run |
| DateConstraints | Constraints to be applied on date |
| DictionaryConstraints | Constraints to be applied on dictionary |
| DomainConstraints | Constraints to be applied on domain |
| DoubleConstraints | Constraints to be applied on double |
| EmailAddressConstraints | Constraints to be applied on emailAddress |
| ExecutionTree | Summary of the execution process |
| FalsyContraints | Constraints to be applied on falsy |
| FloatConstraints | Constraints to be applied on float |
| IAsyncProperty | Interface for asynchronous property, see IRawProperty |
| IAsyncPropertyWithHooks | Interface for asynchronous property defining hooks, see IAsyncProperty |
| ICommand | Interface that should be implemented in order to define a command |
| IntegerConstraints | Constraints to be applied on integer |
| IProperty | Interface for synchronous property, see IRawProperty |
| IPropertyWithHooks | Interface for synchronous property defining hooks, see IProperty |
| IRawProperty | Property |
| JsonSharedConstraints | Shared constraints for: - json, - jsonValue, |
| LetrecTypedTie | Strongly typed type for the tie function passed by letrec to the builder function we pass to it. You may want also want to use its loosely typed version LetrecLooselyTypedTie. |
| LoremConstraints | Constraints to be applied on lorem |
| MapConstraints | Constraints to be applied on map |
| MixedCaseConstraints | Constraints to be applied on mixedCase |
| NatConstraints | Constraints to be applied on nat |
| ObjectConstraints | Constraints for anything and object |
| OptionConstraints | Constraints to be applied on option |
| Parameters | Customization of the parameters used to run the properties |
| RunDetailsCommon | Shared part between variants of RunDetails |
| RunDetailsFailureInterrupted | Run reported as failed because it took too long and thus has been interrupted |
| RunDetailsFailureProperty | Run reported as failed because the property failed |
| RunDetailsFailureTooManySkips | Run reported as failed because too many retries have been attempted to generate valid values |
| RunDetailsSuccess | Run reported as success |
| Scheduler | Instance able to reschedule the ordering of promises for a given app |
| SchedulerConstraints | Constraints to be applied on scheduler |
| SchedulerReportItem | Describe a task for the report produced by the scheduler |
| ShuffledSubarrayConstraints | Constraints to be applied on shuffledSubarray |
| SparseArrayConstraints | Constraints to be applied on sparseArray |
| StringSharedConstraints | Constraints to be applied on arbitraries for strings |
| SubarrayConstraints | Constraints to be applied on subarray |
| UuidConstraints | Constraints to be applied on uuid |
| WebAuthorityConstraints | Constraints to be applied on webAuthority |
| WebFragmentsConstraints | Constraints to be applied on webFragments |
| WebPathConstraints | Constraints to be applied on webPath |
| WebQueryParametersConstraints | Constraints to be applied on webQueryParameters |
| WebSegmentConstraints | Constraints to be applied on webSegment |
| WebUrlConstraints | Constraints to be applied on webUrl |
| WeightedArbitrary | Conjonction of a weight and an arbitrary used by oneof in order to generate values |
| WithCloneMethod | Object instance that should be cloned from one generation/shrink to another |
Type Aliases
| Type Alias | Description |
|---|---|
| AsyncPropertyHookFunction | Type of legal hook function that can be used to call beforeEach or afterEach on a IAsyncPropertyWithHooks |
| BigIntArrayConstraints | Constraints to be applied on typed arrays for big int values |
| CloneValue | Type of the value produced by clone |
| DepthContext | Instance of depth, can be used to alter the depth perceived by an arbitrary or to bias your own arbitraries based on the current depth |
| DepthIdentifier | Type used to strongly type instances of depth identifier while keeping internals what they contain internally |
| DepthSize | Superset of Size to override the default defined for size. It can either be based on a numeric value manually selected by the user (not recommended) or rely on presets based on size (recommended). |
| EntityGraphArbitraries | Defines all entity types and their data fields for entityGraph. |
| EntityGraphContraints | Constraints to be applied on entityGraph |
| EntityGraphRelations | Defines all relationships between entity types for entityGraph. |
| EntityGraphValue | Type of the values generated by entityGraph. |
| FalsyValue | Typing for values generated by falsy |
| Float32ArrayConstraints | Constraints to be applied on float32Array |
| Float64ArrayConstraints | Constraints to be applied on float64Array |
| GeneratorValue | An instance of GeneratorValue can be leveraged within predicates themselves to produce extra random values while preserving part of the shrinking capabilities on the produced values. |
| GlobalAsyncPropertyHookFunction | Type of legal hook function that can be used in the global parameter asyncBeforeEach and/or asyncAfterEach |
| GlobalParameters | Type describing the global overrides |
| GlobalPropertyHookFunction | Type of legal hook function that can be used in the global parameter beforeEach and/or afterEach |
| IntArrayConstraints | Constraints to be applied on typed arrays for integer values |
| JsonValue | Typings for a Json value |
| LetrecLooselyTypedBuilder | Loosely typed type for the builder function passed to letrec. You may want also want to use its strongly typed version LetrecTypedBuilder. |
| LetrecLooselyTypedTie | Loosely typed type for the tie function passed by letrec to the builder function we pass to it. You may want also want to use its strongly typed version LetrecTypedTie. |
| LetrecTypedBuilder | Strongly typed type for the builder function passed to letrec. You may want also want to use its loosely typed version LetrecLooselyTypedBuilder. |
| LetrecValue | Type of the value produced by letrec |
| MaybeWeightedArbitrary | Either an Arbitrary<T> or a WeightedArbitrary<T> |
| Memo | Output type for memo |
| ModelRunAsyncSetup | Asynchronous definition of model and real |
| ModelRunSetup | Synchronous definition of model and real |
| OneOfConstraints | Constraints to be applied on oneof |
| OneOfValue | Infer the type of the Arbitrary produced by oneof given the type of the source arbitraries |
| PropertyFailure | Represent failures of the property |
| PropertyHookFunction | Type of legal hook function that can be used to call beforeEach or afterEach on a IPropertyWithHooks |
| RandomGenerator | Merged type supporting both pure-rand v7 and v8 random generators. Keeping compatibility with v7 avoids a breaking API change and a new major version. |
| RandomType | Random generators automatically recognized by the framework without having to pass a builder function |
| RecordConstraints | Constraints to be applied on record |
| RecordValue | Infer the type of the Arbitrary produced by record given the type of the source arbitrary and constraints to be applied |
| RunDetails | Post-run details produced by check |
| SchedulerAct | Function responsible to run the passed function and surround it with whatever needed. The name has been inspired from the act function coming with React. |
| SchedulerSequenceItem | Define an item to be passed to scheduleSequence |
| SetConstraints | Constraints to be applied on set |
| Size | The size parameter defines how large the generated values could be. |
| SizeForArbitrary | Superset of Size to override the default defined for size |
| StringConstraints | Constraints to be applied on arbitrary string |
| StringMatchingConstraints | Constraints to be applied on the arbitrary stringMatching |
| UniqueArrayConstraints | Constraints implying known and optimized comparison function to be applied on uniqueArray |
| UniqueArrayConstraintsCustomCompare | Constraints implying a fully custom comparison function to be applied on uniqueArray |
| UniqueArrayConstraintsCustomCompareSelect | Constraints implying fully custom comparison function and selector to be applied on uniqueArray |
| UniqueArrayConstraintsRecommended | Constraints implying known and optimized comparison function to be applied on uniqueArray |
| UniqueArraySharedConstraints | Shared constraints to be applied on uniqueArray |
| WithAsyncToStringMethod | Interface to implement for asyncToStringMethod |
| WithToStringMethod | Interface to implement for toStringMethod |
Variables
| Variable | Description |
|---|---|
| __commitHash | Commit hash of the current code (eg.: process.env.COMMIT_HASH) |
| __type | Type of module (commonjs or module) |
| __version | Version of fast-check used by your project (eg.: process.env.PACKAGE_VERSION) |
| asyncToStringMethod | Use this symbol to define a custom serializer for your instances. Serializer must be a function returning a promise of string (see WithAsyncToStringMethod). |
| cloneMethod | Generated instances having a method [cloneMethod] will be automatically cloned whenever necessary |
| toStringMethod | Use this symbol to define a custom serializer for your instances. Serializer must be a function returning a string (see WithToStringMethod). |
Functions
| Function | Description |
|---|---|
| anything | For any type of values |
| array | For arrays of values coming from arb |
| assert | Run the property, throw in case of failure |
| asyncDefaultReportMessage | Format output of check using the default error reporting of assert |
| asyncModelRun | Run asynchronous commands over a Model and the Real system |
| asyncProperty | Instantiate a new fast-check#IAsyncProperty |
| asyncStringify | Convert any value to its fast-check string representation |
| base64String | For base64 strings |
| bigInt | For bigint |
| bigInt64Array | For BigInt64Array |
| bigUint64Array | For BigUint64Array |
| boolean | For boolean values - true or false |
| check | Run the property, do not throw contrary to assert |
| clone | Clone the values generated by arb in order to produce fully equal values (might not be equal in terms of === or ==) |
| cloneIfNeeded | Clone an instance if needed |
| commands | For arrays of AsyncCommand to be executed by asyncModelRun |
| compareBooleanFunc | For comparison boolean functions |
| compareFunc | For comparison functions |
| configureGlobal | Define global parameters that will be used by all the runners |
| constant | For value |
| constantFrom | For one ...values values - all equiprobable |
| context | Produce a ContextValue instance |
| createDepthIdentifier | Create a new and unique instance of DepthIdentifier that can be shared across multiple arbitraries if needed |
| date | For date between constraints.min or new Date(-8640000000000000) (included) and constraints.max or new Date(8640000000000000) (included) |
| defaultReportMessage | Format output of check using the default error reporting of assert |
| dictionary | For dictionaries with keys produced by keyArb and values from valueArb |
| domain | For domains having an extension with at least two lowercase characters |
| double | For 64-bit floating point numbers: - sign: 1 bit - significand: 52 bits - exponent: 11 bits |
| emailAddress | For email address |
| entityGraph | Generates interconnected entities with relationships based on a schema definition. |
| falsy | For falsy values: - '' - 0 - NaN - false - null - undefined - 0n (whenever withBigInt: true) |
| float | For 32-bit floating point numbers: - sign: 1 bit - significand: 23 bits - exponent: 8 bits |
| float32Array | For Float32Array |
| float64Array | For Float64Array |
| func | For pure functions |
| gen | Generate values within the test execution itself by leveraging the strength of gen |
| getDepthContextFor | Get back the requested DepthContext |
| hasAsyncToStringMethod | Check if an instance implements WithAsyncToStringMethod |
| hasCloneMethod | Check if an instance has to be clone |
| hash | CRC-32 based hash function |
| hasToStringMethod | Check if an instance implements WithToStringMethod |
| infiniteStream | Produce an infinite stream of values |
| int16Array | For Int16Array |
| int32Array | For Int32Array |
| int8Array | For Int8Array |
| integer | For integers between min (included) and max (included) |
| ipV4 | For valid IP v4 |
| ipV4Extended | For valid IP v4 according to WhatWG |
| ipV6 | For valid IP v6 |
| json | For any JSON strings |
| jsonValue | For any JSON compliant values |
| letrec | For mutually recursive types |
| limitShrink | Create another Arbitrary with a limited (or capped) number of shrink values |
| lorem | For lorem ipsum string of words or sentences with maximal number of words or sentences |
| map | For Maps with keys produced by keyArb and values from valueArb |
| mapToConstant | Generate non-contiguous ranges of values by mapping integer values to constant |
| maxSafeInteger | For integers between Number.MIN_SAFE_INTEGER (included) and Number.MAX_SAFE_INTEGER (included) |
| maxSafeNat | For positive integers between 0 (included) and Number.MAX_SAFE_INTEGER (included) |
| memo | For mutually recursive types |
| mixedCase | Randomly switch the case of characters generated by stringArb (upper/lower) |
| modelRun | Run synchronous commands over a Model and the Real system |
| nat | For positive integers between 0 (included) and 2147483647 (included) |
| noBias | Build an arbitrary without any bias. |
| noShrink | Build an arbitrary without shrinking capabilities. |
| object | For any objects |
| oneof | For one of the values generated by ...arbs - with all ...arbs equiprobable |
| option | For either nil or a value coming from arb with custom frequency |
| pre | Add pre-condition checks inside a property execution |
| property | Instantiate a new fast-check#IProperty |
| readConfigureGlobal | Read global parameters that will be used by runners |
| record | For records following the recordModel schema |
| resetConfigureGlobal | Reset global parameters |
| sample | Generate an array containing all the values that would have been generated during assert or check |
| scheduledModelRun | Run asynchronous and scheduled commands over a Model and the Real system |
| scheduler | For scheduler of promises |
| schedulerFor | For custom scheduler with predefined resolution order |
| set | For sets of values coming from arb |
| shuffledSubarray | For subarrays of originalArray |
| sparseArray | For sparse arrays of values coming from arb |
| statistics | Gather useful statistics concerning generated values |
| stream | Create a Stream based on g |
| string | For strings of char |
| stringify | Convert any value to its fast-check string representation |
| stringMatching | For strings matching the provided regex |
| subarray | For subarrays of originalArray (keeps ordering) |
| tuple | For tuples produced using the provided arbs |
| uint16Array | For Uint16Array |
| uint32Array | For Uint32Array |
| uint8Array | For Uint8Array |
| uint8ClampedArray | For Uint8ClampedArray |
| ulid | For ulid |
| uniqueArray | For arrays of unique values coming from arb |
| uuid | For UUID from v1 to v5 |
| webAuthority | For web authority |
| webFragments | For fragments of an URI (web included) |
| webPath | For web path |
| webQueryParameters | For query parameters of an URI (web included) |
| webSegment | For internal segment of an URI (web included) |
| webUrl | For web url |