You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by fi...@apache.org on 2017/06/22 17:34:41 UTC

[10/14] cordova-lib git commit: fixes to integration test refrences so they run, bye bye save integration specs.

fixes to integration test refrences so they run, bye bye save integration specs.


Project: http://git-wip-us.apache.org/repos/asf/cordova-lib/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-lib/commit/4c8563c6
Tree: http://git-wip-us.apache.org/repos/asf/cordova-lib/tree/4c8563c6
Diff: http://git-wip-us.apache.org/repos/asf/cordova-lib/diff/4c8563c6

Branch: refs/heads/master
Commit: 4c8563c6234c6b854b3fdbb4db5d05bb80a785df
Parents: 96facdc
Author: filmaj <ma...@gmail.com>
Authored: Tue Jun 20 14:20:54 2017 -0500
Committer: filmaj <ma...@gmail.com>
Committed: Wed Jun 21 14:58:15 2017 -0500

----------------------------------------------------------------------
 integration-tests/plugin.spec.js            |   2 +-
 integration-tests/plugin_fetch.spec.js      |   2 +-
 integration-tests/plugman_uninstall.spec.js |   2 +-
 integration-tests/save.spec.js              | 683 -----------------------
 src/cordova/plugin/index.js                 |   2 +-
 src/cordova/plugin/remove.js                |   1 +
 6 files changed, 5 insertions(+), 687 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/4c8563c6/integration-tests/plugin.spec.js
----------------------------------------------------------------------
diff --git a/integration-tests/plugin.spec.js b/integration-tests/plugin.spec.js
index 8572362..15243ca 100644
--- a/integration-tests/plugin.spec.js
+++ b/integration-tests/plugin.spec.js
@@ -17,7 +17,7 @@
     under the License.
 */
 
-var helpers = require('./helpers'),
+var helpers = require('../spec-cordova/helpers'),
     path = require('path'),
     Q = require('q'),
     shell = require('shelljs'),

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/4c8563c6/integration-tests/plugin_fetch.spec.js
----------------------------------------------------------------------
diff --git a/integration-tests/plugin_fetch.spec.js b/integration-tests/plugin_fetch.spec.js
index d6791c2..6bf5501 100644
--- a/integration-tests/plugin_fetch.spec.js
+++ b/integration-tests/plugin_fetch.spec.js
@@ -18,7 +18,7 @@
 */
 
 var plugin  = require('../src/cordova/plugin'),
-    helpers = require('./helpers'),
+    helpers = require('../spec-cordova/helpers'),
     path    = require('path'),
     events = require('cordova-common').events,
     shell   = require('shelljs');

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/4c8563c6/integration-tests/plugman_uninstall.spec.js
----------------------------------------------------------------------
diff --git a/integration-tests/plugman_uninstall.spec.js b/integration-tests/plugman_uninstall.spec.js
index 2b81705..af6ed1c 100644
--- a/integration-tests/plugman_uninstall.spec.js
+++ b/integration-tests/plugman_uninstall.spec.js
@@ -25,7 +25,7 @@ var uninstall = require('../src/plugman/uninstall'),
     PluginInfo = require('cordova-common').PluginInfo,
     events = require('cordova-common').events,
     plugman = require('../src/plugman/plugman'),
-    common  = require('./common'),
+    common  = require('../spec-plugman/common'),
     platforms = require('../src/platforms/platforms'),
     xmlHelpers = require('cordova-common').xmlHelpers,
     et      = require('elementtree'),

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/4c8563c6/integration-tests/save.spec.js
----------------------------------------------------------------------
diff --git a/integration-tests/save.spec.js b/integration-tests/save.spec.js
deleted file mode 100644
index e83b096..0000000
--- a/integration-tests/save.spec.js
+++ /dev/null
@@ -1,683 +0,0 @@
-/**
-    Licensed to the Apache Software Foundation (ASF) under one
-    or more contributor license agreements.  See the NOTICE file
-    distributed with this work for additional information
-    regarding copyright ownership.  The ASF licenses this file
-    to you under the Apache License, Version 2.0 (the
-    "License"); you may not use this file except in compliance
-    with the License.  You may obtain a copy of the License at
-
-    http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing,
-    software distributed under the License is distributed on an
-    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-    KIND, either express or implied.  See the License for the
-    specific language governing permissions and limitations
-    under the License.
-*/
-
-describe('(save flag)', function () {
-    var rewire      = require('rewire'),
-        cordova     = require('../src/cordova/cordova'),
-        helpers     = require('../spec-cordova/helpers'),
-        path        = require('path'),
-        Q           = require('q'),
-        fs          = require('fs'),
-        shell       = require('shelljs'),
-        util        = require('../src/cordova/util'),
-        node_util   = require('util'),
-        prepare     = require('../src/cordova/prepare'),
-        registry    = require('../src/plugman/registry/registry'),
-        PlatformApi = require('../src/platforms/PlatformApiPoly'),
-        events      = require('cordova-common').events,
-        addHelper   = rewire('../src/cordova/platform/addHelper'),
-        platform    = require('../src/cordova/platform');
-
-    var appName                = 'testApp',
-        tempPath               = path.join(__dirname, 'temp'),
-        appPath                = path.join(tempPath, appName),
-        //srcProject             = path.join(__dirname, '..', 'spec-plugman','projects', 'android'),
-        platformName           = helpers.testPlatform,
-        platformVersionOld     = '5.0.0',
-        platformVersionNew     = '6.0.0',
-        platformVersionNewer   = '6.2.1',
-        platformLocalPathOld   = path.join(__dirname, 'cordova-' + platformName + '-old'),
-        platformLocalPathNew   = path.join(__dirname, 'cordova-' + platformName + '-new'),
-        platformLocalPathNewer = path.join(__dirname, 'cordova-' + platformName + '-newer'),
-        platformGitUrl         = 'https://github.com/apache/cordova-' + platformName,
-        platformGitRef         = '4.0.x',
-        platformTgzUrl         = 'https://git-wip-us.apache.org/repos/asf?p=cordova-' + platformName + '.git;a=snapshot;h=' + platformVersionNew + ';sf=tgz',
-        otherPlatformName      = 'windows',
-        otherPlatformSpec      = '4.0.0',
-        pluginName             = 'cordova-plugin-console',
-        pluginVersion          = '1.0.0',
-        pluginName2            = 'cordova-plugin-globalization',
-        pluginVersion2         = '1.0.2',
-        pluginGitUrl           = 'https://github.com/apache/cordova-plugin-console.git',
-        pluginOldName          = 'org.apache.cordova.console',
-        pluginOldVersion       = '0.2.11',
-        gitPluginName          = 'cordova-plugin-device',
-        gitPluginUrl           = 'https://github.com/apache/cordova-plugin-device.git',
-        variablePluginName     = 'cordova-plugin-facebook4',
-        variablePluginUrl      = 'https://github.com/jeduan/cordova-plugin-facebook4',
-        localPluginName        = 'org.apache.cordova.fakeplugin1',
-        localPluginPath        = path.join(__dirname, 'fixtures', 'plugins', 'fake1'),
-        TIMEOUT                = 60 * 1000,
-        BIG_TIMEOUT            = 2 * 60 * 1000;
-
-    //mock variables
-    var revertInstallPluginsForNewPlatform,
-        revertDownloadPlatform,
-        createPlatformOrig = PlatformApi.createPlatform;
-
-    function mockDownloadPlatform(libDir, version) {
-        console.log('in mockDownloadPlatform');
-        console.log(addHelper);
-        revertDownloadPlatform = addHelper.__set__('downloadPlatform', function () {
-            console.log('fake');
-            return Q({
-                libDir: libDir,
-                platform: platformName,
-                version: version
-            });
-        });
-    }
-
-    /**
-     * For testing scoped packages. We don't have those packages published, so just
-     * redirect the registry calls to their un-scoped counterparts
-     */
-    function redirectRegistryCalls(id) {
-        var originalFetch = registry.fetch;
-        spyOn(registry, 'fetch').and.callFake(function(package) {
-            return originalFetch([id]);
-        });
-
-        var originalInfo = registry.info;
-        spyOn(registry, 'info').and.callFake(function(package) {
-            return originalInfo([id]);
-        });
-    }
-
-    beforeEach(function (done) {
-        // initial cleanup
-        shell.rm('-rf', tempPath);
-        shell.mkdir(tempPath);
-
-        //jasmine mocks
-        spyOn(util, 'isCordova').and.returnValue(appPath);
-        spyOn(util, 'cdProjectRoot').and.returnValue(appPath);
-        spyOn(cordova, 'prepare').and.returnValue(Q());
-        spyOn(prepare, 'preparePlatforms').and.returnValue(Q());
-
-        spyOn(PlatformApi, 'createPlatform').and.returnValue(Q());
-        spyOn(PlatformApi, 'updatePlatform').and.returnValue(Q());
-
-        //rewire mocks
-        revertInstallPluginsForNewPlatform = addHelper.__set__('installPluginsForNewPlatform', function () { return Q(); });
-
-       //creating test app
-        cordova.create(appPath, undefined, undefined, {}, events).then(function () {
-            //removing unnecessary whitelist plugin from config
-            helpers.removePlugin(appPath, 'cordova-plugin-whitelist');
-            done();
-        }, function (err) {
-            expect(true).toBe(false);
-            console.log(err);
-            done();
-        });
-    }, TIMEOUT);
-
-    afterEach(function () {
-        revertInstallPluginsForNewPlatform();
-    });
-
-    function gitClone(repo, dir, ref, cb) {
-        var gitTemplate = 'git clone --branch %s --depth=1 %s %s';
-        var gitCommand = node_util.format(gitTemplate, ref, repo, dir);
-        shell.exec(gitCommand, { silent: true }, cb);
-    }
-
-    describe('preparing fixtures', function () {
-        it('Test 001 : cloning "old" platform', function (done) {
-            shell.rm('-rf', platformLocalPathOld);
-            gitClone(platformGitUrl, platformLocalPathOld, platformVersionOld, function (err) {
-                expect(err).toBe(0);
-                done();
-            });
-        }, BIG_TIMEOUT);
-
-        it('Test 002 : cloning "new" platform', function (done) {
-            shell.rm('-rf', platformLocalPathNew);
-            gitClone(platformGitUrl, platformLocalPathNew, platformVersionNew, function (err) {
-                expect(err).toBe(0);
-                done();
-            });
-        }, BIG_TIMEOUT);
-
-        it('Test 003 : cloning "newer" platform', function (done) {
-            shell.rm('-rf', platformLocalPathNewer);
-            gitClone(platformGitUrl, platformLocalPathNewer, platformVersionNewer, function (err) {
-                expect(err).toBe(0);
-                done();
-            });
-        }, BIG_TIMEOUT);
-    });
-
-    describe('platform add --save', function () {
-        it('Test 004 : spec.1 should support custom tgz files', function (done) {
-            helpers.removeEngine(appPath, platformName);
-            platform('add', platformName + '@' + platformTgzUrl, { 'save': true })
-            .then(function () {
-                expect(helpers.getEngineSpec(appPath, platformName)).toBe(platformTgzUrl);
-                done();
-            }).catch(function (err) {
-                console.log(err);
-                expect(false).toBe(true);
-                done();
-            });
-        }, BIG_TIMEOUT);
-
-       it('Test 005 : spec.2 should save platform to config', function (done) {
-            helpers.removeEngine(appPath, platformName);
-            mockDownloadPlatform(platformLocalPathNew, platformVersionNew);
-            platform('add', platformName, { 'save': true })
-            .then(function () {
-                expect(helpers.getEngineSpec(appPath, platformName)).toBe('~' + platformVersionNew);
-                done();
-            }).catch(function (err) {
-                console.log(err);
-                expect(false).toBe(true);
-                done();
-            }).finally(function () {
-                revertDownloadPlatform();
-            });
-        }, TIMEOUT);
-
-        it('Test 006 : spec.3 should overwrite platform in config, spec = version', function (done) {
-            helpers.setEngineSpec(appPath, platformName, platformVersionOld);
-            mockDownloadPlatform(platformLocalPathOld, platformVersionOld);
-
-            platform('add', platformName, { 'save': true })
-            .then(function () {
-                expect(helpers.getEngineSpec(appPath, platformName)).toBe('~' + platformVersionOld);
-                done();
-            }).catch(function (err) {
-                console.log(err);
-                expect(false).toBe(true);
-                done();
-            }).finally(function () {
-                revertDownloadPlatform();
-            });
-        }, TIMEOUT);
-
-        it('Test 007 : spec.4 should overwrite platform in config, spec = path', function (done) {
-            helpers.setEngineSpec(appPath, platformName, platformLocalPathNewer);
-            mockDownloadPlatform(platformLocalPathNewer, platformVersionNewer);
-
-            platform('add', platformName, { 'save': true })
-            .then(function () {
-                expect(helpers.getEngineSpec(appPath, platformName)).toBe(platformLocalPathNewer);
-                done();
-            }).catch(function (err) {
-                console.log(err);
-                expect(false).toBe(true);
-                done();
-            }).finally(function () {
-                revertDownloadPlatform();
-            });
-        }, TIMEOUT);
-
-        it('Test 008 : spec.5 should fail and should not update config if invalid version is specified', function (done) {
-            helpers.removeEngine(appPath, platformName);
-
-            platform('add', platformName + '@3.969.696', { 'save': true })
-            .then(function () {
-                expect(false).toBe(true);
-                done();
-            }).catch(function (err) {
-                expect(err.message.indexOf('version not found') >= 0).toBe(true);
-                expect(helpers.getEngineSpec(appPath, platformName)).toBe(null);
-                done();
-            });
-        }, TIMEOUT);
-
-        it('Test 009 : spec.6 should save local path as spec if added using only local path', function (done) {
-            helpers.removeEngine(appPath, platformName);
-
-            platform('add', platformLocalPathNewer, { 'save': true })
-            .then(function () {
-                expect(helpers.getEngineSpec(appPath, platformName)).toBe(platformLocalPathNewer);
-                done();
-            }).catch(function (err) {
-                console.log(err);
-                expect(false).toBe(true);
-                done();
-            });
-        }, TIMEOUT);
-
-        it('Test 010 : spec.7 should save git url with git ref properly', function (done) {
-            var platformUrl = platformGitUrl + '#' + platformGitRef;
-            helpers.removeEngine(appPath, platformName);
-            mockDownloadPlatform(platformLocalPathNew, platformVersionNew);
-
-            platform('add', platformUrl, { 'save': true })
-            .then(function () {
-                expect(helpers.getEngineSpec(appPath, platformName)).toBe(platformUrl);
-                done();
-            }).catch(function (err) {
-                console.log(err);
-                expect(false).toBe(true);
-                done();
-            }).finally(function () {
-                revertDownloadPlatform();
-            });
-        }, TIMEOUT);
-    });
-
-    describe('platform remove --save', function () {
-        it('Test 011 : spec.8 should not update config if there is no engine in it', function (done) {
-            helpers.removeEngine(appPath, platformName);
-
-            platform('add', platformLocalPathNewer)
-            .then(function () {
-                return cordova.platform('rm', platformName, { 'save': true });
-            }).then(function () {
-                expect(helpers.getEngineSpec(appPath, platformName)).toBe(null);
-                done();
-            }).catch(function (err) {
-                console.log(err);
-                expect(false).toBe(true);
-                done();
-            });
-        }, TIMEOUT);
-
-        it('Test 012 : spec.9 should remove engine from config', function (done) {
-            helpers.setEngineSpec(appPath, platformName, platformLocalPathNewer);
-
-            platform('add', platformLocalPathNewer)
-            .then(function () {
-                return cordova.platform('rm', platformName, { 'save': true });
-            }).then(function () {
-                expect(helpers.getEngineSpec(appPath, platformName)).toBe(null);
-                done();
-            }).catch(function (err) {
-                console.log(err);
-                expect(false).toBe(true);
-                done();
-            });
-        }, TIMEOUT);
-    });
-
-    describe('platform update --save', function () {
-        it('Test 013 : spec.10 should update config with new spec', function (done) {
-            helpers.setEngineSpec(appPath, platformName, platformVersionNew);
-            mockDownloadPlatform(platformLocalPathNew, platformVersionNew);
-
-            platform('add', platformName + '@' + platformVersionNew)
-            .then(function () {
-                var fsExistsSync = fs.existsSync.bind(fs);
-                spyOn(fs, 'existsSync').and.callFake(function (somePath) {
-                    return (somePath === path.join(appPath, 'platforms', platformName)) || fsExistsSync(somePath);
-                });
-
-                revertDownloadPlatform();
-                mockDownloadPlatform(platformLocalPathOld, platformVersionOld);
-
-                return platform('update', platformName + '@' + platformVersionOld, { 'save': true });
-            }).then(function () {
-                expect(helpers.getEngineSpec(appPath, platformName)).toBe('~' + platformVersionOld);
-                done();
-            }).catch(function (err) {
-                console.log(err);
-                expect(false).toBe(true);
-                done();
-            }).finally(function () {
-                revertDownloadPlatform();
-            });
-        }, TIMEOUT);
-
-        it('Test 014 : spec.11 should update spec with git url when updating using git url', function (done) {
-            helpers.setEngineSpec(appPath, platformName, platformVersionNew);
-            mockDownloadPlatform(platformLocalPathOld, platformVersionOld);
-
-            platform('add', platformName + '@' + platformVersionOld)
-            .then(function () {
-                revertDownloadPlatform();
-                var fsExistsSync = fs.existsSync.bind(fs);
-                spyOn(fs, 'existsSync').and.callFake(function (somePath) {
-                    return (somePath === path.join(appPath, 'platforms', platformName)) || fsExistsSync(somePath);
-                });
-                mockDownloadPlatform(platformLocalPathNew, platformVersionNew);
-                return platform('update', platformGitUrl, { 'save': true });
-            }).then(function () {
-                revertDownloadPlatform();
-                var spec = helpers.getEngineSpec(appPath, platformName);
-                expect(spec).not.toBe(null);
-                expect(spec).not.toBe(platformVersionNew);
-                done();
-            }).catch(function (err) {
-                console.log(err);
-                expect(false).toBe(true);
-                done();
-            }).finally(function (err) {
-
-            });
-        }, TIMEOUT);
-    });
-
-    describe('plugin add --save', function () {
-
-        it('Test 015 : spec.12 should save plugin to config', function (done) {
-            cordova.plugin('add', pluginName, { 'save': true })
-            .then(function () {
-                expect(helpers.getPluginSpec(appPath, pluginName)).not.toBe(null);
-                done();
-            }).catch(function (err) {
-                console.log(err.message);
-                expect(err).toBeUndefined();
-                done();
-            });
-        }, TIMEOUT);
-
-        it('Test 016 : spec.13 should create new plugin tag in config with old plugin id when downgrading from plugin with new id', function (done) {
-            helpers.setPluginSpec(appPath, pluginName, pluginOldVersion);
-            cordova.plugin('add', pluginName, { 'save': true })
-            .then(function () {
-                expect(helpers.getPluginSpec(appPath, pluginOldName)).toBe('~' + pluginOldVersion);
-                done();
-            }).catch(function (err) {
-                expect(true).toBe(false);
-                console.log(err.message);
-                done();
-            });
-        }, TIMEOUT);
-
-        it('Test 017 : spec.14 should save variables', function (done) {
-            cordova.plugin('add', variablePluginUrl, {
-                'save': true,
-                'cli_variables': {
-                    'APP_ID':'123456789',
-                    'APP_NAME':'myApplication'
-                }
-            }).then(function () {
-                expect(helpers.getPluginVariable(appPath, variablePluginName, 'APP_ID')).toBe('123456789');
-                expect(helpers.getPluginVariable(appPath, variablePluginName, 'APP_NAME')).toBe('myApplication');
-                done();
-            }).catch(function (err) {
-                expect(true).toBe(false);
-                console.log(err.message);
-                done();
-            });
-        }, BIG_TIMEOUT);
-
-        it('Test 018 : spec.14.1 should restore plugin with variables', function (done) {
-            cordova.plugin('add', variablePluginUrl, {
-                'save': true,
-                'cli_variables': {
-                    'APP_ID':'123456789',
-                    'APP_NAME':'myApplication'
-                }
-            }).then(function () {
-                expect(helpers.getPluginVariable(appPath, variablePluginName, 'APP_ID')).toBe('123456789');
-                expect(helpers.getPluginVariable(appPath, variablePluginName, 'APP_NAME')).toBe('myApplication');
-                return cordova.plugin('rm', variablePluginName);
-            }).then(function() {
-                expect(path.join(appPath, 'plugins', variablePluginName)).not.toExist();
-                return cordova.plugin('add', variablePluginName);
-            }).then(function() {
-                expect(path.join(appPath, 'plugins', variablePluginName)).toExist();
-                done();
-            }).catch(function (err) {
-                console.log(err.message);
-                expect(true).toBe(false);
-                done();
-            });
-        }, BIG_TIMEOUT);
-
-        it('Test 019 : spec.15 save git url as spec', function (done) {
-            cordova.plugin('add', pluginGitUrl, { 'save': true })
-            .then(function () {
-                expect(helpers.getPluginSpec(appPath, pluginName)).toBe(pluginGitUrl);
-                done();
-            }).catch(function (err) {
-                expect(true).toBe(false);
-                console.log(err.message);
-                done();
-            });
-        }, TIMEOUT);
-
-        it('Test 020 : spec.16 should save local directory as spec', function (done) {
-            cordova.plugin('add', localPluginPath, { 'save': true })
-            .then(function () {
-                expect(helpers.getPluginSpec(appPath, localPluginName)).toBe(localPluginPath);
-                done();
-            }).catch(function (err) {
-                expect(true).toBe(false);
-                console.log(err.message);
-                done();
-            });
-        }, TIMEOUT);
-
-        it('Test 021 : spec.16.1 save scoped registry packages as spec', function (done) {
-            redirectRegistryCalls(pluginName + '@' + pluginVersion);
-            var scopedPackage = '@test-scope/' + pluginName;
-
-            cordova.plugin('add', scopedPackage + '@' + pluginVersion, { 'save': true })
-            .then(function () {
-                expect(registry.fetch).toHaveBeenCalledWith([scopedPackage + '@' + pluginVersion]);
-                expect(helpers.getPluginSpec(appPath, pluginName)).toBe(scopedPackage + '@~' + pluginVersion);
-                done();
-            }).catch(function (err) {
-                expect(true).toBe(false);
-                console.log(err.message);
-                done();
-            });
-        }, TIMEOUT);
-    });
-
-    describe('plugin remove --save', function () {
-        it('Test 022 : spec.17 should not add plugin to config', function (done) {
-            cordova.plugin('add', pluginName)
-            .then(function () {
-                return cordova.plugin('rm', pluginName, { 'save': true });
-            }).then(function () {
-                expect(helpers.getPluginSpec(appPath, pluginName)).toBe(null);
-                done();
-            }).catch(function (err) {
-                expect(true).toBe(false);
-                console.log(err.message);
-                done();
-            });
-        }, TIMEOUT);
-
-        it('Test 023 : spec.18 should remove plugin from config', function (done) {
-            cordova.plugin('add', pluginName)
-            .then(function () {
-                helpers.setPluginSpec(appPath, pluginName, pluginGitUrl);
-                return cordova.plugin('rm', pluginName, { 'save': true });
-            }).then(function () {
-                expect(helpers.getPluginSpec(appPath, pluginName)).toBe(null);
-                done();
-            }).catch(function (err) {
-                expect(true).toBe(false);
-                console.log(err.message);
-                done();
-            });
-        }, TIMEOUT);
-    });
-
-    describe('platform save', function () {
-        it('Test 024 : spec.19 should not update config when there are no platforms installed', function (done) {
-            var configContent = helpers.getConfigContent(appPath);
-            platform('save')
-            .then(function () {
-                expect(helpers.getConfigContent(appPath)).toBe(configContent);
-                done();
-            }).catch(function (err) {
-                expect(true).toBe(false);
-                console.log(err.message);
-                done();
-            });
-        }, TIMEOUT);
-
-        it('Test 025 : spec.20 should add platform to config', function (done) {
-            mockDownloadPlatform(platformLocalPathNew, platformVersionNew);
-
-            platform('add', platformName + '@' + platformVersionNew)
-            .then(function () {
-                return platform('save');
-            }).then(function () {
-                expect(helpers.getEngineSpec(appPath, platformName)).toBe('~' + platformVersionNew);
-                done();
-            }).catch(function (err) {
-                expect(true).toBe(false);
-                console.log(err.message);
-                done();
-            }).finally(function () {
-                revertDownloadPlatform();
-            });
-        }, TIMEOUT);
-    });
-
-    describe('plugin save', function () {
-        it('Test 026: spec.21 should not update config when there are no plugins installed', function (done) {
-            var configContent = helpers.getConfigContent(appPath);
-            cordova.plugin('save')
-            .finally(function () {
-                expect(helpers.getConfigContent(appPath)).toBe(configContent);
-                done();
-            });
-        }, TIMEOUT);
-
-        it('Test 028 : spec.22.1 should update config with a spec that includes the scope for scoped plugins', function (done) {
-            // Fetching globalization rather than console to avoid conflicts with earlier tests
-            redirectRegistryCalls(pluginName2 + '@' + pluginVersion2);
-            var scopedPackage = '@test-scope/' + pluginName2;
-            cordova.plugin('add', scopedPackage + '@' + pluginVersion2)
-            .then(function () {
-                return cordova.plugin('save');
-            }).then(function () {
-                expect(registry.fetch).toHaveBeenCalledWith([scopedPackage + '@' + pluginVersion2]);
-                expect(helpers.getPluginSpec(appPath, pluginName2)).toBe(scopedPackage + '@~' + pluginVersion2);
-                done();
-            }).catch(function (err) {
-                expect(true).toBe(false);
-                console.log(err.message);
-                done();
-            });
-        }, TIMEOUT);
-    });
-
-    describe('prepare', function () {
-        beforeEach(function () {
-            // Restore back mocked createPlatform functionality
-            PlatformApi.createPlatform = createPlatformOrig;
-        });
-
-        it('Test 029 : spec.23 should restore all platforms and plugins', function (done) {
-            helpers.setEngineSpec(appPath, platformName, platformLocalPathNewer);
-            helpers.setPluginSpec(appPath, localPluginName, localPluginPath);
-            prepare()
-            .then(function () {
-                expect(path.join(appPath, 'platforms', platformName)).toExist();
-                expect(path.join(appPath, 'plugins', localPluginName)).toExist();
-                done();
-            }).catch(function (err) {
-                expect(true).toBe(false);
-                console.log(err.message);
-                done();
-            });
-        }, TIMEOUT);
-
-        it('Test 030 : spec.23.2 should restore plugins without spec attribute', function (done) {
-            redirectRegistryCalls(pluginName2);
-            helpers.setEngineSpec(appPath, platformName, platformLocalPathNewer);
-            helpers.setPluginSpec(appPath, pluginName2/**, do not specify spec here */);
-            prepare()
-            .then(function () {
-                expect(registry.fetch).toHaveBeenCalledWith([pluginName2]);
-                expect(path.join(appPath, 'plugins', pluginName2)).toExist();
-            }).catch(function (err) {
-                expect(true).toBe(false);
-                console.log(err.message);
-            })
-            .fin(done);
-        }, TIMEOUT);
-
-        it('Test 031 : spec.23.1 should restore scoped plugins', function (done) {
-            redirectRegistryCalls(pluginName2 + '@~' + pluginVersion2);
-            var scopedPackage = '@test-scope/' + pluginName2;
-            helpers.setEngineSpec(appPath, platformName, platformLocalPathNewer);
-            helpers.setPluginSpec(appPath, pluginName2, scopedPackage + '@~' + pluginVersion2);
-            prepare()
-            .then(function () {
-                expect(registry.fetch).toHaveBeenCalledWith([scopedPackage + '@~' + pluginVersion2]);
-                expect(path.join(appPath, 'plugins', pluginName2)).toExist();
-                done();
-            }).catch(function (err) {
-                expect(true).toBe(false);
-                console.log(err.message);
-                done();
-            });
-        }, TIMEOUT);
-
-        it('Test 032 : spec.24 should restore only specified platform', function (done) {
-            
-            helpers.setEngineSpec(appPath, platformName, platformLocalPathNewer);
-            helpers.setEngineSpec(appPath, otherPlatformName, otherPlatformSpec);
-            var options = {
-                verbose: false,
-                platforms: [ platformName ],
-                options: []
-            };
-            prepare(options)
-            .then(function () {
-                expect(path.join(appPath, 'platforms', platformName)).toExist();
-                expect(path.join(appPath, 'platforms', otherPlatformName)).not.toExist();
-                done();
-            }).catch(function (err) {
-                expect(true).toBe(false);
-                console.log(err.message);
-                done();
-            });
-        }, BIG_TIMEOUT);
-
-        xit('Test 033 : spec.25 should install plugins already added to the project into platform when restoring it', function (done) {
-            var fail = jasmine.createSpy('fail').and.callFake(function (err) {
-                console.log(err.message);
-            });
-
-            cordova.plugin('add', localPluginPath)
-            .then(function() {
-                helpers.setEngineSpec(appPath, platformName, platformLocalPathNewer);
-                return prepare({ platforms: [ platformName ] });
-            })
-            .then(function() {
-                console.log('prepare ran');
-                expect(path.join(appPath, 'platforms', platformName)).toExist();
-                // Validate that plugin has been installed to platform by checking
-                console.log(path.join(appPath, 'platforms', platformName, platformName + '.json'));
-                // platformJson file for plugin entry added
-                var platformJson = require(path.join(appPath, 'platforms', platformName, platformName + '.json'));
-                console.log(platformJson);
-                //console.log(fs.readFileSync(path.join(appPath, 'config.xml'), 'utf8'))
-                expect(platformJson.installed_plugins[localPluginName]).toBeDefined();
-            })
-            .finally(function () {
-                expect(fail).not.toHaveBeenCalled();
-                done();
-            });
-        }, BIG_TIMEOUT);
-    });
-
-    describe('(cleanup)', function () {
-        it('Test 034 : removing temp dir', function () {
-            shell.rm('-rf', tempPath);
-            shell.rm('-rf', platformLocalPathNewer);
-            shell.rm('-rf', platformLocalPathNew);
-            shell.rm('-rf', platformLocalPathOld);
-        });
-    });
-});

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/4c8563c6/src/cordova/plugin/index.js
----------------------------------------------------------------------
diff --git a/src/cordova/plugin/index.js b/src/cordova/plugin/index.js
index 1099de1..7b34780 100644
--- a/src/cordova/plugin/index.js
+++ b/src/cordova/plugin/index.js
@@ -59,7 +59,7 @@ function plugin (command, targets, opts) {
 
         // Massage plugin name(s) / path(s)
         if (!targets || !targets.length) {
-            // TODO: what if command provided is 'remove' ?
+            // TODO: what if command provided is 'remove' ? shouldnt search need a target too?
             if (command === 'add' || command === 'rm') {
                 return Q.reject(new CordovaError('You need to qualify `' + cordova_util.binname + ' plugin add` or `' + cordova_util.binname + ' plugin remove` with one or more plugins!'));
             } else {

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/4c8563c6/src/cordova/plugin/remove.js
----------------------------------------------------------------------
diff --git a/src/cordova/plugin/remove.js b/src/cordova/plugin/remove.js
index ca27601..78a355e 100644
--- a/src/cordova/plugin/remove.js
+++ b/src/cordova/plugin/remove.js
@@ -67,6 +67,7 @@ function remove (projectRoot, targets, hooksRunner, opts) {
                     .then(function (didPrepare) {
                         // If platform does not returned anything we'll need
                         // to trigger a prepare after all plugins installed
+                        // TODO: if didPrepare is falsy, what does that imply? WHY are we doing this?
                         if (!didPrepare) shouldRunPrepare = true;
                     });
                 });


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org