Detalhes do pacote

replace-stack-traces

jaydenseric10MIT2.0.0

A JavaScript function to replace error stack traces and following Node.js versions at any indent in a multiline string.

replace, stack, traces, esm

readme (leia-me)

replace-stack-traces

A JavaScript function to replace error stack traces and following Node.js versions at any indent in a multiline string.

Useful for snapshot testing CLI stderr output containing error stack traces, because:

  • Different Node.js versions generate different error stack traces, and v17.0.0+ appends the Node.js version if the error caused the process to exit.
  • Editing modules that affect the line and column numbers, etc. in the error stack traces requires the snapshots to be updated annoyingly often.

Installation

For Node.js, to install replace-stack-traces with npm, run:

npm install replace-stack-traces

For Deno, an example import map:

{
  "imports": {
    "replace-stack-traces": "https://unpkg.com/replace-stack-traces@2.0.0/replaceStackTraces.mjs"
  }
}

Requirements

Supported runtime environments:

  • Node.js versions ^14.17.0 || ^16.0.0 || >= 18.0.0.
  • Deno

Non Deno projects must configure TypeScript to use types from the ECMAScript modules that have a // @ts-check comment:

Exports

The npm package replace-stack-traces features optimal JavaScript module design. These ECMAScript modules are exported via the package.json field exports:

changelog (log de mudanças)

replace-stack-traces changelog

2.0.0

Major

  • Updated Node.js support to ^14.17.0 || ^16.0.0 || >= 18.0.0.
  • ANSI escape sequences at the end of stack traces are no longer replaced.

Patch

  • Updated dev dependencies.
  • Updated jsconfig.json:
    • Set compilerOptions.maxNodeModuleJsDepth to 10.
    • Set compilerOptions.module to nodenext.
  • Updated ESLint config.
  • Updated GitHub Actions CI config:
    • Run tests with Node.js v14, v16, v18.
    • Updated actions/checkout to v3.
    • Updated actions/setup-node to v3.
  • Revamped the readme:

1.0.0

Initial release.