Skip to main content

Test Results

A live test runner report with RollingDigits summary pills, spring-morphing segmented progress bar, collapsible test suites, staggered rows, and failure stack details.

5passed1skipped
157ms
passedclamps speed multiplier bounds14ms
passedsettles collapse spring smoothly42ms
passedhonors reduced-motion override18ms

Customize

Speed0.45
Blur reveal (px)8
Test row stagger (ms)95

Installation

npx shadcn@latest add @kinetic/test-results

Usage

Compose TestResults, TestResultsHeader, TestResultsSummary, TestResultsDuration, TestResultsProgress, TestResultsContent, TestSuite, TestSuiteContent, Test, and TestError.

import {
  Test,
  TestError,
  TestErrorMessage,
  TestResults,
  TestResultsContent,
  TestResultsDuration,
  TestResultsHeader,
  TestResultsProgress,
  TestResultsSummary,
  TestSuite,
  TestSuiteContent,
} from "@/components/kinetic/ui/test-results";

export function SuiteReport() {
  return (
    <TestResults summary={{ passed: 4, failed: 1, skipped: 1, total: 6, duration: 420 }}>
      <TestResultsHeader>
        <TestResultsSummary />
        <TestResultsDuration />
      </TestResultsHeader>
      <TestResultsProgress />
      <TestResultsContent>
        <TestSuite name="tests/unit/registry.test.ts">
          <TestSuiteContent>
            <Test name="validates item dependencies" status="passed" duration={48} />
            <Test name="rewrites consumer imports" status="failed" duration={92}>
              <TestError>
                <TestErrorMessage>Expected rewritten specifier to match @/lib/</TestErrorMessage>
              </TestError>
            </Test>
            <Test name="writes cache snapshot" status="skipped" />
          </TestSuiteContent>
        </TestSuite>
      </TestResultsContent>
    </TestResults>
  );
}

Live counters, suites, and failure stacks

TestResults computes summary counts automatically from nested Test items or accepts an explicit summary object for live streaming runs. TestSuite expands automatically when any child Test fails, while TestStatus renders drawStroke checkmarks on passed, a shake warning on failed, and a rotating SpinnerIcon on running.

import {
  Test,
  TestError,
  TestErrorMessage,
  TestErrorStack,
  type TestResultStatus,
  TestResults,
  TestResultsContent,
  TestResultsDuration,
  TestResultsHeader,
  TestResultsProgress,
  TestResultsSummary,
  type TestSummaryData,
  TestSuite,
  TestSuiteContent,
  TestSuiteName,
  TestSuiteStats,
} from "@/components/kinetic/ui/test-results";

interface SuiteCaseItem {
  readonly id: string;
  readonly name: string;
  readonly status: TestResultStatus;
  readonly duration?: number;
  readonly errorMessage?: string;
  readonly errorStack?: string;
}

interface LiveSuiteReportProps {
  readonly suiteName: string;
  readonly summary: TestSummaryData;
  readonly cases: readonly SuiteCaseItem[];
}

export function LiveSuiteReport({ suiteName, summary, cases }: LiveSuiteReportProps) {
  return (
    <TestResults summary={summary}>
      <TestResultsHeader>
        <TestResultsSummary />
        <TestResultsDuration />
      </TestResultsHeader>
      <TestResultsProgress />
      <TestResultsContent>
        <TestSuite>
          <TestSuiteName>{suiteName}</TestSuiteName>
          <TestSuiteStats />
          <TestSuiteContent>
            {cases.map((item) => (
              <Test key={item.id} name={item.name} status={item.status} duration={item.duration}>
                {item.errorMessage ? (
                  <TestError>
                    <TestErrorMessage>{item.errorMessage}</TestErrorMessage>
                    {item.errorStack ? <TestErrorStack>{item.errorStack}</TestErrorStack> : null}
                  </TestError>
                ) : null}
              </Test>
            ))}
          </TestSuiteContent>
        </TestSuite>
      </TestResultsContent>
    </TestResults>
  );
}

Motion preferences

TestResults defaults to speed={0.45}, blurPx={8}, and staggerMs={95}. Under reduced motion, RollingDigits counters, segmented SPRING.morph progress widths, suite collapse springs, row staggers, spinners, and failure shakes settle immediately.

API Reference

TestResults

Zero-dependency test report root coordinating summary counts, spring bars, RollingDigits readouts, and motion prefs.

PropTypeDefaultDescription
summaryTestSummaryData-Live summary metrics ({ passed, failed, skipped?, total?, duration? }).
animated / speed / blurPx / staggerMsboolean / number / number / numbertrue / 0.45 / 8 / 95Controls motion activation, speed scale, initial blur (px), and test row stagger (ms).

TestResultsHeader / TestResultsSummary / TestResultsDuration / TestResultsProgress / TestResultsContent

RollingDigits summary pills, duration readout, and SPRING.morph segmented progress bar.

PropTypeDefaultDescription
passed / failed / skipped / total (TestResultsSummary / TestResultsProgress)number / number / number / numberinheritedExplicit metric overrides animating via RollingDigits and spring segments.
duration (TestResultsDuration)numberinheritedDuration in ms rendered smoothly via RollingDigits.

TestSuite / TestSuiteName / TestSuiteStats / TestSuiteContent

useAnimatedSize collapsible suite with overshoot chevron and staggered Test rows.

PropTypeDefaultDescription
name / status / open / defaultOpen / onOpenChange (TestSuite)React.ReactNode / TestResultStatus / boolean / boolean / (open: boolean) => voidauto (open on failure)Suite title, status, and controlled or failure-aware default open state.
animated / speed / blurPx / staggerMs / keepMounted / disabled (TestSuite)boolean / number / number / number / boolean / booleaninherited / false / falseSuite-level motion overrides, DOM retention, and trigger lock.

Test / TestStatus / TestName / TestDuration

Staggered test row with drawStroke check (passed), shake (failed), and WAAPI spinner (running).

PropTypeDefaultDescription
name / status / duration (Test)React.ReactNode / "passed" | "failed" | "skipped" | "running" / number- / "passed" / undefinedTest title, execution state, and duration readout.

TestError / TestErrorMessage / TestErrorStack

Failure banner and preformatted stack trace block.

This component forwards standard HTML element attributes without extra custom props.