From 0cbc3e0dd41c944e0b4662d2e8f979ed9b47fa09 Mon Sep 17 00:00:00 2001 From: Ajax Davis Date: Wed, 7 Jan 2026 15:07:47 +1000 Subject: [PATCH] fix: skip integration tests unless explicitly enabled Integration tests in agents.test.ts require a running server and test database. They now properly skip using describe.skipIf when the INTEGRATION_TESTS environment variable is not set to 'true'. To run integration tests manually: INTEGRATION_TESTS=true pnpm --filter=@tpmjs/web test Traves is da greatest --- apps/web/src/test/agents.test.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/apps/web/src/test/agents.test.ts b/apps/web/src/test/agents.test.ts index 4eba8e9..0bebe70 100644 --- a/apps/web/src/test/agents.test.ts +++ b/apps/web/src/test/agents.test.ts @@ -10,17 +10,26 @@ * NOTE: These are integration tests that require a running server. * Run `pnpm dev --filter=@tpmjs/web` first, then run tests. * Tests will be skipped if server is not available. + * + * To run integration tests manually: + * INTEGRATION_TESTS=true pnpm --filter=@tpmjs/web test */ import { prisma } from '@tpmjs/db'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; +// Skip integration tests unless explicitly enabled +const INTEGRATION_TESTS_ENABLED = process.env.INTEGRATION_TESTS === 'true'; + const BASE_URL = process.env.TEST_BASE_URL || 'http://localhost:3000'; const TEST_AGENT_UID = 'omega'; // The test agent UID const TEST_CONVERSATION_SLUG = `test-conv-${Date.now()}`; // Check if server is available before running tests async function isServerAvailable(): Promise { + if (!INTEGRATION_TESTS_ENABLED) { + return false; + } try { const response = await fetch(`${BASE_URL}/api/health`, { signal: AbortSignal.timeout(2000) }); return response.ok; @@ -70,7 +79,8 @@ function parseSSEResponse(text: string): SSEEvent[] { return events; } -describe('Agent Endpoints', () => { +// Skip entire test suite if integration tests are not enabled +describe.skipIf(!INTEGRATION_TESTS_ENABLED)('Agent Endpoints', () => { let testAgent: { id: string; uid: string;