Web-based user interface for the Vitest testing framework with real-time test execution visualization and HTML reporting capabilities
npx @tessl/cli install tessl/npm-vitest--ui@3.2.0@vitest/ui provides a web-based user interface for the Vitest testing framework, offering developers a visual and interactive way to run, monitor, and analyze their test suites. The package includes both a Vite plugin for development mode and an HTML reporter for generating standalone test reports.
npm install @vitest/uiimport vitestUI from "@vitest/ui";For the HTML reporter:
import HTMLReporter from "@vitest/ui/reporter";import { defineConfig } from 'vite';
import vitestUI from '@vitest/ui';
export default defineConfig({
plugins: [
vitestUI(vitestContext), // vitestContext is a Vitest instance
],
});import { defineConfig } from 'vitest/config';
import HTMLReporter from '@vitest/ui/reporter';
export default defineConfig({
test: {
reporters: [
new HTMLReporter({ outputFile: 'test-results/index.html' })
],
},
});@vitest/ui is built around several key components:
Provides a Vite plugin that serves the Vitest UI during development, enabling real-time test monitoring and interaction through a web interface.
declare function vitestUI(ctx: Vitest): Plugin;Generates comprehensive HTML reports containing test results, coverage information, and interactive visualizations for offline viewing and CI/CD integration.
declare class HTMLReporter implements Reporter {
constructor(options: HTMLOptions);
onInit(ctx: Vitest): Promise<void>;
onFinished(): Promise<void>;
}Browser-based API for connecting to and controlling Vitest through WebSocket communication, including test execution, file management, and result viewing.
interface BrowserUI {
setCurrentFileId(fileId: string): void;
setIframeViewport(width: number, height: number): Promise<void>;
}interface WSMessage {
type: string;
data: any;
}
type RunState = 'idle' | 'running';
interface BrowserRunnerState {
files: string[];
config: SerializedConfig;
type: 'orchestrator';
provider: string;
wrapModule: <T>(module: () => T) => T;
}
interface HTMLOptions {
outputFile?: string | Partial<Record<string, string>>;
}
// External types from dependencies:
// - Vitest: from 'vitest/node'
// - Plugin: from 'vite'
// - Reporter: from 'vitest/reporters'
// - SerializedConfig: from 'vitest'