npm.io
3.0.0 • Published 6 years ago

assertion-error-formatter

Licence
MIT
Version
3.0.0
Deps
3
Size
24 kB
Vulns
0
Weekly
0
Stars
2

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