fix: make build and test suite pass on Windows - #1139
Conversation
Replace the Unix-only cp/mkdir-p/2>/dev/null || true shell pipeline with a small Node script so npm run build works on Windows as well as macOS and Linux. Signed-off-by: Adrian Coroi <coroi_adrian@outlook.com>
Fix path, temp-dir, and homedir handling in tests so the full suite passes on Windows. Changes include: - Use path.resolve/path.join and os.tmpdir instead of Unix literals - Set USERPROFILE alongside HOME where os.homedir() is used - Use platform-aware iii.exe/iii binary names - Resolve project names via resolveProject in copilot hook tests Signed-off-by: Adrian Coroi <coroi_adrian@outlook.com>
|
@noises1990 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 (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe build now delegates asset packaging to ChangesPortable build and test paths
Estimated code review effort: 2 (Simple) | ~15 minutes Possibly related PRs
🚥 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 |
There was a problem hiding this comment.
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 `@test/copilot-plugin.test.ts`:
- Line 6: Update the test around resolveProject and runHook to remove the
production resolver from expected-value construction. Clear
AGENTMEMORY_PROJECT_NAME for the test, then assert the platform-specific
expected project name directly, using "repo" for Windows while preserving the
appropriate non-Windows expectation.
🪄 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: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 2b5a264e-54d6-4fb2-9fb0-4f40ce4beabb
📒 Files selected for processing (7)
package.jsonscripts/copy-assets.mjstest/cli-remove.test.tstest/compress-file.test.tstest/copilot-plugin.test.tstest/obsidian-export.test.tstest/slots-flag-gate.test.ts
CodeRabbit review: do not use the production resolveProject() helper to compute the expected value. Pass AGENTMEMORY_PROJECT_NAME as empty so an env override cannot leak into the test, and assert the literal platform-correct project name ("repo" on Windows, "C:\repo" elsewhere).
Signed-off-by: Adrian Coroi <coroi_adrian@outlook.com>
What it does
Makes the project build and the full test suite pass on Windows without breaking macOS or Linux:
package.jsonbuild script (cp ... 2>/dev/null || true,mkdir -p ...) with a cross-platform Node script (scripts/copy-assets.mjs).HOME, andiiibinary names:test/cli-remove.test.ts— usesiii.exeon Windows,iiielsewhere.test/compress-file.test.ts— usespath.resolve()andpath.join()instead of literal/tmp/...paths.test/copilot-plugin.test.ts— assertsresolveProject()result, not a hard-coded Windows absolute path.test/obsidian-export.test.ts— usesos.tmpdir()+path.join()for export roots and file lookups.test/slots-flag-gate.test.ts— sets/restoresUSERPROFILEalongsideHOMEbecauseos.homedir()readsUSERPROFILEon Windows.Why
Windows contributors currently cannot run
npm run buildbecause the build pipeline relies oncp/mkdirshell tools that are not available incmd.exeor PowerShell. Several unit tests also fail on Windows because they use/tmp/...literals, check foriiiwithout the.exeextension, or only mockHOMEwhile Node'sos.homedir()prefersUSERPROFILEon Windows. This PR removes those blockers.How to verify
npm install.npm run build— it should complete without shell errors.npm test— the full suite (excludingtest/integration.test.ts) should pass.The change is additive and should not affect Linux/macOS behavior: the shell pipeline is replaced by Node's
fs/promisesandpathAPIs, and the test fixes use standard cross-platform helpers.Notes
npx tsc --noEmitstill reports the same pre-existing errors present onmain.Summary by CodeRabbit
Build
Bug Fixes
Tests