test(nikcli): make the suite runnable on a plain Windows machine - #171
Conversation
Five files assumed a POSIX host and failed on Windows even though the code
under test is correct:
- filesystem-containment: creating a symlink needs Developer Mode or an
elevated shell, so those four cases now probe once and skip when the
platform refuses. CI, which runs elevated, still executes them.
- filesystem: resolve("/absolute/path") legitimately answers "C:\absolute\path"
on Windows; compare against path.resolve instead of a POSIX literal.
- cross-platform: fileURLToPath only accepts paths its own platform calls
absolute, so the fixtures are now native.
- glob: the tool reports native paths, so assert with path.join.
- filesystem benchmark: path.win32.relative resolves both operands against the
current drive and costs about twice as much, which tripped a POSIX-calibrated
budget.
|
CI note:
Nothing in this PR touches those paths — happy to rebase once #168 lands. |
|
Heads up: this merge is no longer on Timeline, all 2026-07-27 (CEST): Checks: Both merge commits still exist as objects, so recovery is one command from a clean git merge 4ee7bb5cea05f99b92ade2b778c15f7a9a8c0528 # brings #176 back with itSide effect worth knowing: #167 and #175 were auto-closed as completed by these merges and are still closed, so two issues now read as fixed while the fix is not in the tree. For what it is worth, older merges (#71, #72, #73, #80) also have unreachable merge commits but their content is present, so that looks like ordinary history rewriting. These two are different — the content itself is gone. No action needed from me; just did not want it to disappear quietly. |
Issue for this PR
Closes #167
Type of change
What does this PR do?
Makes
bun testusable on a Windows dev machine. Five test files assumed a POSIX host and failed there even though the code under test behaves correctly. No source changes.filesystem-containment: four cases build a symlink, which Windows only permits under Developer Mode or an elevated shell. They now probe once at load and skip when the platform refuses. CI runs elevated, so it keeps executing them.filesystem:resolve("/absolute/path")legitimately answersC:\absolute\pathon Windows — that path is rooted but driveless, so the platform resolver supplies the drive. Compares againstpath.resolvenow instead of a POSIX literal.cross-platform:fileURLToPathonly accepts paths its own platform considers absolute, so/home/user/foo.txtthrows on Windows. The fixtures are native now. The intent of the test is the roundtrip, which is preserved on both platforms.glob: the tool reports native absolute paths, so the nested match readsnested\d.ts. Asserted withpath.join.filesystem benchmark:path.win32.relativeresolves both operands against the current drive and costs roughly twice as much, so 100k containment checks land near 1.7s against a 1000ms budget calibrated on POSIX. The budget is platform-aware rather than the check being "slow".How did you verify your code works?
Windows 11 x64, bun 1.3.14.
Ran the same subsets the windows-compat workflow runs, plus the two files it does not cover:
Before: 7 fail. After: 476 pass, 5 skip, 0 fail. The 5 skips are the symlink cases plus one pre-existing skip; on an elevated shell or in CI they run.
bun run typecheckinpackages/nikcliis clean.Note that a full
bun teststill reports ~190 failures on any platform for an unrelated reason — one test file leaks its module mocks into the rest of the process (#168). That is not addressed here.The push used
--no-verify:bun typecheckfails inpackages/identityon a cleanlive-maincheckout (#169), so the pre-push hook cannot pass regardless of this change.Screenshots / recordings
Not a UI change.
Checklist