mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-21 09:04:59 +00:00
fix(test): use path.resolve in tilde expansion test for Windows compat
expandHomePrefix resolves HOME through platform-native path normalization,
producing drive-letter paths on Windows (e.g. C:\tmp\...). The test was
comparing against the raw POSIX string, causing CI failure on Windows
shard 1/2.
Use path.resolve(fakeHome) for the expected value so it matches on all
platforms. No-op on POSIX where resolve('/tmp/...') === '/tmp/...'.
This commit is contained in:
@@ -182,7 +182,8 @@ describe("tilde expansion in file tools", () => {
|
||||
process.env.HOME = fakeHome;
|
||||
try {
|
||||
const result = expandHomePrefix("~/file.txt");
|
||||
expect(result).toBe(`${fakeHome}/file.txt`);
|
||||
// path.resolve produces platform-native paths (e.g. C:\tmp\... on Windows)
|
||||
expect(result).toBe(`${path.resolve(fakeHome)}/file.txt`);
|
||||
} finally {
|
||||
process.env.HOME = originalHome;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user