assertion-error-formatter

3.0.0 • Public • Published

Node Assertion Error Formatter

Format errors to display a diff between the actual and expected

Originally extracted from mocha

Usage

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

Readme

Keywords

none

Package Sidebar

Install

npm i assertion-error-formatter

Weekly Downloads

1,065,490

Version

3.0.0

License

MIT

Unpacked Size

24.6 kB

Total Files

16

Last publish

Collaborators

  • charlierudolph