(
suite: SuiteNode,
ancestors: Array<SuiteNode>,
results: Array<TestResult>,
state: {
index: number
total: number
},
options: {
onTestStart?: (context: {
name: string
index: number
total: number
}) => void
},
)
| 419 | } |
| 420 | |
| 421 | async function runSuite( |
| 422 | suite: SuiteNode, |
| 423 | ancestors: Array<SuiteNode>, |
| 424 | results: Array<TestResult>, |
| 425 | state: { |
| 426 | index: number |
| 427 | total: number |
| 428 | }, |
| 429 | options: { |
| 430 | onTestStart?: (context: { |
| 431 | name: string |
| 432 | index: number |
| 433 | total: number |
| 434 | }) => void |
| 435 | }, |
| 436 | ): Promise<void> { |
| 437 | if (suite.skipped) { |
| 438 | return |
| 439 | } |
| 440 | |
| 441 | const suitePath = [...ancestors, suite] |
| 442 | const beforeAllSucceeded = await runHookList( |
| 443 | suite.beforeAllHooks, |
| 444 | `${formatSuitePath(suitePath)} beforeAll`, |
| 445 | results, |
| 446 | ) |
| 447 | |
| 448 | if (beforeAllSucceeded) { |
| 449 | for (const testNode of suite.tests) { |
| 450 | const testName = formatSuitePath(suitePath, testNode.name) |
| 451 | state.index++ |
| 452 | |
| 453 | if (testNode.skipped) { |
| 454 | results.push({ |
| 455 | name: testName, |
| 456 | status: `skipped`, |
| 457 | }) |
| 458 | continue |
| 459 | } |
| 460 | |
| 461 | options.onTestStart?.({ |
| 462 | name: testName, |
| 463 | index: state.index, |
| 464 | total: state.total, |
| 465 | }) |
| 466 | |
| 467 | try { |
| 468 | for (const entry of suitePath) { |
| 469 | for (const hook of entry.beforeEachHooks) { |
| 470 | await hook() |
| 471 | } |
| 472 | } |
| 473 | |
| 474 | await testNode.fn() |
| 475 | results.push({ |
| 476 | name: testName, |
| 477 | status: `passed`, |
| 478 | }) |
no test coverage detected