jestjs/jest · error · PrettyFormatPluginError

${error.message}

Error message

${error.message}

What it means

Error "${error.message}" thrown in jestjs/jest.

Source

Thrown at packages/pretty-format/src/index.ts:335

      : plugin.print(
          val,
          valChild => printer(valChild, config, indentation, depth, refs),
          str => {
            const indentationNext = indentation + config.indent;
            return (
              indentationNext +
              str.replaceAll(NEWLINE_REGEXP, `\n${indentationNext}`)
            );
          },
          {
            edgeSpacing: config.spacingOuter,
            min: config.min,
            spacing: config.spacingInner,
          },
          config.colors,
        );
  } catch (error: any) {
    throw new PrettyFormatPluginError(error.message, error.stack);
  }
  if (typeof printed !== 'string') {
    throw new TypeError(
      `pretty-format: Plugin must return type "string" but instead returned "${typeof printed}".`,
    );
  }
  return printed;
}

function findPlugin(plugins: Plugins, val: unknown) {
  for (const plugin of plugins) {
    try {
      if (plugin.test(val)) {
        return plugin;
      }
    } catch (error: any) {
      throw new PrettyFormatPluginError(error.message, error.stack);
    }

View on GitHub (pinned to f49721c78e)

Solutions

  1. pretty-format re-threw an error thrown by a plugin's serialize/print function. Inspect the inner error message to find the failing plugin, then fix or remove that plugin from your pretty-format configuration.

When it happens

Trigger: Thrown at packages/pretty-format/src/index.ts:335 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of jestjs/jest@f49721c78e (2026-08-03). Data as JSON: /data/errors/2d2a56e4fa937188.json. Report an issue: GitHub.