1.0.1 • Published 7 years ago

tape-pencil v1.0.1

Weekly downloads
7
License
MIT
Repository
github
Last release
7 years ago

Pencil for tape

Build Status Code Coverage

A small helper to inject complex dependencies into your tape tests.

Install

yarn add --dev tape-pencil

API

testWithProvision(provider, name, opts, cb)

Create a new test with an optional name string and optional opts object. cb(t, dep1, dep2, ..., depx) is fired with the new test object along with the dependencies returned from calling the provider function.

Example

import testWithProvision from 'tape-pencil';

function provideDependencies() {
  return [{foo: 'bar'}, someDependency()];
}

testWithProvision(provideDependencies, 'Test this or that', (t, dependencyOne, dependencyTwo) => {
  // dependencyOne: ({foo: 'bar'}) and dependencyTwo: (the return value of someDependency())
  // are now available in your test
});

Licence

MIT

1.0.1

7 years ago

1.0.0

7 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago