# tap-arc

> spec-like TAP reporter

Latest version **1.3.2** (published 2024-07-29) · Apache-2.0 license · 0 weekly downloads

## Install

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

Provides the command `tap-arc`.

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.3.2 |
| Published | 2024-07-29 |
| First published | 2021-11-19 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 6 |
| Unpacked size | 30.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 31 |
| Author | tbeseda |
| Maintainers | tbeseda, ryanblock, architectci |
| Keywords | test, tap, spec, tap-spec, tape, reporter |

## Links

- npm: https://www.npmjs.com/package/tap-arc
- Repository: https://github.com/architect/tap-arc
- Homepage: https://github.com/architect/tap-arc#readme
- Issues: https://github.com/architect/tap-arc/issues
- npm.io page: https://npm.io/package/tap-arc

## Dependencies (6)

- [diff](https://npm.io/package/diff.md) ^5.2.0
- [chalk](https://npm.io/package/chalk.md) ^5.3.0
- [json5](https://npm.io/package/json5.md) ^2.2.3
- [minimist](https://npm.io/package/minimist.md) ^1.2.8
- [strip-ansi](https://npm.io/package/strip-ansi.md) ^7.1.0
- [tap-reader](https://npm.io/package/tap-reader.md) ^0.2.1

## 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
- [@ethereum-waffle/mock-contract](https://npm.io/package/@ethereum-waffle/mock-contract.md) — 40.0K weekly downloads
- [aws-elasticsearch-connector](https://npm.io/package/aws-elasticsearch-connector.md) — 37.4K weekly downloads

## Recent versions

- 1.3.2 (latest) — 2024-07-29
- 1.2.0-RC.2 (RC) — 2023-10-27
- 1.3.1 — 2024-07-29
- 1.2.2 — 2023-11-01
- 1.2.1 — 2023-11-01
- 1.2.0 — 2023-10-27
- 1.2.0-RC.1 — 2023-10-18
- 1.1.0 — 2023-10-17
- 1.2.0-RC.0 — 2023-10-17
- 1.1.0-RC2 — 2023-10-10
- 1.1.0-RC1 — 2023-10-10
- 1.1.0-RC0 — 2023-10-10
- 1.0.2 — 2023-10-02
- 1.0.1 — 2023-09-20
- 1.0.0 — 2023-09-14
- … 19 more at https://npm.io/package/tap-arc/versions

## README

<h1 align="center"><code>tap-arc</code> 📋</h1>

<p align="center">
  A small <a href="https://testanything.org/">TAP</a> reporter with spec-like output, streaming, and failure diffing.<br>
  <a href="https://www.npmjs.com/package/tap-arc"><strong><code>tap-arc</code> on npmjs.org »</strong></a><br>
  <br>
  Contents:
  <a href="#Installation-and-usage">Install</a>
  •
  <a href="#Development">Development</a>
  •
  <a href="#FAQ">FAQ</a>
</p>

## Objectives

- minimal, informative spec-like output for all assertion types
- helpful diffing for failures
- shallow graph of maintained dependencies

![tap-arc output screen shot](./screen-shot.png)

## Installation and Usage

Compatible with Node.js v16+ -- v14 also works but is ***not*** recommended.

Save `tap-arc` as a development dependency:

```sh
npm i -D tap-arc
```

Simply pipe tap output to `tap-arc`.  
Example `npm test` script:

```js
// package.json
"scripts": {
  "test": "tape test/**/*.js | tap-arc"
}
```

> [!IMPORTANT]  
> 💁  `tap-arc` will format output from any tap reporter. [`tape`](https://github.com/ljharb/tape) is our favorite and was used for testing.

### `tap-arc --help`

```
Usage:
  tap-arc <options>

Parses TAP data from stdin, and outputs a "spec-like" formatted result.

Options:

  -v | --verbose
    Output full stack trace, TAP version, and plan

  -p | --pessimistic | --bail
    Immediately exit upon encountering a failure
    example: tap-arc -p

  --no-diff
    Do not show diff for failed assertions
    example: tap-arc --no-diff

  --no-color
    Output without ANSI escape sequences for colors
    example: tap-arc --no-color

  --fail-bad-count
    Fail when the number of assertions parsed does not match the plan
    example: tap-arc --fail-bad-count
```

## Development

When building `tap-arc`, it's helpful to try various TAP outputs. See `package.json` `"scripts"` for useful "tap-arc.*" commands to test passing and failing TAP.

```sh
npm run tap-arc.simple # used to create the screen shot above
```

### Dev Tips

1. To see previous exit code, run:

```sh
echo $?
```

### Testing

Primarily, `tap-arc` is tested to output the correct exit code based on your test suite's TAP output.

Testing could be improved by unit testing the printer and diff maker.

## FAQ

<details>
<summary>"Expected <code>n</code> tests, but found <code>< n</code>"</summary>

_What happened?_  
✅ The TAP parser found zero failing tests  
✅ The final tally from the raw TAP shows `n` of `n` passed  
🤨 But the TAP plan called for more tests than were found, counted, and parsed.

💁‍♀️ Currently, when this case is detected, `tap-arc` will exit with a successful status code.  
This can be overridden with the `--fail-bad-count` flag.

_Why, though_?  
This has been observed specifically on Windows, where the TAP output is buffered to another stream and not piped to `tap-arc`.  
Libraries like `mock-fs` tinker with stdout and subsequent TAP output is lost. Try closing those helpers before making an assertion that generates TAP.

</details>

<details>
<summary>"0 tests found" fails the suite?</summary>

Yes. At least one passing test is required to pass the suite.  
This helps ensures there wasn't a silent, catastrophic failure in the test suite.

</details>

<details>
<summary>Why does <code>tap-arc</code> get to decide these things?</summary>

`tap-arc` is responsible for the test suite's exit code. If your entire CI stack is piped to a reporter, it's an important job. So `tap-arc` is a bit skeptical by default to help ensure your suite is passing.

If you'd like to see different behavior from `tap-arc`, please open an issue or PR. We'd love to hear your use case.

</details>

## Credit & Inspiration

- [tap-spec](https://github.com/scottcorgan/tap-spec) ol' reliable, but a bit stale and vulnerable
- [tap-difflet](https://github.com/namuol/tap-difflet) inspired output and diffing, also vulnerable

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