#23480: fix(test): use path.join for cross-platform XDG path assertions in qmd-manager
gateway
size: XS
Cluster:
Windows Compatibility Fixes
## Problem
The test `QmdMemoryManager > passes manager-scoped XDG env to mcporter commands` in `src/memory/qmd-manager.test.ts` was failing on Windows CI because it checked for hardcoded Unix-style path separators:
```
AssertionError: expected 'C:\Users\RUNNER~1\AppData\Local\Temp\...' to contain '/agents/main/qmd/xdg-config'
```
This caused the `checks-windows (node, test, ...)` CI job to fail on multiple unrelated PRs.
## Fix
Replace the string literal with `path.join()` so the expected substring uses the correct OS path separator on every platform.
```typescript
// Before
const normalizePath = (value?: string) => value?.replace(/\\/g, "/");
expect(normalizePath(spawnOpts?.env?.XDG_CONFIG_HOME)).toContain("/agents/main/qmd/xdg-config");
expect(normalizePath(spawnOpts?.env?.XDG_CACHE_HOME)).toContain("/agents/main/qmd/xdg-cache");
// After
expect(spawnOpts?.env?.XDG_CONFIG_HOME).toContain(
path.join("agents", "main", "qmd", "xdg-config"),
);
expect(spawnOpts?.env?.XDG_CACHE_HOME).toContain(
path.join("agents", "main", "qmd", "xdg-cache"),
);
```
## Tests
- `pnpm check` passes ✅
- 1 file changed, minimal diff
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Replaced hardcoded Unix-style path separators with `path.join()` in test assertions to fix Windows CI failures. The test was using a `normalizePath` helper function to convert backslashes to forward slashes, then checking for hardcoded `/agents/main/qmd/xdg-config` strings. This caused assertion failures on Windows where paths use backslashes. The fix properly uses `path.join("agents", "main", "qmd", "xdg-config")` to construct platform-appropriate path separators, making the test pass on all platforms.
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with minimal risk
- The change is a focused test fix that replaces hardcoded path strings with proper cross-platform path construction. The `path` module is already imported at the top of the file (line 4), and `path.join()` is the correct way to construct OS-agnostic paths. The fix removes unnecessary normalization logic and directly tests the actual path values, which is cleaner and more maintainable.
- No files require special attention
<sub>Last reviewed commit: 50bd11c</sub>
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#23142: fix(test): Windows CI — use path.join for XDG path assertions in qm...
by ihsanmokhlisse · 2026-02-22
92.5%
#13848: fix(test): normalize paths in source-display test for windows
by gengmao · 2026-02-11
80.8%
#11529: fix(wizard): strip shell-style backslash escapes from workspace paths
by mcaxtr · 2026-02-07
77.3%
#10714: fix: handle Windows PATH case-sensitivity in node register invoke
by Yida-Dev · 2026-02-06
77.0%
#12939: fix(memory): strip null bytes from workspace paths causing ENOTDIR
by omair445 · 2026-02-09
76.6%
#10708: fix: handle Windows PATH case-sensitivity in exec environment
by Yida-Dev · 2026-02-06
76.6%
#7507: test(ci): make tests cross-platform (Windows) + add basic sanitizat...
by ThinkIbrokeIt · 2026-02-02
76.4%
#19931: Config: merge PATH env vars and bootstrap Windows bins
by Kemalau · 2026-02-18
76.4%
#20330: Fix SSH tunnel startup on Windows by resolving ssh from PATH
by graysurf · 2026-02-18
76.4%
#22178: test(web): allow fixture roots in media local file tests
by Kansodata · 2026-02-20
75.6%