Skip to main content

Interface: IPropertyWithHooks<Ts>

Defined in: packages/fast-check/src/check/property/Property.generic.ts:37

Interface for synchronous property defining hooks, see IProperty

Remarks

Since 2.2.0

Extends

Type Parameters

Type Parameter
Ts

Properties

runAfterEach

runAfterEach: () => void

Defined in: packages/fast-check/src/check/property/IRawProperty.ts:81

Run after each hook

Returns

void

Remarks

Since 3.4.0

Inherited from

IProperty.runAfterEach


runBeforeEach

runBeforeEach: () => void

Defined in: packages/fast-check/src/check/property/IRawProperty.ts:75

Run before each hook

Returns

void

Remarks

Since 3.4.0

Inherited from

IProperty.runBeforeEach

Methods

afterEach()

Call Signature

afterEach(invalidHookFunction): "afterEach expects a synchronous function but was given a function returning a Promise"

Defined in: packages/fast-check/src/check/property/Property.generic.ts:59

Define a function that should be called after all calls to the predicate

Parameters
ParameterTypeDescription
invalidHookFunction(hookFunction) => Promise<unknown>Function to be called, please provide a valid hook function
Returns

"afterEach expects a synchronous function but was given a function returning a Promise"

Remarks

Since 1.6.0

Call Signature

afterEach(hookFunction): IPropertyWithHooks<Ts>

Defined in: packages/fast-check/src/check/property/Property.generic.ts:67

Define a function that should be called after all calls to the predicate

Parameters
ParameterTypeDescription
hookFunctionPropertyHookFunctionFunction to be called
Returns

IPropertyWithHooks<Ts>

Remarks

Since 1.6.0


beforeEach()

Call Signature

beforeEach(invalidHookFunction): "beforeEach expects a synchronous function but was given a function returning a Promise"

Defined in: packages/fast-check/src/check/property/Property.generic.ts:43

Define a function that should be called before all calls to the predicate

Parameters
ParameterTypeDescription
invalidHookFunction(hookFunction) => Promise<unknown>Function to be called, please provide a valid hook function
Returns

"beforeEach expects a synchronous function but was given a function returning a Promise"

Remarks

Since 1.6.0

Call Signature

beforeEach(hookFunction): IPropertyWithHooks<Ts>

Defined in: packages/fast-check/src/check/property/Property.generic.ts:52

Define a function that should be called before all calls to the predicate

Parameters
ParameterTypeDescription
hookFunctionPropertyHookFunctionFunction to be called
Returns

IPropertyWithHooks<Ts>

Remarks

Since 1.6.0


generate()

generate(mrng, runId?): Value<Ts>

Defined in: packages/fast-check/src/check/property/IRawProperty.ts:49

Generate values of type Ts

Parameters

ParameterTypeDescription
mrngRandomRandom number generator
runId?numberId of the generation, starting at 0 - if set the generation might be biased

Returns

Value<Ts>

Remarks

Since 0.0.7 (return type changed in 3.0.0)

Inherited from

IProperty.generate


isAsync()

isAsync(): false

Defined in: packages/fast-check/src/check/property/IRawProperty.ts:39

Is the property asynchronous?

true in case of asynchronous property, false otherwise

Returns

false

Remarks

Since 0.0.7

Inherited from

IProperty.isAsync


run()

run(v): PreconditionFailure | PropertyFailure | null

Defined in: packages/fast-check/src/check/property/IRawProperty.ts:65

Check the predicate for v

Parameters

ParameterTypeDescription
vTsValue of which we want to check the predicate

Returns

PreconditionFailure | PropertyFailure | null

Remarks

Since 0.0.7

Inherited from

IProperty.run


shrink()

shrink(value): Stream<Value<Ts>>

Defined in: packages/fast-check/src/check/property/IRawProperty.ts:58

Shrink value of type Ts

Parameters

ParameterTypeDescription
valueValue<Ts>The value to be shrunk, it can be context-less

Returns

Stream<Value<Ts>>

Remarks

Since 3.0.0

Inherited from

IProperty.shrink