{"record":{"id":"24216b928b881ae6","repo":"angular/angular-cli","slug":"project-projectname-has-a-non-string-reporter","errorCode":null,"errorMessage":"Project \"${projectName}\" has a non-string reporter in Karma config. This cannot be automatically mapped to Vitest.","messagePattern":"Project \"(.+?)\" has a non-string reporter in Karma config\\. This cannot be automatically mapped to Vitest\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/schematics/angular/migrations/migrate-karma-to-vitest/karma-processor.ts","lineNumber":45,"sourceCode":"          mappedReporters.push('default');\n        } else if (r === 'kjhtml') {\n          context.logger.warn(\n            `Project \"${projectName}\" uses the \"kjhtml\" reporter. ` +\n              `This has not been automatically mapped. ` +\n              `For an interactive test UI in Vitest, consider setting the \"ui\" option to true in your test target options ` +\n              `and installing \"@vitest/ui\".`,\n          );\n        } else if (SUPPORTED_REPORTERS.has(r)) {\n          mappedReporters.push(r);\n        } else {\n          context.logger.warn(\n            `Project \"${projectName}\" uses a custom Karma reporter \"${r}\". ` +\n              `This reporter cannot be automatically mapped to Vitest. ` +\n              `Please check the Vitest documentation for equivalent reporters.`,\n          );\n        }\n      } else {\n        context.logger.warn(\n          `Project \"${projectName}\" has a non-string reporter in Karma config. ` +\n            `This cannot be automatically mapped to Vitest.`,\n        );\n      }\n    }\n    if (mappedReporters.length > 0) {\n      options['reporters'] = [...new Set(mappedReporters)];\n    }\n  }\n}\n\nfunction extractCoverageSettings(\n  analysis: KarmaConfigAnalysis,\n  options: Record<string, json.JsonValue | undefined>,\n  projectName: string,\n  context: SchematicContext,\n): void {\n  const coverageReporter = analysis.settings.get('coverageReporter');","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/angular/angular-cli/blob/bb72145f9ab45aee29f523236b3a25cd0813a841/packages/schematics/angular/migrations/migrate-karma-to-vitest/karma-processor.ts#L27-L63","documentation":"Warning from extractReporters in karma-processor.ts. The migration expects karma.conf.js `reporters` entries to be plain strings; if an entry is not a string (e.g. an array-style multi-reporter entry, an object, or a function returned by a custom framework), it cannot be mapped and is skipped with this warning.","triggerScenarios":"Running the migrate-karma-to-vitest migration when a karma.conf.js reporters array contains a non-string element — e.g. nested arrays as produced by karma's multi-reporter form, or objects/functions assigned by reporter plugins.","commonSituations":"Hand-written karma.conf.js using non-standard reporter values; configs assembled programmatically; Karma plugins that register reporters as objects in the reporters array.","solutions":["Flatten the reporters array to plain strings in karma.conf.js before migrating so entries can be mapped.","Replace object/function reporter registrations with supported string reporter names.","Remove the non-string entries if the reporters are no longer needed and re-run the migration.","After migration, manually add equivalent Vitest reporters/plugins in the generated config."],"exampleFix":"// before (karma.conf.js)\nreporters: ['progress', ['junit', { outputDir: 'reports' }]],\n// after\nreporters: ['progress', 'junit'], // junit options moved to junitReporter config","handlingStrategy":"validation","validationCode":"const reporters = karmaConfig?.reporters ?? [];\nif (reporters.some(r => typeof r !== 'string')) {\n  console.warn('reporters contains non-string entries; flatten before migrating');\n}","typeGuard":"function allStringReporters(reporters: unknown): reporters is string[] {\n  return Array.isArray(reporters) && reporters.every(r => typeof r === 'string');\n}","tryCatchPattern":null,"preventionTips":["Keep karma.conf.js reporters as a flat array of plain strings.","Move multi-reporter options into the plugin's own config section rather than nested arrays.","Lint karma.conf.js with a schema check before running the migration."],"tags":["angular","migration","karma","vitest","reporters","config-shape"],"backgroundTag":"unmigrated-karma-reporter","analyzedSha":"bb72145f9ab45aee29f523236b3a25cd0813a841","analyzedAt":"2026-08-30T02:47:34.745Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}