fast-check
Version:
Property based testing framework for JavaScript (like QuickCheck)
90 lines (89 loc) • 3.05 kB
TypeScript
import type { IRawProperty } from '../property/IRawProperty.js';
import type { Parameters } from './configuration/Parameters.js';
import type { RunDetails } from './reporter/RunDetails.js';
import type { IAsyncProperty } from '../property/AsyncProperty.js';
import type { IProperty } from '../property/Property.js';
/**
* Run the property, do not throw contrary to {@link assert}
*
* WARNING: Has to be awaited
*
* @param property - Asynchronous property to be checked
* @param params - Optional parameters to customize the execution
*
* @returns Test status and other useful details
*
* @remarks Since 0.0.7
* @public
*/
declare function check<Ts>(property: IAsyncProperty<Ts>, params?: Parameters<Ts>): Promise<RunDetails<Ts>>;
/**
* Run the property, do not throw contrary to {@link assert}
*
* @param property - Synchronous property to be checked
* @param params - Optional parameters to customize the execution
*
* @returns Test status and other useful details
*
* @remarks Since 0.0.1
* @public
*/
declare function check<Ts>(property: IProperty<Ts>, params?: Parameters<Ts>): RunDetails<Ts>;
/**
* Run the property, do not throw contrary to {@link assert}
*
* WARNING: Has to be awaited if the property is asynchronous
*
* @param property - Property to be checked
* @param params - Optional parameters to customize the execution
*
* @returns Test status and other useful details
*
* @remarks Since 0.0.7
* @public
*/
declare function check<Ts>(property: IRawProperty<Ts>, params?: Parameters<Ts>): Promise<RunDetails<Ts>> | RunDetails<Ts>;
/**
* Run the property, throw in case of failure
*
* It can be called directly from describe/it blocks of Mocha.
* No meaningful results are produced in case of success.
*
* WARNING: Has to be awaited
*
* @param property - Asynchronous property to be checked
* @param params - Optional parameters to customize the execution
*
* @remarks Since 0.0.7
* @public
*/
declare function assert<Ts>(property: IAsyncProperty<Ts>, params?: Parameters<Ts>): Promise<void>;
/**
* Run the property, throw in case of failure
*
* It can be called directly from describe/it blocks of Mocha.
* No meaningful results are produced in case of success.
*
* @param property - Synchronous property to be checked
* @param params - Optional parameters to customize the execution
*
* @remarks Since 0.0.1
* @public
*/
declare function assert<Ts>(property: IProperty<Ts>, params?: Parameters<Ts>): void;
/**
* Run the property, throw in case of failure
*
* It can be called directly from describe/it blocks of Mocha.
* No meaningful results are produced in case of success.
*
* WARNING: Returns a promise to be awaited if the property is asynchronous
*
* @param property - Synchronous or asynchronous property to be checked
* @param params - Optional parameters to customize the execution
*
* @remarks Since 0.0.7
* @public
*/
declare function assert<Ts>(property: IRawProperty<Ts>, params?: Parameters<Ts>): Promise<void> | void;
export { check, assert };