Skip to content

Commit

Permalink
Don't print test summary in --silent (jestjs#4106)
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronabramov authored and cpojer committed Jul 22, 2017
1 parent 0b0d34b commit 3ce4d9f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,5 @@ exports[`does not print to console with --silent 3`] = `
Tests: 1 passed, 1 total
Snapshots: 0 total
Time: <<REPLACED>>
Ran all test suites.
"
`;
2 changes: 1 addition & 1 deletion integration_tests/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ const createEmptyPackage = (directory, packageJson) => {

const extractSummary = stdout => {
const match = stdout.match(
/Test Suites:.*\nTests.*\nSnapshots.*\nTime.*\nRan all test suites.*\n*$/gm,
/Test Suites:.*\nTests.*\nSnapshots.*\nTime.*(\nRan all test suites)*.*\n*$/gm,
);
if (!match) {
throw new Error(
Expand Down
20 changes: 11 additions & 9 deletions packages/jest-cli/src/reporters/summary_reporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,16 +106,18 @@ class SummaryReporter extends BaseReporter {
);

if (numTotalTestSuites) {
const testSummary = wasInterrupted
? chalk.bold.red('Test run was interrupted.')
: this._getTestSummary(contexts, this._globalConfig);
this.log(
getSummary(aggregatedResults, {
estimatedTime: this._estimatedTime,
}) +
let message = getSummary(aggregatedResults, {
estimatedTime: this._estimatedTime,
});

if (!this._globalConfig.silent) {
message +=
'\n' +
testSummary,
);
(wasInterrupted
? chalk.bold.red('Test run was interrupted.')
: this._getTestSummary(contexts, this._globalConfig));
}
this.log(message);
}
}
}
Expand Down

0 comments on commit 3ce4d9f

Please sign in to comment.