@@ -530,23 +530,40 @@ describe("failure output", () => {
530530 } )
531531
532532 it ( "emits one distinguishable annotation per source location" , ( ) => {
533- const annotations = formatAnnotations (
534- [
535- ...blocking ,
536- {
537- filePath : "utils/other.ts" ,
538- status : "NoCoverage" ,
539- mutatorName : "ConditionalExpression" ,
540- replacement : "true" ,
541- location : { start : { line : 9 } } ,
542- } ,
543- ] ,
544- "src" ,
545- )
533+ const mutants = [
534+ blocking [ 2 ] ,
535+ blocking [ 1 ] ,
536+ {
537+ filePath : "utils/other.ts" ,
538+ status : "NoCoverage" ,
539+ mutatorName : "ConditionalExpression" ,
540+ replacement : "true" ,
541+ location : { start : { line : 9 } } ,
542+ } ,
543+ blocking [ 0 ] ,
544+ ]
545+ const originalOrder = [ ...mutants ]
546+ const annotations = formatAnnotations ( mutants , "src" )
546547
547548 assert . equal ( annotations . length , 2 )
548- assert . match ( annotations [ 0 ] . message , / ^ s r c \/ c o r e \/ v a l u e \. t s : 4 : 2 m u t a t i o n t e s t g a p s ; e x a m p l e : / )
549- assert . match ( annotations [ 1 ] . message , / ^ s r c \/ u t i l s \/ o t h e r \. t s : 9 : 2 m u t a t i o n t e s t g a p s ; e x a m p l e : / )
549+ assert . deepEqual ( mutants , originalOrder )
550+ assert . match (
551+ annotations [ 0 ] . message ,
552+ / ^ s r c \/ c o r e \/ v a l u e \. t s : 4 : 2 m u t a t i o n t e s t g a p s ; e x a m p l e : N o C o v e r a g e S t r i n g L i t e r a l m u t a n t \( r e p l a c e m e n t : " l e f t \| r i g h t " \) / ,
553+ )
554+ assert . match (
555+ annotations [ 1 ] . message ,
556+ / ^ s r c \/ u t i l s \/ o t h e r \. t s : 9 : 2 m u t a t i o n t e s t g a p s ; e x a m p l e : S u r v i v e d B o o l e a n L i t e r a l m u t a n t \( r e p l a c e m e n t : f a l s e \) / ,
557+ )
558+ } )
559+
560+ it ( "prefixes singleton annotations with their source location" , ( ) => {
561+ const [ annotation ] = formatAnnotations ( [ blocking [ 2 ] ] , "src" )
562+
563+ assert . equal (
564+ annotation . message ,
565+ "src/utils/other.ts:9: Survived BooleanLiteral mutant (replacement: false). See the job summary for the complete list and resolution guidance." ,
566+ )
550567 } )
551568
552569 it ( "shares annotation limits across packages" , ( ) => {
@@ -625,6 +642,50 @@ describe("failure output", () => {
625642 }
626643 } )
627644
645+ it ( "classifies successful package rows from blocking mutants" , ( ) => {
646+ const repo = fs . mkdtempSync ( path . join ( os . tmpdir ( ) , "stryker-success-" ) )
647+ const packageEntry = {
648+ id : "core" ,
649+ root : "packages/core" ,
650+ vitestConfig : "vitest.unit.config.ts" ,
651+ selectors : [ "src/value.ts:1-1" ] ,
652+ changedExecutableLines : 1 ,
653+ }
654+ const execute = ( report ) =>
655+ runManifest ( repo , { packages : [ { ...packageEntry } ] } , path . join ( repo , "reports" ) , {
656+ runMutation : ( _repoRoot , _entry , _reportRoot , dryRunOnly ) =>
657+ dryRunOnly ? "Instrumented 1 source file(s) with 1 mutant(s)" : "" ,
658+ readMutationReport : ( ) => report ,
659+ } ) [ 0 ]
660+
661+ try {
662+ const advisoryRow = execute ( {
663+ files : {
664+ "src/value.ts" : {
665+ mutants : [
666+ {
667+ status : "Survived" ,
668+ mutatorName : "BooleanLiteral" ,
669+ replacement : "false" ,
670+ location : { start : { line : 1 } } ,
671+ } ,
672+ ] ,
673+ } ,
674+ } ,
675+ } )
676+ assert . equal ( advisoryRow . result , "Advisory findings" )
677+ assert . deepEqual ( advisoryRow . advisories , [ ] )
678+
679+ const passedRow = execute ( {
680+ files : { "src/value.ts" : { mutants : [ { status : "Killed" , location : { start : { line : 1 } } } ] } } ,
681+ } )
682+ assert . equal ( passedRow . result , "Passed" )
683+ assert . deepEqual ( passedRow . advisories , [ ] )
684+ } finally {
685+ fs . rmSync ( repo , { recursive : true , force : true } )
686+ }
687+ } )
688+
628689 it ( "does not fail when the GitHub job summary cannot be written" , ( ) => {
629690 const previousSummary = process . env . GITHUB_STEP_SUMMARY
630691 const summaryDirectory = fs . mkdtempSync ( path . join ( os . tmpdir ( ) , "stryker-summary-" ) )
0 commit comments