diff --git a/AGENTS.md b/AGENTS.md index 5d960e83b5..340304999f 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -48,10 +48,10 @@ yarn vitest run path/to/file.test.ts yarn vitest run path/to/file.test.ts --testNamePattern="specific test name" # Integration test specific file -yarn test path/to/file.integration-test.ts -- --integrationTestsOnly +VITEST_MODE=integration yarn test path/to/file.integration-test.ts # Integration test specific file + specific test -yarn test path/to/file.integration-test.ts --testNamePattern="specific test name" -- --integrationTestsOnly +VITEST_MODE=integration yarn test path/to/file.integration-test.ts --testNamePattern="specific test name" # E2E test specific file PLAYWRIGHT_HEADLESS=1 yarn e2e path/to/file.e2e.ts diff --git a/agents/commands.md b/agents/commands.md index f6da7d8a88..b818c526ec 100644 --- a/agents/commands.md +++ b/agents/commands.md @@ -34,9 +34,9 @@ ### Integration Tests -- `yarn test -- --integrationTestsOnly` - Run integration tests (vitest) -- `yarn test -- --integrationTestsOnly` - Run integration tests for specific file -- `yarn test -t "" -- --integrationTestsOnly` - Run specific integration test by name for specific file +- `VITEST_MODE=integration yarn test` - Run integration tests (vitest) +- `VITEST_MODE=integration yarn test ` - Run integration tests for specific file +- `VITEST_MODE=integration yarn test -t ""` - Run specific integration test by name for specific file ### End-to-End Tests @@ -73,7 +73,7 @@ yarn vitest run packages/lib/some-file.test.ts # Integration test specific file -yarn test routing-form-response-denormalized.integration-test.ts -- --integrationTestsOnly +VITEST_MODE=integration yarn test routing-form-response-denormalized.integration-test.ts # E2E test specific file yarn e2e tests/booking-flow.e2e.ts diff --git a/vitest.config.mts b/vitest.config.mts index c665589259..008ec4f359 100644 --- a/vitest.config.mts +++ b/vitest.config.mts @@ -1,7 +1,15 @@ import path from "node:path"; import react from "@vitejs/plugin-react"; +import { loadEnv } from "vite"; import { defineConfig } from "vitest/config"; +const env = loadEnv("", process.cwd(), ""); +for (const [key, value] of Object.entries(env)) { + if (process.env[key] === undefined) { + process.env[key] = value; + } +} + const vitestMode = process.env.VITEST_MODE; // Support both new VITEST_MODE env var and legacy CLI flags for backwards compatibility // The CLI flags are passed through but Vitest 4.0 doesn't reject them when using yarn test