fix(tests): exclude build/ from bats test discovery #141

Merged
Defame1297 merged 1 commits from fix/bats-repo-root-resolution into main 2026-09-25 14:13:21 +00:00
Collaborator

Summary

  • tests/run-bats.sh's test-discovery walk excluded apm_modules/ and .claude/skills/ (apm-installed copies of the same *.bats files, one directory level shallower than their plugins/*/.apm/ source) but was missing the same exclusion for build/ — the apm pack staging output, which hits the identical failure mode from a different apm subcommand.
  • A stray local apm pack run leaves build/<package>-<version>/ on disk (gitignored, regenerable). Its staged .bats copies carry the same hardcoded six-levels-up REPO_ROOT walk in each test's setup(), which overshoots the real repo root when run from the shallower build/ layout and fails to find the tests/test_helper/bats-support submodule — silently doubling the suite (846 tests instead of 423) with 423 of them failing.
  • Added -not -path "*/build/*" to the find walk and the matching git ls-files grep exclusion, mirroring the existing apm_modules//.claude/skills/ entries.
  • Extended tests/test-run-bats.sh with a regression case following the same pattern as the existing exclusion-bug fixtures.

Verification

  • bash tests/run-bats.sh (with a stray build/holocron-*/ still on disk): 846/423-failing → 423/0-failing after the fix.
  • bash tests/run-tests.sh --strict (the actual run-tests pre-commit/pre-push hook entry): exit 0, === Summary: 21 passed, 0 skipped, 0 failed ===.
  • bash tests/test-run-bats.sh: 15 passed, 0 failed (was 14).
  • apm audit --ci and apm pack --check-clean: pass.
  • Pushed and verified against the live pre-push gate on git.rkdr.net.

Test plan

  • bash tests/run-tests.sh --strict passes
  • bash tests/test-run-bats.sh passes with the new case
  • apm audit --ci / apm pack --check-clean pass

Unrelated to and independent of the separate chore/git-host-migration PR.

🤖 Generated with Claude Code

https://claude.ai/code/session_011EBLjPSWgt4N5Q47sH8bSV

## Summary - `tests/run-bats.sh`'s test-discovery walk excluded `apm_modules/` and `.claude/skills/` (apm-installed copies of the same `*.bats` files, one directory level shallower than their `plugins/*/.apm/` source) but was missing the same exclusion for `build/` — the `apm pack` staging output, which hits the identical failure mode from a different apm subcommand. - A stray local `apm pack` run leaves `build/<package>-<version>/` on disk (gitignored, regenerable). Its staged `.bats` copies carry the same hardcoded six-levels-up `REPO_ROOT` walk in each test's `setup()`, which overshoots the real repo root when run from the shallower `build/` layout and fails to find the `tests/test_helper/bats-support` submodule — silently doubling the suite (846 tests instead of 423) with 423 of them failing. - Added `-not -path "*/build/*"` to the `find` walk and the matching `git ls-files` grep exclusion, mirroring the existing `apm_modules/`/`.claude/skills/` entries. - Extended `tests/test-run-bats.sh` with a regression case following the same pattern as the existing exclusion-bug fixtures. ## Verification - `bash tests/run-bats.sh` (with a stray `build/holocron-*/` still on disk): 846/423-failing → 423/0-failing after the fix. - `bash tests/run-tests.sh --strict` (the actual `run-tests` pre-commit/pre-push hook entry): exit 0, `=== Summary: 21 passed, 0 skipped, 0 failed ===`. - `bash tests/test-run-bats.sh`: 15 passed, 0 failed (was 14). - `apm audit --ci` and `apm pack --check-clean`: pass. - Pushed and verified against the live pre-push gate on `git.rkdr.net`. ## Test plan - [x] `bash tests/run-tests.sh --strict` passes - [x] `bash tests/test-run-bats.sh` passes with the new case - [x] `apm audit --ci` / `apm pack --check-clean` pass Unrelated to and independent of the separate `chore/git-host-migration` PR. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_011EBLjPSWgt4N5Q47sH8bSV
Claude added 1 commit 2026-09-25 14:07:55 +00:00
Why
tests/run-bats.sh's discovery walk already excludes apm_modules/ and
.claude/skills/ because those hold apm-installed copies of the same
*.bats files one directory level shallower than their plugins/*/.apm/
source, which overshoots the hardcoded six-levels-up REPO_ROOT walk
each test's setup() does and fails to find the bats-support helper.
build/ was missing the same exclusion: apm pack stages an identical
copy under build/<package>-<version>/ before archiving, hitting the
exact same failure mode from a different apm subcommand. A stray
local `apm pack` run leaves that directory on disk (gitignored,
regenerable) and silently doubles the suite (846 tests instead of
423) with 423 of them failing.

Implementation Notes
Added `-not -path "*/build/*"` to the find walk and the matching
git ls-files grep exclusion, mirroring the existing apm_modules/ and
.claude/skills/ entries. Extended tests/test-run-bats.sh with a case
following the same pattern as the existing exclusion-bug fixtures.

Impact
Unblocks the run-tests pre-commit/pre-push hook for any checkout that
has ever run a bare `apm pack` locally.
Defame1297 merged commit 4357da5b4d into main 2026-09-25 14:13:21 +00:00
Defame1297 deleted branch fix/bats-repo-root-resolution 2026-09-25 14:13:21 +00:00
Sign in to join this conversation.