← Back to PRs

#23480: fix(test): use path.join for cross-platform XDG path assertions in qmd-manager

by hydro13 open 2026-02-22 10:43 View on GitHub →
gateway size: XS
## 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