jestjs/jest · error · Error

pretty-format: Unknown option "${key}".

Error message

pretty-format: Unknown option "${key}".

What it means

Error "pretty-format: Unknown option "${key}"." thrown in jestjs/jest.

Source

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

  callToJSON: true,
  compareKeys: undefined,
  escapeRegex: false,
  escapeString: true,
  highlight: false,
  indent: 2,
  maxDepth: Number.POSITIVE_INFINITY,
  maxWidth: Number.POSITIVE_INFINITY,
  min: false,
  plugins: [],
  printBasicPrototype: true,
  printFunctionName: true,
  theme: DEFAULT_THEME,
});

function validateOptions(options: OptionsReceived) {
  for (const key of Object.keys(options)) {
    if (!Object.prototype.hasOwnProperty.call(DEFAULT_OPTIONS, key)) {
      throw new Error(`pretty-format: Unknown option "${key}".`);
    }
  }

  if (options.min && options.indent !== undefined && options.indent !== 0) {
    throw new Error(
      'pretty-format: Options "min" and "indent" cannot be used together.',
    );
  }

  if (options.theme !== undefined) {
    if (options.theme === null) {
      throw new Error('pretty-format: Option "theme" must not be null.');
    }

    if (typeof options.theme !== 'object') {
      throw new TypeError(
        `pretty-format: Option "theme" must be of type "object" but instead received "${typeof options.theme}".`,
      );

View on GitHub (pinned to f49721c78e)

Solutions

  1. Remove or correct the unknown option passed to pretty-format. Check the pretty-format documentation for the list of supported options (e.g. callToJSON, maxDepth, min, plugins, printFunctionName, theme).

When it happens

Trigger: Thrown at packages/pretty-format/src/index.ts:426 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/433977f49c84bb6d.json. Report an issue: GitHub.