| 208 | resolveDefaultChromePath(buildDir); |
| 209 | |
| 210 | async function runTests(attempt) { |
| 211 | if (attempt > 1) { |
| 212 | console.log(`\nRun attempt ${attempt}...\n`); |
| 213 | } |
| 214 | return await new Promise(resolve => { |
| 215 | const child = spawn(process.execPath, nodeArgs, { |
| 216 | cwd: projectRoot, |
| 217 | stdio: 'inherit', |
| 218 | env: { |
| 219 | ...process.env, |
| 220 | ...(defaultChromeExecutable |
| 221 | ? {PUPPETEER_EXECUTABLE_PATH: defaultChromeExecutable} |
| 222 | : {}), |
| 223 | CHROME_DEVTOOLS_MCP_NO_USAGE_STATISTICS: 'true', |
| 224 | CHROME_DEVTOOLS_MCP_CRASH_ON_UNCAUGHT: 'true', |
| 225 | CHROME_DEVTOOLS_MCP_NO_UPDATE_CHECKS: 'true', |
| 226 | CHROME_DEVTOOLS_MCP_NO_CONFIG_DISCOVERY: 'true', |
| 227 | ...(process.env['RUNNER_DEBUG'] === '1' |
| 228 | ? {NODE_DEBUG: 'puppeteer:*'} |
| 229 | : {}), |
| 230 | }, |
| 231 | }); |
| 232 | |
| 233 | child.on('close', code => { |
| 234 | resolve(code); |
| 235 | }); |
| 236 | }); |
| 237 | } |
| 238 | |
| 239 | const maxAttempts = shouldRetry ? 3 : 1; |
| 240 | let exitCode = 1; |