fix(test): configure git user.email/name in integration setup#13
Merged
Conversation
Integration test "returns undefined on detached HEAD" calls `git commit --allow-empty`. That fails on CI runners without a global user.email/user.name configured — `.quiet()` hides the error, so the subsequent checkout --detach has no commit to detach to, HEAD stays on main, and the test assertion fails. Set identity locally on the test repo in beforeAll so every commit works regardless of ambient git config. Verified by running the tests with GIT_CONFIG_GLOBAL=/dev/null (simulates a bare CI runner).
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.
Summary
Main is red because the detached-HEAD integration test calls `git commit --allow-empty` without setting `user.email` / `user.name`. On my machine that's fine (globally configured); on CI runners it isn't. `.quiet()` suppresses the failure, so the subsequent `git checkout --detach` has no commit to detach to, HEAD stays on main, and the assertion fails.
Fix: set identity locally on the test repo in `beforeAll`, so every `git commit` in the suite works regardless of ambient config. Chose repo-local config over global so we don't leak test identity into a contributor's shell.
Verification
```sh
GIT_CONFIG_GLOBAL=/dev/null bun test src/shared/repository/
```
Simulates a bare CI runner with no global git config. All 15 tests pass.
Why this slipped past local dev
Locally everyone (including agents running under my env) has `user.email` globally set. The CI runner is the first environment without it. Worth remembering for any future `git commit` in integration tests — prefer explicit local config over ambient.