The Open Framework for Building Agents
feat(eve): improve eval assertion diagnostics (#1418)
Casey Gowrie01791118f9f5
diff --git a/.changeset/rich-judge-diagnostics.md b/.changeset/rich-judge-diagnostics.mdnew file mode 100644index 000000000..69d6214de--- /dev/null+++ b/.changeset/rich-judge-diagnostics.md@@ -0,0 +1,5 @@+---+"eve": patch+---++Report concise, actionable diagnostics for failed value and LLM judge assertions, including actual and expected values, schema issues, evaluated prompts, and judge rationale. Add assertion labels, preserve structured evidence in artifacts, and prevent duplicate Braintrust score names from overwriting each other.diff --git a/docs/evals/assertions.mdx b/docs/evals/assertions.mdxindex 0a834a1f1..66a1f198b 100644--- a/docs/evals/assertions.mdx+++ b/docs/evals/assertions.mdx@@ -73,6 +73,12 @@ t.check(| `similarity(expected)` | normalized Levenshtein similarity, 1 = identical | soft || `satisfies(fn, label)` | custom boolean predicate | gate |+For example, a failed labeled equality check prints:++```text+✗ equals [status] (0% < 100%): expected {"status":"active"}; received {"status":"disabled"}+```+Pick the cheapest builder that captures what "correct" means. When exact match is too strict but a judge model is overkill, `similarity` is the middle ground. For nuanced grading, reach for the [judge](./judge).## The matcher mini-language@@ -154,12 +160,13 @@ Every assertion returns a chainable handle. Severity rides on the assertion, so- `.gate(threshold?)` is hard. A miss marks the eval `failed` and `eve eval` exits non-zero.- `.soft(threshold?)` is tracked data. A below-threshold miss marks the eval `scored`, fatal only under `--strict`. With no threshold, it is tracked-only and never fails.- `.atLeast(threshold)` is soft with a bar (equivalent to `.soft(threshold)`).+- `.label(name)` adds a stable name when an eval records several assertions from the same family.The defaults are chosen so you rarely set severity. Run-level methods and `includes`/`equals`/`matches` are gates; `similarity` and every `t.judge.*` assertion are soft. Annotate only when you deviate:```tst.calledTool("get_weather").soft(); // record the tool call as a metric, don't gate-t.check(t.reply, similarity("Sunny")).atLeast(0.8); // gate the fuzzy match under --strict+t.check(t.reply, similarity("Sunny")).label("forecast wording").atLeast(0.8);t.check(t.reply, includes("error")).soft(); // track without failing the build```diff --git a/docs/evals/judge.mdx b/docs/evals/judge.mdxindex 810eb73a2..733153e9f 100644--- a/docs/evals/judge.mdx+++ b/docs/evals/judge.mdx@@ -28,6 +28,16 @@ The judges live under `t.judge.autoevals`. The namespace names the [Braintrust a| `t.judge.autoevals.closedQA(criteria)` | Whether the reply satisfies a free-form yes/no criterion (no expected answer to match) || `t.judge.autoevals.sql(expected)` | Semantic equivalence of two SQL statements |+A failed `closedQA` assertion prints the input and judge explanation:++```text+✗ judge.autoevals.closedQA [citation] (0% < 80%): prompt: "Name the source."+ criteria: "cites a source"+ response: "It is widely believed."+ rationale: "The response does not cite a source."+ choice: "N"+```+The reference or criteria is the positional argument. An options object follows:- `on` is the value to grade, defaulting to `t.reply`. Pass an intermediate draft or parsed value to grade it instead.@@ -48,7 +58,7 @@ Judge assertions are soft, so the threshold rides on the assertion handle. There```tst.judge.autoevals.closedQA("cites a source"); // tracked, never fails-t.judge.autoevals.closedQA("cites a source").atLeast(0.6); // soft, fails under --strict below 0.6+t.judge.autoevals.closedQA("cites a source").label("citation").atLeast(0.6);t.judge.autoevals.factuality(reference).gate(0.8); // hard gate at 0.8```diff --git a/docs/evals/reporters.mdx b/docs/evals/reporters.mdxindex 46349a170..731549329 100644--- a/docs/evals/reporters.mdx+++ b/docs/evals/reporters.mdx@@ -38,7 +38,7 @@ export default defineEval({});```-The reporter config takes an optional `projectName` and `experimentName`, plus a base experiment (by name or id) to diff against. Gate assertions log as binary scores under a `gate:` prefix so experiments diff gate regressions the same way they diff soft-score regressions. Eval `metadata` rides along to reporters.+The reporter config takes an optional `projectName` and `experimentName`, plus a base experiment (by name or id) to diff against. Gate assertions log as binary scores under a `gate:` prefix so experiments diff gate regressions the same way they diff soft-score regressions. Repeated names use `#2`, `#3`, and later suffixes; use `.label(name)` to give them meaningful names. Failed assertion details are stored in the Braintrust metadata under `eveFailedAssertions`.A reporter instance observes the evals that reference it. Share one instance across several evals (the config, a `shared.ts` export, or every entry of a dataset array) and their results land in a single experiment. Listing the same config reporter on an eval too does not double-report it.diff --git a/packages/eve/src/evals/assertions/collector.ts b/packages/eve/src/evals/assertions/collector.tsindex 64a7b43e0..74afb64fc 100644--- a/packages/eve/src/evals/assertions/collector.ts+++ b/packages/eve/src/evals/assertions/collector.ts@@ -1,5 +1,7 @@import { toErrorMessage } from "#shared/errors.js";+import { formatAssertionName } from "#evals/diagnostics.js";import type {+ AssertionEvaluation,AssertionHandle,AssertionResult,AssertionSeverity,@@ -7,15 +9,7 @@ import type {} from "#evals/types.js";import type { EveEvalAssertionSubject } from "#evals/assertions/run.js";-/**- * Outcome of evaluating one assertion: a 0–1 score (boolean assertions use- * exactly 0 or 1) with optional human-readable detail and metadata.- */-export interface AssertionOutcome {- readonly score: number;- readonly message?: string;- readonly metadata?: Readonly<Record<string, unknown>>;-}+export type AssertionOutcome = AssertionEvaluation;/*** A scoped assertion evaluated lazily after `test(t)` returns. The selected@@ -27,6 +21,7 @@ export interface RunAssertion {}interface MutableEntry {+ readonly baseName: string;name: string;severity: AssertionSeverity;threshold: number | undefined;@@ -63,6 +58,7 @@ export class AssertionCollector {severity: AssertionSeverity = "gate",): AssertionHandle {const entry: MutableEntry = {+ baseName: spec.name,name: spec.name,severity,threshold: undefined,@@ -84,6 +80,7 @@ export class AssertionCollector {readonly score: () => Promise<AssertionOutcome>;}): AssertionHandle {const entry: MutableEntry = {+ baseName: input.name,name: input.name,severity: input.severity,threshold: input.threshold,@@ -102,6 +99,7 @@ export class AssertionCollector {/** Record an already-computed assertion outcome and return whether it passed. */recordOutcome(input: { readonly name: string; readonly outcome: AssertionOutcome }): boolean {const entry: MutableEntry = {+ baseName: input.name,name: input.name,severity: "gate",threshold: undefined,@@ -122,6 +120,7 @@ export class AssertionCollector {readonly score: () => Promise<AssertionOutcome>;}): Promise<boolean> {const entry: MutableEntry = {+ baseName: input.name,name: input.name,severity: "gate",threshold: input.threshold,@@ -216,6 +215,10 @@ function makeHandle(entry: MutableEntry): AssertionHandle {entry.threshold = threshold;return handle;},+ label(label) {+ entry.name = formatAssertionName(entry.baseName, label);+ return handle;+ },};return handle;}diff --git a/packages/eve/src/evals/context.ts b/packages/eve/src/evals/context.tsindex 7c8e184f0..f7ee0aef7 100644--- a/packages/eve/src/evals/context.ts+++ b/packages/eve/src/evals/context.ts@@ -6,6 +6,7 @@ import { buildJudgeContext } from "#evals/judge.js";import { EvalRequirementFailed, EvalSkipped } from "#evals/control-flow.js";import type {Assertion,+ AssertionEvaluation,AssertionHandle,EveEvalContext,EveEvalJudgeConfig,@@ -107,9 +108,7 @@ async function requireCheck<T>(const passed = await collector.recordRequirement({name: gated.name,threshold: gated.threshold,- score: async () => {- return { score: await gated.score(value) };- },+ score: () => evaluateAssertion(gated, value),});if (!passed) throw new EvalRequirementFailed();return value;@@ -124,10 +123,20 @@ function recordCheck(name: assertion.name,severity: assertion.severity,threshold: assertion.threshold,- score: async () => ({ score: await assertion.score(value) }),+ score: () => evaluateAssertion(assertion, value),});}+async function evaluateAssertion(+ assertion: Assertion,+ value: unknown,+): Promise<AssertionEvaluation> {+ if (assertion.evaluate !== undefined) {+ return await assertion.evaluate(value);+ }+ return { score: await assertion.score(value) };+}+function promptText(input: SendTurnInput): string {if (typeof input === "string") return input;const message = (input as { readonly message?: unknown }).message;diff --git a/packages/eve/src/evals/diagnostics.test.ts b/packages/eve/src/evals/diagnostics.test.tsnew file mode 100644index 000000000..3c277e5ae--- /dev/null+++ b/packages/eve/src/evals/diagnostics.test.ts@@ -0,0 +1,21 @@+import { describe, expect, it } from "vitest";++import { toDiagnosticMetadataValue } from "#evals/diagnostics.js";++describe("toDiagnosticMetadataValue", () => {+ it("preserves repeated references that are not circular", () => {+ const shared = { value: 1 };++ expect(toDiagnosticMetadataValue({ left: shared, right: shared })).toEqual({+ left: { value: 1 },+ right: { value: 1 },+ });+ });++ it("replaces references to ancestors as circular", () => {+ const value: { self?: unknown } = {};+ value.self = value;++ expect(toDiagnosticMetadataValue(value)).toEqual({ self: "[Circular]" });+ });+});diff --git a/packages/eve/src/evals/diagnostics.ts b/packages/eve/src/evals/diagnostics.tsnew file mode 100644index 000000000..cd05a2ae3--- /dev/null+++ b/packages/eve/src/evals/diagnostics.ts@@ -0,0 +1,52 @@+const DEFAULT_VALUE_LENGTH = 160;++/** Adds an optional user label without replacing the assertion's stable family name. */+export function formatAssertionName(name: string, label: string): string {+ const normalized = label.trim();+ if (normalized.length === 0) {+ throw new Error("Assertion labels must be non-empty.");+ }+ return `${name} [${normalized}]`;+}++/** Formats an assertion value for a compact human-readable diagnostic. */+export function formatDiagnosticValue(value: unknown, maxLength = DEFAULT_VALUE_LENGTH): string {+ let text: string;+ try {+ text = JSON.stringify(value) ?? String(value);+ } catch {+ text = String(value);+ }+ return truncateDiagnostic(text, maxLength);+}++/** Converts arbitrary assertion evidence into an artifact-safe JSON value. */+export function toDiagnosticMetadataValue(value: unknown): unknown {+ const ancestors: object[] = [];+ try {+ const json = JSON.stringify(value, function (this: object, _key, current: unknown) {+ if (typeof current === "bigint") return `${String(current)}n`;+ if (typeof current === "function" || typeof current === "symbol") return String(current);+ if (current instanceof Error) {+ return { name: current.name, message: current.message, stack: current.stack };+ }+ if (current !== null && typeof current === "object") {+ // Shared references are valid; only objects on the active traversal path are circular.+ while (ancestors.length > 0 && ancestors.at(-1) !== this) {+ ancestors.pop();+ }+ if (ancestors.includes(current)) return "[Circular]";+ ancestors.push(current);+ }+ return current;+ });+ return json === undefined ? String(value) : (JSON.parse(json) as unknown);+ } catch {+ return String(value);+ }+}++/** Bounds diagnostic text while leaving full structured evidence in metadata. */+export function truncateDiagnostic(text: string, maxLength: number): string {+ return text.length <= maxLength ? text : `${text.slice(0, maxLength)}…`;+}diff --git a/packages/eve/src/evals/expect/index.test.ts b/packages/eve/src/evals/expect/index.test.tsindex e79023f2f..633eca56c 100644--- a/packages/eve/src/evals/expect/index.test.ts+++ b/packages/eve/src/evals/expect/index.test.ts@@ -1,6 +1,7 @@import { describe, expect, it } from "vitest";-import { equals, includes, satisfies, similarity } from "#evals/expect/index.js";+import type { StandardSchemaV1 } from "#compiled/@standard-schema/spec/index.js";+import { equals, includes, matches, satisfies, similarity } from "#evals/expect/index.js";describe("expect builders", () => {it("includes scores 1 on substring, 0 otherwise, gate by default", () => {@@ -31,6 +32,54 @@ describe("expect builders", () => {expect(assertion.score({ a: 1 })).toBe(0);});+ it("retains actual and expected values for failed checks", async () => {+ const evaluation = await equals({ city: "Brooklyn" }).evaluate?.({ city: "Queens" });++ expect(evaluation).toEqual({+ score: 0,+ message: 'expected {"city":"Brooklyn"}; received {"city":"Queens"}',+ metadata: {+ actual: { city: "Queens" },+ expected: { city: "Brooklyn" },+ },+ });+ });++ it("makes arbitrary diagnostic values safe for JSON artifacts", async () => {+ const actual: { amount: bigint; self?: unknown } = { amount: 3n };+ actual.self = actual;++ const evaluation = await equals({ amount: 4n }).evaluate?.(actual);++ expect(evaluation?.metadata).toEqual({+ actual: { amount: "3n", self: "[Circular]" },+ expected: { amount: "4n" },+ });+ });++ it("retains schema issue paths for failed checks", async () => {+ const schema = {+ "~standard": {+ version: 1,+ vendor: "test",+ validate: () => ({+ issues: [{ message: "Required", path: ["city"] }],+ }),+ },+ } satisfies StandardSchemaV1;++ const evaluation = await matches(schema).evaluate?.({});++ expect(evaluation).toMatchObject({+ score: 0,+ message: "schema validation failed: city: Required",+ metadata: {+ actual: {},+ issues: [{ message: "Required", path: ["city"] }],+ },+ });+ });+it("similarity is soft by default and scores 1 on an exact match", async () => {const assertion = similarity("hello");expect(assertion.severity).toBe("soft");diff --git a/packages/eve/src/evals/expect/index.ts b/packages/eve/src/evals/expect/index.tsindex 2f0701100..e47385a1e 100644--- a/packages/eve/src/evals/expect/index.ts+++ b/packages/eve/src/evals/expect/index.ts@@ -1,25 +1,41 @@import { Levenshtein as AutoevalsLevenshtein } from "autoevals";import type { StandardSchemaV1 } from "#compiled/@standard-schema/spec/index.js";+import { formatDiagnosticValue, toDiagnosticMetadataValue } from "#evals/diagnostics.js";import { deepEquals } from "#evals/match.js";import { testRegExp } from "#evals/match.js";-import type { Assertion, AssertionSeverity } from "#evals/types.js";+import type { Assertion, AssertionEvaluation, AssertionSeverity } from "#evals/types.js";-export type { Assertion, AssertionHandle, AssertionSeverity } from "#evals/types.js";+export type {+ Assertion,+ AssertionEvaluation,+ AssertionHandle,+ AssertionSeverity,+} from "#evals/types.js";interface AssertionSpec {readonly name: string;readonly severity: AssertionSeverity;readonly threshold?: number;- score(value: unknown): number | Promise<number>;+ evaluate(value: unknown): AssertionEvaluation | number | Promise<AssertionEvaluation | number>;}function makeAssertion(spec: AssertionSpec): Assertion {+ const evaluate = (value: unknown): AssertionEvaluation | Promise<AssertionEvaluation> => {+ const result = spec.evaluate(value);+ return result instanceof Promise+ ? result.then(normalizeEvaluation)+ : normalizeEvaluation(result);+ };return {name: spec.name,severity: spec.severity,threshold: spec.threshold,- score: spec.score,+ evaluate,+ score(value) {+ const result = evaluate(value);+ return result instanceof Promise ? result.then((outcome) => outcome.score) : result.score;+ },gate(threshold) {return makeAssertion({ ...spec, severity: "gate", threshold });},@@ -32,6 +48,10 @@ function makeAssertion(spec: AssertionSpec): Assertion {};}+function normalizeEvaluation(result: AssertionEvaluation | number): AssertionEvaluation {+ return typeof result === "number" ? { score: result } : result;+}+/*** Passes when the value (coerced to a string) contains a substring or matches* a RegExp. A hard gate by default.@@ -40,13 +60,16 @@ export function includes(substring: string | RegExp): Assertion {return makeAssertion({name: `includes(${substring})`,severity: "gate",- score: (value) => {+ evaluate: (value) => {const text = String(value ?? "");- return (- typeof substring === "string" ? text.includes(substring) : testRegExp(substring, text)- )- ? 1- : 0;+ const passed =+ typeof substring === "string" ? text.includes(substring) : testRegExp(substring, text);+ if (passed) return 1;+ return {+ score: 0,+ message: `expected ${formatDiagnosticValue(text)} to include ${formatDiagnosticValue(String(substring))}`,+ metadata: { actual: text, expected: String(substring) },+ };},});}@@ -57,7 +80,14 @@ export function satisfies<T = unknown>(predicate: (value: T) => boolean, label:return makeAssertion({name: `satisfies(${label})`,severity: "gate",- score: (value) => (predicate(value as T) ? 1 : 0),+ evaluate: (value) =>+ predicate(value as T)+ ? 1+ : {+ score: 0,+ message: `predicate did not hold for ${formatDiagnosticValue(value)}`,+ metadata: { actual: toDiagnosticMetadataValue(value), predicate: label },+ },});}@@ -69,7 +99,17 @@ export function equals(expected: unknown): Assertion {return makeAssertion({name: "equals",severity: "gate",- score: (value) => (deepEquals(value, expected) ? 1 : 0),+ evaluate: (value) =>+ deepEquals(value, expected)+ ? 1+ : {+ score: 0,+ message: `expected ${formatDiagnosticValue(expected)}; received ${formatDiagnosticValue(value)}`,+ metadata: {+ actual: toDiagnosticMetadataValue(value),+ expected: toDiagnosticMetadataValue(expected),+ },+ },});}@@ -81,9 +121,17 @@ export function matches(schema: StandardSchemaV1): Assertion {return makeAssertion({name: "matches",severity: "gate",- score: async (value) => {+ evaluate: async (value) => {const outcome = await schema["~standard"].validate(value);- return !("issues" in outcome) || outcome.issues === undefined ? 1 : 0;+ if (!("issues" in outcome) || outcome.issues === undefined) return 1;+ return {+ score: 0,+ message: `schema validation failed: ${outcome.issues.map(formatSchemaIssue).join("; ")}`,+ metadata: {+ actual: toDiagnosticMetadataValue(value),+ issues: toDiagnosticMetadataValue(outcome.issues),+ },+ };},});}@@ -98,9 +146,24 @@ export function similarity(expected: string): Assertion {return makeAssertion({name: "similarity",severity: "soft",- score: async (value) => {- const result = await AutoevalsLevenshtein({ output: String(value ?? ""), expected });- return result.score ?? 0;+ evaluate: async (value) => {+ const actual = String(value ?? "");+ const result = await AutoevalsLevenshtein({ output: actual, expected });+ return {+ score: result.score ?? 0,+ message: `expected similarity to ${formatDiagnosticValue(expected)}; received ${formatDiagnosticValue(actual)}`,+ metadata: { actual, expected },+ };},});}++function formatSchemaIssue(issue: StandardSchemaV1.Issue): string {+ const path =+ issue.path === undefined+ ? ""+ : `${issue.path+ .map((segment) => (typeof segment === "object" ? String(segment.key) : String(segment)))+ .join(".")}: `;+ return `${path}${issue.message}`;+}diff --git a/packages/eve/src/evals/index.ts b/packages/eve/src/evals/index.tsindex 1633684ca..31a41a7de 100644--- a/packages/eve/src/evals/index.ts+++ b/packages/eve/src/evals/index.ts@@ -27,6 +27,7 @@ export type {export type {Assertion,+ AssertionEvaluation,AssertionHandle,AssertionResult,AssertionSeverity,diff --git a/packages/eve/src/evals/judge.test.ts b/packages/eve/src/evals/judge.test.tsnew file mode 100644index 000000000..bbaa56f4d--- /dev/null+++ b/packages/eve/src/evals/judge.test.ts@@ -0,0 +1,128 @@+import { afterEach, describe, expect, it, vi } from "vitest";++import { AssertionCollector } from "#evals/assertions/collector.js";+import { buildJudgeContext } from "#evals/judge.js";+import { createEmptyDerivedFacts } from "#evals/runner/derive-run-facts.js";+import type { EveEvalTaskResult } from "#evals/types.js";++const mocks = vi.hoisted(() => ({+ closedQA: vi.fn(),+ createAutoevalsClient: vi.fn(() => ({ kind: "autoevals-client" })),+ factuality: vi.fn(),+ sql: vi.fn(),+ summary: vi.fn(),+}));++vi.mock("autoevals", () => ({+ ClosedQA: mocks.closedQA,+ Factuality: mocks.factuality,+ Sql: mocks.sql,+ Summary: mocks.summary,+}));++vi.mock("#evals/autoevals-client.js", () => ({+ createAutoevalsClient: mocks.createAutoevalsClient,+}));++afterEach(() => {+ vi.clearAllMocks();+});++describe("buildJudgeContext", () => {+ it("reports the prompt, criteria, response, and autoevals explanation", async () => {+ mocks.closedQA.mockResolvedValueOnce({+ name: "ClosedQA",+ score: 0,+ metadata: {+ choice: "N",+ rationale: "The response makes no mention of a source.",+ tokens: 42,+ },+ });+ const collector = new AssertionCollector();+ const judge = buildJudgeContext({+ collector,+ getInput: () => "Name the source for this claim.",+ getReply: () => "It is widely believed.",+ judge: { model: "openai/gpt-5.4-mini" },+ });++ judge.autoevals.closedQA("cites a source").label("source citation").atLeast(0.8);+ const [assertion] = await collector.finalize(emptyTaskResult());++ expect(mocks.closedQA).toHaveBeenCalledWith(+ expect.objectContaining({+ criteria: "cites a source",+ input: "Name the source for this claim.",+ model: "openai/gpt-5.4-mini",+ output: "It is widely believed.",+ }),+ );+ expect(assertion).toMatchObject({+ name: "judge.autoevals.closedQA [source citation]",+ score: 0,+ severity: "soft",+ threshold: 0.8,+ passed: false,+ message: [+ 'prompt: "Name the source for this claim."',+ 'criteria: "cites a source"',+ 'response: "It is widely believed."',+ 'rationale: "The response makes no mention of a source."',+ 'choice: "N"',+ ].join("\n"),+ metadata: {+ autoevalsName: "ClosedQA",+ choice: "N",+ criteria: "cites a source",+ input: "Name the source for this claim.",+ judge: "openai/gpt-5.4-mini",+ output: "It is widely believed.",+ rationale: "The response makes no mention of a source.",+ tokens: 42,+ },+ });+ });++ it("reports the custom value and expected answer for comparison graders", async () => {+ mocks.factuality.mockResolvedValueOnce({+ name: "Factuality",+ score: 1,+ metadata: { choice: "A" },+ });+ const collector = new AssertionCollector();+ const judge = buildJudgeContext({+ collector,+ getInput: () => "What is the capital of France?",+ getReply: () => "This value is not graded.",+ judge: { model: "openai/gpt-5.4-mini" },+ });++ judge.autoevals.factuality("Paris", { on: "The capital is Paris." });+ const [assertion] = await collector.finalize(emptyTaskResult());++ expect(assertion).toMatchObject({+ passed: true,+ message: [+ 'prompt: "What is the capital of France?"',+ 'expected: "Paris"',+ 'response: "The capital is Paris."',+ 'choice: "A"',+ ].join("\n"),+ metadata: {+ expected: "Paris",+ output: "The capital is Paris.",+ },+ });+ });+});++function emptyTaskResult(): EveEvalTaskResult {+ return {+ derived: createEmptyDerivedFacts(),+ events: [],+ finalMessage: null,+ output: null,+ status: "completed",+ };+}diff --git a/packages/eve/src/evals/judge.ts b/packages/eve/src/evals/judge.tsindex 2aa8e2d8a..431c0d2f6 100644--- a/packages/eve/src/evals/judge.ts+++ b/packages/eve/src/evals/judge.ts@@ -1,10 +1,11 @@-import { ClosedQA, Factuality, Sql, Summary } from "autoevals";+import { ClosedQA, Factuality, Sql, Summary, type Score } from "autoevals";import type { LanguageModel } from "ai";import { formatLanguageModelGatewayId } from "#internal/runtime-model.js";import type { AgentModelOptionsDefinition } from "#shared/agent-definition.js";import { createAutoevalsClient } from "#evals/autoevals-client.js";import type { AssertionCollector } from "#evals/assertions/collector.js";+import { formatDiagnosticValue } from "#evals/diagnostics.js";import type { AssertionHandle, EveEvalJudgeConfig, JudgeContext, JudgeOpts } from "#evals/types.js";/**@@ -25,6 +26,11 @@ type GraderCall = {readonly modelOptions: AgentModelOptionsDefinition | undefined;};+type GraderEvidence = {+ readonly label: "criteria" | "expected";+ readonly value: string;+};+/*** Builds the `t.judge` namespace bound to the resolved judge model. Each* grader records a soft assertion (override with `.atLeast`/`.gate`) that@@ -35,9 +41,10 @@ export function buildJudgeContext(deps: JudgeDeps): JudgeContext {function grade(name: string,opts: JudgeOpts | undefined,+ evidence: GraderEvidence,invoke: (params: { readonly input: string; readonly output: string } & GraderCall,- ) => { readonly score: number | null } | Promise<{ readonly score: number | null }>,+ ) => Score | Promise<Score>,): AssertionHandle {const value = opts?.on ?? deps.getReply();const output = String(value ?? "");@@ -56,9 +63,20 @@ export function buildJudgeContext(deps: JudgeDeps): JudgeContext {);}const result = await invoke({ input, output, model, modelOptions });+ const autoevalsError = result.error === undefined ? {} : { autoevalsError: result.error };+ const metadata = {+ ...result.metadata,+ ...autoevalsError,+ judge: formatLanguageModelGatewayId(model),+ input,+ output,+ [evidence.label]: evidence.value,+ autoevalsName: result.name,+ };return {score: result.score ?? 0,- metadata: { judge: formatLanguageModelGatewayId(model) },+ message: formatJudgeDetail(input, output, evidence, result),+ metadata,};},});@@ -67,25 +85,64 @@ export function buildJudgeContext(deps: JudgeDeps): JudgeContext {return {autoevals: {factuality: (expected, opts) =>- grade("judge.autoevals.factuality", opts, ({ input, output, model, modelOptions }) =>- Factuality({ input, output, expected, ...client(model, modelOptions) }),+ grade(+ "judge.autoevals.factuality",+ opts,+ { label: "expected", value: expected },+ ({ input, output, model, modelOptions }) =>+ Factuality({ input, output, expected, ...client(model, modelOptions) }),),summarizes: (expected, opts) =>- grade("judge.autoevals.summarizes", opts, ({ input, output, model, modelOptions }) =>- Summary({ input, output, expected, ...client(model, modelOptions) }),+ grade(+ "judge.autoevals.summarizes",+ opts,+ { label: "expected", value: expected },+ ({ input, output, model, modelOptions }) =>+ Summary({ input, output, expected, ...client(model, modelOptions) }),),closedQA: (criteria, opts) =>- grade("judge.autoevals.closedQA", opts, ({ input, output, model, modelOptions }) =>- ClosedQA({ input, output, criteria, ...client(model, modelOptions) }),+ grade(+ "judge.autoevals.closedQA",+ opts,+ { label: "criteria", value: criteria },+ ({ input, output, model, modelOptions }) =>+ ClosedQA({ input, output, criteria, ...client(model, modelOptions) }),),sql: (expected, opts) =>- grade("judge.autoevals.sql", opts, ({ input, output, model, modelOptions }) =>- Sql({ input, output, expected, ...client(model, modelOptions) }),+ grade(+ "judge.autoevals.sql",+ opts,+ { label: "expected", value: expected },+ ({ input, output, model, modelOptions }) =>+ Sql({ input, output, expected, ...client(model, modelOptions) }),),},};}+function formatJudgeDetail(+ input: string,+ output: string,+ evidence: GraderEvidence,+ result: Score,+): string {+ const fields: [string, unknown][] = [+ ["prompt", input],+ [evidence.label, evidence.value],+ ["response", output],+ ];+ if (result.metadata?.rationale !== undefined) {+ fields.push(["rationale", result.metadata.rationale]);+ }+ if (result.metadata?.choice !== undefined) {+ fields.push(["choice", result.metadata.choice]);+ }+ if (result.error !== undefined) {+ fields.push(["autoevals error", result.error]);+ }+ return fields.map(([label, value]) => `${label}: ${formatDiagnosticValue(value)}`).join("\n");+}+type AutoevalsClientFields = {readonly model: string;readonly client: ReturnType<typeof createAutoevalsClient>;diff --git a/packages/eve/src/evals/runner/artifacts.test.ts b/packages/eve/src/evals/runner/artifacts.test.tsindex 470578ad6..34631f70c 100644--- a/packages/eve/src/evals/runner/artifacts.test.ts+++ b/packages/eve/src/evals/runner/artifacts.test.ts@@ -37,6 +37,35 @@ describe("eval artifacts", () => {skipReason: "dev routes unavailable",});});++ it("keeps assertion diagnostics in the run summary", async () => {+ await writeArtifacts("/tmp/eve-evals", judgedSummary());++ const summary = writtenJson("/tmp/eve-evals/summary.json");+ expect(summary).toMatchObject({+ evals: [+ {+ assertions: [+ {+ message: 'prompt: "Name the source."',+ metadata: {+ criteria: "cites a source",+ input: "Name the source.",+ rationale: "No source was cited.",+ },+ name: "judge.autoevals.closedQA",+ passed: false,+ score: 0,+ severity: "soft",+ threshold: 0.8,+ },+ ],+ id: "quality/source",+ verdict: "scored",+ },+ ],+ });+ });});function writtenJson(path: string): Record<string, unknown> {@@ -73,3 +102,45 @@ function skippedSummary(): EveEvalRunSummary {errored: 0,};}++function judgedSummary(): EveEvalRunSummary {+ const result: EveEvalResult = {+ id: "quality/source",+ assertions: [+ {+ name: "judge.autoevals.closedQA",+ score: 0,+ severity: "soft",+ threshold: 0.8,+ passed: false,+ message: 'prompt: "Name the source."',+ metadata: {+ criteria: "cites a source",+ input: "Name the source.",+ rationale: "No source was cited.",+ },+ },+ ],+ result: {+ derived: createEmptyDerivedFacts(),+ events: [],+ finalMessage: "No source.",+ output: "No source.",+ status: "completed",+ },+ verdict: "scored",+ startedAt: "2026-01-01T00:00:00.000Z",+ completedAt: "2026-01-01T00:00:01.000Z",+ };+ return {+ target: { capabilities: { devRoutes: true }, kind: "local", url: "http://localhost:3000" },+ results: [result],+ startedAt: result.startedAt,+ completedAt: result.completedAt,+ passed: 0,+ failed: 0,+ scored: 1,+ skipped: 0,+ errored: 0,+ };+}diff --git a/packages/eve/src/evals/runner/artifacts.ts b/packages/eve/src/evals/runner/artifacts.tsindex 4e0c2b11e..8b31f5f5f 100644--- a/packages/eve/src/evals/runner/artifacts.ts+++ b/packages/eve/src/evals/runner/artifacts.ts@@ -68,7 +68,10 @@ function buildSummaryArtifact(summary: EveEvalRunSummary): Record<string, unknowname: a.name,score: a.score,severity: a.severity,+ threshold: a.threshold,passed: a.passed,+ message: a.message,+ metadata: a.metadata,})),error: result.error,skipReason: result.skipReason,diff --git a/packages/eve/src/evals/runner/reporters/assertion-diagnostics.test.ts b/packages/eve/src/evals/runner/reporters/assertion-diagnostics.test.tsnew file mode 100644index 000000000..06dbe00df--- /dev/null+++ b/packages/eve/src/evals/runner/reporters/assertion-diagnostics.test.ts@@ -0,0 +1,31 @@+import { describe, expect, it } from "vitest";++import {+ formatAssertionFailureDetailLines,+ formatAssertionFailureHeadline,+} from "#evals/runner/reporters/assertion-diagnostics.js";+import type { AssertionResult } from "#evals/types.js";++describe("assertion failure diagnostics", () => {+ it("shows the score against its threshold and bounds verbose details", () => {+ const assertion: AssertionResult = {+ message: [`prompt: ${"x".repeat(300)}`, "one", "two", "three", "four", "five"].join("\n"),+ name: "judge.autoevals.closedQA [citation]",+ passed: false,+ score: 0.42,+ severity: "soft",+ threshold: 0.8,+ };++ expect(formatAssertionFailureHeadline(assertion)).toMatch(+ /^judge\.autoevals\.closedQA \[citation\] \(42% < 80%\): prompt: .+…$/u,+ );+ expect(formatAssertionFailureDetailLines(assertion)).toEqual([+ "one",+ "two",+ "three",+ "four",+ "…",+ ]);+ });+});diff --git a/packages/eve/src/evals/runner/reporters/assertion-diagnostics.ts b/packages/eve/src/evals/runner/reporters/assertion-diagnostics.tsnew file mode 100644index 000000000..12135be0c--- /dev/null+++ b/packages/eve/src/evals/runner/reporters/assertion-diagnostics.ts@@ -0,0 +1,29 @@+import { truncateDiagnostic } from "#evals/diagnostics.js";+import type { AssertionResult } from "#evals/types.js";++const MAX_DETAIL_LINE_LENGTH = 240;+const MAX_DETAIL_LINES = 4;++export function formatAssertionFailureHeadline(assertion: AssertionResult): string {+ const threshold = assertion.threshold ?? (assertion.severity === "gate" ? 1 : undefined);+ const comparison =+ threshold === undefined+ ? ""+ : ` (${formatPercent(assertion.score)} < ${formatPercent(threshold)})`;+ const [headline] = assertion.message?.split("\n") ?? [];+ const detail =+ headline === undefined ? "" : `: ${truncateDiagnostic(headline, MAX_DETAIL_LINE_LENGTH)}`;+ return `${assertion.name}${comparison}${detail}`;+}++export function formatAssertionFailureDetailLines(assertion: AssertionResult): readonly string[] {+ const [, ...lines] = assertion.message?.split("\n") ?? [];+ const visible = lines+ .slice(0, MAX_DETAIL_LINES)+ .map((line) => truncateDiagnostic(line, MAX_DETAIL_LINE_LENGTH));+ return lines.length > MAX_DETAIL_LINES ? [...visible, "…"] : visible;+}++function formatPercent(score: number): string {+ return `${Math.round(score * 100)}%`;+}diff --git a/packages/eve/src/evals/runner/reporters/braintrust.test.ts b/packages/eve/src/evals/runner/reporters/braintrust.test.tsindex 9dbc1cc64..a70421659 100644--- a/packages/eve/src/evals/runner/reporters/braintrust.test.ts+++ b/packages/eve/src/evals/runner/reporters/braintrust.test.ts@@ -1,6 +1,19 @@-import { describe, expect, it } from "vitest";+import { beforeEach, describe, expect, it, vi } from "vitest";import { Braintrust, type BraintrustReporterConfig } from "#evals/reporters/index.js";-import type { EveEvalResult, EveEvalTarget } from "#evals/types.js";+import type { EveEval, EveEvalResult, EveEvalTarget } from "#evals/types.js";++const braintrustMocks = vi.hoisted(() => ({+ close: vi.fn(),+ flush: vi.fn(),+ init: vi.fn(),+ log: vi.fn(),+ summarize: vi.fn(),+}));++vi.mock("braintrust", () => ({+ flush: braintrustMocks.flush,+ init: braintrustMocks.init,+}));// ---------------------------------------------------------------------------// Helpers@@ -62,11 +75,28 @@ function makeEvalResult(overrides: Partial<EveEvalResult> = {}): EveEvalResult {};}+function makeEval(): EveEval {+ return {+ _tag: "EveEval",+ id: "eval-1",+ test: async () => {},+ };+}+// ---------------------------------------------------------------------------// Tests// ---------------------------------------------------------------------------describe("Braintrust", () => {+ beforeEach(() => {+ vi.clearAllMocks();+ braintrustMocks.init.mockResolvedValue({+ close: braintrustMocks.close,+ log: braintrustMocks.log,+ summarize: braintrustMocks.summarize,+ });+ });+it("creates a reporter", () => {const reporter = Braintrust(makeConfig());expect(reporter).toBeDefined();@@ -98,4 +128,75 @@ describe("Braintrust", () => {errored: 0,});});++ it("uploads complete failed assertion diagnostics", async () => {+ const reporter = Braintrust(makeConfig());+ await reporter.onRunStart([makeEval()], makeTarget());++ reporter.onEvalComplete(+ makeEvalResult({+ assertions: [+ {+ message: 'prompt: "Name the source."',+ metadata: {+ criteria: "cites a source",+ input: "Name the source.",+ rationale: "No source was cited.",+ },+ name: "judge.autoevals.closedQA",+ passed: false,+ score: 0,+ severity: "soft",+ threshold: 0.8,+ },+ ],+ verdict: "scored",+ }),+ );++ expect(braintrustMocks.log).toHaveBeenCalledWith(+ expect.objectContaining({+ metadata: expect.objectContaining({+ eveFailedAssertions: [+ {+ message: 'prompt: "Name the source."',+ metadata: {+ criteria: "cites a source",+ input: "Name the source.",+ rationale: "No source was cited.",+ },+ name: "judge.autoevals.closedQA",+ passed: false,+ score: 0,+ severity: "soft",+ threshold: 0.8,+ },+ ],+ }),+ }),+ );+ });++ it("keeps duplicate assertion scores under stable keys", async () => {+ const reporter = Braintrust(makeConfig());+ await reporter.onRunStart([makeEval()], makeTarget());++ reporter.onEvalComplete(+ makeEvalResult({+ assertions: [+ { name: "similarity", passed: true, score: 0.8, severity: "soft" },+ { name: "similarity", passed: true, score: 0.6, severity: "soft" },+ ],+ }),+ );++ expect(braintrustMocks.log).toHaveBeenCalledWith(+ expect.objectContaining({+ scores: {+ similarity: 0.8,+ "similarity#2": 0.6,+ },+ }),+ );+ });});diff --git a/packages/eve/src/evals/runner/reporters/braintrust.ts b/packages/eve/src/evals/runner/reporters/braintrust.tsindex 7d86122e8..2b611cde6 100644--- a/packages/eve/src/evals/runner/reporters/braintrust.ts+++ b/packages/eve/src/evals/runner/reporters/braintrust.ts@@ -133,14 +133,18 @@ class BraintrustReporter implements EvalReporter {// scores under a `gate:` prefix so experiments diff gate regressions the// same way they diff soft-score regressions.const scores: Record<string, number> = {};+ const scoreNameCounts = new Map<string, number>();for (const assertion of result.assertions) {- const key = assertion.severity === "gate" ? `gate:${assertion.name}` : assertion.name;+ const baseName = assertion.severity === "gate" ? `gate:${assertion.name}` : assertion.name;+ const count = (scoreNameCounts.get(baseName) ?? 0) + 1;+ scoreNameCounts.set(baseName, count);+ const key = count === 1 ? baseName : `${baseName}#${count}`;scores[key] = assertion.score;}const failedAssertions = result.assertions.filter((assertion) => !assertion.passed)- .map((assertion) => ({ name: assertion.name, message: assertion.message }));+ .map((assertion) => ({ ...assertion }));const metadata: Record<string, unknown> = {...evaluation?.metadata,diff --git a/packages/eve/src/evals/runner/reporters/console.test.ts b/packages/eve/src/evals/runner/reporters/console.test.tsindex 1528800d7..6ebc8c78b 100644--- a/packages/eve/src/evals/runner/reporters/console.test.ts+++ b/packages/eve/src/evals/runner/reporters/console.test.ts@@ -16,6 +16,74 @@ describe("Console", () => {expect(lines.join("\n")).toContain("dev routes unavailable");expect(lines.join("\n")).toContain("1 skipped");});++ it("indents multiline assertion failure details", () => {+ const lines: string[] = [];+ const reporter = Console({ color: false, log: (line) => lines.push(line) });++ reporter.onEvalComplete({+ assertions: [+ {+ message: [+ 'prompt: "Name the source."',+ 'criteria: "cites a source"',+ 'rationale: "No source was cited."',+ ].join("\n"),+ name: "judge.autoevals.closedQA",+ passed: false,+ score: 0,+ severity: "soft",+ threshold: 0.8,+ },+ ],+ completedAt: "2026-01-01T00:00:01.000Z",+ id: "sourcing",+ result: {+ derived: createEmptyDerivedFacts(),+ events: [],+ finalMessage: "No source.",+ output: "No source.",+ status: "completed",+ },+ startedAt: "2026-01-01T00:00:00.000Z",+ verdict: "scored",+ });++ expect(lines).toContain(' ✗ judge.autoevals.closedQA (0% < 80%): prompt: "Name the source."');+ expect(lines).toContain(' criteria: "cites a source"');+ expect(lines).toContain(' rationale: "No source was cited."');+ });++ it("does not print diagnostics for passing assertions", () => {+ const lines: string[] = [];+ const reporter = Console({ color: false, log: (line) => lines.push(line) });++ reporter.onEvalComplete({+ assertions: [+ {+ message: 'prompt: "Successful prompt details"',+ metadata: { rationale: "Successful rationale details" },+ name: "judge.autoevals.closedQA",+ passed: true,+ score: 1,+ severity: "gate",+ },+ ],+ completedAt: "2026-01-01T00:00:01.000Z",+ id: "sourcing",+ result: {+ derived: createEmptyDerivedFacts(),+ events: [],+ finalMessage: "A sourced answer.",+ output: "A sourced answer.",+ status: "completed",+ },+ startedAt: "2026-01-01T00:00:00.000Z",+ verdict: "passed",+ });++ expect(lines).toEqual(["✓ sourcing gates 1/1"]);+ });});function skippedResult(): EveEvalResult {diff --git a/packages/eve/src/evals/runner/reporters/console.ts b/packages/eve/src/evals/runner/reporters/console.tsindex dd740e43d..0b969fd3f 100644--- a/packages/eve/src/evals/runner/reporters/console.ts+++ b/packages/eve/src/evals/runner/reporters/console.ts@@ -7,6 +7,10 @@ import type {EveEvalRunSummary,EveEvalTarget,} from "#evals/types.js";+import {+ formatAssertionFailureDetailLines,+ formatAssertionFailureHeadline,+} from "#evals/runner/reporters/assertion-diagnostics.js";import type { EvalReporter } from "#evals/runner/reporters/types.js";/**@@ -70,8 +74,10 @@ class ConsoleReporter implements EvalReporter {for (const assertion of assertions) {if (assertion.passed) continue;- const detail = assertion.message === undefined ? "" : `: ${assertion.message}`;- this.#log(` ${this.#colors.red(`✗ ${assertion.name}${detail}`)}`);+ this.#log(` ${this.#colors.red(`✗ ${formatAssertionFailureHeadline(assertion)}`)}`);+ for (const detailLine of formatAssertionFailureDetailLines(assertion)) {+ this.#log(` ${this.#colors.red(detailLine)}`);+ }}if (error) {diff --git a/packages/eve/src/evals/runner/reporters/junit.test.ts b/packages/eve/src/evals/runner/reporters/junit.test.tsindex d834e7f15..69d7c750d 100644--- a/packages/eve/src/evals/runner/reporters/junit.test.ts+++ b/packages/eve/src/evals/runner/reporters/junit.test.ts@@ -26,7 +26,8 @@ describe("JUnit", () => {const [, xml] = fsMocks.writeFile.mock.calls[0]!;expect(xml).toContain('<testsuite name="suite & one" tests="2" failures="1" skipped="0"');expect(xml).toContain('<testcase classname="eve.eval" name="runtime/passes"');- expect(xml).toContain('<failure message="contains: expected hello">');+ expect(xml).toContain('<failure message="contains (0% < 100%): expected hello">');+ expect(xml).not.toContain("Successful assertion details");});it("defaults the suite name", async () => {@@ -93,7 +94,16 @@ function makeSummary(): EveEvalRunSummary {function makeEvalResult(overrides: Partial<EveEvalResult> = {}): EveEvalResult {return {id: "eval-1",- assertions: [{ name: "check", score: 1, severity: "gate", passed: true }],+ assertions: [+ {+ message: "Successful assertion details",+ metadata: { rationale: "Successful rationale details" },+ name: "check",+ score: 1,+ severity: "gate",+ passed: true,+ },+ ],result: {derived: createEmptyDerivedFacts(),events: [],diff --git a/packages/eve/src/evals/runner/reporters/junit.ts b/packages/eve/src/evals/runner/reporters/junit.tsindex d84e7c8aa..680128df1 100644--- a/packages/eve/src/evals/runner/reporters/junit.ts+++ b/packages/eve/src/evals/runner/reporters/junit.ts@@ -2,6 +2,8 @@ import { mkdir, writeFile } from "node:fs/promises";import { dirname } from "node:path";import type { EveEvalResult, EveEvalRunSummary } from "#evals/types.js";+import { truncateDiagnostic } from "#evals/diagnostics.js";+import { formatAssertionFailureHeadline } from "#evals/runner/reporters/assertion-diagnostics.js";import type { EvalReporter } from "#evals/runner/reporters/types.js";export interface JUnitReporterConfig {@@ -89,9 +91,9 @@ function buildFailureDetail(result: EveEvalResult): Record<string, unknown> {function failureMessage(result: EveEvalResult): string {if (result.error !== undefined) return result.error;- const failed = result.assertions.find((assertion) => !assertion.passed);- if (failed !== undefined) {- return failed.message === undefined ? failed.name : `${failed.name}: ${failed.message}`;+ const failed = result.assertions.filter((assertion) => !assertion.passed);+ if (failed.length > 0) {+ return truncateDiagnostic(failed.map(formatAssertionFailureHeadline).join("; "), 1_000);}if (result.verdict === "scored") return "score below threshold";return result.verdict;diff --git a/packages/eve/src/evals/types.ts b/packages/eve/src/evals/types.tsindex d06603b38..81689d1da 100644--- a/packages/eve/src/evals/types.ts+++ b/packages/eve/src/evals/types.ts@@ -133,14 +133,26 @@ export interface EveEvalTaskResult {*/export type AssertionSeverity = "gate" | "soft";+/**+ * A rich value-assertion evaluation. Built-in assertions use this to retain a+ * concise failure reason and structured evidence alongside the numeric score.+ */+export interface AssertionEvaluation {+ /** Normalized 0–1 score. */+ readonly score: number;+ /** Concise human-readable reason, shown when the assertion fails. */+ readonly message?: string;+ /** Structured diagnostic evidence retained by artifacts and reporters. */+ readonly metadata?: Readonly<Record<string, unknown>>;+}+/*** A value-level assertion produced by the builders in `eve/evals/expect`* (e.g. `includes`, `equals`, `similarity`) and applied to an explicit value* via `t.check(value, assertion)`. Boolean assertions score exactly 0 or 1.** The chainable `gate`/`soft`/`atLeast` return a new assertion with the- * severity or threshold overridden, so the threshold rides on the assertion- * itself rather than a detached map.+ * severity or threshold overridden.*/export interface Assertion {readonly name: string;@@ -148,6 +160,8 @@ export interface Assertion {/** Minimum passing score. `undefined` on a soft assertion = tracked only. */readonly threshold?: number;score(value: unknown): number | Promise<number>;+ /** Rich evaluation used by `t.check` and `t.require`; custom assertions may omit it. */+ evaluate?(value: unknown): AssertionEvaluation | Promise<AssertionEvaluation>;gate(threshold?: number): Assertion;soft(threshold?: number): Assertion;atLeast(threshold: number): Assertion;@@ -155,14 +169,17 @@ export interface Assertion {/*** Handle to a recorded assertion, returned by every `t` assertion method.- * Chain `gate`/`soft`/`atLeast` to override the recorded severity or- * threshold. Recorded assertions are finalized by the runner; use `t.require`- * or a `require*` lookup when later control flow depends on a passing result.+ * Chain `gate`/`soft`/`atLeast` to override the recorded severity or threshold,+ * and `label` to distinguish repeated assertion families. Recorded assertions+ * are finalized by the runner; use `t.require` or a `require*` lookup when+ * later control flow depends on a passing result.*/export interface AssertionHandle {gate(threshold?: number): this;soft(threshold?: number): this;atLeast(threshold: number): this;+ /** Adds a stable human-readable label to this recorded assertion. */+ label(label: string): this;}/**diff --git a/packages/eve/test/scenarios/eval-command-environment.scenario.test.ts b/packages/eve/test/scenarios/eval-command-environment.scenario.test.tsindex 78544f061..875a3c419 100644--- a/packages/eve/test/scenarios/eval-command-environment.scenario.test.ts+++ b/packages/eve/test/scenarios/eval-command-environment.scenario.test.ts@@ -243,7 +243,7 @@ describe("eve eval environment loading", () => {expect(xml).toContain('<testsuite name="eve evals" tests="2" failures="1" skipped="0"');expect(xml).toContain('name="alpha"');expect(xml).toContain('name="beta"');- expect(xml).toContain('<failure message="check: nope">');+ expect(xml).toContain('<failure message="check (0% < 100%): nope">');expect(exit).toHaveBeenCalledWith(1);});});