assertion-error-formatter

Format errors to display a diff between the actual and expected

MIT 6 个版本
安装
npm install assertion-error-formatter
yarn add assertion-error-formatter
pnpm add assertion-error-formatter
bun add assertion-error-formatter
README

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
版本列表
3.0.0 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