@@ -80,6 +80,9 @@ export class InsightsPageController {
8080 }
8181 > ( ) ;
8282
83+ // Track flaky test counts per job
84+ const jobFlakyCountsMap = new Map < string , number > ( ) ;
85+
8386 function processTest (
8487 test : RecordedTestResult ,
8588 runId : number ,
@@ -113,6 +116,12 @@ export class InsightsPageController {
113116 jobCounts : new Map ( [ [ jobName , test . flakyCount ] ] ) ,
114117 } ) ;
115118 }
119+
120+ // Track flaky counts per job
121+ jobFlakyCountsMap . set (
122+ jobName ,
123+ ( jobFlakyCountsMap . get ( jobName ) || 0 ) + test . flakyCount ,
124+ ) ;
116125 }
117126
118127 // Track failed tests
@@ -166,10 +175,16 @@ export class InsightsPageController {
166175 ( a , b ) => b . failureCount - a . failureCount ,
167176 ) ;
168177
178+ // Convert job flaky counts to array and sort
179+ const flakyJobs = Array . from ( jobFlakyCountsMap . entries ( ) )
180+ . map ( ( [ name , count ] ) => ( { name, count } ) )
181+ . sort ( ( a , b ) => b . count - a . count ) ;
182+
169183 return {
170184 data : {
171185 flakyTests,
172186 failedTests,
187+ flakyJobs,
173188 totalRunsAnalyzed : mainBranchRuns . length ,
174189 oldestRun : mainBranchRuns [ mainBranchRuns . length - 1 ] ,
175190 newestRun : mainBranchRuns [ 0 ] ,
@@ -179,8 +194,14 @@ export class InsightsPageController {
179194}
180195
181196export default define . page < typeof handler > ( function InsightsPage ( { data } ) {
182- const { flakyTests, failedTests, totalRunsAnalyzed, oldestRun, newestRun } =
183- data ;
197+ const {
198+ flakyTests,
199+ failedTests,
200+ flakyJobs,
201+ totalRunsAnalyzed,
202+ oldestRun,
203+ newestRun,
204+ } = data ;
184205
185206 return (
186207 < div class = "container mx-auto px-4 py-8 max-w-7xl" >
@@ -270,7 +291,7 @@ export default define.page<typeof handler>(function InsightsPage({ data }) {
270291 ) }
271292 </ div >
272293
273- < div class = "bg-white rounded-lg shadow" >
294+ < div class = "bg-white rounded-lg shadow mb-6 " >
274295 < div class = "bg-yellow-100 px-4 py-3 rounded-t-lg border-b border-yellow-300" >
275296 < div class = "flex items-center justify-between" >
276297 < h2 class = "font-semibold text-xl" >
@@ -354,6 +375,52 @@ export default define.page<typeof handler>(function InsightsPage({ data }) {
354375 </ div >
355376 ) }
356377 </ div >
378+
379+ < div class = "bg-white rounded-lg shadow" >
380+ < div class = "bg-purple-100 px-4 py-3 rounded-t-lg border-b border-purple-300" >
381+ < div class = "flex items-center justify-between" >
382+ < h2 class = "font-semibold text-xl" >
383+ 🔧 Most Flaky Jobs ({ flakyJobs . length } )
384+ </ h2 >
385+ </ div >
386+ </ div >
387+ { flakyJobs . length === 0
388+ ? (
389+ < div class = "p-8 text-center" >
390+ < div class = "text-6xl mb-4" > 🎉</ div >
391+ < h3 class = "text-xl font-bold mb-2" > No Flaky Jobs!</ h3 >
392+ < p class = "text-gray-600" >
393+ No jobs had flaky tests across the analyzed runs.
394+ </ p >
395+ </ div >
396+ )
397+ : (
398+ < div class = "divide-y divide-gray-200" >
399+ { flakyJobs . map ( ( job , idx ) => (
400+ < div
401+ key = { idx }
402+ class = "px-4 py-3 hover:bg-gray-50 transition-colors"
403+ >
404+ < div class = "flex items-center justify-between gap-4" >
405+ < div class = "flex-1 min-w-0" >
406+ < div class = "font-mono text-sm font-semibold text-gray-900" >
407+ { job . name }
408+ </ div >
409+ </ div >
410+ < div class = "flex-shrink-0" >
411+ < div class = "bg-purple-100 text-purple-800 px-3 py-2 rounded text-center" >
412+ < div class = "text-2xl font-bold" >
413+ { job . count }
414+ </ div >
415+ < div class = "text-xs" > flaky tests</ div >
416+ </ div >
417+ </ div >
418+ </ div >
419+ </ div >
420+ ) ) }
421+ </ div >
422+ ) }
423+ </ div >
357424 </ div >
358425 ) ;
359426} ) ;
0 commit comments