From 8b8fbfc169afb88f54058b9e585b83e8275c28b7 Mon Sep 17 00:00:00 2001 From: jeffmo Date: Tue, 5 Aug 2014 08:05:51 -0400 Subject: [PATCH] Make the onComplete callback for the CLI utility optional (See #105) --- bin/jest.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bin/jest.js b/bin/jest.js index 4189e43c6e5b..0483fb7ba41a 100755 --- a/bin/jest.js +++ b/bin/jest.js @@ -84,7 +84,7 @@ function _onRunComplete(completionData) { ); results += ', '; } - results += + results += colors.colorize( [numPassedTests, (numPassedTests > 1 ? 'tests' : 'test'), 'passed'].join(' '), colors.GREEN + colors.BOLD @@ -134,7 +134,8 @@ function runCLI(argv, packageRoot, onComplete) { if (argv.version) { console.log('v' + _getJestVersion()); - onComplete(true); + onComplete && onComplete(true); + return; } var config; @@ -201,7 +202,7 @@ function runCLI(argv, packageRoot, onComplete) { }) .then(function(completionData) { _onRunComplete(completionData); - onComplete(completionData.numFailedTests === 0); + onComplete && onComplete(completionData.numFailedTests === 0); }); }