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 <cjihrig@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
  • Loading branch information
richiemccoll authored and danielleadams committed Apr 5, 2023
1 parent e6db6be commit eef3051
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 @@ -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;
}
}
},
});
Expand Down Expand Up @@ -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;
}
}
},
});
Expand Down Expand Up @@ -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;
}
}
}
}
Expand All @@ -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;
}
}
}
};
Expand Down

0 comments on commit eef3051

Please sign in to comment.