(pendingSubtestsError)
| 1474 | } |
| 1475 | |
| 1476 | postRun(pendingSubtestsError) { |
| 1477 | // If the test was cancelled before it started, then the start and end |
| 1478 | // times need to be corrected. |
| 1479 | this.endTime ??= hrtime(); |
| 1480 | this.startTime ??= this.endTime; |
| 1481 | |
| 1482 | // The test has run, so recursively cancel any outstanding subtests and |
| 1483 | // mark this test as failed if any subtests failed. |
| 1484 | this.pendingSubtests = []; |
| 1485 | let failed = 0; |
| 1486 | for (let i = 0; i < this.subtests.length; i++) { |
| 1487 | const subtest = this.subtests[i]; |
| 1488 | |
| 1489 | if (!subtest.finished) { |
| 1490 | subtest.#cancel(pendingSubtestsError); |
| 1491 | subtest.postRun(pendingSubtestsError); |
| 1492 | } |
| 1493 | if (!subtest.passed && !subtest.isTodo) { |
| 1494 | failed++; |
| 1495 | } |
| 1496 | } |
| 1497 | |
| 1498 | if ((this.passed || this.parent === null) && failed > 0) { |
| 1499 | const subtestString = `subtest${failed > 1 ? 's' : ''}`; |
| 1500 | const msg = `${failed} ${subtestString} failed`; |
| 1501 | |
| 1502 | this.fail(new ERR_TEST_FAILURE(msg, kSubtestsFailed)); |
| 1503 | } |
| 1504 | |
| 1505 | this.outerSignal?.removeEventListener('abort', this.#abortHandler); |
| 1506 | this.mock?.reset(); |
| 1507 | |
| 1508 | if (this.parent !== null) { |
| 1509 | if (!this.filtered) { |
| 1510 | const report = this.getReportDetails(); |
| 1511 | report.details.passed = this.passed; |
| 1512 | this.testNumber ||= ++this.parent.outputSubtestCount; |
| 1513 | this.reporter.complete( |
| 1514 | this.nesting, this.loc, this.testNumber, this.name, |
| 1515 | report.details, report.directive, this.testId, this.parent?.testId, this.tags, |
| 1516 | ); |
| 1517 | this.parent.activeSubtests--; |
| 1518 | } |
| 1519 | |
| 1520 | this.parent.addReadySubtest(this); |
| 1521 | this.parent.processReadySubtestRange(false); |
| 1522 | this.parent.processPendingSubtests(); |
| 1523 | } else if (!this.reported) { |
| 1524 | const { |
| 1525 | diagnostics, |
| 1526 | harness, |
| 1527 | loc, |
| 1528 | nesting, |
| 1529 | reporter, |
| 1530 | } = this; |
| 1531 | |
| 1532 | this.reported = true; |
| 1533 | reporter.plan(nesting, loc, harness.counters.topLevel); |
no test coverage detected