Skip to Content
agore-skill
Reference

Testing and coverage

Test layout, the injection fakes, and the coverage gate.

Test layout

Every package carries tests next to the code:

PackageTest files
cmd/agore-skillmain_test.go
internal/clicli_test.go
internal/configconfig_test.go
internal/workspacediscover_test.go
internal/skillparser_test.go, templates_test.go
internal/filefilterfilefilter_test.go
internal/inspectanalyzer_test.go
internal/lintrules_test.go
internal/releaserelease_test.go, bundle_more_test.go, github_test.go, github_more_test.go
internal/uirender_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

  1. Unit tests (mise run test) — package-local, fast, deterministic.
  2. Command tests — internal/cli drives each command through cobra with an injected fake App: captured writers, fake git helpers (ChangedFiles, DescribeTag, WorkingTreeClean, RemoteURL), fake LookPath/Getenv/RunCommand, prompt fakes, and PublishGitHub stubs. No real TTY, no real network.
  3. 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 cover

scripts/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.

On this page