Sorellabs Claire Save Abandoned

[Unmaintained: please use jsverify instead] A property-based testing library for clearly specifying code invariants and behaviour.

Project README


Build Status NPM version Dependencies Status experimental

Claire is a random testing library for both property-based testing (QuickCheck-like) and random program generation (ScalaCheck command's like), which allows you to express your code's behaviours and invariants in a clear way.


var claire = require('claire')
var _      =
var forAll = claire.forAll

var commutative_p = forAll( _.Int, _.Int ).satisfy( function(a, b) {
                      return a + b == b + a
// + OK passed 100 tests.

var identity_p = forAll(_.Int).satisfy(function(a) {
                   return a == a + 1

identity_p.asTest({ verbose: true, times: 100 })()
// <property failed>: ! Falsified after 1 tests, 1 failed.
// : Failure #1 --------------------
// : The following arguments were provided:
//   0 - 93 (<int>)
// (Stack trace)


The easiest way is to grab it from NPM. If you're running in a Browser environment, you can use Browserify

$ npm install claire

Using with CommonJS

If you're not using NPM, Download the latest release, and require the claire.umd.js file:

var claire = require('claire')

Using with AMD

Download the latest release, and require the claire.umd.js file:

require(['claire'], function(claire) {
  ( ... )

Using without modules

Download the latest release, and load the claire.umd.js file. The properties are exposed in the global claire object:

<script src="/path/to/claire.umd.js"></script>

Compiling from source

If you want to compile this library from the source, you'll need Git, Make, Node.js, and run the following commands:

$ git clone git://
$ cd claire
$ npm install
$ make bundle

This will generate the dist/claire.umd.js file, which you can load in any JavaScript environment.


You can read the documentation online or build it yourself:

$ git clone git://
$ cd claire
$ npm install
$ make documentation

Then open the file docs/manual/build/html/index.html in your browser.

Platform support

This library assumes an ES5 environment, but can be easily supported in ES3 platforms by the use of shims. Just include es5-shim :)


Copyright (c) 2013-2014 Quildreen Motta.

Released under the MIT licence.

Open Source Agenda is not affiliated with "Sorellabs Claire" Project. README Source: sorellabs/claire
Open Issues
Last Commit
10 years ago

Open Source Agenda Badge

Open Source Agenda Rating