From 3c80287e406575f5d888ba3db7e9a84a22dd8a15 Mon Sep 17 00:00:00 2001 From: richiemccoll Date: Fri, 17 Feb 2023 09:55:22 +0000 Subject: [PATCH] doc: add test:coverage event to custom reporter examples --- doc/api/test.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/doc/api/test.md b/doc/api/test.md index be5b9baeeb9fbe..a88a37c933ba7c 100644 --- a/doc/api/test.md +++ b/doc/api/test.md @@ -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; + } } }, }); @@ -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; + } } }, }); @@ -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; + } } } } @@ -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; + } } } };