mcpField
V
vitest-evals

vitest-evals

github.com/getsentryTesting & quality35892 installsUpdated 7w ago
Repository

About vitest-evals

A skill for authoring and reviewing Vitest evaluation suites using a harness to run systems and ordinary assertions to check results. It covers AI SDK and Pi AI integrations, judges, tool recording and replay, and assertions over session history and spans.

Key features

  1. 01Author evaluations with describeEval and a harness
  2. 02Assert on output, tool calls, and messages
  3. 03Inspect spans and failed spans
  4. 04Configure judges and track usage
  5. 05Set up tool recording and replay

Use cases

  1. 01Write Vitest evaluations for AI applications
  2. 02Build a harness for a custom application
  3. 03Evaluate tool calls and session behavior
  4. 04Diagnose missing traces or evaluation failures

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/getsentry/vitest-evals --skill vitest-evals

After installing, type/vitest-evalsin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

README.md
SOURCES.md
SPEC.md
references/
custom-harness.md
harness-ai-sdk.md
harness-pi-ai.md
judges-and-assertions.md
suite-authoring.md
tool-replay.md
troubleshooting.md
utilities.md

Details

From the project README

vitest-evals

Use the harness-backed API as the only authoring model.

First Steps

  1. Read the package, app, or eval file being changed.
  2. Identify the runtime target, then open only the needed reference.
  3. Keep suites close to Vitest: one harness per describeEval(...), explicit run(...) inside each test, ordinary expect(...) assertions over the returned result.

Reference Router

NeedOpen
Write or review a normal eval suitereferences/suite-authoring.md
Build a custom app Harness without a first-party adapterreferences/custom-harness.md
Integrate AI SDK generateText, generateObject, tools, or an AI SDK-style agentreferences/harness-ai-sdk.md
Integrate a Pi AI or Pi Mono-style agentreferences/harness-pi-ai.md
Add custom judges, suite judges, built-in judges, or toSatisfyJudge(...) assertionsreferences/judges-and-assertions.md
Assert on message, tool-call, or span historyreferences/utilities.md
Configure tool recording or replayreferences/tool-replay.md
Diagnose failures, missing traces, odd output, or choose verification commandsreferences/troubleshooting.md

Runtime Defaults

  • Import describeEval(...), judges, and helpers from vitest-evals.
  • Bind exactly one harness to a suite.
  • Call run(input) where the test should execute the system.
  • Assert on result.output for app-facing behavior.
  • Use toolCalls(result) and message helpers for normalized session assertions.
  • Use spans(result), spansByKind(result, kind), and failedSpans(result) for span assertions.
  • Keep HarnessRun, NormalizedSession, usage, artifacts, and tool records JSON-serializable.
  • Report known tokens and USD cost in run.usage. Omit costUsd when unknown; use 0 only when the run is known to be free.
  • Keep rubric text and parsing in the judge. Put provider calls in a judgeHarness, then call them through ctx.runJudge(...) so usage is recorded.
  • Put scenario-owned criteria on the input value. Put direct-check expected values in Vitest case rows. Pass per-case judge criteria through explicit matcher options, and suite-wide criteria through judge config.
  • Custom judges should use createJudge(...) for stable reporter labels.

Verification

Prefer the smallest command that covers the edited files:

TaskCommand
Lint filepnpm exec biome lint path/to/file.ts
Format filepnpm exec biome format --write path/to/file.ts
Test filepnpm exec vitest run path/to/file.test.ts -c vitest.config.ts
Eval filepnpm exec vitest run path/to/file.eval.ts -c vitest.config.ts --reporter=./packages/vitest-evals/src/reporter.ts
Type surfacepnpm typecheck
Package buildpnpm build

Comments

Markdown supported