angular/angular-cli · warning

Project "${projectName}" uses the "kjhtml" reporter. This ha

Error message

Project "${projectName}" uses the "kjhtml" reporter. This has not been automatically mapped. For an interactive test UI in Vitest, consider setting the "ui" option to true in your test target options and installing "@vitest/ui".

What it means

Warning from extractReporters in the Karma-to-Vitest migration (karma-processor.ts). The migration maps known Karma reporters to Vitest equivalents (e.g. 'progress' -> 'default'), but the 'kjhtml' interactive HTML reporter has no automatic Vitest mapping. The schematic warns that it was skipped and suggests the Vitest UI plugin as the equivalent experience.

Source

Thrown at packages/schematics/angular/migrations/migrate-karma-to-vitest/karma-processor.ts:29

import { SUPPORTED_COVERAGE_REPORTERS, SUPPORTED_REPORTERS } from './constants';
import { KarmaConfigAnalysis, analyzeKarmaConfig } from './karma-config-analyzer';
import { compareKarmaConfigToDefault, hasDifferences } from './karma-config-comparer';

function extractReporters(
  analysis: KarmaConfigAnalysis,
  options: Record<string, json.JsonValue | undefined>,
  projectName: string,
  context: SchematicContext,
): void {
  const reporters = analysis.settings.get('reporters');
  if (Array.isArray(reporters)) {
    const mappedReporters: string[] = [];
    for (const r of reporters) {
      if (typeof r === 'string') {
        if (r === 'progress') {
          mappedReporters.push('default');
        } else if (r === 'kjhtml') {
          context.logger.warn(
            `Project "${projectName}" uses the "kjhtml" reporter. ` +
              `This has not been automatically mapped. ` +
              `For an interactive test UI in Vitest, consider setting the "ui" option to true in your test target options ` +
              `and installing "@vitest/ui".`,
          );
        } else if (SUPPORTED_REPORTERS.has(r)) {
          mappedReporters.push(r);
        } else {
          context.logger.warn(
            `Project "${projectName}" uses a custom Karma reporter "${r}". ` +
              `This reporter cannot be automatically mapped to Vitest. ` +
              `Please check the Vitest documentation for equivalent reporters.`,
          );
        }
      } else {
        context.logger.warn(
          `Project "${projectName}" has a non-string reporter in Karma config. ` +
            `This cannot be automatically mapped to Vitest.`,

View on GitHub (pinned to bb72145f9a)

Solutions

  1. Remove 'kjhtml' from reporters and rely on the mapped defaults; run tests with `ng test` after migration.
  2. Install `@vitest/ui` and set `"ui": true` in the test target options for an interactive UI.
  3. Manually add a Vitest html reporter in the generated config if HTML output is required.
  4. Update dependencies to drop karma-jasmine-html-reporter from package.json since it is no longer used.

Example fix

// before (karma.conf.js)
reporters: ['progress', 'kjhtml'],
// after (generated vitest config)
test: { reporters: ['default'], ui: true }, // plus npm i -D @vitest/ui
Defensive patterns

Strategy: validation

Validate before calling

const reporters: string[] = karmaConfig?.reporters ?? [];
if (reporters.includes('kjhtml')) {
  console.warn('kjhtml will not be migrated; plan to use @vitest/ui instead');
}

Type guard

function usesKjhtml(reporters: unknown): reporters is string[] {
  return Array.isArray(reporters) && reporters.some(r => r === 'kjhtml');
}

Prevention

When it happens

Trigger: Running the migrate-karma-to-vitest migration on a project whose karma.conf.js `reporters` array includes 'kjhtml'; the string is recognized, unmapped, warned, and omitted from mappedReporters.

Common situations: Projects that used karma-jasmine-html-reporter for interactive HTML test results; teams migrating legacy Karma setups that had the reporter added via `ng generate config` in older CLI versions.

Related errors


AI-assisted analysis of angular/angular-cli@bb72145f9a (2026-08-30). Data as JSON: /api/errors/65893b9d3b266c25. Report an issue: GitHub.