Skip to content

Recovered: fix(test): restore full test suite on Windows (#4 by @SahilRakhaiya05)#243

Open
jangjos-128 wants to merge 5 commits into
TestSprite:mainfrom
SahilRakhaiya05:fix/windows-cross-platform-tests
Open

Recovered: fix(test): restore full test suite on Windows (#4 by @SahilRakhaiya05)#243
jangjos-128 wants to merge 5 commits into
TestSprite:mainfrom
SahilRakhaiya05:fix/windows-cross-platform-tests

Conversation

@jangjos-128

@jangjos-128 jangjos-128 commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

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

Summary by CodeRabbit

  • Bug Fixes

    • Improved handling of output paths with trailing slashes and backslashes across operating systems.
    • Improved compatibility with Windows paths and files using CRLF line endings.
  • Tests

    • Improved cross-platform test reliability, including Windows npm execution and path handling.
    • Symlink tests now skip automatically when the environment does not support symlink creation.
  • Chores

    • PNG files are now explicitly treated as binary to prevent line-ending normalization.

Solving Issue #108

- 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
Rebased onto v0.2.0 main introduced skill-nudge tests that assumed
Unix-style path prefixes. Use path.join/resolve and TARGETS landing
paths so probes match on Windows.
@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: ad2c1798-e23f-45e8-99f7-d853647ff99c

📥 Commits

Reviewing files that changed from the base of the PR and between ef279db and 1e411da.

📒 Files selected for processing (8)
  • .gitattributes
  • src/commands/agent.test.ts
  • src/lib/agent-targets.test.ts
  • src/lib/bundle.test.ts
  • src/lib/bundle.ts
  • src/lib/skill-nudge.test.ts
  • test/cli.subprocess.test.ts
  • test/help.snapshot.test.ts
🚧 Files skipped from review as they are similar to previous changes (5)
  • src/commands/agent.test.ts
  • src/lib/skill-nudge.test.ts
  • .gitattributes
  • test/help.snapshot.test.ts
  • src/lib/bundle.ts

Walkthrough

Changes

Cross-platform compatibility

Layer / File(s) Summary
Path and line-ending handling
.gitattributes, src/lib/agent-targets.test.ts, src/lib/bundle.*, src/lib/skill-nudge.test.ts
PNG files are marked binary, CRLF descriptions are normalized, bundle paths trim both separator styles, and path assertions use platform-safe resolution and boundaries.
Cross-platform npm test execution
test/helpers/execNpm.ts, test/cli.subprocess.test.ts, test/help.snapshot.test.ts
Npm commands run through a Windows-compatible helper, while subprocess tests rebuild from the repository root and isolate home-directory variables.
Platform-specific test gates
src/commands/agent.test.ts
Real-disk symlink safety tests are skipped when the environment cannot create symlinks.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related issues

Possibly related PRs

Suggested reviewers: ruili-testsprite, zeshi-du

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: restoring the test suite on Windows with cross-platform fixes.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed: private package registry requires authentication. Disable ESLint in CodeRabbit settings or use public packages.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/lib/skill-nudge.test.ts`:
- Line 89: Replace the prefix-only containment checks in both assertions of the
skill-nudge tests with boundary-safe path.relative checks: resolve each observed
path against the resolved root, and accept it only when the relative result is
neither absolute nor equal to or nested under .. . Preserve the existing
every-based assertions and test intent.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 3d31c606-a737-4562-b2bf-d8bec80a7295

📥 Commits

Reviewing files that changed from the base of the PR and between 60d55e4 and ef279db.

📒 Files selected for processing (10)
  • .gitattributes
  • src/commands/agent.test.ts
  • src/lib/agent-targets.test.ts
  • src/lib/bundle.test.ts
  • src/lib/bundle.ts
  • src/lib/credentials.test.ts
  • src/lib/skill-nudge.test.ts
  • test/cli.subprocess.test.ts
  • test/help.snapshot.test.ts
  • test/helpers/execNpm.ts

Comment thread src/lib/skill-nudge.test.ts Outdated
@jangjos-128

Copy link
Copy Markdown
Contributor Author

Hi @SahilRakhaiya05 👋 — this is the recovery of your PR #4, which was auto-closed by an error in our 2026-07-09 release process. Your commits are intact — thank you for the contribution!

It currently shows merge conflicts because main has moved on since your branch was cut. To clear them, update your PR branch (BRANCH) against the latest main — either option works and both update this PR in place:

Option A — merge (no force-push):

git checkout BRANCH
git fetch upstream          # your remote for TestSprite/testsprite-cli (may be "origin")
git merge upstream/main     # resolve conflicts, commit
git push

Option B — rebase (cleaner history, needs force):

git checkout BRANCH
git fetch upstream
git rebase upstream/main    # resolve conflicts
git push --force-with-lease

Once you push, the conflicts here resolve automatically and we'll take it into review.

Sorry again for the extra step!

Resolve conflicts from main drift after PR recovery:
- .gitattributes: keep upstream LF comment + *.png binary
- bundle.test.ts: add isAbsolute assertion from main
- credentials/cli.subprocess: unify Windows chmod skips with main
- skill-nudge.test.ts: cross-platform TARGETS paths + path.relative bounds
- cli.subprocess: keep execNpm helper, use rmSync from main
@SahilRakhaiya05

Copy link
Copy Markdown
Contributor

solving issue #108

@SahilRakhaiya05

SahilRakhaiya05 commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Hi @jangjos-128 — triage gate fix for this recovered PR

Thanks!

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