(profile, run)
| 359 | } |
| 360 | |
| 361 | function verifyCoverage(profile, run) { |
| 362 | const index = new Map(); |
| 363 | |
| 364 | for (const entry of run.results) { |
| 365 | if (!isPlainObject(entry)) continue; |
| 366 | if (entry.framework !== profile.framework) continue; |
| 367 | const scenario = |
| 368 | typeof entry.scenario === "string" && entry.scenario.length > 0 ? entry.scenario : null; |
| 369 | if (!scenario) continue; |
| 370 | const params = normalizeParams(entry.params ?? {}, `results.params(${scenario})`); |
| 371 | const key = makeKey(scenario, profile.framework, params); |
| 372 | index.set(key, true); |
| 373 | } |
| 374 | |
| 375 | for (const scenario of profile.requiredScenarios) { |
| 376 | const hasAnyForScenario = [...index.keys()].some((key) => |
| 377 | key.startsWith(`${scenario}|${profile.framework}|`), |
| 378 | ); |
| 379 | if (!hasAnyForScenario) { |
| 380 | fail(`required scenario missing from output: ${scenario} [${profile.framework}]`); |
| 381 | } |
| 382 | } |
| 383 | |
| 384 | for (const [scenario, paramSets] of profile.requiredScenarioParams.entries()) { |
| 385 | for (const params of paramSets) { |
| 386 | const key = makeKey(scenario, profile.framework, params); |
| 387 | if (!index.has(key)) { |
| 388 | fail( |
| 389 | `required scenario+params missing from output: ${scenario} [${profile.framework}] params=${stableStringify( |
| 390 | params, |
| 391 | )}`, |
| 392 | ); |
| 393 | } |
| 394 | } |
| 395 | } |
| 396 | |
| 397 | return { |
| 398 | requiredScenarios: profile.requiredScenarios.length, |
| 399 | requiredParamRows: [...profile.requiredScenarioParams.values()].reduce( |
| 400 | (sum, paramSets) => sum + paramSets.length, |
| 401 | 0, |
| 402 | ), |
| 403 | frameworkResultRows: [...index.keys()].length, |
| 404 | }; |
| 405 | } |
| 406 | |
| 407 | async function main() { |
| 408 | const { outputDir: outputDirArg } = parseArgs(process.argv.slice(2)); |
no test coverage detected