Skip to content

Commit 2636b55

Browse files
authored
doc: add test:coverage event to custom reporter examples
PR-URL: #46752 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
1 parent 7a1d158 commit 2636b55

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

doc/api/test.md

+20
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,11 @@ const customReporter = new Transform({
557557
case 'test:diagnostic':
558558
callback(null, event.data.message);
559559
break;
560+
case 'test:coverage': {
561+
const { totalLineCount } = event.data.summary.totals;
562+
callback(null, `total line count: ${totalLineCount}\n`);
563+
break;
564+
}
560565
}
561566
},
562567
});
@@ -586,6 +591,11 @@ const customReporter = new Transform({
586591
case 'test:diagnostic':
587592
callback(null, event.data.message);
588593
break;
594+
case 'test:coverage': {
595+
const { totalLineCount } = event.data.summary.totals;
596+
callback(null, `total line count: ${totalLineCount}\n`);
597+
break;
598+
}
589599
}
590600
},
591601
});
@@ -614,6 +624,11 @@ export default async function * customReporter(source) {
614624
case 'test:diagnostic':
615625
yield `${event.data.message}\n`;
616626
break;
627+
case 'test:coverage': {
628+
const { totalLineCount } = event.data.summary.totals;
629+
yield `total line count: ${totalLineCount}\n`;
630+
break;
631+
}
617632
}
618633
}
619634
}
@@ -638,6 +653,11 @@ module.exports = async function * customReporter(source) {
638653
case 'test:diagnostic':
639654
yield `${event.data.message}\n`;
640655
break;
656+
case 'test:coverage': {
657+
const { totalLineCount } = event.data.summary.totals;
658+
yield `total line count: ${totalLineCount}\n`;
659+
break;
660+
}
641661
}
642662
}
643663
};

0 commit comments

Comments
 (0)