ci(tests): re-enable CLI / examples suites on Windows via shared helpers#36
Merged
Conversation
Four test suites previously skipped on win32 now run across the full ubuntu/windows/macos matrix: - tests/cli-program.test.ts - tests/cli-run-modules.test.ts - tests/examples.test.ts - tests/cli.test.ts Introduces tests/helpers/paths.ts with three small cross-platform helpers that sidestep the actual Windows failure modes: - canonicalTmpDir(prefix): wraps fs.mkdtempSync with fs.realpathSync, collapsing the 8.3 short-name form that os.tmpdir() can return on Windows runners into the canonical long form. No-op on Linux/macOS. - runCli(args, opts): thin execFileSync wrapper that invokes the built CLI via process.execPath and an argv array, bypassing cmd.exe quoting of paths with backslashes. - buildCliOnce(): memoised npm run build per Jest worker, with shell: true on win32 so the npm.cmd shim resolves. Removes the coverage-gate carve-out in jest.config.js. Now that the previously-skipped suites execute on Windows the global thresholds apply unconditionally. No production code changes.
|
✅ Tests completed on Node.js 20.x: success |
…plicit cwd Two cascading failures blocked the Windows matrix on PR #36: 1. tests/cli-program.test.ts init subtests call process.chdir(tempDir). On Windows you cannot rmdir the current working directory, so afterEach's fs.rmSync raised EBUSY before reaching process.chdir(originalCwd). The cwd leaked into the next suite. 2. tests/helpers/paths.ts buildCliOnce() ran npm without an explicit cwd, inheriting the leaked temp-dir path. npm then tried to open package.json from a deleted directory and exited ENOENT, which cascaded into every cli-run-modules / cli.test.ts test via their beforeAll hook. ~30 tests down. Fixes: - afterEach restores cwd first, wraps both chdir and rmSync in try / catch so one failure doesn't abort the rest of the teardown. - buildCliOnce resolves to PROJECT_ROOT via __dirname and only runs 'npm run build' when dist/cli.js is missing. The CI pipeline already builds in a dedicated step, so the test path is now a cheap exists() check rather than a subprocess that inherits process.cwd(). Linux remains green (855 passed). Real verification is the Windows matrix on this commit.
|
✅ Tests completed on Node.js 20.x: success |
path.join('modules', 'x.som') emits backslashes on Windows, so the
.includes('modules/') filter produced an empty array and Jest's
test.each bailed with 'called with an empty Array of table data'.
Match either separator.
|
|
✅ Tests completed on Node.js 20.x: success |
ggulpari
approved these changes
Apr 23, 2026
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.



Four test suites previously skipped on win32 now run across the full ubuntu/windows/macos matrix:
Introduces tests/helpers/paths.ts with three small cross-platform helpers that sidestep the actual Windows failure modes:
Removes the coverage-gate carve-out in jest.config.js. Now that the previously-skipped suites execute on Windows the global thresholds apply unconditionally.
No production code changes.
🎉 Pull Request
Description
Type of Change
to not work as expected)
Related Issue
Fixes #(issue number)
Changes Made
Testing
npm test)npm run lint)npm run type-check)Checklist
Additional Context
📋 License Information
SomonScript is open source software licensed under the MIT License.
By submitting this pull request, you agree that your contributions will be
licensed under the MIT License.
For contribution guidelines, please review:
guidelines
Thank you for contributing to SomonScript! 🚀