Skip to content

test: make CLI tests cross-platform on Windows#59

Merged
abewheel merged 1 commit intoSunpeak-AI:mainfrom
udaykakade25:fix/windows-test-path-separators
May 3, 2026
Merged

test: make CLI tests cross-platform on Windows#59
abewheel merged 1 commit intoSunpeak-AI:mainfrom
udaykakade25:fix/windows-test-path-separators

Conversation

@udaykakade25
Copy link
Copy Markdown
Contributor

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.

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.
@abewheel abewheel merged commit 5660c56 into Sunpeak-AI:main May 3, 2026
2 checks passed
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