wiring-bats-testslisted
Install: claude install-skill amarbel-llc/eng
# Wiring bats Tests with Nix Lanes
## Overview
Stand up integration tests under bats inside the nix sandbox: one
derivation per `# bats file_tags=` directive, plus a `bats-default` that
runs everything. Tests exercise real binaries via env-var injection from
the flake, isolate per-test under `BATS_TEST_TMPDIR`, and use
bats-island/bats-emo/bats-assert as the standard helper vocabulary.
**Reference repos** (all under `~/eng/repos/`):
- `tap` — fully on `amarbel-llc/bats`; cleanest separation (bats.nix
as its own file). The **target shape** for new wirings.
- `clown` — simplest stable shape: HTTP fixture with handshake-on-stdout
- `madder` — most mature lane wiring (race + coverage + sftp/webdav
lanes, version burnin), fully on `amarbel-llc/bats`. The worked
example for the `extraBinaries` per-tag binary-fixture overlay
## When to Use
**Bootstrap flow** — repo has no integration tests yet, or only ad-hoc
shell scripts under `tests/`. Add `zz-tests_bats/`, wire `bats.nix`,
expose `bats-default` as a flake check.
**Migration flow** — repo has Go-level `*_test.go` exercising whole
binaries via subprocess. Lift those into bats; keep narrow unit tests in
Go. Tap is mid-migration; use it as the worked example.
**Skip when:**
- Pure library code with no CLI surface — Go's `testing` package is fine
- One-off scripts in `playgrounds/` or `zz-explore/`
- Tests must run on macOS without nix — bats works, but the lane builder assumes `amarbel-llc/nixpkgs`
## Migrating from a