Testing and coverage
Test layout, the injection fakes, and the coverage gate.
Test layout
Every package carries tests next to the code:
| Package | Test files |
|---|---|
cmd/agore-skill | main_test.go |
internal/cli | cli_test.go |
internal/config | config_test.go |
internal/workspace | discover_test.go |
internal/skill | parser_test.go, templates_test.go |
internal/filefilter | filefilter_test.go |
internal/inspect | analyzer_test.go |
internal/lint | rules_test.go |
internal/release | release_test.go, bundle_more_test.go, github_test.go, github_more_test.go |
internal/ui | render_test.go |
Style: table-driven tests, exact message matching, and — for the CLI —
end-to-end command runs against a fake App.
The three test layers
- Unit tests (
mise run test) — package-local, fast, deterministic. - Command tests —
internal/clidrives each command through cobra with an injected fakeApp: captured writers, fake git helpers (ChangedFiles,DescribeTag,WorkingTreeClean,RemoteURL), fakeLookPath/Getenv/RunCommand, prompt fakes, andPublishGitHubstubs. No real TTY, no real network. - End-to-end (
scripts/e2e.sh,mise run e2e) — the real binary in a temp directory through the whole lifecycle, verifying archive contents, checksums, SKILL.md immutability and no repository leakage.
A cross-package invariant: the lint package asserts that all three embedded scaffold templates lint with 0 errors and 0 warnings — the contract the user tutorials rely on.
Commands
mise run test # go test ./...
mise run test:race # go test -race ./...
mise run vet # go vet ./...The coverage gate
mise run coverscripts/coverage.sh runs tests with
-covermode=atomic -coverprofile and parses go tool cover -func for the
total. It fails below 90.0% (COVERAGE_MIN env var to change), and the
profile path is COVERAGE_PROFILE (default coverage.out, gitignored).
Current total statement coverage: run the script — it prints the total and enforces the gate, which is the contract that matters.
In CI, the quality job runs the same gate and uploads coverage.out as
an artifact (14 days retention); the upload step is skipped in local act
runs (if: ${{ !env.ACT }}) because act's artifact server does not
implement the upload-artifact@v7 protocol.
Related
- Why everything is injectable: Testability and injection
- The e2e script stage by stage: How to run the e2e tests