ava-jsverify
An interface for running
jsverify tests with AVA
Getting started
NPM
$ npm install ava-jsverify --save
Yarn
$ yarn add ava-jsverify
Usage
ava-jsverify
exports a check
function to be passed to ava's test
function. check
performs broadly the same task as jsc#checkforall
, except that it also exposes ava's test api for assertions. You should continue to use the jsverify and ava API's with the exception of check
.
const test = require('ava');
const jsc = require('jsverify');
const { check } = require('ava-jsverify');
test(
'generates',
check(jsc.integer, jsc.string, (t, x, y) => {
t.is(typeof x, 'number');
t.is(typeof y, 'string');
})
);
Output
On a test failure the shrunken fail case will be displayed after the test description and between the parentheses. In the example below the smallest failure has been identified as 0
3 passed
1 failed
generates with plan ( 0 )
/ava-jsverify/test/check.test.js:30
29: t.plan(2);
30: t.true(x >= 1);
31: t.is(typeof x, 'number');
Value is not `true`:
false
x>=1
=> false
x
=> 0