test: add 38 unit tests for lib/git.ts and lib/files.ts#203
Open
TerminalGravity wants to merge 3 commits intomainfrom
Open
test: add 38 unit tests for lib/git.ts and lib/files.ts#203TerminalGravity wants to merge 3 commits intomainfrom
TerminalGravity wants to merge 3 commits intomainfrom
Conversation
- examples/.preflight/config.yml — profile, related projects, thresholds, embeddings - examples/.preflight/triage.yml — keyword rules and strictness tuning - examples/.preflight/contracts/api.yml — manual cross-service contract definitions - examples/README.md — quick setup instructions - README.md — link to examples from config reference section
Covers run() with array/string args, timeout handling, error paths (ENOENT, stderr, SIGTERM, killed), plus all convenience functions (getBranch, getStatus, getDiffFiles fallback logic, getDiffStat, etc.) Increases test count from 43 to 69.
Tests readIfExists (null handling, line limits, binary rejection) and findWorkspaceDocs (return shape, metadataOnly, 40-line cap). Total test count: 43 → 81.
TerminalGravity
commented
Mar 10, 2026
Collaborator
Author
TerminalGravity
left a comment
There was a problem hiding this comment.
Tests look comprehensive — good coverage on run() edge cases (timeout, SIGTERM, stderr fallback) and the getDiffFiles/getDiffStat fallback chains.
One thing: this PR also includes the examples/.preflight/ directory and README changes that belong in #201. Can you rebase to drop those files and keep this test-only?
This was referenced Mar 10, 2026
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 test coverage for two core untested lib modules.
lib/git.ts (26 tests)
run(): array/string args, output trimming, custom/default timeouts3 → HEAD1 → 'no commits'), getDiffStat (HEAD5 → HEAD3 → fallback)lib/files.ts (12 tests)
readIfExists: missing files, text reading, line limits, binary rejection (null bytes)findWorkspaceDocs: return shape, metadataOnly mode, 40-line content capPROJECT_DIR: export validationTest count: 43 → 81 (all green)