(filePath: string)
| 24 | const traceDir = path.resolve(process.cwd(), 'e2e-traces', 'base-deep') |
| 25 | |
| 26 | const loadEnvFile = async (filePath: string) => { |
| 27 | try { |
| 28 | const content = await fs.promises.readFile(filePath, 'utf-8') |
| 29 | for (const rawLine of content.split('\n')) { |
| 30 | const line = rawLine.trim() |
| 31 | if (!line || line.startsWith('#')) continue |
| 32 | const normalized = line.startsWith('export ') |
| 33 | ? line.slice('export '.length) |
| 34 | : line |
| 35 | const equalsIndex = normalized.indexOf('=') |
| 36 | if (equalsIndex <= 0) continue |
| 37 | const key = normalized.slice(0, equalsIndex).trim() |
| 38 | if (!key || process.env[key]) continue |
| 39 | let value = normalized.slice(equalsIndex + 1).trim() |
| 40 | if ( |
| 41 | (value.startsWith('"') && value.endsWith('"')) || |
| 42 | (value.startsWith("'") && value.endsWith("'")) |
| 43 | ) { |
| 44 | value = value.slice(1, -1) |
| 45 | } |
| 46 | process.env[key] = value |
| 47 | } |
| 48 | } catch { |
| 49 | // ignore missing env files |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | const getApiKeyOrSkip = (): string | null => { |
| 54 | const apiKey = |
no test coverage detected