From 4cd485930e5baa0569ba4398cc4bcc503320c238 Mon Sep 17 00:00:00 2001 From: waleedcodes <110061477+waleedcodes@users.noreply.github.com> Date: Fri, 9 Oct 2026 21:25:17 +0500 Subject: [PATCH 1/3] test(runner): scaffold test runner test suite --- tests/testRunner.test.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 tests/testRunner.test.ts diff --git a/tests/testRunner.test.ts b/tests/testRunner.test.ts new file mode 100644 index 0000000..8f5694b --- /dev/null +++ b/tests/testRunner.test.ts @@ -0,0 +1,14 @@ +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 { TestRunner } from '../src/test-runner/testRunner'; + +describe('TestRunner', () => { + let tempDir: string; + + beforeEach(() => { + tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'proofcode-runner-test-')); + }); + + afterEach(() => { From 4e35025ee6385fda9b82655b3ea4f7eec70922a5 Mon Sep 17 00:00:00 2001 From: waleedcodes <110061477+waleedcodes@users.noreply.github.com> Date: Fri, 9 Oct 2026 21:25:17 +0500 Subject: [PATCH 2/3] test(runner): test package manager detection across lockfiles --- tests/testRunner.test.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/testRunner.test.ts b/tests/testRunner.test.ts index 8f5694b..c97cbc4 100644 --- a/tests/testRunner.test.ts +++ b/tests/testRunner.test.ts @@ -12,3 +12,19 @@ describe('TestRunner', () => { }); afterEach(() => { + fs.rmSync(tempDir, { recursive: true, force: true }); + }); + + it('should detect pnpm, yarn, bun, and npm based on lockfiles', () => { + const runner = new TestRunner(); + + expect(runner.detectPackageManager(tempDir)).toBe('npm'); + + fs.writeFileSync(path.join(tempDir, 'pnpm-lock.yaml'), ''); + expect(runner.detectPackageManager(tempDir)).toBe('pnpm'); + + fs.unlinkSync(path.join(tempDir, 'pnpm-lock.yaml')); + fs.writeFileSync(path.join(tempDir, 'yarn.lock'), ''); + expect(runner.detectPackageManager(tempDir)).toBe('yarn'); + + fs.unlinkSync(path.join(tempDir, 'yarn.lock')); From bcee407ae657624b5a74925cad70370715fe2929 Mon Sep 17 00:00:00 2001 From: waleedcodes <110061477+waleedcodes@users.noreply.github.com> Date: Fri, 9 Oct 2026 21:25:17 +0500 Subject: [PATCH 3/3] test(runner): test typecheck command runner execution --- tests/testRunner.test.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/testRunner.test.ts b/tests/testRunner.test.ts index c97cbc4..dd7538f 100644 --- a/tests/testRunner.test.ts +++ b/tests/testRunner.test.ts @@ -28,3 +28,13 @@ describe('TestRunner', () => { expect(runner.detectPackageManager(tempDir)).toBe('yarn'); fs.unlinkSync(path.join(tempDir, 'yarn.lock')); + fs.writeFileSync(path.join(tempDir, 'bun.lockb'), ''); + expect(runner.detectPackageManager(tempDir)).toBe('bun'); + }); + + it('should skip TypeScript check if no tsconfig.json exists', async () => { + const runner = new TestRunner(); + const result = await runner.runTypeScriptCheck(tempDir); + expect(result.status).toBe('SKIPPED'); + }); +});