Test results
ProA test run that leads with what failed. Passing tests fold into a count. Coverage shows against what a production deploy requires, and only once the run has measured it.
Preview
Install
With the Candor CLI
First time? Get started sets up the registry and theme. Or with shadcn directly: npx shadcn@latest add @candor/test-results
Brings in: collapsible, locale, streaming-text, work, utils · npm: lucide-react@^1.67.0
Usage
"use client"
import type { TestRun } from "@/lib/work"
import { TestResults } from "@/components/test-results"
const run: TestRun = {
status: "failed",
duration: "48s",
coverage: 0.71,
coverageRequired: 0.75,
cases: [
{ id: "t1", className: "customers/region.test.ts", method: "sets region from billing country", outcome: "fail", duration: "1.2s", message: "Expected: eu, Received: other", stack: "at Object.<anonymous> (api/src/customers/region.test.ts:48:5)" },
{ id: "t2", className: "customers/region.test.ts", method: "keeps region when already set", outcome: "pass", duration: "0.4s" },
{ id: "t3", className: "customers/region.test.ts", method: "bulk insert of 200 rows", outcome: "pass", duration: "3.1s" },
{ id: "t4", className: "routing/assign-region.test.ts", method: "routes by region", outcome: "pass", duration: "0.9s" },
{ id: "t5", className: "routing/assign-region.test.ts", method: "falls back to partner tier", outcome: "skip" },
],
}
export default function Example() {
return <TestResults className="max-w-2xl" run={run} />
}<TestResults>
| Prop | Type | Default | Description |
|---|---|---|---|
| runrequired | TestRun | — | The test run: its status, cases and, once measured, coverage against what's required. |
| className | string | undefined | — | Extra classes for the outer element. |
Strings
The fixed words, in English by default. Change any of them under testResults in <LocaleProvider strings={{ … }}>; the table is exported as testResultsStrings.
| Key | English |
|---|---|
| label | Test results |
| running | Running tests |
| someFailed | { one: "{failed} of {count} test failed", other: "{failed} of {count} tests failed" } |
| allPassed | { one: "All {count} test passed", other: "All {count} tests passed" } |
| passed | {count} passed |
| failed | {count} failed |
| skipped | {count} skipped |
| passedAndSkipped | {passed} passed, {skipped} skipped |
| coverage | Coverage |
| measuring | Measuring |
| notMeasured | Not measured |
| belowRequired | Below the {percent} production needs |
| required | Production needs {percent} |
| failedIcon | Failed |
| passedIcon | Passed |
| skippedIcon | Skipped |