Skip to content

Commit

Permalink
test: fix tests on windows
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Sagi-Kazar <[email protected]>
  • Loading branch information
sagikazarmark committed Jun 4, 2024
1 parent 54e781a commit 74addbc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion file.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ func (v *Viper) findConfigFileWithFinder(finder Finder) (string, error) {
return "", ConfigFileNotFoundError{v.configName, fmt.Sprintf("%s", v.configPaths)}
}

return results[0], nil
// We call clean on the final result to ensure that the path is in its canonical form.
// This is mostly for consistent path handling and to make sure tests pass.
return filepath.Clean(results[0]), nil
}

// Search all configPaths for any config file.
Expand Down
2 changes: 1 addition & 1 deletion internal/testutil/filepath.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ func AbsFilePath(t *testing.T, path string) string {
t.Fatal(err)
}

return s
return filepath.Clean(s)
}

0 comments on commit 74addbc

Please sign in to comment.