Context
bashunit::unmock is a public helper (src/test_doubles.sh:26) that removes a
mock or spy and cleans up its state files. It is missing from
docs/test-doubles.md — the page a user or agent reads to learn the doubles API.
Where it currently appears:
docs/globals.md:101 — mentioned only in passing, in a note about the
bashunit:: prefix
src/runner.sh:2059 — the runner's own per-test cleanup
tests/unit/coverage_core_test.sh:284 — one real usage in the suite
It is absent from docs/test-doubles.md, docs/public/bashunit-skill.md and
docs/ai-agents.md.
Proposal
Add a ## bashunit::unmock section to docs/test-doubles.md alongside mock and
spy, covering:
- signature
bashunit::unmock "function" and what it removes (the function
override plus the spy's times/params files)
- that it is a no-op for a name that was never mocked
- when you actually need it: the runner already unmocks after each test, so
the case that matters is undoing a double established in
set_up_before_script, or re-mocking the same command differently inside one
test
That last point is the real documentation gap: without it a reader cannot tell
whether they are supposed to call unmock in every tear_down.
Why this matters for agentic coding
The per-test auto-cleanup is invisible from the docs, so an agent reading only
docs/test-doubles.md has two failure modes: adding defensive bashunit::unmock
calls to every tear_down (noise, and it reads as if leakage were a real risk),
or not knowing the helper exists when a set_up_before_script mock genuinely does
leak between tests. Stating the lifecycle once removes both.
Acceptance criteria
Context
bashunit::unmockis a public helper (src/test_doubles.sh:26) that removes amock or spy and cleans up its state files. It is missing from
docs/test-doubles.md— the page a user or agent reads to learn the doubles API.Where it currently appears:
docs/globals.md:101— mentioned only in passing, in a note about thebashunit::prefixsrc/runner.sh:2059— the runner's own per-test cleanuptests/unit/coverage_core_test.sh:284— one real usage in the suiteIt is absent from
docs/test-doubles.md,docs/public/bashunit-skill.mdanddocs/ai-agents.md.Proposal
Add a
## bashunit::unmocksection todocs/test-doubles.mdalongsidemockandspy, covering:bashunit::unmock "function"and what it removes (the functionoverride plus the spy's times/params files)
the case that matters is undoing a double established in
set_up_before_script, or re-mocking the same command differently inside onetest
That last point is the real documentation gap: without it a reader cannot tell
whether they are supposed to call
unmockin everytear_down.Why this matters for agentic coding
The per-test auto-cleanup is invisible from the docs, so an agent reading only
docs/test-doubles.mdhas two failure modes: adding defensivebashunit::unmockcalls to every
tear_down(noise, and it reads as if leakage were a real risk),or not knowing the helper exists when a
set_up_before_scriptmock genuinely doesleak between tests. Stating the lifecycle once removes both.
Acceptance criteria
bashunit::unmockdocumented indocs/test-doubles.mdwith an exampleset_up_before_scriptdoublesdocs/public/bashunit-skill.mdanddocs/ai-agents.mddoublessections
make lintgreen