fix: resolve test environment loading race condition in CI
- Move getTestConfig() calls from module level to test execution time - Add CI-specific debug logging to diagnose environment loading issues - Add verification step in CI workflow to check .env.test availability - Ensure environment variables are loaded before tests access config The issue was that config was being accessed at module import time, which could happen before the global setup runs in some CI environments.
This commit is contained in:
9
.github/workflows/test.yml
vendored
9
.github/workflows/test.yml
vendored
@@ -19,6 +19,15 @@ jobs:
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
# Verify test environment setup
|
||||
- name: Verify test environment
|
||||
run: |
|
||||
echo "Current directory: $(pwd)"
|
||||
echo "Checking for .env.test file:"
|
||||
ls -la .env.test || echo ".env.test not found!"
|
||||
echo "First few lines of .env.test:"
|
||||
head -5 .env.test || echo "Cannot read .env.test"
|
||||
|
||||
# Run tests with coverage and multiple reporters
|
||||
- name: Run tests with coverage
|
||||
run: npm run test:ci
|
||||
|
||||
Reference in New Issue
Block a user