Skip to content

Commit 94cab2c

Browse files
committed
🤖 refactor: use TEST_OLLAMA env var to control Ollama tests
Simplifies CI by using an explicit environment variable instead of path filtering: **Test Changes:** - Ollama tests now require both TEST_INTEGRATION=1 and TEST_OLLAMA=1 - Uses `describeOllama` that checks `process.env.TEST_OLLAMA === '1'` - Auto-skips when TEST_OLLAMA is not set (no manual filtering needed) **CI Changes:** - `integration-test` job: runs all tests, Ollama tests skip automatically - `ollama-test` job: sets TEST_OLLAMA=1 to enable Ollama tests - Removed `--testPathIgnorePatterns` (no longer needed) - Cleaner and more explicit test gating Benefits: - Simpler CI configuration (no path filtering) - Consistent pattern with TEST_INTEGRATION - Easy to run Ollama tests locally: TEST_INTEGRATION=1 TEST_OLLAMA=1 bun x jest tests/ipcMain/ollama.test.ts _Generated with `cmux`_
1 parent de39340 commit 94cab2c

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ jobs:
104104

105105
- name: Run integration tests with coverage
106106
# --silent suppresses per-test output (17 test files × 32 workers = overwhelming logs)
107-
# Exclude Ollama tests (run separately in ollama-test job)
108-
run: TEST_INTEGRATION=1 bun x jest --coverage --maxWorkers=100% --silent --testPathIgnorePatterns=ollama.test.ts ${{ github.event.inputs.test_filter || 'tests' }}
107+
# Ollama tests are skipped automatically (require TEST_OLLAMA=1)
108+
run: TEST_INTEGRATION=1 bun x jest --coverage --maxWorkers=100% --silent ${{ github.event.inputs.test_filter || 'tests' }}
109109
env:
110110
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
111111
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
@@ -144,8 +144,8 @@ jobs:
144144
run: make build-main
145145

146146
- name: Run Ollama integration tests with coverage
147-
# Run only Ollama-specific tests
148-
run: TEST_INTEGRATION=1 bun x jest --coverage --maxWorkers=100% tests/ipcMain/ollama.test.ts
147+
# TEST_OLLAMA=1 enables Ollama-specific tests
148+
run: TEST_INTEGRATION=1 TEST_OLLAMA=1 bun x jest --coverage --maxWorkers=100% tests/ipcMain/ollama.test.ts
149149
env:
150150
OLLAMA_BASE_URL: http://localhost:11434/api
151151

tests/ipcMain/ollama.test.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@ import {
77
} from "./helpers";
88
import { spawn } from "child_process";
99

10-
// Skip all tests if TEST_INTEGRATION is not set
11-
const describeIntegration = shouldRunIntegrationTests() ? describe : describe.skip;
10+
// Skip all tests if TEST_INTEGRATION or TEST_OLLAMA is not set
11+
const shouldRunOllamaTests = shouldRunIntegrationTests() && process.env.TEST_OLLAMA === "1";
12+
const describeOllama = shouldRunOllamaTests ? describe : describe.skip;
1213

1314
// Ollama doesn't require API keys - it's a local service
1415
// Tests require Ollama to be running and will pull models idempotently
16+
// Set TEST_OLLAMA=1 to enable these tests
1517

1618
const OLLAMA_MODEL = "gpt-oss:20b";
1719

@@ -73,7 +75,7 @@ async function ensureOllamaModel(model: string): Promise<void> {
7375
});
7476
}
7577

76-
describeIntegration("IpcMain Ollama integration tests", () => {
78+
describeOllama("IpcMain Ollama integration tests", () => {
7779
// Enable retries in CI for potential network flakiness with Ollama
7880
if (process.env.CI && typeof jest !== "undefined" && jest.retryTimes) {
7981
jest.retryTimes(3, { logErrorsBeforeRetry: true });

0 commit comments

Comments
 (0)