---
title: ▶️ Running Tests
description: How to run ZUnit tests — CLI usage, all flags, output modes, and result summary.
canonical_url: https://wiki.zshell.dev/community/zunit/zunit-running-tests
markdown_url: https://wiki.zshell.dev/community/zunit/zunit-running-tests/index.md
locale: en
source_path: community/03_zunit/04_running-tests.mdx
---

<!-- Generated from the canonical Z-Shell Wiki build. The linked human-facing page remains the editorial source of truth. -->

# ▶️ Running Tests

<a id="basic-usage"></a>

## Basic usage

Run the full suite from the project root (ZUnit picks up `.zunit.yml` automatically):

```zunit
zunit
```

Pass a specific file, directory, or glob:

```zunit
zunit tests/example.zunit
zunit tests
zunit 'tests/**/*.zunit'
```

<a id="synopsis"></a>

## Synopsis

```zunit
zunit run [options] [tests...]
```

`zunit` without a subcommand defaults to `zunit run`.

<a id="options"></a>

## Options

<table><thead><tr><th>Flag</th><th>Description</th></tr></thead><tbody><tr><td><code>-h</code>, <code>--help</code></td><td>Print usage and exit</td></tr><tr><td><code>-v</code>, <code>--version</code></td><td>Print version and exit</td></tr><tr><td><code>-f</code>, <code>--fail-fast</code></td><td>Stop immediately after the first failure</td></tr><tr><td><code>-t</code>, <code>--tap</code></td><td>Output results in TAP-compatible format (stdout)</td></tr><tr><td><code>--verbose</code></td><td>Print full output from each test</td></tr><tr><td><code>--output-text</code></td><td>Write a TAP-format text report to the output directory</td></tr><tr><td><code>--output-html</code></td><td>Write an HTML report to the output directory</td></tr><tr><td><code>--allow-risky</code></td><td>Suppress warnings for risky tests (tests with no assertions)</td></tr><tr><td><code>--time-limit &lt;n&gt;</code></td><td>Set a per-test time limit of <code>n</code> seconds</td></tr></tbody></table>

<a id="examples"></a>

## Examples

```zunit
# Stop on first failure
zunit --fail-fast

# TAP output (useful for CI parsers)
zunit --tap tests

# Full output + HTML report
zunit --verbose --output-html tests

# Time-limit each test to 10 seconds
zunit --time-limit 10 tests
```

<a id="result-summary"></a>

## Result summary

After a run, ZUnit prints a table to stdout (unless `--tap` is active):

```text
42 tests run in 1234ms

Results
✔ Passed      38
✘ Failed       2
‼ Errors       1
● Skipped      1
‼ Warnings     0
```

Exit code is `0` when all tests pass, non-zero on any failure or error.

<a id="output-files"></a>

## Output files

When `--output-text` or `--output-html` is used, reports are written to the directory configured under `directories.output` in `.zunit.yml` (default: `tests/_output`).

tip

Combine `--tap` with a TAP reporter (e.g., `tap-junit`) in CI to get structured test result artifacts. See [CI Integration](https://wiki.zshell.dev/community/zunit/zunit-ci/index.md) for ready-to-use workflow examples.
