# tap-out

> A different tap parser

Latest version **3.0.0** (published 2018-06-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install tap-out
pnpm add tap-out
yarn add tap-out
bun add tap-out
```

Provides the command `tap-out`.

## 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 | 3.0.0 |
| Published | 2018-06-05 |
| First published | 2014-11-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 33.4 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 23 |
| Author | Scott Corgan |
| Maintainers | scottcorgan |
| Keywords | tap, parser, tape, tap-spec, test |

## Links

- npm: https://www.npmjs.com/package/tap-out
- Repository: https://github.com/scottcorgan/tap-out
- Issues: https://github.com/scottcorgan/tap-out/issues
- npm.io page: https://npm.io/package/tap-out

## Dependencies (4)

- [trim](https://npm.io/package/trim.md) 0.0.1
- [split](https://npm.io/package/split.md) 1.0.0
- [re-emitter](https://npm.io/package/re-emitter.md) 1.1.3
- [readable-stream](https://npm.io/package/readable-stream.md) 2.2.9

## 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

- 3.0.0 (latest) — 2018-06-05
- 2.1.0 — 2018-06-05
- 2.0.0 — 2017-05-04
- 1.4.2 — 2016-04-06
- 1.4.1 — 2015-11-21
- 1.4.0 — 2015-11-21
- 1.3.2 — 2015-06-23
- 1.3.1 — 2015-06-17
- 1.3.0 — 2015-06-10
- 1.2.1 — 2015-06-02
- 1.2.0 — 2015-05-29
- 1.1.3 — 2015-04-02
- 1.1.2 — 2015-04-01
- 1.1.0 — 2014-12-29
- 1.0.0 — 2014-11-21
- … 1 more at https://npm.io/package/tap-out/versions

## README

# tap-out

A different tap parser

## Install

```
npm install tap-out --save
```

## Usage

**CLI**

```
$ something-that-produces-tap | tap-out
{
  tests: [
    { name: 'is true', number: 1, raw: '# is true', type: 'test' }
  ],
  asserts: [
    { name: 'true value', number: 1, ok: true, raw: 'ok 1 true value', test: 1, type: 'assert' },
    { name: 'true value', number: 2, ok: true, raw: 'ok 2 true value', test: 1, type: 'assert' }
  ],
  versions: [],
  results: [],
  comments: [],
  plans: [{ type: 'plan', raw: '1..2', from: 1, to: 2, skip: false }],
  pass: [
    { name: 'true value', number: 1, ok: true, raw: 'ok 1 true value', test: 1, type: 'assert' },
    { name: 'true value', number: 2, ok: true, raw: 'ok 2 true value', test: 1, type: 'assert' }
  ],
  fail: [],
  errors: []
}
```

**API**

```js
var tapOut = require('tap-out');

var t = tapOut(function (output) {

  console.log(output);
});

t.on('assert', function (assert) {

	// Do something
});

process.stdin.pipe(t);
```

## Methods

### var t = tapOut(function (err, output) {})

Returns a stream that emits events with various TAP data. Takes a callback which is called when all parsing is done.

## Events

### t.on('output', function (output) {})

All output after all TAP data is parsed.

Example output

```js
{
  tests: [
    { name: 'is true', number: 1, raw: '# is true', type: 'test' }
  ],
  asserts: [
    { name: 'true value', number: 1, ok: true, raw: 'ok 1 true value', test: 1, type: 'assert' },
    { name: 'true value', number: 2, ok: true, raw: 'ok 2 true value', test: 1, type: 'assert' }
  ],
  results: [],
  versions: [],
  comments: [],
  fail: [],
  pass: [
    { name: 'true value', number: 1, ok: true, raw: 'ok 1 true value', test: 1, type: 'assert' },
    { name: 'true value', number: 2, ok: true, raw: 'ok 2 true value', test: 1, type: 'assert' }
  ],
}
```

### t.on('test', function (test) {})

Parsed test object with details.

* `type` - value will always be `test`
* `name` - name of the test
* `raw` - the raw output before it was parsed
* `number` - the number of the test

```js
{
  type: 'test',
  name: 'is true',
  raw: '# is true',
  number: 1
}
```

### t.on('assert', function (assertion) {})

Parsed assert object details.

* `type` - this will always be `assert`
* `name` - the name of the assertion
* `raw` - the raw output before it was parsed
* `number` - the number of the assertion
* `ok` - whether the assertion passed or failed
* `test` - the number of the test this assertion belongs to

```js
{
  name: 'true value',
  number: 1,
  ok: true,
  raw: 'ok 1 true value',
  test: 1,
  type: 'assert'
}
```

### t.on('version', function (version) {})

Parsed version data.

* `type` - this will always be `version`
* `raw` - the raw output before it was parsed

```js
{
  raw: 'TAP version 13',
  type: 'version'
}
```

### t.on('result', function (result) {})

Parsed test result data for tests, pass, fail.

* `type` - this will always be `result`
* `name` - the name of the result
* `raw` - the raw output before it was parsed
* `count` - the number of tests related to this result

Tests

```js
{
  count: '15',
  name: 'tests',
  raw: '# tests 15',
  type: 'result'
}
```

Pass

```js
{
  count: '13',
  name: 'pass',
  raw: '# pass  13',
  type: 'result'
}
```

Fail

```js
{
  count: '2',
  name: 'fail',
  raw: '# fail  2',
  type: 'result'
}
```

### t.on('pass', function (assertion) {})

Parsed assertion that has passed with details. The assertion formate is the same as the [`assert`](#tonassert-function-assertion-) event.

### t.on('fail', function (assertion) {})

Failed assertion that has passed with details. The assertion formate is the same as the [`assert`](#tonassert-function-assertion-) event.

### t.on('comment', function (comment) {})

Generic output like `console.log()` in your tests.

* `type` - this will always be `comment`
* `raw` - the raw output before it was parsed
* `test` - the number of the test this comment belongs to

```js
{
  type: 'comment',
  raw: 'this is a console log',
  test: 1
}
```

## Run Tests

```
git clone git@github.com:scottcorgan/tap-out.git && cd tap-out
npm install
npm test
```

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