fix(test): restore full test suite on Windows#4
Conversation
There was a problem hiding this comment.
Thanks for this, @SahilRakhaiya05 — this is a clean, well-scoped fix and the PR description is excellent. We'd like to merge it. Two required items and one optional nit before we can:
1. format:check will fail CI (required)
Our CI runs npm run format:check (Prettier), and two new files are missing a trailing newline:
test/helpers/execNpm.ts.gitattributes
Please run npm run format and commit the result — that should make the check green. (You ran npm run lint, which is ESLint; Prettier is a separate step here.)
2. Please rebase onto latest main (required)
We've cut a couple of releases since you opened this, so the branch now conflicts. The only conflict is in test/cli.subprocess.test.ts:
git fetch origin
git rebase origin/main
# resolve test/cli.subprocess.test.ts, then:
git push --force-with-lease3. Optional nit — dead branch in stripTrailingSeparators (src/lib/bundle.ts)
This line is unreachable and can be dropped:
if (end === 1 && rawPath[0] === '/') break;The while (end > 1 ...) guard means end is never 1 at that check, and the rawPath.length <= 1 early return already covers a bare /. Totally fine to leave it if you'd rather not touch it — just flagging.
The drive-root handling (C:\) and the multi-separator stripping all look correct. Thanks again for improving the Windows story here! 🙏
273af9d to
e3e582b
Compare
- Strip both slash and backslash trailing separators in resolveBundleDir - Add cross-platform npm helper for subprocess/snapshot builds - Set USERPROFILE alongside HOME in subprocess tests - Replace Unix-only rm with unlinkSync for credential cleanup - Skip symlink and chmod assertions when platform cannot honor them - Normalize CRLF in frontmatter description parsing - Enforce LF line endings via .gitattributes
e3e582b to
18fc2b9
Compare
|
Thanks for the review and the kind feedback! • Fixed trailing newlines in test/helpers/execNpm.ts and .gitattributes (npm run format) |
Fixes 10 Windows-only test failures so the Vitest suite runs cleanly on Windows dev machines. Linux/macOS CI behavior is unchanged.
Windows result:
What changed
resolveBundleDirto strip both/and\trailing separators while preserving roots likeC:\and/.HOMEandUSERPROFILEso credentials stay inside the test temp directory on Windows.rmusage withunlinkSync().test/helpers/execNpm.tssonpmsubprocess calls work on Windows.cmdshims.\r..gitattributesto normalize line endings to LF.0600chmod assertions on Windows because NTFS does not enforce POSIX file modes.path.resolve(),path.join(), andhomedir()based checks.Test Plan
npm test— 1416 passed, 3 skipped on Windows onlynpm run typechecknpm run lintSkipped on Windows by design:
0600test due to NTFS behavior