test: add unit tests for lib/git.ts (22 tests)#117
Open
TerminalGravity wants to merge 3 commits intomainfrom
Open
test: add unit tests for lib/git.ts (22 tests)#117TerminalGravity wants to merge 3 commits intomainfrom
TerminalGravity wants to merge 3 commits intomainfrom
Conversation
Collaborator
Author
|
Nice — 22 tests for the core git module is solid coverage. Good to see the edge cases (SIGTERM, ENOENT, stderr fallback) tested. Once #116 lands with the new |
This was referenced Mar 5, 2026
TerminalGravity
commented
Mar 5, 2026
Collaborator
Author
TerminalGravity
left a comment
There was a problem hiding this comment.
22 tests for git.ts — great coverage. The vi.mock isolation is exactly right for this kind of lib. CI green on both Node 20 and 22. This is ready to merge. 🚀
f66a890 to
1f2a483
Compare
1f2a483 to
a2ab791
Compare
…tools Fixes the remaining tools listed in #215 where run() was being called with shell syntax (pipes, redirects, non-git commands). run() uses execFileSync('git', args) — no shell, always prepends 'git'. Changes: - Add shell() helper to src/lib/git.ts (execSync with shell support) - verify-completion: use shell() for tsc/build, readFileSync for package.json, array args for git diff - clarify-intent: use shell() for tsc and find commands - session-handoff: use shell() for command -v and gh pr list - audit-workspace: use run() with array args for git diff, shell() for find - sharpen-followup: use run() with array args for git diff/status - enrich-agent-task: use shell() for piped git ls-files, readFileSync for head - sequence-tasks: use shell() for piped git ls-files - checkpoint: use run() with array args for git add/reset, shell() for compound command - scope-work: use run() with array args for git status/diff, shell() for piped ls-files Closes #215
Shows real input/output examples for preflight_check, prompt_score, scope_work, estimate_cost, log_correction, and search_history. Includes workflow tip for automatic preflight via CLAUDE.md.
Covers run(), shell(), and all convenience functions including error handling, timeout behavior, fallback logic in getDiffFiles and getDiffStat.
a2ab791 to
c3e0b53
Compare
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.
Adds comprehensive test coverage for
src/lib/git.ts— the core module every tool depends on.22 tests covering:
run(): array args, string splitting, timeout handling, stderr fallback, ENOENT, generic failuresshell(): basic execution, error handling, custom timeoutgetBranch,getStatus,getRecentCommits,getLastCommit,getLastCommitTime,getStagedFilesgetDiffFiles()andgetDiffStat()