From d45a79fde5078838743f2312674da01d57ec02cf Mon Sep 17 00:00:00 2001 From: Marco Sylvestersen Date: Fri, 10 Oct 2025 16:04:07 +0200 Subject: [PATCH] fix(front): test suite duration/sorting --- front/assets/js/test_results/components/test_explorer.tsx | 3 ++- front/assets/js/test_results/types/suite.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/front/assets/js/test_results/components/test_explorer.tsx b/front/assets/js/test_results/components/test_explorer.tsx index 79100b693..639ea4979 100644 --- a/front/assets/js/test_results/components/test_explorer.tsx +++ b/front/assets/js/test_results/components/test_explorer.tsx @@ -129,7 +129,8 @@ const FilterInfo = (state: { suites: types.Suite[], filteredSuites: types.Suite[ return sum.add(suite.summary); }, types.Summary.empty()); - const filteredSuiteSummary = filteredSuites.reduce((sum, suite) => { + // We need to use cloneDeep because syncSummary mutates the suite + const filteredSuiteSummary = _.cloneDeep(filteredSuites).reduce((sum, suite) => { suite.syncSummary(); return sum.add(suite.summary); }, types.Summary.empty()); diff --git a/front/assets/js/test_results/types/suite.ts b/front/assets/js/test_results/types/suite.ts index 20c6c53fd..c295bea48 100644 --- a/front/assets/js/test_results/types/suite.ts +++ b/front/assets/js/test_results/types/suite.ts @@ -55,7 +55,7 @@ export class Suite implements Stateful { syncSummary() { this.summary = new Summary({ - duration: this.tests.reduce((duration, test) => duration + test.duration, 0), + duration: this.summary.duration, total: this.tests.length, failed: this.tests.filter(test => test.state === State.FAILED).length, passed: this.tests.filter(test => test.state === State.PASSED).length,