Socket
Socket
Sign inDemoInstall

tape-testcheck

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tape-testcheck

Use Testcheck with Tape test runner


Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

Tape Testcheck

Use Testcheck with Tape.

Usage

This is a small library that simply adds a check method to Tape's test method.

A basic test

import test from 'tape-testcheck';

test('Something', t => {
    t.check(
        [t.gen.int],
        num => typeof num === 'number',
        'it works!'
    );
});
# Outputs:
$ ok 1 it works!

With Options

import test from 'tape-testcheck';

test('Something', t => {
    // with options
    t.check(
        [t.gen.int],
        num => typeof num === 'number',
        { times: 10 },
        'works with options'
    );
});
# outputs
$ ok 1 works with options

A failing test

import test from 'tape-testcheck';

test('Something', t => {

    t.check(
        [t.gen.int],
        num => typeof num === 'string',
        'it fails!'
    );
});
# Outputs:
$ not ok 1 it fails!
  ---
    operator: fail
    expected: |-
      { result: true }
    actual: |-
      { fail: [ 0 ], 'failing-size': 0, 'num-tests': 1, result: false, shrunk: { depth: 0, result: false, smallest: [ 0 ], 'total-nodes-visited': 0 } }
    at: ...

API

t.check(generators, propertyFn, options, msg)

  • generators: An array of testcheck generators
  • propertyFn: The testcheck property function to run
  • options: Testcheck options
  • msg: The message to use in the test (same as any other Tape message, e.g. t.ok(value, msg)

Run a testcheck property on propertyFn with the provided generators and options. The msg will be passed to the t.pass and t.fail methods.

t.gen

Alias for testcheck.gen.

t.sample

Alias for testcheck.sample

Keywords

FAQs

Package last updated on 16 Oct 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc