Skip to content

Commit d45a79f

Browse files
committed
fix(front): test suite duration/sorting
1 parent ae73078 commit d45a79f

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

front/assets/js/test_results/components/test_explorer.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@ const FilterInfo = (state: { suites: types.Suite[], filteredSuites: types.Suite[
129129
return sum.add(suite.summary);
130130
}, types.Summary.empty());
131131

132-
const filteredSuiteSummary = filteredSuites.reduce((sum, suite) => {
132+
// We need to use cloneDeep because syncSummary mutates the suite
133+
const filteredSuiteSummary = _.cloneDeep(filteredSuites).reduce((sum, suite) => {
133134
suite.syncSummary();
134135
return sum.add(suite.summary);
135136
}, types.Summary.empty());

front/assets/js/test_results/types/suite.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export class Suite implements Stateful {
5555

5656
syncSummary() {
5757
this.summary = new Summary({
58-
duration: this.tests.reduce((duration, test) => duration + test.duration, 0),
58+
duration: this.summary.duration,
5959
total: this.tests.length,
6060
failed: this.tests.filter(test => test.state === State.FAILED).length,
6161
passed: this.tests.filter(test => test.state === State.PASSED).length,

0 commit comments

Comments
 (0)