Skip to content

Commit

Permalink
doc: add test:coverage event to custom reporter examples
Browse files Browse the repository at this point in the history
PR-URL: #46752
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Moshe Atlow <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
  • Loading branch information
richiemccoll authored Feb 23, 2023
1 parent 7a1d158 commit 2636b55
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions doc/api/test.md
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,11 @@ const customReporter = new Transform({
case 'test:diagnostic':
callback(null, event.data.message);
break;
case 'test:coverage': {
const { totalLineCount } = event.data.summary.totals;
callback(null, `total line count: ${totalLineCount}\n`);
break;
}
}
},
});
Expand Down Expand Up @@ -586,6 +591,11 @@ const customReporter = new Transform({
case 'test:diagnostic':
callback(null, event.data.message);
break;
case 'test:coverage': {
const { totalLineCount } = event.data.summary.totals;
callback(null, `total line count: ${totalLineCount}\n`);
break;
}
}
},
});
Expand Down Expand Up @@ -614,6 +624,11 @@ export default async function * customReporter(source) {
case 'test:diagnostic':
yield `${event.data.message}\n`;
break;
case 'test:coverage': {
const { totalLineCount } = event.data.summary.totals;
yield `total line count: ${totalLineCount}\n`;
break;
}
}
}
}
Expand All @@ -638,6 +653,11 @@ module.exports = async function * customReporter(source) {
case 'test:diagnostic':
yield `${event.data.message}\n`;
break;
case 'test:coverage': {
const { totalLineCount } = event.data.summary.totals;
yield `total line count: ${totalLineCount}\n`;
break;
}
}
}
};
Expand Down

0 comments on commit 2636b55

Please sign in to comment.