@@ -34,16 +34,33 @@ function parseResults() {
3434 failedTests : [ ] ,
3535 nonStrictTests : [ ] ,
3636 unimplementedTests : [ ] ,
37- informationalTests : [ ]
37+ informationalTests : [ ] ,
38+ performance : {
39+ totalDuration : 0 ,
40+ testCount : 0 ,
41+ byCategory : {
42+ 'limits' : { tests : [ ] , totalDuration : 0 , description : '9.x - Limits/Performance' } ,
43+ 'largeMessages' : { tests : [ ] , totalDuration : 0 , description : '10.x - Large Messages' } ,
44+ 'fragmentation' : { tests : [ ] , totalDuration : 0 , description : '12.x - WebSocket Fragmentation' } ,
45+ 'other' : { tests : [ ] , totalDuration : 0 , description : 'Other Tests' }
46+ }
47+ }
3848 } ;
3949
50+ // Category mapping for performance tests
51+ const categoryMap = {
52+ '9' : 'limits' ,
53+ '10' : 'largeMessages' ,
54+ '12' : 'fragmentation'
55+ } ;
56+
4057 // Parse each test case
4158 for ( const [ testCase , result ] of Object . entries ( testResults ) ) {
4259 summary . total ++ ;
43-
60+
4461 const behavior = result . behavior ;
4562 const behaviorClose = result . behaviorClose ;
46-
63+
4764 if ( behavior === 'OK' && behaviorClose === 'OK' ) {
4865 summary . ok ++ ;
4966 } else if ( behavior === 'UNIMPLEMENTED' ) {
@@ -81,6 +98,23 @@ function parseResults() {
8198 remoteCloseCode : result . remoteCloseCode
8299 } ) ;
83100 }
101+
102+ // Track performance metrics
103+ if ( result . duration !== undefined ) {
104+ summary . performance . totalDuration += result . duration ;
105+ summary . performance . testCount ++ ;
106+
107+ // Categorize performance tests
108+ const majorCategory = testCase . split ( '.' ) [ 0 ] ;
109+ const category = categoryMap [ majorCategory ] || 'other' ;
110+
111+ summary . performance . byCategory [ category ] . tests . push ( {
112+ testCase : testCase ,
113+ duration : result . duration ,
114+ description : result . description
115+ } ) ;
116+ summary . performance . byCategory [ category ] . totalDuration += result . duration ;
117+ }
84118 }
85119
86120 // Print summary
@@ -144,7 +178,48 @@ function parseResults() {
144178 }
145179 }
146180
147- console . log ( '\n' ) ;
181+ // Print performance summary
182+ if ( summary . performance . testCount > 0 ) {
183+ console . log ( '=== PERFORMANCE METRICS ===' ) ;
184+ console . log ( ` Total test duration: ${ summary . performance . totalDuration . toLocaleString ( ) } ms` ) ;
185+ console . log ( ` Tests with timing data: ${ summary . performance . testCount } ` ) ;
186+ console . log ( ` Average duration: ${ ( summary . performance . totalDuration / summary . performance . testCount ) . toFixed ( 2 ) } ms\n` ) ;
187+
188+ // Print category breakdown for performance-focused tests
189+ const perfCategories = Object . keys ( summary . performance . byCategory ) . filter ( key => key !== 'other' ) ;
190+ let hasPerfData = false ;
191+
192+ for ( const categoryKey of perfCategories ) {
193+ const category = summary . performance . byCategory [ categoryKey ] ;
194+ if ( category . tests . length > 0 ) {
195+ hasPerfData = true ;
196+ const avgDuration = ( category . totalDuration / category . tests . length ) . toFixed ( 2 ) ;
197+ console . log ( ` ${ category . description } :` ) ;
198+ console . log ( ` Tests: ${ category . tests . length } ` ) ;
199+ console . log ( ` Total duration: ${ category . totalDuration . toLocaleString ( ) } ms` ) ;
200+ console . log ( ` Average duration: ${ avgDuration } ms` ) ;
201+
202+ // Show top 5 slowest tests in this category
203+ const slowestTests = [ ...category . tests ]
204+ . sort ( ( a , b ) => b . duration - a . duration )
205+ . slice ( 0 , 5 ) ;
206+
207+ if ( slowestTests . length > 0 ) {
208+ console . log ( ' Slowest tests:' ) ;
209+ slowestTests . forEach ( test => {
210+ console . log ( ` ${ test . testCase } : ${ test . duration } ms` ) ;
211+ } ) ;
212+ }
213+ console . log ( '' ) ;
214+ }
215+ }
216+
217+ if ( ! hasPerfData ) {
218+ console . log ( ' No performance-focused tests (9.x, 10.x, 12.x) executed.\n' ) ;
219+ }
220+ }
221+
222+ console . log ( '' ) ;
148223
149224 // Exit with error code if there are actual failures
150225 if ( summary . failed > 0 ) {
0 commit comments