Skip to content

Commit eef3051

Browse files
richiemccolldanielleadams
authored andcommittedApr 5, 2023
doc: add test:coverage event to custom reporter examples
PR-URL: #46752 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent e6db6be commit eef3051

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
@@ -555,6 +555,11 @@ const customReporter = new Transform({
555555
case 'test:diagnostic':
556556
callback(null, event.data.message);
557557
break;
558+
case 'test:coverage': {
559+
const { totalLineCount } = event.data.summary.totals;
560+
callback(null, `total line count: ${totalLineCount}\n`);
561+
break;
562+
}
558563
}
559564
},
560565
});
@@ -584,6 +589,11 @@ const customReporter = new Transform({
584589
case 'test:diagnostic':
585590
callback(null, event.data.message);
586591
break;
592+
case 'test:coverage': {
593+
const { totalLineCount } = event.data.summary.totals;
594+
callback(null, `total line count: ${totalLineCount}\n`);
595+
break;
596+
}
587597
}
588598
},
589599
});
@@ -612,6 +622,11 @@ export default async function * customReporter(source) {
612622
case 'test:diagnostic':
613623
yield `${event.data.message}\n`;
614624
break;
625+
case 'test:coverage': {
626+
const { totalLineCount } = event.data.summary.totals;
627+
yield `total line count: ${totalLineCount}\n`;
628+
break;
629+
}
615630
}
616631
}
617632
}
@@ -636,6 +651,11 @@ module.exports = async function * customReporter(source) {
636651
case 'test:diagnostic':
637652
yield `${event.data.message}\n`;
638653
break;
654+
case 'test:coverage': {
655+
const { totalLineCount } = event.data.summary.totals;
656+
yield `total line count: ${totalLineCount}\n`;
657+
break;
658+
}
639659
}
640660
}
641661
};

0 commit comments

Comments
 (0)
Please sign in to comment.