# assertion-error-formatter

> Format errors to display a diff between the actual and expected

Latest version **3.0.0** (published 2019-08-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install assertion-error-formatter
pnpm add assertion-error-formatter
yarn add assertion-error-formatter
bun add assertion-error-formatter
```

## 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 | 2019-08-21 |
| First published | 2016-12-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 24.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Charlie Rudolph |
| Maintainers | charlierudolph |

## Links

- npm: https://www.npmjs.com/package/assertion-error-formatter
- Repository: https://github.com/charlierudolph/node-assertion-error-formatter
- Issues: https://github.com/charlierudolph/node-assertion-error-formatter/issues
- npm.io page: https://npm.io/package/assertion-error-formatter

## Dependencies (3)

- [diff](https://npm.io/package/diff.md) ^4.0.1
- [pad-right](https://npm.io/package/pad-right.md) ^0.2.2
- [repeat-string](https://npm.io/package/repeat-string.md) ^1.6.1

## Recent versions

- 3.0.0 (latest) — 2019-08-21
- 2.0.1 — 2017-11-27
- 2.0.0 — 2016-12-22
- 1.0.2 — 2016-12-21
- 1.0.1 — 2016-12-21
- 1.0.0 — 2016-12-21

## README

# Node Assertion Error Formatter

Format errors to display a diff between the actual and expected

Originally extracted from [mocha](https://github.com/mochajs/mocha)

## Usage
```js
import {format} from 'assertion-error-formatter'

format(error)
```

## API Reference

#### `format(error [, options])`

* `error`: a javascript error
* `options`: An object with the following keys:
  * `colorFns`: An object with the keys 'diffAdded', 'diffRemoved', 'errorMessage', 'errorStack'. The values are functions to colorize a string, each defaults to identity.
  * `inlineDiff`: boolean (default: false)
    * toggle between inline and unified diffs

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