Skip to content

fix(test): restore full test suite on Windows#4

Open
SahilRakhaiya05 wants to merge 1 commit into
TestSprite:mainfrom
SahilRakhaiya05:fix/windows-cross-platform-tests
Open

fix(test): restore full test suite on Windows#4
SahilRakhaiya05 wants to merge 1 commit into
TestSprite:mainfrom
SahilRakhaiya05:fix/windows-cross-platform-tests

Conversation

@SahilRakhaiya05

Copy link
Copy Markdown

Fixes 10 Windows-only test failures so the Vitest suite runs cleanly on Windows dev machines. Linux/macOS CI behavior is unchanged.

Windows result:

  • 1416 passing
  • 3 skipped intentionally on Windows only

What changed

  • Fixed resolveBundleDir to strip both / and \ trailing separators while preserving roots like C:\ and /.
  • Updated subprocess tests to set both HOME and USERPROFILE so credentials stay inside the test temp directory on Windows.
  • Replaced Unix-only rm usage with unlinkSync().
  • Added test/helpers/execNpm.ts so npm subprocess calls work on Windows .cmd shims.
  • Fixed CRLF handling in frontmatter parsing by stripping trailing \r.
  • Added .gitattributes to normalize line endings to LF.
  • Skipped symlink tests only when the OS cannot create symlinks.
  • Skipped Unix 0600 chmod assertions on Windows because NTFS does not enforce POSIX file modes.
  • Replaced Unix-only path assertions with path.resolve(), path.join(), and homedir() based checks.

Test Plan

  • npm test — 1416 passed, 3 skipped on Windows only
  • npm run typecheck
  • npm run lint
  • Subprocess suite — 49/49 passed
  • Help snapshot suite — passed

Skipped on Windows by design:

  • 2 symlink tests requiring Developer Mode/elevation
  • 1 chmod 0600 test due to NTFS behavior

@ruili-testsprite ruili-testsprite left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-lease

3. 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! 🙏

@SahilRakhaiya05 SahilRakhaiya05 force-pushed the fix/windows-cross-platform-tests branch from 273af9d to e3e582b Compare June 23, 2026 05:51
- 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
@SahilRakhaiya05 SahilRakhaiya05 force-pushed the fix/windows-cross-platform-tests branch from e3e582b to 18fc2b9 Compare June 23, 2026 05:51
@SahilRakhaiya05

Copy link
Copy Markdown
Author

Thanks for the review and the kind feedback!

• Fixed trailing newlines in test/helpers/execNpm.ts and .gitattributes (npm run format)
• Rebased onto latest main (v0.1.2); resolved test/cli.subprocess.test.ts (upstream command renames + our Windows fixes)
• Dropped the unreachable branch in stripTrailingSeparators

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants