You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by dp...@apache.org on 2018/06/06 06:51:11 UTC
[cordova-lib] 01/02: improve tests using ios@4.5.4,
adjusting timeout params and improve plugin remove sequentially
This is an automated email from the ASF dual-hosted git repository.
dpogue pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-lib.git
commit 9144115dd684a2ff4904fab1619bdbd47d9a5ade
Author: knaito <kn...@asial.co.jp>
AuthorDate: Mon Jun 4 13:11:38 2018 +0900
improve tests using ios@4.5.4, adjusting timeout params and improve plugin remove sequentially
---
integration-tests/pkgJson.spec.js | 7 +++--
src/plugman/uninstall.js | 60 +++++++++++++++++++++------------------
2 files changed, 37 insertions(+), 30 deletions(-)
diff --git a/integration-tests/pkgJson.spec.js b/integration-tests/pkgJson.spec.js
index 1a4168b..a95efdd 100644
--- a/integration-tests/pkgJson.spec.js
+++ b/integration-tests/pkgJson.spec.js
@@ -22,7 +22,7 @@ var shell = require('shelljs');
var events = require('cordova-common').events;
var ConfigParser = require('cordova-common').ConfigParser;
var cordova = require('../src/cordova/cordova');
-var TIMEOUT = 30 * 1000;
+var TIMEOUT = 60 * 1000;
var cordova_util = require('../src/cordova/util');
var semver = require('semver');
@@ -370,6 +370,7 @@ describe('platform end-to-end with --save', function () {
var results;
beforeEach(function () {
+ jasmine.DEFAULT_TIMEOUT_INTERVAL = 30 * 1000;
shell.rm('-rf', tmpDir);
// cp then mv because we need to copy everything, but that means it'll copy the whole directory.
@@ -679,7 +680,7 @@ describe('During add, if pkg.json has a platform/plugin spec, use that one.', fu
expect(err).toBeUndefined();
}).fin(done);
// Cordova prepare needs extra wait time to complete.
- }, 60000);
+ }, 120000);
});
// Test #021 : use basePkgJson16 as config.xml contains platform/spec and plugin/spec pkg.json does not.
@@ -840,7 +841,7 @@ describe('During add, if add specifies a platform spec, use that one regardless
expect(engines).toEqual([ { name: 'ios', spec: '~4.2.1' } ]);
emptyPlatformList().then(function () {
// Add ios with --save and --fetch.
- return cordova.platform('add', ['ios@4.3.0'], {'save': true, 'fetch': true});
+ return cordova.platform('add', ['ios@4.5.4'], {'save': true, 'fetch': true});
}).then(function () {
// Delete any previous caches of require(package.json).
pkgJson = cordova_util.requireNoCache(pkgJsonPath);
diff --git a/src/plugman/uninstall.js b/src/plugman/uninstall.js
index 562636e..c15b1af 100644
--- a/src/plugman/uninstall.js
+++ b/src/plugman/uninstall.js
@@ -202,34 +202,40 @@ module.exports.uninstallPlugin = function (id, plugins_dir, options) {
});
});
- var i;
- var plugin_id;
- var msg;
- var delArray = [];
- for (i in toDelete) {
- plugin_id = toDelete[i];
-
- if (dependList[plugin_id]) {
- msg = '"' + plugin_id + '" is required by (' + dependList[plugin_id] + ')';
- if (options.force) {
- events.emit('log', msg + ' but forcing removal.');
- } else {
- // @tests - error and event message is checked spec/uninstall.spec.js
- msg += ' and cannot be removed (hint: use -f or --force)';
-
- if (plugin_id === top_plugin_id) {
- return Q.reject(new CordovaError(msg));
- } else {
- events.emit('warn', msg);
- continue;
- }
- }
- }
- // create an array of promises
- delArray.push(doDelete(plugin_id));
+ var dependPluginIds = toDelete.filter(function (plugin_id) {
+ return dependList[plugin_id];
+ });
+ var createMsg = function (plugin_id) {
+ return '"' + 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)';
+ };
+ if (!options.force && dependPluginIds.includes(top_plugin_id)) {
+ var msg = createMsg2(top_plugin_id);
+ return Q.reject(new CordovaError(msg));
}
- // return promise.all
- return Q.all(delArray);
+
+ // action emmiting events.
+ if (options.force) {
+ dependPluginIds.forEach(function (plugin_id) {
+ var msg = createMsg(plugin_id);
+ events.emit('log', msg + ' but forcing removal.');
+ });
+ } else {
+ dependPluginIds.forEach(function (plugin_id) {
+ var msg = createMsg2(plugin_id);
+ events.emit('warn', msg);
+ });
+ }
+ var deletePluginIds = options.force ? toDelete : toDelete.filter(function (plugin_id) { return !dependList[plugin_id]; });
+ var deleteExecList = deletePluginIds.map(function (plugin_id) {
+ return function () { return doDelete(plugin_id); };
+ });
+ return deleteExecList.reduce(function (acc, deleteExec) {
+ return acc.then(deleteExec);
+ }, Q());
+
};
// possible options: cli_variables, www_dir, is_top_level
--
To stop receiving notification emails like this one, please contact
dpogue@apache.org.
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org