{"id":"f7680098fa91e050","repo":"jestjs/jest","slug":"pretty-format-option-theme-must-not-be-null","errorCode":null,"errorMessage":"pretty-format: Option \"theme\" must not be null.","messagePattern":"pretty-format: Option \"theme\" must not be null\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/pretty-format/src/index.ts","lineNumber":438,"sourceCode":"  theme: DEFAULT_THEME,\n});\n\nfunction validateOptions(options: OptionsReceived) {\n  for (const key of Object.keys(options)) {\n    if (!Object.prototype.hasOwnProperty.call(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  if (options.theme !== undefined) {\n    if (options.theme === null) {\n      throw new Error('pretty-format: Option \"theme\" must not be null.');\n    }\n\n    if (typeof options.theme !== 'object') {\n      throw new TypeError(\n        `pretty-format: Option \"theme\" must be of type \"object\" but instead received \"${typeof options.theme}\".`,\n      );\n    }\n  }\n}\n\nconst getColorsHighlight = (options: OptionsReceived): Colors =>\n  DEFAULT_THEME_KEYS.reduce((colors, key) => {\n    const value =\n      options.theme && options.theme[key] !== undefined\n        ? options.theme[key]\n        : DEFAULT_THEME[key];\n    const color = value && (style as any)[value];\n    if (","sourceCodeStart":420,"sourceCodeEnd":456,"githubUrl":"https://github.com/jestjs/jest/blob/f49721c78e195558b40913977c9230f5b7f559d8/packages/pretty-format/src/index.ts#L420-L456","documentation":"Error \"pretty-format: Option \"theme\" must not be null.\" thrown in jestjs/jest.","triggerScenarios":"Thrown at packages/pretty-format/src/index.ts:438 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Do not pass null for the \"theme\" option in pretty-format. Either omit the option to use the default theme or pass a theme object with valid ansi-styles keys."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"f49721c78e195558b40913977c9230f5b7f559d8","analyzedAt":"2026-08-03T20:16:28.571Z","schemaVersion":2}