# Test Results Errors Example

> Example implementation of test results-errors.

A shadcn/ui block from the [@ai-elements](https://ai-sdk.dev/elements) registry, listed on [shadcn.exchange](https://shadcn.exchange/r/ai-elements/example-test-results-errors).

- Page, with a live preview: https://shadcn.exchange/r/ai-elements/example-test-results-errors
- Screenshot: https://abzjhwgwpdpz7ua5.public.blob.vercel-storage.com/shots/ai-elements/example-test-results-errors-light-62ab202c1fc3cfb4.png
- Registry item: https://ai-sdk.dev/elements/api/registry/example-test-results-errors.json
- Listed: 2026-10-13, source last changed 2026-10-13

## Install

```bash
npx shadcn@latest add https://ai-sdk.dev/elements/api/registry/example-test-results-errors.json
```

Run it in a project that has shadcn/ui set up. It adds the files below and installs what they depend on.

## Dependencies

- Registry items: `https://elements.ai-sdk.dev/test-results.json`

## Files

### `registry/default/examples/test-results-errors.tsx`

```tsx
"use client";

import {
  Test,
  TestError,
  TestErrorMessage,
  TestErrorStack,
  TestResults,
  TestResultsContent,
  TestResultsHeader,
  TestResultsSummary,
  TestSuite,
  TestSuiteContent,
  TestSuiteName,
} from "@/components/ai-elements/test-results";

const stackTrace = `    at Object.<anonymous> (/app/src/api.test.ts:45:12)
    at Module._compile (node:internal/modules/cjs/loader:1369:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1427:10)`;

const Example = () => (
  <TestResults
    summary={{
      duration: 130,
      failed: 1,
      passed: 1,
      skipped: 0,
      total: 2,
    }}
  >
    <TestResultsHeader>
      <TestResultsSummary />
    </TestResultsHeader>
    <TestResultsContent>
      <TestSuite defaultOpen name="API" status="failed">
        <TestSuiteName />
        <TestSuiteContent>
          <Test duration={45} name="should fetch data" status="passed" />
          <Test duration={85} name="should update" status="failed">
            <TestError>
              <TestErrorMessage>Expected 200, got 500</TestErrorMessage>
              <TestErrorStack>{stackTrace}</TestErrorStack>
            </TestError>
          </Test>
        </TestSuiteContent>
      </TestSuite>
    </TestResultsContent>
  </TestResults>
);

export default Example;
```
