Repository navigation
Description
Description
All 246 BATS tests fail at load test_helper in the local Nix dev shell, with:
Could not find library 'bats-support' relative to test file or in BATS_LIB_PATH
The failure is environmental, not a problem with the tests themselves — every .bats file errors during setup() before any assertion runs.
Root cause
tests/bats/test_helper.bash resolves the BATS helper libraries (bats-support, bats-assert, bats-file) in three steps:
node_modules/bats-support(local dev)/usr/lib/bats-support(CI viabats-core/bats-action)bats_load_libraryfallback (needsBATS_LIB_PATH)
On the Nix-migration branch none of these resolve locally:
node_modules/is never populated. The helper libs are declared as npm deps inpackage.json, but the Nix-firstjust init/ dev-shell flow no longer runsnpm install/npm ci.just test-batsinvokesnpx bats, which auto-fetches onlybats-coreinto the npx cache — not the three helper libraries./usr/lib/bats-*is gone — that path was the Debian build path, decommissioned in this migration (1d4e9db).BATS_LIB_PATHis unset in the dev shell, so thebats_load_libraryfallback also fails.
CI is unaffected: .github/actions/setup-env installs the libs to /usr/lib via bats-core/bats-action and exports BATS_LIB_PATH, and test-project runs the bats binary directly. The gap is local-only.
Steps to Reproduce
- Enter the Nix dev shell on
feature/625-nix-claude-migrationwith nonode_modules/present. - Run
just test-bats(ornpx bats tests/bats/). - Every test errors with the
bats-supportnot-found message.
Expected Behavior
just test-bats runs the suite locally in the Nix dev shell without manual setup.
Actual Behavior
246 tests, 246 failures — all fail in setup() at load test_helper because the helper libraries cannot be found.
Environment
- OS: NixOS (Nix dev shell)
- Branch:
feature/625-nix-claude-migration - bats: via
npx bats(1.13.0 frompackage.json);batsnot onPATH, not in the flake node_modules/absent;BATS_LIB_PATHempty
Verification
Running npm ci populates node_modules/{bats,bats-support,bats-assert,bats-file}; afterwards the first resolution branch in test_helper.bash succeeds and the suite passes (e.g. worktree-claude-cli.bats → 5/5 ok). This confirms the diagnosis.
Possible Solution
Pick one (the migration intent should decide):
- Add bats + helper libs to the flake (consistent with "Nix-first" for the rest of the toolchain) and have
test_helper.bashresolve them viaBATS_LIB_PATH/Nix store. Removes the npm dependency for local testing. - Make
just test-bats(orjust init) ensurenode_modulesis installed (npm ci) before running, keeping the existing npm-based resolution. Lowest-effort; matches the currentpackage.jsoncomment that BATS "keeps its npm config".
Option 1 aligns better with the #625 migration goal; option 2 is a quick unblock.
Changelog Category
Fixed
Refs: #625
Activity
test(nix): assert flake provides bats with resolvable helper libs
build(nix): provide bats + helper libraries from the flake
build(nix): resolve bats via flake BATS_LIB_PATH; drop npm bats deps
build(nix): resolve BATS helper libraries from the flake (#696)
c-vigo commentedon Jun 30, 2026
Resolved by #696 (36ee161) on the Nix-migration branch (epic #625, PR #670). Closing as part of post-merge backlog hygiene (#677).
chore: release 0.4.0 (#195)
chore: release 0.4.0 (#813)