Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve plugman/uninstall.js messages #630

Merged
merged 2 commits into from
Jul 31, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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