test: make CLI tests cross-platform on Windows#59
Merged
abewheel merged 1 commit intoSunpeak-AI:mainfrom May 3, 2026
Merged
Conversation
Path assertions in commands.test.ts assumed POSIX separators, so 9 tests failed on Windows where path.join produces backslashes. Use path.join for expected literals and normalize backslashes to forward slashes when matching mock-call paths. Runtime code unchanged.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Path assertions in commands.test.ts assumed POSIX separators, so 9 tests failed on Windows where path.join produces backslashes. Use path.join for expected literals and normalize backslashes to forward slashes when matching mock-call paths. Runtime code unchanged.
BEFORE
The failures
All paths in the test file use /, but on Windows path.join('/test', 'my-project', ...) returns
\test\my-project..., so the matchers don't find a match.
#: 1
Test: should create project with selected resources
Expected: { from: '/test/my-project/_gitignore', to: '/test/my-project/.gitignore' }
Actual on Windows: \test\my-project_gitignore
────────────────────────────────────────
#: 2
Test: should scaffold e2e, visual, live, and eval tests for external projects
Expected: stringContaining('live/playwright.config.ts')
Actual on Windows: …\sunpeak\live\playwright.config.ts
────────────────────────────────────────
#: 3
Test: should scaffold 4 test types for JS projects
Expected: stringContaining('e2e/smoke.test.ts')
Actual on Windows: …\tests\e2e\smoke.test.ts
────────────────────────────────────────
#: 4
Test: should scaffold all test types for sunpeak projects without NOTE in live config
Expected: stringContaining('live/playwright.config.ts')
Actual on Windows: …\tests\live\playwright.config.ts
────────────────────────────────────────
#: 5
Test: should skip existing files without overwriting
Expected: stringContaining('evals/eval.config.ts')
Actual on Windows: …\tests\evals\eval.config.ts
────────────────────────────────────────
#: 6
Test: should parse command-based server into command and args
Expected: getWrittenContent(…, 'sunpeak/playwright.config.ts')
Actual on Windows: endsWith() returns false → config is undefined
────────────────────────────────────────
#: 7
Test: should not scaffold test bodies that would fail on missing tools
Expected: getWrittenContent(…, 'live/example.test.ts')
Actual on Windows: same as above
────────────────────────────────────────
#: 8
Test: should include multi-language hints in "configure later" config
Expected: getWrittenContent(…, 'sunpeak/playwright.config.ts')
Actual on Windows: same as above
AFTER FIXES
all
pnpm --filter sunpeak validate- all checks pass.