# tape-pencil

> A small helper for tape to inject dependencies into your tests

Latest version **1.0.1** (published 2017-08-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install tape-pencil
pnpm add tape-pencil
yarn add tape-pencil
bun add tape-pencil
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2017-08-09 |
| First published | 2016-09-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Andy Shea |
| Maintainers | andy-shea |
| Keywords | tap, tape, test, provision, dependency, injection |

## Links

- npm: https://www.npmjs.com/package/tape-pencil
- Repository: https://github.com/andy-shea/tape-pencil
- Issues: https://github.com/andy-shea/tape-pencil/issues
- npm.io page: https://npm.io/package/tape-pencil

## Dependencies (1)

- [tape](https://npm.io/package/tape.md) ^4.6.2

## Alternatives

- [duck](https://npm.io/package/duck.md) — 4.2M weekly downloads
- [ava](https://npm.io/package/ava.md) — 560.2K weekly downloads
- [storybook-addon-module-mock](https://npm.io/package/storybook-addon-module-mock.md) — 71.7K weekly downloads
- [vest](https://npm.io/package/vest.md) — 50.1K weekly downloads
- [@ethereum-waffle/mock-contract](https://npm.io/package/@ethereum-waffle/mock-contract.md) — 40.0K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2017-08-09
- 1.0.0 — 2017-08-09
- 0.1.2 — 2016-10-23
- 0.1.1 — 2016-09-23
- 0.1.0 — 2016-09-23

## README

<p align="center"><img alt="A pencil rewinding a cassette tape" src="https://farm8.static.flickr.com/7567/27795910783_eae6c8966b_b.jpg" width="300"/></p>

# Pencil for tape

[![Build Status](https://travis-ci.org/andy-shea/tape-pencil.svg?branch=master)](https://travis-ci.org/andy-shea/tape-pencil)
[![Code Coverage](http://codecov.io/github/andy-shea/tape-pencil/coverage.svg?branch=master)](http://codecov.io/github/andy-shea/tape-pencil?branch=master)

A small helper to inject complex dependencies into your [**tape**](https://github.com/substack/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

```javascript
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](./LICENSE)

---
_Source: https://npm.io/package/tape-pencil · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
