Skip to content

Stabilize release-gate test by mocking targeted runner execution - #61

Merged
waleedcodes merged 2 commits into
masterfrom
copilot/fix-github-actions-build-publish-release
Nov 13, 2026
Merged

waleedcodes merged 2 commits into
masterfrom
copilot/fix-github-actions-build-publish-release

Conversation

Copilot AI commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

The Build & Publish GitHub Release workflow was failing before packaging because npm test intermittently timed out in tests/testRunner.test.ts. The timeout came from a unit test invoking a real npx vitest process in a temporary workspace.

  • Root cause addressed

    • Replaced process-spawning behavior in the vitest-detection unit test with a deterministic mock of TestRunner.executeCommand.
    • Kept the test focused on command selection logic rather than external tool execution timing.
  • Test behavior change

    • The test now verifies the exact targeted command generated for vitest:
      • npx vitest run "tests/sample.test.ts"
    • Asserted result shape remains Targeted Tests with PASS status from the mock.
  • Scope

    • Single-file change: tests/testRunner.test.ts
    • No production/runtime logic changes.
const executeCommandSpy = vi.spyOn(runner as never, 'executeCommand').mockResolvedValue({
  name: 'Targeted Tests',
  status: 'PASS',
  message: 'Completed successfully without errors.'
});

await runner.runTargetedTests(tempDir, [path.join(tempDir, 'tests/sample.test.ts')]);

expect(executeCommandSpy).toHaveBeenCalledWith(
  'npx vitest run "tests/sample.test.ts"',
  tempDir,
  'Targeted Tests'
);

Copilot AI changed the title [WIP] Fix the failing GitHub Actions job 'Build & Publish GitHub Release' Stabilize release-gate test by mocking targeted runner execution Nov 13, 2026
Copilot AI requested a review from waleedcodes November 13, 2026 19:38
@waleedcodes
waleedcodes marked this pull request as ready for review November 13, 2026 19:41
@waleedcodes
waleedcodes merged commit 4b9fd26 into master Nov 13, 2026
2 of 6 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