fix: ensure test environment configuration is always available

- Added fallback values in getTestConfig() to prevent undefined errors
- Call setTestDefaults() if environment variables are not set
- Added CI debug logging to diagnose environment loading issues
- Made configuration access more resilient to timing issues

This should resolve the persistent CI test failure by ensuring
environment variables always have valid values.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
czlonkowski
2025-07-29 08:49:53 +02:00
parent a8c3d04c12
commit 4da7ccdec7
2 changed files with 19 additions and 4 deletions

View File

@@ -54,6 +54,16 @@ describe('Test Environment Configuration Example', () => {
it('should have mock API configuration', () => {
const testConfig = getTestConfig();
// Add debug logging for CI
if (process.env.CI) {
console.log('CI Environment Debug:', {
NODE_ENV: process.env.NODE_ENV,
N8N_API_URL: process.env.N8N_API_URL,
N8N_API_KEY: process.env.N8N_API_KEY,
configUrl: testConfig.api.url,
configKey: testConfig.api.key
});
}
expect(testConfig.api.url).toMatch(/mock-api/);
expect(testConfig.api.key).toBe('test-api-key-12345');
});