Skip to content

Commit d36676b

Browse files
committed
store all TestCaseStarted, filter at query time
1 parent 431b2bb commit d36676b

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

javascript/src/ExtendedQuery.ts

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export class ExtendedQuery {
5252
this.updateTestCase(envelope.testCase)
5353
}
5454
if (envelope.testCaseStarted) {
55-
this.updateTestCaseStarted(envelope.testCaseStarted)
55+
this.testCaseStarted.push(envelope.testCaseStarted)
5656
}
5757
if (envelope.testStepFinished) {
5858
this.updateTestStepFinished(envelope.testStepFinished)
@@ -147,16 +147,6 @@ export class ExtendedQuery {
147147
testCase.testSteps.forEach((testStep) => this.testStepById.set(testStep.id, testStep))
148148
}
149149

150-
private updateTestCaseStarted(testCaseStarted: TestCaseStarted) {
151-
// ensure this replaces any previous attempt for the same test case
152-
this.testCaseStarted = [
153-
...this.testCaseStarted.filter(
154-
(existing) => existing.testCaseId !== testCaseStarted.testCaseId
155-
),
156-
testCaseStarted,
157-
]
158-
}
159-
160150
private updateTestStepFinished(testStepFinished: TestStepFinished) {
161151
this.testStepFinishedByTestCaseStartedId.put(
162152
testStepFinished.testCaseStartedId,
@@ -200,7 +190,10 @@ export class ExtendedQuery {
200190
}
201191

202192
findAllTestCaseStarted(): ReadonlyArray<TestCaseStarted> {
203-
return [...this.testCaseStarted]
193+
return this.testCaseStarted.filter((testCaseStarted) => {
194+
const testCaseFinished = this.testCaseFinishedByTestCaseStartedId.get(testCaseStarted.id)
195+
return !testCaseFinished?.willBeRetried
196+
})
204197
}
205198

206199
findTestCaseBy(testCaseStarted: TestCaseStarted) {

0 commit comments

Comments
 (0)