@jest/source-map

  • Version 30.5.2
  • Published
  • 36.6 kB
  • 4 dependencies
  • MIT license

Install

npm i @jest/source-map
yarn add @jest/source-map
pnpm add @jest/source-map

Overview

Applies source maps to stack traces, so a failing test points at the code you wrote rather than at the code Jest ran.

Index

Functions

function getCallsite

getCallsite: (
level: number,
sourceMaps?: SourceMapRegistry | null
) => callsites.CallSite;
  • One remapped CallSite, level frames above the caller.

    Deprecated

    Use SourceMapSupport#getCallsite instead.

Classes

class SourceMapSupport

class SourceMapSupport {}

    constructor

    constructor();

      method getCallsite

      getCallsite: (
      level: number,
      sourceMaps?: SourceMapRegistry | null
      ) => callsites.CallSite;
      • One remapped CallSite, level frames above the caller.

      method install

      install: (
      sourceMaps?: SourceMapRegistry | null,
      options?: SourceMapSupportInstallOptions
      ) => void;
      • Replaces Error.prepareStackTrace in the current realm, so error.stack renders frames against the original sources.

        Stays installed for the lifetime of the worker — each call swaps in its own cache. There is deliberately no uninstall: restoring V8's formatter at teardown would leave an error thrown after the environment is torn down pointing into the transformed file. Holding the cache does not retain the environment: it only ever references path strings and parsed source maps.

      Interfaces

      interface SourceMapSupportInstallOptions

      interface SourceMapSupportInstallOptions {}

        property suppressWarnings

        suppressWarnings?: boolean;
        • Turns off the once-per-map warning about maps that cannot be parsed.

        Type Aliases

        type SourceMapRegistry

        type SourceMapRegistry = ReadonlyMap<string, string>;
        • Transformed file path to the map file written for it.

        Package Files (1)

        Dependencies (4)

        Dev Dependencies (2)

        Peer Dependencies (0)

        No peer dependencies.

        Badge

        To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

        You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@jest/source-map.

        • Markdown
          [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@jest/source-map)
        • HTML
          <a href="https://www.jsdocs.io/package/@jest/source-map"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>