@@ -8,11 +8,6 @@ import { splitLines } from '../../../common/stringUtils';
88import { splitTestNameWithRegex } from './utils' ;
99import { clearAllChildren } from './testItemUtilities' ;
1010
11- export interface SubtestStats {
12- passed : number ;
13- failed : number ;
14- }
15-
1611/**
1712 * Stateless handler for processing execution payloads and updating TestRun instances.
1813 * This handler is shared across all workspaces and contains no instance state.
@@ -21,27 +16,23 @@ export class TestExecutionHandler {
2116 /**
2217 * Process execution payload and update test run
2318 * Pure function - no instance state used
24- * Returns subtest statistics for caller to manage
2519 */
2620 public processExecution (
2721 payload : ExecutionTestPayload ,
2822 runInstance : TestRun ,
2923 testItemIndex : TestItemIndex ,
3024 testController : TestController ,
31- ) : Map < string , SubtestStats > {
32- const subtestStats = new Map < string , SubtestStats > ( ) ;
25+ ) : void {
3326 const rawTestExecData = payload as ExecutionTestPayload ;
3427
3528 if ( rawTestExecData !== undefined && rawTestExecData . result !== undefined ) {
3629 for ( const keyTemp of Object . keys ( rawTestExecData . result ) ) {
3730 const testItem = rawTestExecData . result [ keyTemp ] ;
3831
3932 // Delegate to specific outcome handlers
40- this . handleTestOutcome ( keyTemp , testItem , runInstance , testItemIndex , testController , subtestStats ) ;
33+ this . handleTestOutcome ( keyTemp , testItem , runInstance , testItemIndex , testController ) ;
4134 }
4235 }
43-
44- return subtestStats ;
4536 }
4637
4738 /**
@@ -53,7 +44,6 @@ export class TestExecutionHandler {
5344 runInstance : TestRun ,
5445 testItemIndex : TestItemIndex ,
5546 testController : TestController ,
56- subtestStats : Map < string , SubtestStats > ,
5747 ) : void {
5848 if ( testItem . outcome === 'error' ) {
5949 this . handleTestError ( runId , testItem , runInstance , testItemIndex , testController ) ;
@@ -64,9 +54,9 @@ export class TestExecutionHandler {
6454 } else if ( testItem . outcome === 'skipped' ) {
6555 this . handleTestSkipped ( runId , runInstance , testItemIndex , testController ) ;
6656 } else if ( testItem . outcome === 'subtest-failure' ) {
67- this . handleSubtestFailure ( runId , testItem , runInstance , testItemIndex , testController , subtestStats ) ;
57+ this . handleSubtestFailure ( runId , testItem , runInstance , testItemIndex , testController ) ;
6858 } else if ( testItem . outcome === 'subtest-success' ) {
69- this . handleSubtestSuccess ( runId , runInstance , testItemIndex , testController , subtestStats ) ;
59+ this . handleSubtestSuccess ( runId , runInstance , testItemIndex , testController ) ;
7060 }
7161 }
7262
@@ -168,17 +158,16 @@ export class TestExecutionHandler {
168158 runInstance : TestRun ,
169159 testItemIndex : TestItemIndex ,
170160 testController : TestController ,
171- subtestStats : Map < string , SubtestStats > ,
172161 ) : void {
173162 const [ parentTestCaseId , subtestId ] = splitTestNameWithRegex ( runId ) ;
174163 const parentTestItem = testItemIndex . getTestItem ( parentTestCaseId , testController ) ;
175164
176165 if ( parentTestItem ) {
177- const stats = subtestStats . get ( parentTestCaseId ) ;
166+ const stats = testItemIndex . getSubtestStats ( parentTestCaseId ) ;
178167 if ( stats ) {
179168 stats . failed += 1 ;
180169 } else {
181- subtestStats . set ( parentTestCaseId , {
170+ testItemIndex . setSubtestStats ( parentTestCaseId , {
182171 failed : 1 ,
183172 passed : 0 ,
184173 } ) ;
@@ -213,17 +202,16 @@ export class TestExecutionHandler {
213202 runInstance : TestRun ,
214203 testItemIndex : TestItemIndex ,
215204 testController : TestController ,
216- subtestStats : Map < string , SubtestStats > ,
217205 ) : void {
218206 const [ parentTestCaseId , subtestId ] = splitTestNameWithRegex ( runId ) ;
219207 const parentTestItem = testItemIndex . getTestItem ( parentTestCaseId , testController ) ;
220208
221209 if ( parentTestItem ) {
222- const stats = subtestStats . get ( parentTestCaseId ) ;
210+ const stats = testItemIndex . getSubtestStats ( parentTestCaseId ) ;
223211 if ( stats ) {
224212 stats . passed += 1 ;
225213 } else {
226- subtestStats . set ( parentTestCaseId , { failed : 0 , passed : 1 } ) ;
214+ testItemIndex . setSubtestStats ( parentTestCaseId , { failed : 0 , passed : 1 } ) ;
227215 clearAllChildren ( parentTestItem ) ;
228216 }
229217
0 commit comments