Skip to content

Commit

Permalink
TINY-11177: The test wasn't broken, my code was. Messages sent close …
Browse files Browse the repository at this point in the history
…to the end of the test run are now waited for correctly.
  • Loading branch information
TheSpyder committed Sep 16, 2024
1 parent b0dc184 commit c4359e8
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions modules/runner/src/main/ts/reporter/Reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,17 +179,15 @@ export const Reporter = (params: UrlParams, callbacks: Callbacks, ui: ReporterUi
};
};

const waitForResults = (): Promise<void> => {
const waitForResults = async (): Promise<void> => {
sendCurrentResults();
const currentRequests = requestsInFlight.slice(0);
requestsInFlight.length = 0;
Promise.all(currentRequests).then(() => {
if (requestsInFlight.length > 0) {
const currentRequests = requestsInFlight.slice(0);
requestsInFlight.length = 0;
await Promise.all(currentRequests);
// if more things have been queued, such as a failing test stack trace, wait for those as well
if (requestsInFlight.length !== 0) {
return waitForResults();
}
});
return Promise.resolve();
return waitForResults();
}
};

const done = (error?: LoggedError): void => {
Expand Down

0 comments on commit c4359e8

Please sign in to comment.