Skip to content
This repository has been archived by the owner on Apr 26, 2019. It is now read-only.
/ ava-jsverify Public archive

An interface for running jsverify property based tests with AVA

Notifications You must be signed in to change notification settings

imranolas/ava-jsverify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ava-jsverify

npm version

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

About

An interface for running jsverify property based tests with AVA

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published