Function
waitForExpression
(client, expression, timeoutMs, label)
Source from the content-addressed store, hash-verified
| 404 | } |
| 405 | |
| 406 | async function waitForExpression(client, expression, timeoutMs, label) { |
| 407 | const deadline = Date.now() + timeoutMs |
| 408 | let lastError = null |
| 409 | while (Date.now() < deadline) { |
| 410 | try { |
| 411 | const value = await evaluate(client, expression) |
| 412 | if (value) return value |
| 413 | } catch (err) { |
| 414 | lastError = err |
| 415 | } |
| 416 | await sleep(50) |
| 417 | } |
| 418 | throw new Error(`Timed out waiting for ${label}: ${lastError?.message ?? 'condition not met'}`) |
| 419 | } |
| 420 | |
| 421 | function parseMainPerfSamples(log) { |
| 422 | const samples = [] |
Tested by
no test coverage detected