()
| 7 | * Defaults to a mock key for deterministic local runs. |
| 8 | */ |
| 9 | export function getApiKey(): string { |
| 10 | if (shouldRunLiveE2e) { |
| 11 | const apiKey = process.env.CODEBUFF_API_KEY |
| 12 | if (!apiKey) { |
| 13 | throw new Error( |
| 14 | 'CODEBUFF_API_KEY environment variable is required for live e2e tests. ' + |
| 15 | 'Get your API key at https://www.codebuff.com/api-keys', |
| 16 | ) |
| 17 | } |
| 18 | return apiKey |
| 19 | } |
| 20 | |
| 21 | setupE2eMocks() |
| 22 | process.env.CODEBUFF_API_KEY = E2E_MOCK_API_KEY |
| 23 | return E2E_MOCK_API_KEY |
| 24 | } |
| 25 | |
| 26 | /** |
| 27 | * E2E tests should always run; use mock mode when not opted-in. |
no test coverage detected