Skip to content

Commit

Permalink
TINY-11177: Only update the HUD once for batch results, instead of on…
Browse files Browse the repository at this point in the history
…ce for every result
  • Loading branch information
TheSpyder committed Sep 16, 2024
1 parent c4359e8 commit 5e55c44
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions modules/server/src/main/ts/bedrock/server/Controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,8 @@ export const create = (stickyFirstSession: boolean, overallTimeout: number, test
updateHud(session);
};

const recordTestResult = (id: string, name: string, file: string, passed: boolean, time: string, error: TestErrorData | null, skipped: string) => {
const now = Date.now();
const session = getSession(id);
const record = { name, file, passed, time, error, skipped };
const recordTestResult = (session: TestSession, record: TestResult) => {
const {name, file} = record;
if (session.lookup[file] !== undefined && session.lookup[file][name] !== undefined) {
// rerunning a test
session.results[session.lookup[file][name]] = record;
Expand All @@ -146,9 +144,6 @@ export const create = (stickyFirstSession: boolean, overallTimeout: number, test
session.lookup[file][name] = session.results.length;
session.results.push(record);
}
session.updated = now;
session.done = false;
updateHud(session);
};

const recordTestResults = (id: string, results: TestResult[]) => {
Expand All @@ -163,9 +158,12 @@ export const create = (stickyFirstSession: boolean, overallTimeout: number, test
};
}
results.forEach(
({name, file, passed, time, error, skipped}) =>
recordTestResult(id, name, file, passed, time, error, skipped)
(record) =>
recordTestResult(session, record)
);
session.updated = now;
session.done = false;
updateHud(session);
};

const recordDone = (id: string, error?: string) => {
Expand Down

0 comments on commit 5e55c44

Please sign in to comment.