npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

checkers

v0.13.1

Published

Property-based testing for JavaScript via ClojureScript's test.check

Downloads

33

Readme

checkers

npm version Build Status

Property-based testing for JavaScript via ClojureScript's test.check.

test.check is a Clojure property-based testing tool inspired by QuickCheck. The core idea of test.check is that instead of enumerating expected input and output for unit tests, you write properties about your function that should hold true for all inputs. This lets you write concise, powerful tests.

Checkers brings the power of test.check to plain ol' JavaScript.

Install

npm install checkers --save

Usage

var checkers = require('checkers');
var gen = checkers.gen;

// Property is incorrect
checkers.forAll(
    [gen.int],
    function(i) {
        return i * i > i;
    }
).check(1000);

// Property is now correct
checkers.forAll(
    [gen.int],
    function(i) {
        return i * i >= i;
    }
).check(1000);

// Check property with a particular seed
checkers.forAll(
    [gen.int],
    function(i) {
        return i * i >= i;
    }
).check(1000, {seed: 1422111938215});

Usage with Mocha

Checkers comes with a helper function to make writing tests for mocha simpler.

var checking = require('checkers/mocha');
var gen = checking.gen;
describe("Addition", function() {
    checking("+1", [gen.int], function(i) {
        return i + 1 > i;
    }, 100, {seed: 1422111938215});
});

The count is optional, and defaults to 1000. The extra options are also optional.

Full Documentation

More coming soon!

For now you'll have to rely on the examples in the test folder.

TODO

  • Generator tests
  • Generator docs
  • Sugar for other testing frameworks?
  • Tutorial
  • Better examples

Development

See npm run or package.json for a list of available scripts.

You will need leiningen in order to build locally.

License

Distributed under the Eclipse Public License.

checkers is Copyright © 2015 Glen Mailer and contributors.

test.check is Copyright Rich Hickey, Reid Draper and contributors.