You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
test(git-utils): build the .git-as-file fixture from resolve() so it passes on Windows - #727
This fixes the red Unit Tests (Windows) on main left by #257. The findGitRoot ".git as a file" test now builds its fixture from resolve(), so on Windows it carries the same drive letter as the path the walker resolves.
flowchart LR
F["fixture: resolve('/wt') + .git"] --> W["findGitRoot(resolve('/wt')/pkg)"]
W --> C["compares against the resolved .git path (D:\\wt\\.git on Windows)"]
C --> OK["returns resolve('/wt')"]
Loading
Before, on main's Windows job:
FAIL src/lib/git-utils.test.ts > findGitRoot > treats .git as a file (worktree or submodule) the same as a directory
AssertionError: expected null to be 'D:\wt'
After, locally (macOS; Windows runs in this PR's CI):
$ npx vitest run src/lib/git-utils.test.ts
Tests 30 passed (30)
Test-only change.
Summary by CodeRabbit
Tests
Updated Git root test paths to support resolved paths on Windows.
…passes on Windows
The findGitRoot test compared against join('/wt', '.git'), which lacks the
drive letter the resolved walk produces on Windows, so Unit Tests (Windows)
failed on main after #257.
No merge-blocking risk remains from this test-only path fixture update.
Pre-merge checks: 5
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title clearly describes the test-only change: building the .git-as-file fixture from resolve() to fix Windows path handling.
Linked Issues check
[#726] The issue requires the findGitRoot ".git as a file" test fixture to use the drive-letter path that the walker resolves on Windows. At head, the test builds wt = resolve('/wt') and sets `mockE…
Out of Scope Changes check
The whole-PR diff (merge base d9d942f to head 6e4949f) changes only src/lib/git-utils.test.ts, in the single 'treats .git as a file' test. The edits replace the hard-coded /wt fixture paths with val…
Docstring Coverage
No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Full details: Linked Issues check
Explanation
[#726] The issue requires the findGitRoot ".git as a file" test fixture to use the drive-letter path that the walker resolves on Windows. At head, the test builds wt = resolve('/wt') and sets mockExists to match join(wt, '.git'). It calls findGitRoot(join(wt, 'pkg'), ...) and expects wt. findGitRoot (src/lib/git-utils.ts) applies resolve(dir) and then checks join(current, '.git') while walking up. On Windows, resolve('/wt') yields D:\wt, so the mock matches the walker's D:\wt\.git probe and the expected value equals the returned root. On POSIX, resolve('/wt') returns /wt, so the behavior is unchanged. The change does not alter the production code path, which the issue states is correct. The author reports a local macOS run (30 passed). The Windows CI result was not available to this assessment; the PASS rests on code analysis of the fixture and walker.
Full details: Out of Scope Changes check
Explanation
The whole-PR diff (merge base d9d942f to head 6e4949f) changes only src/lib/git-utils.test.ts, in the single 'treats .git as a file' test. The edits replace the hard-coded /wt fixture paths with values derived from resolve('/wt') and add a comment explaining the reason. These edits implement the objective of #726 directly. No production code, other tests, or unrelated files are changed. The import of resolve is already used by the test's expectation, so no unrelated dependency change is present.
Full details: Docstring Coverage
Explanation
No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 1 files.
Finishing Touches
Generate docstrings
Commit to this branch
Create a new PR
Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Reviewing files that changed from the base of the PR and between d9d942f and 6e4949f.
Files selected for processing: 1
src/lib/git-utils.test.ts
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.
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
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.
This fixes the red
Unit Tests (Windows)on main left by #257. ThefindGitRoot".git as a file" test now builds its fixture fromresolve(), so on Windows it carries the same drive letter as the path the walker resolves.Closes #726.
flowchart LR F["fixture: resolve('/wt') + .git"] --> W["findGitRoot(resolve('/wt')/pkg)"] W --> C["compares against the resolved .git path (D:\\wt\\.git on Windows)"] C --> OK["returns resolve('/wt')"]Before, on main's Windows job:
After, locally (macOS; Windows runs in this PR's CI):
Test-only change.
Summary by CodeRabbit