fix(test): normalise fs mock paths so they match on Windows - #1262
fix(test): normalise fs mock paths so they match on Windows#1262anhtahaylove wants to merge 1 commit into
Conversation
Both suites key their in-memory fs mocks on the raw path string, but the functions under test call resolve()/join() first. On Windows that turns "/tmp/notes.md" into "C:\tmp\notes.md", so every lookup misses: lstat threw ENOENT and compress-file reported "file not found" for fixtures the test had just written. Normalises keys on the way into the mocks and on the three assertions that compare a returned path or error message against a POSIX literal. 13 of the 30 Windows baseline failures come from this; suite goes from 30 failed to 17. Signed-off-by: anhtahaylove <everest.kill1@gmail.com>
|
@anhtahaylove is attempting to deploy a commit to the rohitg00's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughChangesTest path normalization
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to This is a localized test-only change that normalizes mocked filesystem paths for Windows and reports the affected tests passing; no actionable merge-blocking risk remains after normal checks and review. Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Context for this one: #1264 audits the whole Windows test picture — 30 failures, what causes each group, and which PR covers it. |
test/compress-file.test.tsandtest/obsidian-export.test.tsfail on Windows — 13 tests between them — because their in-memorynode:fs/promisesmocks are keyed on the raw path string while the functions under test resolve the path first.Cause
compress-filecallsresolve(data.filePath)before its firstlstat. The mock'sfileStorehas/tmp/notes.md, the lookup asks forC:\tmp\notes.md,lstatthrows ENOENT, and the function returnsfile not found— for a fixture the test wrote two lines earlier.obsidian-exporthas the same mismatch throughjoin().That is why the failures read like unrelated assertion noise (
expected 'file not found' to contain 'symlink',expected undefined to be defined) rather than a path problem.Fix
A small
key()normaliser applied where paths enter the mock maps, plus three assertions that compare a returned path or error message against a POSIX literal. No production code changes.Verification
Windows, clean checkout of
main:Linux is unaffected:
key()is an identity transform on paths that are already POSIX.The remaining 17 are separate Windows issues (process spawning, file locking,
cli-lifecycle-safetyfixtures) — happy to look at those in follow-ups if useful.Summary by CodeRabbit