Formats JavaScript Error objects into human-readable diff output (actual vs expected) for testing frameworks. Version 3.0.0 is ESM-only, released 2022-01-31, no longer supports CJS require(). Extracted from Mocha, provides customizable color functions and inline/unified diff styles. Lightweight (0 dependencies), focused on assertion error display, not assertions themselves.
npm install assertion-error-formatterNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows basic usage: import format, create an error with actual/expected, call format with options, and output the diff.
Use dynamic import() or migrate to ESM.
Change import from 'assertion-error-formatter' to { format }.Ensure error.actual and error.expected are set before formatting.
Add "type": "module" to package.json or rename file to .mjs.
Use dynamic import(): const { format } = await import('assertion-error-formatter');Use import { format } from 'assertion-error-formatter'.No dependency data recorded yet.