@vitest-agent/plugin
v1.1.9
Published
Vitest plugin for the vitest-agent ecosystem: owns persistence, classification, baselines, trends, and dispatches rendering to a configurable reporter.
Maintainers
Readme
@vitest-agent/plugin
Vitest plugin that turns your test suite into a live data source for LLM coding agents. Handles persistence, failure classification, coverage policy enforcement, project discovery and a configurable reporter chain — the CLI and MCP server ship as dependencies and are wired automatically.
Features
AgentPlugin— drop intovitest.config.ts; auto-detects human, agent and CI executors and adapts console output accordingly- Project discovery —
AgentPlugin.discover()scans workspace packages, returns{ projects, tags }ready fortest.projectsandtest.tags; classification tags apply at collection time, so every test declaration form inherits them, including wrapper testers like@effect/vitest'sit.effect - Coverage presets —
COVERAGE_LEVELSandCOVERAGE_LEVELS_PER_FILEreturn dual-output{ thresholds, coverageTargets }objects;COVERAGE_AUTOUPDATEtolerance functions plug into Vitest's nativeautoUpdate - Failure classification — persists per-test errors, computes failure signatures, classifies tests as stable, new-failure, persistent, flaky or recovered across runs
- Custom reporters — pass any
VitestAgentReporterFactoryas thereporteroption; the default wiresDefaultVitestAgentReporterfrom@vitest-agent/reporter onRunEventtap — optional read-only callback receiving everyRunEventin parallel with the renderer, safe to throw from
Install
npm install --save-dev @vitest-agent/plugin
# or
pnpm add -D @vitest-agent/plugin@vitest-agent/cli and @vitest-agent/mcp ship as regular dependencies of the plugin, so they install with it on every package manager.
Quick start
import { AgentPlugin } from "@vitest-agent/plugin";
import { defineConfig } from "vitest/config";
export default async () => {
const { projects, tags } = await AgentPlugin.discover();
const coverage = AgentPlugin.COVERAGE_LEVELS.standard;
return defineConfig({
plugins: [AgentPlugin({ console: { human: "stream", agent: "agent" }, coverageTargets: coverage.coverageTargets })],
test: { ...(projects ? { projects } : {}), tags, coverage: { enabled: true, provider: "v8", thresholds: coverage.thresholds } },
});
};Documentation
Full guide, configuration reference and the Claude Code plugin docs live at vitest-agent.dev/guide.
