Skip to content

ci: restore full test coverage and remove duplicate e2e stub#121

Merged
sofq merged 2 commits intomainfrom
fix/ci-test-coverage
Apr 18, 2026
Merged

ci: restore full test coverage and remove duplicate e2e stub#121
sofq merged 2 commits intomainfrom
fix/ci-test-coverage

Conversation

@sofq
Copy link
Copy Markdown
Owner

@sofq sofq commented Apr 18, 2026

Summary

  • CI was only running ./internal/..., ./gen/..., and ./test/e2e/ - skipping ./cmd/... (all unit tests) and the canonical root e2e_test.go (100 tests). Expanded to cover those, bringing ~1066 tests back under CI.
  • Removed test/e2e/e2e_test.go (8 tests, all duplicates of root e2e_test.go) and the now-empty test/e2e/ dir.

Test plan

  • go build ./... clean
  • go test ./cmd/... ./internal/... ./gen/... . - 1066 tests pass across 19 packages
  • CI green on this PR

sofq added 2 commits April 18, 2026 14:54
CI was only running ./internal/..., ./gen/..., and ./test/e2e/ -
skipping ./cmd/... (all unit tests) and the canonical root e2e_test.go
(100 tests). Expanded the test invocation to cover those packages,
bringing ~1066 tests back under CI.

Also removed test/e2e/e2e_test.go (8 tests, all duplicates of root
e2e_test.go coverage) and the now-empty test/e2e/ directory.
Five tests passed on macOS but failed on Linux CI once they started
running. Root causes:

- Three template-related cmd tests (TestRunTemplateShow/List/Apply
  _LookupError) and TestBatchTemplateApply_LookupError rely on
  os.UserConfigDir() resolving into t.TempDir(). On Linux it reads
  XDG_CONFIG_HOME first, which on CI points outside the sandbox, so
  the sentinel file meant to trigger a ReadDir error was never
  consulted. Pin XDG_CONFIG_HOME to a path inside tmpHome.

- TestBatchTemplateApply_LookupError only wrote the macOS sentinel
  path. Also write the Linux path (.config/jr/templates).

- internal/template TestList read the real user templates dir with
  no sandboxing, picking up leftover state on CI runners. Override
  userTemplatesDir to a clean t.TempDir() for the duration of the
  test.
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 18, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@sofq sofq merged commit 74ebced into main Apr 18, 2026
15 checks passed
@sofq sofq deleted the fix/ci-test-coverage branch April 18, 2026 08:07
sofq added a commit that referenced this pull request Apr 18, 2026
## Summary
- Codecov dropped from 100% to 8.71% on #121 because expanding CI to
`./cmd/...` pulled in `cmd/generated/` (51k LOC of OpenAPI-generated
commands) at 0% coverage.
- Adds `codecov.yml` to exclude `cmd/generated/**` and `cmd/gendocs/**`
so the ratio reflects hand-written code only.

## Test plan
- [ ] Codecov report on this PR shows restored coverage (~100% on tested
packages)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant