tape-pencil

1.0.1 • Public • Published

A pencil rewinding a cassette tape

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

Package Sidebar

Install

npm i tape-pencil

Weekly Downloads

0

Version

1.0.1

License

MIT

Last publish

Collaborators

  • andy-shea