77``` bash
88bashunit test [path] [options] # Run tests (default)
99bashunit bench [path] [options] # Run benchmarks
10+ bashunit watch [path] [options] # Watch files, re-run tests on change
11+ bashunit assert < fn> < args> # Run standalone assertion
1012bashunit doc [filter] # Show assertion documentation
1113bashunit init [dir] # Initialize test directory
1214bashunit learn # Interactive tutorial
@@ -55,6 +57,10 @@ bashunit test tests/ --parallel --simple
5557| ` -a, --assert <fn> <args> ` | Run a standalone assert function |
5658| ` -e, --env, --boot <file> ` | Load custom env/bootstrap file (supports args) |
5759| ` -f, --filter <name> ` | Only run tests matching name |
60+ | ` --tag <name> ` | Only run tests with matching ` @tag ` (repeatable) |
61+ | ` --exclude-tag <name> ` | Skip tests with matching ` @tag ` (repeatable) |
62+ | ` --output <format> ` | Output format (` tap ` for TAP version 13) |
63+ | ` -w, --watch ` | Watch files and re-run tests on change |
5864| ` --log-junit <file> ` | Write JUnit XML report |
5965| ` -j, --jobs <N> ` | Run tests in parallel with max N concurrent jobs |
6066| ` -p, --parallel ` | Run tests in parallel |
@@ -114,6 +120,66 @@ bashunit test tests/ --filter "user_login"
114120```
115121:::
116122
123+ ### Tags
124+
125+ > ` bashunit test --tag <name> `
126+ > ` bashunit test --exclude-tag <name> `
127+
128+ Filter tests by ` # @tag ` annotations. Both flags are repeatable. ` --tag ` uses OR
129+ logic across names; ` --exclude-tag ` wins when a test matches both.
130+
131+ ::: code-group
132+ ``` bash [Annotate tests]
133+ # @tag slow
134+ function test_heavy_computation() {
135+ ...
136+ }
137+
138+ # @tag integration
139+ function test_api_call() {
140+ ...
141+ }
142+ ```
143+ ``` bash [Run by tag]
144+ bashunit test tests/ --tag slow
145+ bashunit test tests/ --tag slow --tag integration
146+ bashunit test tests/ --exclude-tag integration
147+ ```
148+ :::
149+
150+ ### Output format
151+
152+ > ` bashunit test --output <format> `
153+
154+ Select an alternative output format. Currently supported:
155+
156+ - ` tap ` — [ TAP version 13] ( https://testanything.org/tap-version-13-specification.html ) for CI/CD integrations.
157+
158+ ::: code-group
159+ ``` bash [Example]
160+ bashunit test tests/ --output tap
161+ ```
162+ ``` [Output]
163+ TAP version 13
164+ 1..2
165+ ok 1 - Should validate input
166+ not ok 2 - Should handle errors
167+ ```
168+ :::
169+
170+ ### Watch mode
171+
172+ > ` bashunit test -w|--watch `
173+ > ` bashunit watch [path] `
174+
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.
177+
178+ ::: warning Requirements
179+ - ** Linux:** ` inotifywait ` (` sudo apt install inotify-tools ` )
180+ - ** macOS:** ` fswatch ` (` brew install fswatch ` )
181+ :::
182+
117183### Environment / Bootstrap
118184
119185> ` bashunit test -e|--env|--boot <file> `
@@ -464,6 +530,36 @@ bashunit bench --filter "parse"
464530| ` --skip-env-file ` | Skip ` .env ` loading, use shell environment only |
465531| ` -l, --login ` | Run in login shell context |
466532
533+ ## watch
534+
535+ > ` bashunit watch [path] [test-options] `
536+
537+ Watch ` .sh ` files for changes and automatically re-run tests. Any option
538+ accepted by ` bashunit test ` is also accepted here.
539+
540+ ::: code-group
541+ ``` bash [Examples]
542+ # Watch current directory
543+ bashunit watch
544+
545+ # Watch the tests/ directory
546+ bashunit watch tests/
547+
548+ # Watch and filter by name
549+ bashunit watch tests/ --filter user
550+
551+ # Watch with simple output
552+ bashunit watch tests/ --simple
553+ ```
554+ :::
555+
556+ ::: warning Requirements
557+ - ** Linux:** ` inotifywait ` (` sudo apt install inotify-tools ` )
558+ - ** macOS:** ` fswatch ` (` brew install fswatch ` )
559+
560+ If the required tool is not installed, bashunit prints a clear installation hint.
561+ :::
562+
467563## doc
468564
469565> ` bashunit doc [filter] `
@@ -604,16 +700,18 @@ bashunit --help
604700Usage: bashunit <command> [arguments] [options]
605701
606702Commands:
607- test [path] Run tests (default command)
608- bench [path] Run benchmarks
609- doc [filter] Display assertion documentation
610- init [dir] Initialize a new test directory
611- learn Start interactive tutorial
612- upgrade Upgrade bashunit to latest version
703+ test [path] Run tests (default command)
704+ bench [path] Run benchmarks
705+ assert <fn> <args> Run standalone assertion
706+ doc [filter] Display assertion documentation
707+ init [dir] Initialize a new test directory
708+ learn Start interactive tutorial
709+ watch [path] Watch files and re-run tests on change
710+ upgrade Upgrade bashunit to latest version
613711
614712Global Options:
615- -h, --help Show this help message
616- -v, --version Display the current version
713+ -h, --help Show this help message
714+ -v, --version Display the current version
617715
618716Run 'bashunit <command> --help' for command-specific options.
619717```
@@ -624,6 +722,7 @@ Each subcommand also supports `--help`:
624722``` bash
625723bashunit test --help
626724bashunit bench --help
725+ bashunit watch --help
627726bashunit doc --help
628727```
629728
0 commit comments