Skip to content

Commit

Permalink
Make the onComplete callback for the CLI utility optional (See #105)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffmo committed Aug 5, 2014
1 parent ab3d966 commit 8b8fbfc
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions bin/jest.js
Expand Up @@ -84,7 +84,7 @@ function _onRunComplete(completionData) {
);
results += ', ';
}
results +=
results +=
colors.colorize(
[numPassedTests, (numPassedTests > 1 ? 'tests' : 'test'), 'passed'].join(' '),
colors.GREEN + colors.BOLD
Expand Down Expand Up @@ -134,7 +134,8 @@ function runCLI(argv, packageRoot, onComplete) {

if (argv.version) {
console.log('v' + _getJestVersion());
onComplete(true);
onComplete && onComplete(true);
return;
}

var config;
Expand Down Expand Up @@ -201,7 +202,7 @@ function runCLI(argv, packageRoot, onComplete) {
})
.then(function(completionData) {
_onRunComplete(completionData);
onComplete(completionData.numFailedTests === 0);
onComplete && onComplete(completionData.numFailedTests === 0);
});
}

Expand Down

0 comments on commit 8b8fbfc

Please sign in to comment.