fix: Windows test compatibility (NormalizeDir + skipped CLI tests)#18
Merged
aanogueira merged 2 commits intomainfrom May 5, 2026
Merged
fix: Windows test compatibility (NormalizeDir + skipped CLI tests)#18aanogueira merged 2 commits intomainfrom
aanogueira merged 2 commits intomainfrom
Conversation
…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 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>
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
Fixes Windows CI failures introduced by v1.4.0.
NormalizeDirnow converts backslashes to forward slashes afterfilepath.Abs, so storedDirectoriesare canonical/platform-agnostic and match what we emit into the manifest (no moreD:\tmp\foo/mixed separators).cmd-package tests skipped on Windows via a smallskipOnWindowshelper. They rely on POSIX-only assumptions: hard-coded/tmp/...literal paths (whichfilepath.Absresolves differently on Windows) ort.Setenv("HOME", ...)isolation that doesn't affectUSERPROFILE(whichos.UserHomeDiractually reads on Windows). Production behavior remains covered on Windows by the unit tests ininternal/configandinternal/git.Test Plan
After merge: tag
v1.4.1to ship theNormalizeDirfix to Windows users.