jestjs/jest · error · Error

pretty-format: Options "min" and "indent" cannot be used tog

Error message

pretty-format: Options "min" and "indent" cannot be used together.

What it means

Error "pretty-format: Options "min" and "indent" cannot be used together." thrown in jestjs/jest.

Source

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

  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}".`,
      );
    }
  }
}

const getColorsHighlight = (options: OptionsReceived): Colors =>

View on GitHub (pinned to f49721c78e)

Solutions

  1. Pass either "min": true or a custom "indent" option to pretty-format, not both. Remove one of the two options from the call.

When it happens

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