Skip to content

fix: Windows test compatibility (NormalizeDir + skipped CLI tests)#18

Merged
aanogueira merged 2 commits intomainfrom
andre.nogueira/windows-test-fix
May 5, 2026
Merged

fix: Windows test compatibility (NormalizeDir + skipped CLI tests)#18
aanogueira merged 2 commits intomainfrom
andre.nogueira/windows-test-fix

Conversation

@aanogueira
Copy link
Copy Markdown
Contributor

Summary

Fixes Windows CI failures introduced by v1.4.0.

  • NormalizeDir now converts backslashes to forward slashes after filepath.Abs, so stored Directories are canonical/platform-agnostic and match what we emit into the manifest (no more D:\tmp\foo/ mixed separators).
  • Five cmd-package tests skipped on Windows via a small skipOnWindows helper. They rely on POSIX-only assumptions: hard-coded /tmp/... literal paths (which filepath.Abs resolves differently on Windows) or t.Setenv("HOME", ...) isolation that doesn't affect USERPROFILE (which os.UserHomeDir actually reads on Windows). Production behavior remains covered on Windows by the unit tests in internal/config and internal/git.

Test Plan

  • Unit + integration tests pass on macOS (176/176)
  • Lint clean
  • CI Windows run is green on this PR

After merge: tag v1.4.1 to ship the NormalizeDir fix to Windows users.

…LI tests on Windows

NormalizeDir now converts backslashes to forward slashes after
filepath.Abs, so stored Directories are platform-agnostic and match
what we emit into the manifest. Without this, Windows produces mixed
separators like `D:\tmp\foo/`.

Five cmd-package tests assumed POSIX path semantics or HOME isolation:
- TestDirAddAssignsAndRegenerates
- TestDirAddRejectsDuplicate
- TestDirRemoveUnassignsAndRegenerates
- TestCurrentShowsEffectiveProfileInCwd
- TestEndToEndDirectoryAssignment

They hard-code `/tmp/...` paths (which absolutize differently on Windows)
or rely on `t.Setenv("HOME", ...)` for isolation, which doesn't override
USERPROFILE that os.UserHomeDir actually reads on Windows. Skip them
there via a small skipOnWindows helper. Production behavior is still
covered on Windows by the unit tests in internal/config and internal/git.

Signed-off-by: Andre Nogueira <aanogueira@protonmail.com>
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

…able

After NormalizeDir was canonicalized to forward slashes (and WriteRootConfig
already runs all paths through toGitPath), the corresponding test
expectations — built via filepath.Join, which uses OS-native separators —
no longer matched on Windows. Run those expectations through the same
slash-conversion as the production code.

POSIX-rooted absolute paths like /Users/x/projects/work are not absolute
on Windows (filepath.Abs resolves them against the cwd's drive), so the
two NormalizeDir rows that use them are skipped on Windows. Equivalent
semantics are still covered by the tilde and relative-path rows.

Signed-off-by: Andre Nogueira <aanogueira@protonmail.com>
@aanogueira aanogueira merged commit 49d844b into main May 5, 2026
9 checks passed
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.

2 participants