Skip to content

Commit ef43a5b

Browse files
committed
feat(check): printing error if trying to upgrade non-existent module, closes #78
1 parent cd70bb6 commit ef43a5b

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

src/dependencies.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,10 @@ function getDependenciesToCheck(options, moduleNames) {
118118
});
119119
});
120120
if (!options.tldr) {
121-
console.log('only checking');
122-
console.json(toCheck);
121+
console.log('only checking modules');
122+
console.log(toCheck.map(function (m) {
123+
return m.name + '@' + m.version;
124+
}));
123125
}
124126
}
125127
return toCheck;

src/next-update.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,16 @@ function checkCurrentInstall(options) {
7676

7777
var isOnline = Q.denodeify(require('is-online'));
7878

79+
function makeSureValidModule(moduleNames, checkingModules) {
80+
la(check.array(moduleNames), 'expected list of modules', moduleNames);
81+
la(check.array(checkingModules), 'expected list of modules to check', checkingModules);
82+
if (moduleNames.length === 1 && check.empty(checkingModules)) {
83+
console.error('Could not find module "%s" in the list of dependencies', moduleNames[0]);
84+
console.error('Please check the name');
85+
process.exit(-1);
86+
}
87+
}
88+
7989
// returns promise
8090
function checkAllUpdates(options) {
8191
options = options || {};
@@ -101,6 +111,8 @@ function checkAllUpdates(options) {
101111
var toCheck = getDependenciesToCheck(options, moduleName);
102112
check.verify.array(toCheck, 'dependencies to check should be an array');
103113

114+
makeSureValidModule(moduleName, toCheck);
115+
104116
var testVersionsBound = testVersions.bind(null, {
105117
modules: toCheck,
106118
command: checkCommand,

test/e2e.coffee

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ gt.module 'end 2 end tests',
1010
teardown: ->
1111
process.chdir __dirname
1212

13+
# TODO set the final version limit to check
1314
gt.async '--module', ->
1415
gt.exec 'node', [index, '--module', moduleName], 0
1516
, ONE_MINUTE

0 commit comments

Comments
 (0)