* @param {boolean} canSend * @returns {void}
(canSend)
| 981 | * @returns {void} |
| 982 | */ |
| 983 | processReadySubtestRange(canSend) { |
| 984 | const start = this.waitingOn; |
| 985 | const end = start + this.readySubtests.size; |
| 986 | |
| 987 | for (let i = start; i < end; i++) { |
| 988 | const subtest = this.readySubtests.get(i); |
| 989 | |
| 990 | // Check if the specified subtest is in the map. If it is not, return |
| 991 | // early to avoid trying to process any more tests since they would be |
| 992 | // out of order. |
| 993 | if (subtest === undefined) { |
| 994 | return; |
| 995 | } |
| 996 | |
| 997 | // Call isClearToSend() in the loop so that it is: |
| 998 | // - Only called if there are results to report in the correct order. |
| 999 | // - Guaranteed to only be called a maximum of once per call to |
| 1000 | // processReadySubtestRange(). |
| 1001 | canSend ||= this.isClearToSend(); |
| 1002 | |
| 1003 | if (!canSend) { |
| 1004 | return; |
| 1005 | } |
| 1006 | |
| 1007 | // Report the subtest's results and remove it from the ready map. |
| 1008 | subtest.finalize(); |
| 1009 | this.readySubtests.delete(i); |
| 1010 | } |
| 1011 | } |
| 1012 | |
| 1013 | createSubtest(Factory, name, options, fn, overrides) { |
| 1014 | if (typeof name === 'function') { |