Skip to content

Commit

Permalink
test: handling of missing shrinkwrap file
Browse files Browse the repository at this point in the history
  • Loading branch information
rmg committed Feb 1, 2017
1 parent a99b947 commit 5a63587
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/shrinkwrap.js
Expand Up @@ -20,7 +20,8 @@ function updateShrinkwrap(shrinkwrap) {
return json(shrinkwrap).then(rewrite).then(function() {
updateShrinkwrap.out('removed resolution URLs from %s', shrinkwrap);
}).catch(function(err) {
console.error('Failed to filter out "resolved" from %s:', shrinkwrap, err);
updateShrinkwrap.out('Failed to filter out "resolved" from %s:',
shrinkwrap, err);
throw err;
});

Expand Down
10 changes: 10 additions & 0 deletions test/test-shrinkwrap.js
Expand Up @@ -39,3 +39,13 @@ test('shrinkwrapping', function(t) {
t.equal(updated, EXPECTED, 'should change shrinkwrap to match expected');
});
});

test('bad shrinkwrap file', function(t) {
tools.shrinkwrap.cli.out = function() {};
return tools.shrinkwrap.cli(SANDBOX_FILE + '-missing').then(function() {
t.fail('should have errored out');
}).catch(function(err) {
t.type(err, Error);
t.match(err.message, 'ENOENT');
});
});

0 comments on commit 5a63587

Please sign in to comment.