Test Results
A test run with suites, tests and failure output. Failures expand by default and passes stay collapsed — nobody opens a report to read what passed.
src/components/ui/test-results.tsxAbout
From the component's own source, where it was written.
A test run: suites, their tests, and the output of anything that failed.
Failures are expanded by default and passes are collapsed. Nobody opens a test report to read what passed — the useful default is the one that puts the failure output on screen without a click.
Suite state is derived from its tests rather than passed in, so a suite cannot claim to pass while containing a failure.
Install
npx astralyx-ui add test-results
Usage
import { TestResults } from '@/components/ui/test-results'
<TestResults suites={suites} />Composer
Change the props and the source below follows.
- keeps radius under half the control height0sexpected 20 to be less than 18at styles.test.ts:41:22
- every colour set defines six variables0s
<TestResults suites={suites} />Examples
Run
<TestResults suites={suites} />API
Generated from the source, so it cannot fall behind the code. One table per exported component, then hooks, functions and types.
TestResults
Extends ComponentProps<'div'>.
| Prop | Type | Default | Description |
|---|---|---|---|
| suites | TestSuite[] | required | { id, name, tests } where a test is { id, name, status, duration?, error? }. |
Functions
| Function | Signature | Description |
|---|---|---|
| suiteStatus | (suite: TestSuite) => TestStatus | Exported roll-up. Derived, so a suite cannot claim to pass while containing a failure. |
Types
TestCase
| Field | Type | Description |
|---|---|---|
| id | string | — |
| name | string | — |
| status | TestStatus | — |
| duration? | number | Seconds. |
| error? | ReactNode | Rendered under the test on a tinted ground — a Terminal, usually. |
TestSuite
| Field | Type | Description |
|---|---|---|
| id | string | — |
| name | string | — |
| tests | TestCase[] | — |
| Type | Definition | Description |
|---|---|---|
TestStatus | 'passed' | 'failed' | 'skipped' | 'running' | A test run: suites, their tests, and the output of anything that failed. |