From 0b9f7865b98751c91573509a0ebef2db1bc799b7 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 13 Nov 2026 19:35:32 +0000 Subject: [PATCH 1/2] Initial plan From 836549a9e0835ee2b39d912325e1f889f6478611 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 13 Nov 2026 19:37:40 +0000 Subject: [PATCH 2/2] test: make TestRunner vitest detection test deterministic Co-authored-by: waleedcodes <110061477+waleedcodes@users.noreply.github.com> --- tests/testRunner.test.ts | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/tests/testRunner.test.ts b/tests/testRunner.test.ts index 4214edd..5f78d0f 100644 --- a/tests/testRunner.test.ts +++ b/tests/testRunner.test.ts @@ -1,7 +1,7 @@ import * as fs from 'node:fs'; import * as os from 'node:os'; import * as path from 'node:path'; -import { afterEach, beforeEach, describe, expect, it } from 'vitest'; +import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; import { TestRunner } from '../src/test-runner/testRunner'; describe('TestRunner', () => { @@ -53,9 +53,20 @@ describe('TestRunner', () => { scripts: { test: 'vitest run' } }) ); - // Since mock files don't actually run, test command will trigger vitest + + const executeCommandSpy = vi.spyOn(runner as never, 'executeCommand').mockResolvedValue({ + name: 'Targeted Tests', + status: 'PASS', + message: 'Completed successfully without errors.' + }); + const result = await runner.runTargetedTests(tempDir, [path.join(tempDir, 'tests/sample.test.ts')]); - expect(['PASS', 'FAIL']).toContain(result.status); + expect(executeCommandSpy).toHaveBeenCalledWith( + 'npx vitest run "tests/sample.test.ts"', + tempDir, + 'Targeted Tests' + ); + expect(result.status).toBe('PASS'); expect(result.name).toBe('Targeted Tests'); }); });