Repository navigation
build(nix): resolve BATS helper libraries from the flake - #696
Merged
c-vigo merged 3 commits intoJun 24, 2026
Merged
Conversation
Add bats wrapped with its helper libraries (bats-support, bats-assert, bats-file) to the devTools SSoT and export BATS_LIB_PATH in the dev-shell and the image so bats_load_library resolves the helpers from the Nix store. The npm (node_modules) and Debian (/usr/lib) resolution paths do not exist on the Nix toolchain, which broke the local BATS suite. Refs: #695
Switch every BATS consumer to the flake-provided bats: - test_helper.bash resolves the helper libraries via bats_load_library (BATS_LIB_PATH from the flake), dropping the node_modules and /usr/lib branches. - just test-bats invokes the flake bats instead of npx bats. - remove the now-unused bats* npm dependencies from package.json/lock. - setup-env skips the ad-hoc bats-action under flake provisioning (the flake provides bats); the action remains for non-flake callers. Refs: #695
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
On the Nix toolchain the local BATS suite failed completely — 246 tests, 246
failures — every
.batsfile erroring insetup()withCould not find library 'bats-support'.tests/bats/test_helper.bashresolvedthe helper libraries (
bats-support/-assert/-file) fromnode_modules(npm) or the now-removed Debian
/usr/libpath; on the Nix dev-shell neitherexists,
BATS_LIB_PATHwas unset, andjust test-batsrannpx bats, whichfetches only
bats-core(not the helpers).This PR makes BATS come from the flake (the toolchain SSoT):
batswrapped withits helper libraries is added to
devTools, andBATS_LIB_PATHis exported inthe dev-shell and image so
bats_load_libraryresolves the helpers from the Nixstore. Consumers are switched to the flake
batsand the unusedbats*npmdependencies are removed.
Type of Change
feat-- New featurefix-- Bug fixdocs-- Documentation onlychore-- Maintenance task (deps, config, etc.)refactor-- Code restructuring (no behavior change)test-- Adding or updating testsci-- CI/CD pipeline changesbuild-- Build system or dependency changesrevert-- Reverts a previous commitstyle-- Code style (formatting, whitespace)Modifiers
!) -- This change breaks backward compatibilityChanges Made
flake.nix— addbatsWithLibs(bats wrapped withbats-support,bats-assert,bats-file) to thedevToolsSSoT; exportBATS_LIB_PATHinthe dev-shell (
mkProjectShell) and the image env.tests/bats/test_helper.bash— resolve the helpers viabats_load_library(BATS_LIB_PATHfrom the flake); drop thenode_modulesand
/usr/libbranches.justfile—test-batsinvokes the flakebatsinstead ofnpx bats.package.json/package-lock.json— remove the now-unusedbats,bats-support,bats-assert,bats-filedependencies (keeps@devcontainers/cli)..github/actions/setup-env/action.yml— skip the ad-hocbats-actionand
BATS_LIB_PATHexport underprovision-via-flake(the flake providesbats); the action remains for non-flake callers. Updated the related comments.
tests/test_flake_devshell.py— add parity tests asserting the flakeprovides
batsand thatBATS_LIB_PATHexposes the three helper libraries.CHANGELOG.md(+ synced.devcontainercopy) — Fixed entry.Changelog Entry
Fixed
tests/bats/test_helper.bashresolved the BATS helper libraries (bats-support/-assert/-file) fromnode_modules(npm) or the now-removed Debian/usr/libpath; on the Nix toolchain neither exists locally, so every.batsfile errored insetup()(Could not find library 'bats-support') and all 246 tests failedbatswrapped with its helper libraries to the flakedevToolsSSoT and exportedBATS_LIB_PATHin the dev-shell and image, sobats_load_libraryresolves the helpers from the Nix store; simplifiedtest_helper.bashto that single path, switchedjust test-batsto the flake-providedbats, and removed the now-unusedbats*npm dependencies. CI provisions BATS from the flake underprovision-via-flake(the ad-hocbats-actionsteps now run only for non-flake callers)Testing
just test)Manual Testing Details
nix develop --command just test-batswithnode_modulesremoved: 246/246pass via the flake
bats(previously 246/246 failed).uv run pytest tests/test_flake_devshell.py: 6 passed (includes the newbats parity tests and
bats --versionrunning insidenix develop).shellcheck -x tests/bats/test_helper.bash: clean.nixfmt flake.nix: clean;nix evalofdevShells,packages.devcontainerImage,and
checksall evaluate.jq empty package.json package-lock.jsonandyamllinton the action: clean.Checklist
docs/templates/, then runjust docs)CHANGELOG.mdin the[Unreleased]section (and pasted the entry above)Additional Notes
Sub-issue of the Nix migration epic #625; PR targets the epic branch
feature/625-nix-claude-migration. The remainingnpx batsreferences indocs/issues/anddocs/pull-requests/are archived issue/PR records and wereintentionally left unchanged.
Refs: #695