()
| 1595 | } |
| 1596 | |
| 1597 | finalize() { |
| 1598 | // By the time this function is called, the following can be relied on: |
| 1599 | // - The current test has completed or been cancelled. |
| 1600 | // - All of this test's subtests have completed or been cancelled. |
| 1601 | // - It is the current test's turn to report its results. |
| 1602 | |
| 1603 | // Report any subtests that have not been reported yet. Since all of the |
| 1604 | // subtests have finished, it's safe to pass true to |
| 1605 | // processReadySubtestRange(), which will finalize all remaining subtests. |
| 1606 | this.processReadySubtestRange(true); |
| 1607 | |
| 1608 | // Output this test's results and update the parent's waiting counter. |
| 1609 | this.report(); |
| 1610 | this.parent.waitingOn++; |
| 1611 | this.finished = true; |
| 1612 | |
| 1613 | if (this.parent === this.root && |
| 1614 | this.root.waitingOn > this.root.subtests.length) { |
| 1615 | // At this point all of the tests have finished running. However, there |
| 1616 | // might be ref'ed handles keeping the event loop alive. This gives the |
| 1617 | // global after() hook a chance to clean them up. The user may also |
| 1618 | // want to force the test runner to exit despite ref'ed handles. |
| 1619 | this.root.run(); |
| 1620 | } |
| 1621 | } |
| 1622 | |
| 1623 | duration() { |
| 1624 | // Duration is recorded in BigInt nanoseconds. Convert to milliseconds. |
no test coverage detected