Skip to content

Commit

Permalink
Merge branch 'release/0.3.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
shamasis committed Aug 22, 2016
2 parents ac731b3 + e230f13 commit f6cf91e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
16 changes: 12 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,17 @@ module.exports = function (options, callback) {
};

// add cli parser
module.exports.cliReporter = function (options) {
module.exports.cliReporter = function (options, callback) {
return function (err, result) {
if (err) {
if (!options.supress) { throw err; }
if (!options.supress) {
if (callback) {
return callback(err, result);
}
else {
throw err;
}
}
!options.quiet && log(colors.red('err! %s'), err && err.message || err);
}

Expand All @@ -159,10 +166,11 @@ module.exports.cliReporter = function (options) {

if (failure) {
!options.quiet && log(colors.bold.red('not ok.'));
!options.exitCode && process.exit(1);
callback ? callback(new Error('package check failed'), result) : (!options.exitCode && process.exit(1));
}
else {
!options.quiet && log(colors.bold.green('ok!'));
callback && callback(null, result);
}
};
};
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "packity",
"version": "0.2.0",
"version": "0.3.1",
"description": "Sanity test for installed node modules of a package",
"main": "index.js",
"bin": {
Expand Down
2 changes: 1 addition & 1 deletion test/core-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe('core local install', function () {
require('../index')({ path: './' }, function (err, result) {
expect(result.package).to.be.eql({
"name": "packity",
"version": "0.2.0",
"version": "0.3.0",
"dependencies": {
"async": "^1.4.2",
"colors": "^1.1.2",
Expand Down

0 comments on commit f6cf91e

Please sign in to comment.