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:
@@ -1,9 +1,18 @@
|
||||
import { beforeEach, afterEach, vi } from 'vitest';
|
||||
import { loadTestEnvironment, getTestConfig, getTestTimeout } from './test-env';
|
||||
|
||||
// CI Debug: Log environment loading in CI only
|
||||
if (process.env.CI === 'true') {
|
||||
console.log('[CI-DEBUG] Global setup starting, NODE_ENV:', process.env.NODE_ENV);
|
||||
}
|
||||
|
||||
// Load test environment configuration
|
||||
loadTestEnvironment();
|
||||
|
||||
if (process.env.CI === 'true') {
|
||||
console.log('[CI-DEBUG] Global setup complete, N8N_API_URL:', process.env.N8N_API_URL);
|
||||
}
|
||||
|
||||
// Get test configuration
|
||||
const testConfig = getTestConfig();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user