@fast-check/jest
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -7,8 +7,15 @@ import { it, test } from '@jest/globals'; | ||
function internalTestPropExecute(testFn, label, arbitraries, prop, params) { | ||
const customParams = params || {}; | ||
if (customParams.seed === undefined) | ||
customParams.seed = Date.now(); | ||
const customParams = Object.assign({}, params); | ||
if (customParams.seed === undefined) { | ||
const seedFromGlobals = fc.readConfigureGlobal().seed; | ||
if (seedFromGlobals !== undefined) { | ||
customParams.seed = seedFromGlobals; | ||
} | ||
else { | ||
customParams.seed = Date.now(); | ||
} | ||
} | ||
const promiseProp = wrapProp(prop); | ||
testFn(`${label} (with seed=${customParams.seed})`, async () => { | ||
await fc.assert(fc.asyncProperty(...arbitraries, promiseProp), params); | ||
await fc.assert(fc.asyncProperty(...arbitraries, promiseProp), customParams); | ||
}); | ||
@@ -15,0 +22,0 @@ } |
@@ -6,39 +6,39 @@ import * as fc from 'fast-check'; | ||
declare type Prop<Ts extends [any] | any[]> = (...args: Ts) => boolean | void | PromiseLike<boolean | void>; | ||
export declare const testProp: (<Ts extends any[] | [any]>(label: string, arbitraries: ArbitraryTuple<Ts>, prop: Prop<Ts>, params?: fc.Parameters<Ts> | undefined) => void) & { | ||
only: (<Ts_1 extends any[] | [any]>(label: string, arbitraries: ArbitraryTuple<Ts_1>, prop: Prop<Ts_1>, params?: fc.Parameters<Ts_1> | undefined) => void) & { | ||
failing: <Ts_2 extends any[] | [any]>(label: string, arbitraries: ArbitraryTuple<Ts_2>, prop: Prop<Ts_2>, params?: fc.Parameters<Ts_2> | undefined) => void; | ||
export declare const testProp: (<Ts extends any[] | [any], TsParameters extends Ts = Ts>(label: string, arbitraries: ArbitraryTuple<Ts>, prop: Prop<Ts>, params?: fc.Parameters<TsParameters> | undefined) => void) & { | ||
only: (<Ts_1 extends any[] | [any], TsParameters_1 extends Ts_1 = Ts_1>(label: string, arbitraries: ArbitraryTuple<Ts_1>, prop: Prop<Ts_1>, params?: fc.Parameters<TsParameters_1> | undefined) => void) & { | ||
failing: <Ts_2 extends any[] | [any], TsParameters_2 extends Ts_2 = Ts_2>(label: string, arbitraries: ArbitraryTuple<Ts_2>, prop: Prop<Ts_2>, params?: fc.Parameters<TsParameters_2> | undefined) => void; | ||
}; | ||
skip: (<Ts_1 extends any[] | [any]>(label: string, arbitraries: ArbitraryTuple<Ts_1>, prop: Prop<Ts_1>, params?: fc.Parameters<Ts_1> | undefined) => void) & { | ||
failing: <Ts_2 extends any[] | [any]>(label: string, arbitraries: ArbitraryTuple<Ts_2>, prop: Prop<Ts_2>, params?: fc.Parameters<Ts_2> | undefined) => void; | ||
skip: (<Ts_1 extends any[] | [any], TsParameters_1 extends Ts_1 = Ts_1>(label: string, arbitraries: ArbitraryTuple<Ts_1>, prop: Prop<Ts_1>, params?: fc.Parameters<TsParameters_1> | undefined) => void) & { | ||
failing: <Ts_2 extends any[] | [any], TsParameters_2 extends Ts_2 = Ts_2>(label: string, arbitraries: ArbitraryTuple<Ts_2>, prop: Prop<Ts_2>, params?: fc.Parameters<TsParameters_2> | undefined) => void; | ||
}; | ||
failing: <Ts_2 extends any[] | [any]>(label: string, arbitraries: ArbitraryTuple<Ts_2>, prop: Prop<Ts_2>, params?: fc.Parameters<Ts_2> | undefined) => void; | ||
failing: <Ts_2 extends any[] | [any], TsParameters_2 extends Ts_2 = Ts_2>(label: string, arbitraries: ArbitraryTuple<Ts_2>, prop: Prop<Ts_2>, params?: fc.Parameters<TsParameters_2> | undefined) => void; | ||
} & { | ||
concurrent: (<Ts extends any[] | [any]>(label: string, arbitraries: ArbitraryTuple<Ts>, prop: Prop<Ts>, params?: fc.Parameters<Ts> | undefined) => void) & { | ||
only: (<Ts_1 extends any[] | [any]>(label: string, arbitraries: ArbitraryTuple<Ts_1>, prop: Prop<Ts_1>, params?: fc.Parameters<Ts_1> | undefined) => void) & { | ||
failing: <Ts_2 extends any[] | [any]>(label: string, arbitraries: ArbitraryTuple<Ts_2>, prop: Prop<Ts_2>, params?: fc.Parameters<Ts_2> | undefined) => void; | ||
concurrent: (<Ts extends any[] | [any], TsParameters extends Ts = Ts>(label: string, arbitraries: ArbitraryTuple<Ts>, prop: Prop<Ts>, params?: fc.Parameters<TsParameters> | undefined) => void) & { | ||
only: (<Ts_1 extends any[] | [any], TsParameters_1 extends Ts_1 = Ts_1>(label: string, arbitraries: ArbitraryTuple<Ts_1>, prop: Prop<Ts_1>, params?: fc.Parameters<TsParameters_1> | undefined) => void) & { | ||
failing: <Ts_2 extends any[] | [any], TsParameters_2 extends Ts_2 = Ts_2>(label: string, arbitraries: ArbitraryTuple<Ts_2>, prop: Prop<Ts_2>, params?: fc.Parameters<TsParameters_2> | undefined) => void; | ||
}; | ||
skip: (<Ts_1 extends any[] | [any]>(label: string, arbitraries: ArbitraryTuple<Ts_1>, prop: Prop<Ts_1>, params?: fc.Parameters<Ts_1> | undefined) => void) & { | ||
failing: <Ts_2 extends any[] | [any]>(label: string, arbitraries: ArbitraryTuple<Ts_2>, prop: Prop<Ts_2>, params?: fc.Parameters<Ts_2> | undefined) => void; | ||
skip: (<Ts_1 extends any[] | [any], TsParameters_1 extends Ts_1 = Ts_1>(label: string, arbitraries: ArbitraryTuple<Ts_1>, prop: Prop<Ts_1>, params?: fc.Parameters<TsParameters_1> | undefined) => void) & { | ||
failing: <Ts_2 extends any[] | [any], TsParameters_2 extends Ts_2 = Ts_2>(label: string, arbitraries: ArbitraryTuple<Ts_2>, prop: Prop<Ts_2>, params?: fc.Parameters<TsParameters_2> | undefined) => void; | ||
}; | ||
failing: <Ts_2 extends any[] | [any]>(label: string, arbitraries: ArbitraryTuple<Ts_2>, prop: Prop<Ts_2>, params?: fc.Parameters<Ts_2> | undefined) => void; | ||
failing: <Ts_2 extends any[] | [any], TsParameters_2 extends Ts_2 = Ts_2>(label: string, arbitraries: ArbitraryTuple<Ts_2>, prop: Prop<Ts_2>, params?: fc.Parameters<TsParameters_2> | undefined) => void; | ||
}; | ||
todo: (testName: string | (number | Function)) => void; | ||
}; | ||
export declare const itProp: (<Ts extends any[] | [any]>(label: string, arbitraries: ArbitraryTuple<Ts>, prop: Prop<Ts>, params?: fc.Parameters<Ts> | undefined) => void) & { | ||
only: (<Ts_1 extends any[] | [any]>(label: string, arbitraries: ArbitraryTuple<Ts_1>, prop: Prop<Ts_1>, params?: fc.Parameters<Ts_1> | undefined) => void) & { | ||
failing: <Ts_2 extends any[] | [any]>(label: string, arbitraries: ArbitraryTuple<Ts_2>, prop: Prop<Ts_2>, params?: fc.Parameters<Ts_2> | undefined) => void; | ||
export declare const itProp: (<Ts extends any[] | [any], TsParameters extends Ts = Ts>(label: string, arbitraries: ArbitraryTuple<Ts>, prop: Prop<Ts>, params?: fc.Parameters<TsParameters> | undefined) => void) & { | ||
only: (<Ts_1 extends any[] | [any], TsParameters_1 extends Ts_1 = Ts_1>(label: string, arbitraries: ArbitraryTuple<Ts_1>, prop: Prop<Ts_1>, params?: fc.Parameters<TsParameters_1> | undefined) => void) & { | ||
failing: <Ts_2 extends any[] | [any], TsParameters_2 extends Ts_2 = Ts_2>(label: string, arbitraries: ArbitraryTuple<Ts_2>, prop: Prop<Ts_2>, params?: fc.Parameters<TsParameters_2> | undefined) => void; | ||
}; | ||
skip: (<Ts_1 extends any[] | [any]>(label: string, arbitraries: ArbitraryTuple<Ts_1>, prop: Prop<Ts_1>, params?: fc.Parameters<Ts_1> | undefined) => void) & { | ||
failing: <Ts_2 extends any[] | [any]>(label: string, arbitraries: ArbitraryTuple<Ts_2>, prop: Prop<Ts_2>, params?: fc.Parameters<Ts_2> | undefined) => void; | ||
skip: (<Ts_1 extends any[] | [any], TsParameters_1 extends Ts_1 = Ts_1>(label: string, arbitraries: ArbitraryTuple<Ts_1>, prop: Prop<Ts_1>, params?: fc.Parameters<TsParameters_1> | undefined) => void) & { | ||
failing: <Ts_2 extends any[] | [any], TsParameters_2 extends Ts_2 = Ts_2>(label: string, arbitraries: ArbitraryTuple<Ts_2>, prop: Prop<Ts_2>, params?: fc.Parameters<TsParameters_2> | undefined) => void; | ||
}; | ||
failing: <Ts_2 extends any[] | [any]>(label: string, arbitraries: ArbitraryTuple<Ts_2>, prop: Prop<Ts_2>, params?: fc.Parameters<Ts_2> | undefined) => void; | ||
failing: <Ts_2 extends any[] | [any], TsParameters_2 extends Ts_2 = Ts_2>(label: string, arbitraries: ArbitraryTuple<Ts_2>, prop: Prop<Ts_2>, params?: fc.Parameters<TsParameters_2> | undefined) => void; | ||
} & { | ||
concurrent: (<Ts extends any[] | [any]>(label: string, arbitraries: ArbitraryTuple<Ts>, prop: Prop<Ts>, params?: fc.Parameters<Ts> | undefined) => void) & { | ||
only: (<Ts_1 extends any[] | [any]>(label: string, arbitraries: ArbitraryTuple<Ts_1>, prop: Prop<Ts_1>, params?: fc.Parameters<Ts_1> | undefined) => void) & { | ||
failing: <Ts_2 extends any[] | [any]>(label: string, arbitraries: ArbitraryTuple<Ts_2>, prop: Prop<Ts_2>, params?: fc.Parameters<Ts_2> | undefined) => void; | ||
concurrent: (<Ts extends any[] | [any], TsParameters extends Ts = Ts>(label: string, arbitraries: ArbitraryTuple<Ts>, prop: Prop<Ts>, params?: fc.Parameters<TsParameters> | undefined) => void) & { | ||
only: (<Ts_1 extends any[] | [any], TsParameters_1 extends Ts_1 = Ts_1>(label: string, arbitraries: ArbitraryTuple<Ts_1>, prop: Prop<Ts_1>, params?: fc.Parameters<TsParameters_1> | undefined) => void) & { | ||
failing: <Ts_2 extends any[] | [any], TsParameters_2 extends Ts_2 = Ts_2>(label: string, arbitraries: ArbitraryTuple<Ts_2>, prop: Prop<Ts_2>, params?: fc.Parameters<TsParameters_2> | undefined) => void; | ||
}; | ||
skip: (<Ts_1 extends any[] | [any]>(label: string, arbitraries: ArbitraryTuple<Ts_1>, prop: Prop<Ts_1>, params?: fc.Parameters<Ts_1> | undefined) => void) & { | ||
failing: <Ts_2 extends any[] | [any]>(label: string, arbitraries: ArbitraryTuple<Ts_2>, prop: Prop<Ts_2>, params?: fc.Parameters<Ts_2> | undefined) => void; | ||
skip: (<Ts_1 extends any[] | [any], TsParameters_1 extends Ts_1 = Ts_1>(label: string, arbitraries: ArbitraryTuple<Ts_1>, prop: Prop<Ts_1>, params?: fc.Parameters<TsParameters_1> | undefined) => void) & { | ||
failing: <Ts_2 extends any[] | [any], TsParameters_2 extends Ts_2 = Ts_2>(label: string, arbitraries: ArbitraryTuple<Ts_2>, prop: Prop<Ts_2>, params?: fc.Parameters<TsParameters_2> | undefined) => void; | ||
}; | ||
failing: <Ts_2 extends any[] | [any]>(label: string, arbitraries: ArbitraryTuple<Ts_2>, prop: Prop<Ts_2>, params?: fc.Parameters<Ts_2> | undefined) => void; | ||
failing: <Ts_2 extends any[] | [any], TsParameters_2 extends Ts_2 = Ts_2>(label: string, arbitraries: ArbitraryTuple<Ts_2>, prop: Prop<Ts_2>, params?: fc.Parameters<TsParameters_2> | undefined) => void; | ||
}; | ||
@@ -45,0 +45,0 @@ todo: (testName: string | (number | Function)) => void; |
@@ -11,8 +11,15 @@ "use strict"; | ||
function internalTestPropExecute(testFn, label, arbitraries, prop, params) { | ||
const customParams = params || {}; | ||
if (customParams.seed === undefined) | ||
customParams.seed = Date.now(); | ||
const customParams = Object.assign({}, params); | ||
if (customParams.seed === undefined) { | ||
const seedFromGlobals = fc.readConfigureGlobal().seed; | ||
if (seedFromGlobals !== undefined) { | ||
customParams.seed = seedFromGlobals; | ||
} | ||
else { | ||
customParams.seed = Date.now(); | ||
} | ||
} | ||
const promiseProp = wrapProp(prop); | ||
testFn(`${label} (with seed=${customParams.seed})`, async () => { | ||
await fc.assert(fc.asyncProperty(...arbitraries, promiseProp), params); | ||
await fc.assert(fc.asyncProperty(...arbitraries, promiseProp), customParams); | ||
}); | ||
@@ -19,0 +26,0 @@ } |
{ | ||
"name": "@fast-check/jest", | ||
"description": "Property based testing for Jest based on fast-check", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"type": "commonjs", | ||
@@ -6,0 +6,0 @@ "main": "lib/jest-fast-check.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
17226
167
0