terra vidhal

Test Runner

Component

About

A test runner with sequential simulated runs, cancel and rerun actions, animated status changes, pass and fail counters, suite states, search, failed-only filtering, expandable errors, flaky reruns and a reset.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Test Runner to your project and fits it to your theme.

Code

How Test Runner is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

"use client";

/**
 * PrequelUI Animate — MIT — https://prequeluianimate.terravidhal.me
 */

import { TestRunner, type TestSuite } from "@/components/ui/test-runner";

const SUITES: TestSuite[] = [
  {
    id: "session",
    name: "Session handling",
    file: "tests/session.test.ts",
    tests: [
      { id: "s1", name: "reads a bearer token", status: "passed", duration: 34 },
      { id: "s2", name: "rejects expired tokens", status: "passed", duration: 41 },
      { id: "s3", name: "refreshes when less than five minutes remain", status: "passed", duration: 88 },
      { id: "s4", name: "returns null for an empty header", status: "passed", duration: 22 },
    ],
  },
  {
    id: "filters",
    name: "Filter bar",
    file: "tests/filter-bar.test.tsx",
    tests: [
      { id: "f1", name: "renders the current value", status: "passed", duration: 61 },
      { id: "f2", name: "calls onChange after typing", status: "passed", duration: 74 },
      { id: "f3", name: "keeps focus while results reload", status: "failed", duration: 132, flaky: true, error: "Expected document.activeElement to be the search input, received <body>." },
      { id: "f4", name: "announces the result count", status: "passed", duration: 58 },
    ],
  },
  {
    id: "billing",
    name: "Billing helpers",
    file: "tests/billing.test.ts",
    tests: [
      { id: "b1", name: "formats invoice totals", status: "passed", duration: 18 },
      { id: "b2", name: "applies a percentage discount", status: "passed", duration: 25 },
      { id: "b3", name: "rounds tax to two decimals", status: "failed", duration: 30, error: "Expected 12.35, received 12.34 in the tax fixture." },
      { id: "b4", name: "skips a zero-value invoice", status: "skipped", duration: 0 },
    ],
  },
];

export default function TestRunnerDemo() {
  return (
    <main className="flex min-h-screen w-full items-start justify-center bg-gradient-to-b from-muted/40 via-background to-background px-4 py-8 sm:px-6">
      <TestRunner suites={SUITES} title="Component test run" />
    </main>
  );
}

Dependencies

More by terra vidhal

View all
  • Project Timeline

    Project Timeline

    30
  • Kanban Board

    Kanban Board

    20
  • Gravity Stars Background

    Gravity Stars Background

    20
  • Booking Calendar

    Booking Calendar

    18
  • Notification Center

    Notification Center

    16
  • Audio Waveform

    Audio Waveform

    16
  • Kpi Counter

    Kpi Counter

    16
  • Topographic Lines

    Topographic Lines

    16

Explore more

Part of PrequelUI Animate — browse the full library on 21st.dev.