fix: load .env file in vitest config and update integration test docs (#26828)

* docs: update integration test commands for Vitest 4.0

Vitest 4.0 no longer supports custom CLI flags like --integrationTestsOnly.
Updated documentation to use the new VITEST_MODE=integration environment
variable syntax instead.

Co-Authored-By: [email protected] <[email protected]>

* fix: load .env file in vitest config for integration tests

Vitest 4.0 doesn't automatically load .env files into process.env.
This caused integration tests to fail with ECONNREFUSED errors because
DATABASE_URL was not available.

Added loadEnv from Vite to load .env file at the start of vitest config.

Co-Authored-By: [email protected] <[email protected]>

* chore: remove unnecessary comment

Co-Authored-By: [email protected] <[email protected]>

* fix: only load .env vars if not already set

Co-Authored-By: [email protected] <[email protected]>

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
Eunjae LeeandDevin AI authored and GitHub committed 2026-01-14 14:12:34 +01:00
1 parent b94e522dd1
commit 97bfb8158d
3 files changed
+14 -6

No files matched your search

+4 -4
View File
@@ -34,9 +34,9 @@
### Integration Tests
- `yarn test -- --integrationTestsOnly` - Run integration tests (vitest)
- `yarn test <filename> -- --integrationTestsOnly` - Run integration tests for specific file
- `yarn test <filename> -t "<testName>" -- --integrationTestsOnly` - Run specific integration test by name for specific file
- `VITEST_MODE=integration yarn test` - Run integration tests (vitest)
- `VITEST_MODE=integration yarn test <filename>` - Run integration tests for specific file
- `VITEST_MODE=integration yarn test <filename> -t "<testName>"` - 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