Skip to content

Commit

Permalink
Improve plugman/uninstall.js messages (#630)
Browse files Browse the repository at this point in the history
* Improve plugman/uninstall.js messages
* Adapt plugman_uninstall.spec.js to new error messages
  • Loading branch information
janpio committed Jul 31, 2018
1 parent c8cb3c5 commit 6019d92
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
22 changes: 11 additions & 11 deletions integration-tests/plugman_uninstall.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ describe('uninstallPlatform', function () {
.then(function (result) {
fail();
}, function err (errMsg) {
expect(errMsg.toString()).toContain('atari not supported.');
expect(errMsg.toString()).toContain('Platform "atari" not supported.');
});
}, 6000);

Expand Down Expand Up @@ -217,9 +217,9 @@ describe('uninstallPlugin', function () {
.then(function (result) {
var del = common.spy.getDeleted(emit);
expect(del).toEqual([
'Deleted "C"',
'Deleted "D"',
'Deleted "A"'
'Deleted plugin "C"',
'Deleted plugin "D"',
'Deleted plugin "A"'
]);
});
});
Expand All @@ -229,15 +229,15 @@ describe('uninstallPlugin', function () {
.then(function (result) {
fail();
}, function err (errMsg) {
expect(errMsg.toString()).toEqual('"C" is required by (A) and cannot be removed (hint: use -f or --force)');
expect(errMsg.toString()).toEqual('Plugin "C" is required by (A) and cannot be removed (hint: use -f or --force)');
});
}, 6000);

it('Test 008 : allow forcefully removing a plugin', function () {
return uninstall.uninstallPlugin('C', plugins_install_dir, {force: true})
.then(function () {
var del = common.spy.getDeleted(emit);
expect(del).toEqual(['Deleted "C"']);
expect(del).toEqual(['Deleted plugin "C"']);
});
});

Expand All @@ -246,8 +246,8 @@ describe('uninstallPlugin', function () {
.then(function () {
var del = common.spy.getDeleted(emit);
expect(del).toEqual([
'Deleted "D"',
'Deleted "A"'
'Deleted plugin "D"',
'Deleted plugin "A"'
]);
});
});
Expand All @@ -257,8 +257,8 @@ describe('uninstallPlugin', function () {
.then(function () {
var del = common.spy.getDeleted(emit);
expect(del).toEqual([
'Deleted "D"',
'Deleted "A"'
'Deleted plugin "D"',
'Deleted plugin "A"'
]);
});
});
Expand All @@ -282,7 +282,7 @@ describe('uninstall', function () {
.then(function (result) {
fail();
}, function err (errMsg) {
expect(errMsg.toString()).toContain('atari not supported.');
expect(errMsg.toString()).toContain('Platform "atari" not supported.');
});
}, 6000);

Expand Down
6 changes: 3 additions & 3 deletions src/plugman/uninstall.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ module.exports.uninstallPlatform = function (platform, project_dir, id, plugins_
plugins_dir = plugins_dir || path.join(project_dir, 'cordova', 'plugins');

if (!platform_modules[platform]) {
return Q.reject(new CordovaError(platform + ' not supported.'));
return Q.reject(new CordovaError('Platform "' + platform + '" not supported.'));
}

var plugin_dir = path.join(plugins_dir, id);
Expand Down Expand Up @@ -128,7 +128,7 @@ module.exports.uninstallPlugin = function (id, plugins_dir, options) {
}

shell.rm('-rf', plugin_dir);
events.emit('verbose', 'Deleted "' + id + '"');
events.emit('verbose', 'Deleted plugin "' + id + '"');

// remove plugin from node_modules directory
return npmUninstall(id, options.projectRoot, options);
Expand Down Expand Up @@ -200,7 +200,7 @@ module.exports.uninstallPlugin = function (id, plugins_dir, options) {
return dependList[plugin_id];
});
var createMsg = function (plugin_id) {
return '"' + plugin_id + '" is required by (' + dependList[plugin_id] + ')';
return 'Plugin "' + plugin_id + '" is required by (' + dependList[plugin_id] + ')';
};
var createMsg2 = function (plugin_id) {
return createMsg(plugin_id) + ' and cannot be removed (hint: use -f or --force)';
Expand Down

0 comments on commit 6019d92

Please sign in to comment.