Skip to content

Commit b844f1f

Browse files
committed
docs(cli): clarify watch modes and fix TAP output sample
1 parent 868681b commit b844f1f

File tree

1 file changed

+35
-10
lines changed

1 file changed

+35
-10
lines changed

docs/command-line.md

Lines changed: 35 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -155,29 +155,47 @@ Select an alternative output format. Currently supported:
155155

156156
- `tap`[TAP version 13](https://testanything.org/tap-version-13-specification.html) for CI/CD integrations.
157157

158+
The `TAP version 13` header comes first, each test file is announced via a
159+
`# <path>` diagnostic line, each test emits an `ok <n> - <name>` or
160+
`not ok <n> - <name>` line (failures include a YAML `--- ... ...` block with
161+
expected/actual), and the `1..N` plan line closes the report.
162+
158163
::: code-group
159164
```bash [Example]
160165
bashunit test tests/ --output tap
161166
```
162167
```[Output]
163168
TAP version 13
164-
1..2
169+
# tests/example_test.sh
165170
ok 1 - Should validate input
166171
not ok 2 - Should handle errors
172+
---
173+
Expected 'foo'
174+
but got 'bar'
175+
...
176+
177+
1..2
167178
```
168179
:::
169180

170181
### Watch mode
171182

172183
> `bashunit test -w|--watch`
173-
> `bashunit watch [path]`
174184
175-
Watch `.sh` files for changes and automatically re-run tests. Available as a
176-
flag on `test` or as a dedicated [`watch`](#watch) subcommand.
185+
Watch the test path (plus `src/` if present) and re-run tests when files change.
186+
The `-w`/`--watch` flag uses a lightweight **checksum polling loop** that works
187+
on any system — no external tools required.
177188

178-
::: warning Requirements
179-
- **Linux:** `inotifywait` (`sudo apt install inotify-tools`)
180-
- **macOS:** `fswatch` (`brew install fswatch`)
189+
::: code-group
190+
```bash [Example]
191+
bashunit test tests/ --watch
192+
```
193+
:::
194+
195+
::: tip
196+
For file-event-driven watching (no polling), use the dedicated
197+
[`watch`](#watch) subcommand, which relies on `inotifywait` (Linux) or
198+
`fswatch` (macOS).
181199
:::
182200

183201
### Environment / Bootstrap
@@ -534,8 +552,9 @@ bashunit bench --filter "parse"
534552

535553
> `bashunit watch [path] [test-options]`
536554
537-
Watch `.sh` files for changes and automatically re-run tests. Any option
538-
accepted by `bashunit test` is also accepted here.
555+
Dedicated watch subcommand that uses **OS file-event notifications** (no
556+
polling) to re-run tests as soon as a `.sh` file changes. Any option accepted
557+
by `bashunit test` is also accepted here.
539558

540559
::: code-group
541560
```bash [Examples]
@@ -557,7 +576,13 @@ bashunit watch tests/ --simple
557576
- **Linux:** `inotifywait` (`sudo apt install inotify-tools`)
558577
- **macOS:** `fswatch` (`brew install fswatch`)
559578

560-
If the required tool is not installed, bashunit prints a clear installation hint.
579+
If the required tool is not installed, bashunit prints a clear installation hint
580+
and exits with a non-zero code.
581+
:::
582+
583+
::: tip
584+
If you cannot install `inotifywait` or `fswatch`, use the portable
585+
[`-w/--watch`](#watch-mode) flag on `bashunit test` instead (uses polling).
561586
:::
562587

563588
## doc

0 commit comments

Comments
 (0)