@@ -123,16 +123,16 @@ describe("isFlaky", () => {
123123 } ) ;
124124
125125 it ( "returns true for frequent alternation" , ( ) => {
126- expect (
127- isFlaky ( [ "passed" , "failed" , "passed" , "failed" , "passed" ] ) ,
128- ) . toBe ( true ) ;
126+ expect ( isFlaky ( [ "passed" , "failed" , "passed" , "failed" , "passed" ] ) ) . toBe (
127+ true ,
128+ ) ;
129129 } ) ;
130130
131131 it ( "ignores 'other' results when counting switches" , ( ) => {
132132 // After filtering: passed, failed, passed = 2 switches
133- expect (
134- isFlaky ( [ "passed" , "other" , "failed" , "other" , "passed" ] ) ,
135- ) . toBe ( true ) ;
133+ expect ( isFlaky ( [ "passed" , "other" , "failed" , "other" , "passed" ] ) ) . toBe (
134+ true ,
135+ ) ;
136136 } ) ;
137137
138138 it ( "only looks at first 10 entries" , ( ) => {
@@ -163,9 +163,7 @@ describe("classifyFailure", () => {
163163 it ( "tags as 'new' when there is no prior history" , ( ) => {
164164 const suiteId = "suite-new" ;
165165 const run = makeRun ( { suiteId, result : "failed" } ) ;
166- const groups : CommitGroup [ ] = [
167- makeCommitGroup ( { runs : [ run ] } ) ,
168- ] ;
166+ const groups : CommitGroup [ ] = [ makeCommitGroup ( { runs : [ run ] } ) ] ;
169167
170168 const result = classifyFailure ( run , "New Suite" , groups ) ;
171169 expect ( result . tags ) . toContain ( "new" ) ;
@@ -218,11 +216,7 @@ describe("classifyFailure", () => {
218216 } ) ,
219217 ] ;
220218
221- const result = classifyFailure (
222- failedRun ,
223- "Flaky Regression" ,
224- groups ,
225- ) ;
219+ const result = classifyFailure ( failedRun , "Flaky Regression" , groups ) ;
226220 expect ( result . tags ) . toContain ( "regression" ) ;
227221 expect ( result . tags ) . toContain ( "flaky" ) ;
228222 } ) ;
@@ -287,156 +281,3 @@ describe("classifyAllFailures", () => {
287281 expect ( results [ 0 ] . suiteName ) . toBe ( "Unknown suite" ) ;
288282 } ) ;
289283} ) ;
290-
291- // ---------------------------------------------------------------------------
292- // buildTriageContext
293- // ---------------------------------------------------------------------------
294-
295- describe ( "buildTriageContext" , ( ) => {
296- it ( "builds context with correct aggregated data" , ( ) => {
297- const failedRun = makeRun ( {
298- suiteId : "s1" ,
299- result : "failed" ,
300- summary : { total : 10 , passed : 7 , failed : 3 , passRate : 70 } ,
301- configSnapshot : {
302- tests : [
303- {
304- title : "test-a" ,
305- query : "q" ,
306- provider : "p" ,
307- model : "m" ,
308- runs : 1 ,
309- expectedToolCalls : [ ] ,
310- } ,
311- {
312- title : "test-b" ,
313- query : "q" ,
314- provider : "p" ,
315- model : "m" ,
316- runs : 1 ,
317- expectedToolCalls : [ ] ,
318- } ,
319- ] ,
320- environment : { servers : [ ] } ,
321- } ,
322- } ) ;
323- const passedRun = makeRun ( {
324- suiteId : "s2" ,
325- result : "passed" ,
326- summary : { total : 5 , passed : 5 , failed : 0 , passRate : 100 } ,
327- } ) ;
328- const notRunRun = makeRun ( {
329- suiteId : "s3" ,
330- result : "cancelled" ,
331- } ) ;
332-
333- const suiteMap = new Map ( [
334- [ "s1" , "Failed Suite" ] ,
335- [ "s2" , "Passed Suite" ] ,
336- [ "s3" , "Not Run Suite" ] ,
337- ] ) ;
338-
339- const commitGroup = makeCommitGroup ( {
340- commitSha : "abc123" ,
341- shortSha : "abc1234" ,
342- branch : "main" ,
343- runs : [ failedRun , passedRun , notRunRun ] ,
344- suiteMap,
345- } ) ;
346-
347- const classified = [
348- {
349- run : failedRun ,
350- suiteName : "Failed Suite" ,
351- tags : [ "regression" as const ] ,
352- } ,
353- ] ;
354-
355- const ctx = buildTriageContext (
356- commitGroup ,
357- classified ,
358- [ passedRun ] ,
359- [ notRunRun ] ,
360- ) ;
361-
362- expect ( ctx . commitSha ) . toBe ( "abc1234" ) ;
363- expect ( ctx . branch ) . toBe ( "main" ) ;
364- expect ( ctx . totalSuites ) . toBe ( 3 ) ;
365- expect ( ctx . totalCases . total ) . toBe ( 15 ) ;
366- expect ( ctx . totalCases . passed ) . toBe ( 12 ) ;
367- expect ( ctx . totalCases . failed ) . toBe ( 3 ) ;
368- expect ( ctx . failures ) . toHaveLength ( 1 ) ;
369- expect ( ctx . failures [ 0 ] . suiteName ) . toBe ( "Failed Suite" ) ;
370- expect ( ctx . failures [ 0 ] . tags ) . toEqual ( [ "regression" ] ) ;
371- expect ( ctx . failures [ 0 ] . testNames ) . toEqual ( [ "test-a" , "test-b" ] ) ;
372- expect ( ctx . passedSuites ) . toEqual ( [ "Passed Suite" ] ) ;
373- expect ( ctx . notRunSuites ) . toEqual ( [ "Not Run Suite" ] ) ;
374- } ) ;
375- } ) ;
376-
377- // ---------------------------------------------------------------------------
378- // buildOverviewTriageContext
379- // ---------------------------------------------------------------------------
380-
381- describe ( "buildOverviewTriageContext" , ( ) => {
382- it ( "categorizes suites correctly" , ( ) => {
383- const suites = [
384- {
385- suite : { _id : "s1" , name : "Failing Suite" } as any ,
386- latestRun : makeRun ( { suiteId : "s1" , result : "failed" } ) ,
387- recentRuns : [ ] ,
388- passRateTrend : [ ] ,
389- totals : { passed : 3 , failed : 2 , runs : 5 } ,
390- } ,
391- {
392- suite : { _id : "s2" , name : "Passing Suite" } as any ,
393- latestRun : makeRun ( { suiteId : "s2" , result : "passed" } ) ,
394- recentRuns : [ ] ,
395- passRateTrend : [ ] ,
396- totals : { passed : 10 , failed : 0 , runs : 10 } ,
397- } ,
398- {
399- suite : { _id : "s3" , name : "New Suite" } as any ,
400- latestRun : null ,
401- recentRuns : [ ] ,
402- passRateTrend : [ ] ,
403- totals : { passed : 0 , failed : 0 , runs : 0 } ,
404- } ,
405- ] ;
406-
407- const ctx = buildOverviewTriageContext ( suites , [ ] ) ;
408- expect ( ctx . totalSuites ) . toBe ( 3 ) ;
409- expect ( ctx . passingSuites ) . toBe ( 1 ) ;
410- expect ( ctx . neverRunSuites ) . toBe ( 1 ) ;
411- expect ( ctx . failingSuites ) . toHaveLength ( 1 ) ;
412- expect ( ctx . failingSuites [ 0 ] . name ) . toBe ( "Failing Suite" ) ;
413- expect ( ctx . failingSuites [ 0 ] . passRate ) . toBe ( "60%" ) ;
414- } ) ;
415-
416- it ( "includes suites that passed overall but have failed cases" , ( ) => {
417- const suites = [
418- {
419- suite : { _id : "s1" , name : "Mostly Passing Suite" } as any ,
420- latestRun : makeRun ( { suiteId : "s1" , result : "passed" } ) ,
421- recentRuns : [ ] ,
422- passRateTrend : [ ] ,
423- totals : { passed : 14 , failed : 2 , runs : 16 } ,
424- } ,
425- {
426- suite : { _id : "s2" , name : "Fully Passing Suite" } as any ,
427- latestRun : makeRun ( { suiteId : "s2" , result : "passed" } ) ,
428- recentRuns : [ ] ,
429- passRateTrend : [ ] ,
430- totals : { passed : 10 , failed : 0 , runs : 10 } ,
431- } ,
432- ] ;
433-
434- const ctx = buildOverviewTriageContext ( suites , [ ] ) ;
435- expect ( ctx . totalSuites ) . toBe ( 2 ) ;
436- expect ( ctx . passingSuites ) . toBe ( 1 ) ;
437- expect ( ctx . failingSuites ) . toHaveLength ( 1 ) ;
438- expect ( ctx . failingSuites [ 0 ] . name ) . toBe ( "Mostly Passing Suite" ) ;
439- expect ( ctx . failingSuites [ 0 ] . passRate ) . toBe ( "88%" ) ;
440- expect ( ctx . failingSuites [ 0 ] . failedCases ) . toBe ( 2 ) ;
441- } ) ;
442- } ) ;
0 commit comments