@@ -4,12 +4,19 @@ const {
44 MathMax,
55} = primordials ;
66const colors = require ( 'internal/util/colors' ) ;
7- const { formatTestReport } = require ( 'internal/test_runner/reporter/utils' ) ;
7+ const { getCoverageReport } = require ( 'internal/test_runner/utils' ) ;
8+ const {
9+ formatTestReport,
10+ reporterColorMap,
11+ reporterUnicodeSymbolMap,
12+ } = require ( 'internal/test_runner/reporter/utils' ) ;
813
914module . exports = async function * dot ( source ) {
1015 let count = 0 ;
1116 let columns = getLineLength ( ) ;
1217 const failedTests = [ ] ;
18+ const diagnostics = [ ] ;
19+ let coverage ;
1320 for await ( const { type, data } of source ) {
1421 if ( type === 'test:pass' ) {
1522 yield `${ colors . green } .${ colors . reset } ` ;
@@ -25,6 +32,12 @@ module.exports = async function* dot(source) {
2532 columns = getLineLength ( ) ;
2633 count = 0 ;
2734 }
35+ if ( type === 'test:diagnostic' ) {
36+ ArrayPrototypePush ( diagnostics , data ) ;
37+ }
38+ if ( type === 'test:coverage' ) {
39+ coverage = data ;
40+ }
2841 }
2942 yield '\n' ;
3043 if ( failedTests . length > 0 ) {
@@ -33,6 +46,13 @@ module.exports = async function* dot(source) {
3346 yield formatTestReport ( 'test:fail' , test ) ;
3447 }
3548 }
49+ for ( const diagnostic of diagnostics ) {
50+ const color = reporterColorMap [ diagnostic . level ] || reporterColorMap [ 'test:diagnostic' ] ;
51+ yield `${ color } ${ reporterUnicodeSymbolMap [ 'test:diagnostic' ] } ${ diagnostic . message } ${ colors . white } \n` ;
52+ }
53+ if ( coverage ) {
54+ yield getCoverageReport ( '' , coverage . summary , reporterUnicodeSymbolMap [ 'test:coverage' ] , colors . blue , true ) ;
55+ }
3656} ;
3757
3858function getLineLength ( ) {
0 commit comments