{"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":"validation","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/d568f8ce3739b532d5bf2c1ee1e45e8a8a473d09/packages/pretty-format/src/index.ts#L458-L494","documentation":"`min: true` requests single-line (minified) output, where indentation is meaningless. The validator rejects combining `min` with a non-zero `indent` because the two intents contradict; `indent: 0` alongside `min` is explicitly allowed.","triggerScenarios":"`format(value, { min: true, indent: 2 })`, or a shared config object that sets both for different call sites.","commonSituations":"Copying a config that set both; expecting indent to apply under min mode; merging option objects where one sets min and another sets indent.","solutions":["Drop `indent` when using `min: true`.","Or set `indent: 0` explicitly with `min` (this passes validation).","Remove `min` if you actually want indented multi-line output."],"exampleFix":"// before\nformat(value, { min: true, indent: 2 })\n\n// after\nformat(value, { min: true })\n// or\nformat(value, { min: true, indent: 0 })","handlingStrategy":"validation","validationCode":"function resolveFormatOptions(opts: { min?: boolean; indent?: number } = {}) {\n  if (opts.min && opts.indent !== undefined && opts.indent !== 0) {\n    // pick one intent: minified wins, drop indent\n    const { indent: _drop, ...rest } = opts\n    return rest\n  }\n  return opts\n}\n\nformat(value, resolveFormatOptions({ min: true, indent: 2 }))","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat `min` and `indent` as mutually exclusive in your config builders.","If merging option objects from different sources, normalize afterwards.","Add a config lint test that asserts not both are set."],"tags":["pretty-format","options","validation"],"analyzedSha":"d568f8ce3739b532d5bf2c1ee1e45e8a8a473d09","analyzedAt":"2026-08-03T20:23:56.861Z","schemaVersion":2}