doc: add test:coverage event to custom reporter examples

PR-URL: https://github.com/nodejs/node/pull/46752
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
Richie McColl authored and Michaël Zasso committed 2023-03-13 11:30:38 +01:00
1 parent b2cfcf9cd8
commit fc319d6a4f
1 file changed
+20
+20
View File
@@ -555,6 +555,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;
}
}
},
});
@@ -584,6 +589,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;
}
}
},
});
@@ -612,6 +622,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;
}
}
}
}
@@ -636,6 +651,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;
}
}
}
};