esnext-coverage-format-text
Code coverage reporter for esnext-coverage.
Similar to other coverage formatters, esnext-coverage-format-text accepts a coverage results object and produces a report as an utf8-encoded string.
Installation
npm install esnext-coverage-format-text --save-dev
Usage
Usage with test frameworks
Add esnext-coverage-format-text to the list of reporters in esnext-coverage configuration object or to your karma configuration file.
reporters: [
{
formatter: 'text',
outFile: 'reports/text-report.txt',
console: true
}
]
Usage with esnext-coverage cli
esnext-coverage format coverage.json -f text -o report.txt
Usage in Node
import fs from 'fs';
import formatter from 'esnext-coverage-format-text';
fs.readFile('coverage.json', 'utf8', (err, data) => {
const coverage = JSON.parse(data);
const report = formatter(coverage);
fs.writeFile('text-report.txt', report);
});
License
MIT License