Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove custom coverage printing. #1999

Merged
merged 1 commit into from
Oct 26, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 8 additions & 16 deletions packages/jest-cli/src/reporters/CoverageReporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ const generateEmptyCoverage = require('../generateEmptyCoverage');
const isCI = require('is-ci');
const istanbulCoverage = require('istanbul-lib-coverage');

const COVERAGE_SUMMARY = chalk.bold;
const FAIL_COLOR = chalk.bold.red;
const RUNNING_TEST_COLOR = chalk.bold.dim;

Expand Down Expand Up @@ -65,25 +64,18 @@ class CoverageReporter extends BaseReporter {
if (config.coverageDirectory) {
reporter.dir = config.coverageDirectory;
}
reporter.addAll(config.coverageReporters || []);
reporter.write(this._coverageMap);

let coverageReporters = config.coverageReporters || [];
if (
config.coverageReporters &&
config.coverageReporters.length &&
config.coverageReporters.indexOf('text') === -1
!config.useStderr &&
coverageReporters.length &&
coverageReporters.indexOf('text') === -1
) {
const results = this._coverageMap.getCoverageSummary().toJSON();
const format = percent => percent + (percent === 'Unknown' ? '' : '%');
this.log(
'\n' + COVERAGE_SUMMARY('Coverage Summary') + ' (add "text" to the ' +
'"coverageReporters" setting to receive a full report)\n' +
' \u203A Statements: ' + format(results.statements.pct) + '\n' +
' \u203A Branches: ' + format(results.branches.pct) + '\n' +
' \u203A Lines: ' + format(results.lines.pct) + '\n' +
' \u203A Functions: ' + format(results.functions.pct) + '\n',
);
coverageReporters = coverageReporters.concat(['text-summary']);
}

reporter.addAll(coverageReporters);
reporter.write(this._coverageMap);
} catch (e) {
console.error(chalk.red(`
Failed to write coverage reports:
Expand Down