Problem
A project with more than one tier of tests has no way to name those tiers. bashunit's own repo is the example: tests/unit, tests/functional, tests/acceptance, tests/benchmark, each wanting different options — and the way you select between them is a Makefile plus remembered flags.
.bashunitrc already exists (src/config/env.sh:82load_config_file), but it only sets global defaults. There is no way to express "the unit suite is this path with these options".
Proposal
Named suites in .bashunitrc, plus a flag to select one:
[suite:unit]paths = tests/unit
parallel = true
[suite:acceptance]paths = tests/acceptance
parallel = false
test_timeout = 60
[suite:ci]paths = tests/unit tests/functional
tags = !slow
--suite <name> Run a named suite from .bashunitrc (repeatable)
--list-suites Print the defined suite names and exit
Precedence, to be documented and tested: CLI flags > suite settings > global .bashunitrc settings > .env > built-in defaults.
The exact file syntax is open — pick whatever parses cleanly in Bash 3.0 without declare -A and stays consistent with how .bashunitrc reads today. INI-style sections are the suggestion, not a requirement.
Where to change
src/config/env.sh:82load_config_file and the surrounding precedence chain.src/main/test.sh, src/main/validate.sh:60.
Acceptance criteria
Repo checklist (agent)
- TDD: RED → GREEN → REFACTOR. Write the failing test first.
- Bash 3.0+ only: no
printf -v, no += append, no declare -A, no [[ ]], no ${var,,}, no &>>, no ${arr[-1]}. Expanding a possibly-empty array under set -u needs ${arr[@]+"${arr[@]}"}. - A new CLI flag must be wired in all of these or a parity test fails:
- Gates:
make sa, make lint, ./bashunit tests/, ./bashunit --parallel tests/. Never run shfmt -w. - Docs: update
docs/command-line.md. Editing docs/assertions.md invalidates the bashunit doc acceptance snapshot — regenerate it. - CHANGELOG.md: add one line under
## Unreleased. - Fixtures under
tests/acceptance/fixtures/ must not end in *test.sh. - One issue = one PR.
Problem
A project with more than one tier of tests has no way to name those tiers. bashunit's own repo is the example:
tests/unit,tests/functional,tests/acceptance,tests/benchmark, each wanting different options — and the way you select between them is aMakefileplus remembered flags..bashunitrcalready exists (src/config/env.sh:82load_config_file), but it only sets global defaults. There is no way to express "theunitsuite is this path with these options".Proposal
Named suites in
.bashunitrc, plus a flag to select one:Precedence, to be documented and tested: CLI flags > suite settings > global
.bashunitrcsettings >.env> built-in defaults.The exact file syntax is open — pick whatever parses cleanly in Bash 3.0 without
declare -Aand stays consistent with how.bashunitrcreads today. INI-style sections are the suggestion, not a requirement.Where to change
src/config/env.sh:82load_config_fileand the surrounding precedence chain.src/main/test.sh,src/main/validate.sh:60.Acceptance criteria
--suite unitruns only that suite's paths with its options--suite a --suite bruns the union of their paths--list-suitesprints the names and exits 0--suiteis either an error or documented precedence — decide, document, test.bashunitrcwith no suite sections behaves exactly as todaydeclare -A)Makefiletargets are migrated to--suitein the same PR as the dogfood proofdocs/configuration.md; acceptance coverage alongsidetests/acceptance/bashunit_bashunitrc_test.shRepo checklist (agent)
printf -v, no+=append, nodeclare -A, no[[ ]], no${var,,}, no&>>, no${arr[-1]}. Expanding a possibly-empty array underset -uneeds${arr[@]+"${arr[@]}"}.src/main/test.sh(report-style flags needexport -n, seesrc/main/test.sh:188-196for why)bashunit::main::validate_config_or_exit(src/main/validate.sh:60) — unvalidated input used to run the wrong thing and exit 0 (Unknown options are silently ignored: a typo'd flag runs a different suite and exits 0 #871, --jobs with a non-integer value hangs on Bash 3.x and is silently ignored on Bash 4.3+ #873)src/config/env.shand a documented line in.env.example--helptext in the same block it belongs tocompletions/bashunit.bashandcompletions/_bashunit(anti-drift test feat(cli): bash and zsh completion scripts with an anti-drift test #778 fails otherwise)make sa,make lint,./bashunit tests/,./bashunit --parallel tests/. Never runshfmt -w.docs/command-line.md. Editingdocs/assertions.mdinvalidates thebashunit docacceptance snapshot — regenerate it.## Unreleased.tests/acceptance/fixtures/must not end in*test.sh.