{"record":{"id":"baefa5d734bd50e0","repo":"vitest-dev/vitest","slug":"pretty-format-options-min-and-indent-cannot-b","errorCode":null,"errorMessage":"pretty-format: Options \"min\" and \"indent\" cannot be used together.","messagePattern":"pretty-format: Options \"min\" and \"indent\" cannot be used together\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/pretty-format/src/index.ts","lineNumber":476,"sourceCode":"  printBasicPrototype: true,\n  printFunctionName: true,\n  printShadowRoot: true,\n  theme: DEFAULT_THEME,\n  singleQuote: false,\n  quoteKeys: true,\n  spacingInner: '\\n',\n  spacingOuter: '\\n',\n} satisfies Options\n\nfunction validateOptions(options: OptionsReceived) {\n  for (const key of Object.keys(options)) {\n    if (!Object.hasOwn(DEFAULT_OPTIONS, key)) {\n      throw new Error(`pretty-format: Unknown option \"${key}\".`)\n    }\n  }\n\n  if (options.min && options.indent !== undefined && options.indent !== 0) {\n    throw new Error(\n      'pretty-format: Options \"min\" and \"indent\" cannot be used together.',\n    )\n  }\n}\n\nfunction getColorsHighlight(): Colors {\n  return DEFAULT_THEME_KEYS.reduce((colors, key) => {\n    const value = DEFAULT_THEME[key]\n    const color = value && (styles as any)[value]\n    if (\n      color\n      && typeof color.close === 'string'\n      && typeof color.open === 'string'\n    ) {\n      colors[key] = color\n    }\n    else {\n      throw new Error(","sourceCodeStart":458,"sourceCodeEnd":494,"githubUrl":"https://github.com/vitest-dev/vitest/blob/1fa9837ec26533512fdcad8baebf249771bd340a/packages/pretty-format/src/index.ts#L458-L494","documentation":"validateOptions rejects the combination of the 'min' option (single-line minimal output) with a non-zero 'indent' option, since they are semantically incompatible: min mode collapses whitespace and indentation has no meaning. Only indent: 0 (or undefined) is allowed with min.","triggerScenarios":"Calling format(value, { min: true, indent: 4 }); or a config layer merging min: true with a pre-set indent value.","commonSituations":"Inheriting a base config with indent and then enabling min; merging user config over defaults without reconciling the two; CI config setting both.","solutions":[],"exampleFix":"// before\nformat(value, { min: true, indent: 4 })\n// after\nformat(value, { min: true })","handlingStrategy":"validation","validationCode":"if (options.min && options.indent != null && options.indent !== 0) {\n  throw new Error('min and indent are incompatible; dropping indent')\n}\nconst { indent, ...rest } = options\nformat(value, options.min ? rest : options)","typeGuard":"function optionsAreCompatible(o: { min?: boolean; indent?: number }): boolean { return !(o.min && o.indent != null && o.indent !== 0) }","tryCatchPattern":null,"preventionTips":["When enabling min, delete indent from the config","Build configs from a single source so conflicts surface","Assert option compatibility in config tests"],"tags":["pretty-format","options","conflict"],"backgroundTag":null,"analyzedSha":"1fa9837ec26533512fdcad8baebf249771bd340a","analyzedAt":"2026-08-11T16:11:39.638Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}