You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by alsorokin <gi...@git.apache.org> on 2015/06/10 20:20:04 UTC

[GitHub] cordova-lib pull request: CB-9122 Added tests for platform/plugin ...

GitHub user alsorokin opened a pull request:

    https://github.com/apache/cordova-lib/pull/246

    CB-9122 Added tests for platform/plugin add/rm/update with --save flag

    https://issues.apache.org/jira/browse/CB-9122

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/MSOpenTech/cordova-lib CB-9122

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/cordova-lib/pull/246.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #246
    
----
commit 71570ebda500beb6f6867f78642fb83576b9b208
Author: alsorokin <al...@akvelon.com>
Date:   2015-06-10T18:15:31Z

    CB-9122 Added tests for platform/plugin add/rm/update with --save flag

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] cordova-lib pull request: CB-9122 Added tests for platform/plugin ...

Posted by alsorokin <gi...@git.apache.org>.
Github user alsorokin commented on a diff in the pull request:

    https://github.com/apache/cordova-lib/pull/246#discussion_r32515523
  
    --- Diff: cordova-lib/spec-cordova/save.spec.js ---
    @@ -0,0 +1,435 @@
    +/**
    +    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('./helpers'),
    +        path        = require('path'),
    +        Q           = require('q'),
    +        fs          = require('fs'),
    +        shell       = require('shelljs'),
    +        util        = require('../src/cordova/util'),
    +        platform    = rewire('../src/cordova/platform.js');
    +
    +    var appName             = 'testApp',
    +        tempPath            = path.join(__dirname, 'temp'),
    +        appPath             = path.join(tempPath, appName),
    +        platformName        = helpers.testPlatform,
    +        platformVersionOld  = '4.0.0',
    +        platformVersionNew  = '4.0.1',
    +        platformLocalPath   = path.join(tempPath, 'cordova-' + platformName),
    +        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',
    +        pluginName          = 'cordova-plugin-console',
    +        pluginVersion       = '1.0.0',
    +        pluginGitUrl        = 'https://github.com/apache/cordova-plugin-console.git',
    +        pluginOldName       = 'org.apache.cordova.console',
    +        pluginOldVersion    = '0.2.11',
    +        variablePluginName  = 'com.phonegap.plugins.facebookconnect',
    +        variablePluginUrl   = 'https://github.com/Wizcorp/phonegap-facebook-plugin',
    +        localPluginName     = 'org.apache.cordova.fakeplugin1',
    +        localPluginPath     = path.join(__dirname, 'fixtures', 'plugins', 'fake1'),
    +        timeout             = 60 * 1000;
    +
    +    //mocks
    +    var is_cordova, cd_project_root, prepare,
    +        revert_copy_cordova_js, revert_copy_cordovajs_src, revert_install_plugins_for_new_platform;
    +
    +    beforeEach(function (done) {
    +        is_cordova = spyOn(util, 'isCordova').andReturn(appPath);
    +        cd_project_root = spyOn(util, 'cdProjectRoot').andReturn(appPath);
    +        prepare = spyOn(cordova.raw, 'prepare').andReturn(Q());
    +
    +        fs.exists(appPath, function (exists) {
    +            if (exists) {
    +                cordova.raw.platform('rm', platformName).then(done, done);
    +            } else {
    +                done();
    +            }
    +        });
    +    });
    +
    +    describe('(preparing fixtures)', function () {
    +        it('preparing temp dir', function () {
    --- End diff --
    
    If this is moved, then 'creating test app' should also be moved, but creating test app before each test could significantly increase test run duration (289 -> 348 sec on my machine).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] cordova-lib pull request: CB-9122 Added tests for platform/plugin ...

Posted by omefire <gi...@git.apache.org>.
Github user omefire commented on a diff in the pull request:

    https://github.com/apache/cordova-lib/pull/246#discussion_r32272314
  
    --- Diff: cordova-lib/spec-cordova/save.spec.js ---
    @@ -0,0 +1,435 @@
    +/**
    +    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('./helpers'),
    +        path        = require('path'),
    +        Q           = require('q'),
    +        fs          = require('fs'),
    +        shell       = require('shelljs'),
    +        util        = require('../src/cordova/util'),
    +        platform    = rewire('../src/cordova/platform.js');
    +
    +    var appName             = 'testApp',
    +        tempPath            = path.join(__dirname, 'temp'),
    +        appPath             = path.join(tempPath, appName),
    +        platformName        = helpers.testPlatform,
    +        platformVersionOld  = '4.0.0',
    +        platformVersionNew  = '4.0.1',
    +        platformLocalPath   = path.join(tempPath, 'cordova-' + platformName),
    +        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',
    +        pluginName          = 'cordova-plugin-console',
    +        pluginVersion       = '1.0.0',
    +        pluginGitUrl        = 'https://github.com/apache/cordova-plugin-console.git',
    +        pluginOldName       = 'org.apache.cordova.console',
    +        pluginOldVersion    = '0.2.11',
    +        variablePluginName  = 'com.phonegap.plugins.facebookconnect',
    +        variablePluginUrl   = 'https://github.com/Wizcorp/phonegap-facebook-plugin',
    +        localPluginName     = 'org.apache.cordova.fakeplugin1',
    +        localPluginPath     = path.join(__dirname, 'fixtures', 'plugins', 'fake1'),
    +        timeout             = 60 * 1000;
    +
    +    //mocks
    +    var is_cordova, cd_project_root, prepare,
    +        revert_copy_cordova_js, revert_copy_cordovajs_src, revert_install_plugins_for_new_platform;
    +
    +    beforeEach(function (done) {
    +        is_cordova = spyOn(util, 'isCordova').andReturn(appPath);
    +        cd_project_root = spyOn(util, 'cdProjectRoot').andReturn(appPath);
    +        prepare = spyOn(cordova.raw, 'prepare').andReturn(Q());
    +
    +        fs.exists(appPath, function (exists) {
    +            if (exists) {
    +                cordova.raw.platform('rm', platformName).then(done, done);
    +            } else {
    +                done();
    +            }
    +        });
    +    });
    +
    +    describe('(preparing fixtures)', function () {
    +        it('preparing temp dir', function () {
    +            shell.rm('-rf', tempPath);
    +            shell.mkdir(tempPath);
    +        });
    +
    +        it('creating mocks', function () {
    +            revert_copy_cordova_js = platform.__set__('copy_cordova_js', function () {});
    +            revert_copy_cordovajs_src = platform.__set__('copy_cordovajs_src', function () {});
    +            revert_install_plugins_for_new_platform = platform.__set__('installPluginsForNewPlatform', function () { return Q(); });
    +        });
    +
    +        it('creating test app', function (done) {
    +            cordova.raw.create(appPath, undefined, undefined, {}).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();
    +            });
    +        });
    +
    +        it('cloning platform', function (done) {
    +            shell.exec('git clone ' + platformGitUrl + ' --depth 1 ' + platformLocalPath, { silent: true }, function (err) {
    +                expect(err).toBe(0);
    +                done();
    +            });
    +        }, timeout);
    +    });
    +
    +    describe('(platform add)', function () {
    +        it('spec.1 cusom tgz support: cordova platform add android@url_to_tgz', function (done) {
    --- End diff --
    
    :nit 'cusom' -> 'custom'


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] cordova-lib pull request: CB-9122 Added tests for platform/plugin ...

Posted by omefire <gi...@git.apache.org>.
Github user omefire commented on a diff in the pull request:

    https://github.com/apache/cordova-lib/pull/246#discussion_r32275358
  
    --- Diff: cordova-lib/spec-cordova/helpers.js ---
    @@ -43,17 +54,101 @@ if (host.match(/win/)) {
     }
     */
     
    -// Just use Android everywhere; we're mocking out any calls to the `android` binary.
    -module.exports.testPlatform = 'android';
    +module.exports.setEngineSpec = function (appPath, spec) {
    +    appPath = getConfigPath(appPath);
    +    var parser = new ConfigParser(appPath);
    +
    +    parser.removeEngine(module.exports.testPlatform);
    +    parser.addEngine(module.exports.testPlatform, spec);
    +    parser.write();
    +};
    +
    +module.exports.getEngineSpec = function (appPath) {
    --- End diff --
    
    consider making this function more general by allowing the engine to be passed in as a separate parameter, instead of using the global variable module.exports.testPlatform.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] cordova-lib pull request: CB-9122 Added tests for platform/plugin ...

Posted by omefire <gi...@git.apache.org>.
Github user omefire commented on the pull request:

    https://github.com/apache/cordova-lib/pull/246#issuecomment-114946797
  
    LGTM !


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] cordova-lib pull request: CB-9122 Added tests for platform/plugin ...

Posted by alsorokin <gi...@git.apache.org>.
Github user alsorokin commented on a diff in the pull request:

    https://github.com/apache/cordova-lib/pull/246#discussion_r32394905
  
    --- Diff: cordova-lib/spec-cordova/save.spec.js ---
    @@ -0,0 +1,435 @@
    +/**
    +    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('./helpers'),
    +        path        = require('path'),
    +        Q           = require('q'),
    +        fs          = require('fs'),
    +        shell       = require('shelljs'),
    +        util        = require('../src/cordova/util'),
    +        platform    = rewire('../src/cordova/platform.js');
    +
    +    var appName             = 'testApp',
    +        tempPath            = path.join(__dirname, 'temp'),
    +        appPath             = path.join(tempPath, appName),
    +        platformName        = helpers.testPlatform,
    +        platformVersionOld  = '4.0.0',
    +        platformVersionNew  = '4.0.1',
    +        platformLocalPath   = path.join(tempPath, 'cordova-' + platformName),
    +        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',
    +        pluginName          = 'cordova-plugin-console',
    +        pluginVersion       = '1.0.0',
    +        pluginGitUrl        = 'https://github.com/apache/cordova-plugin-console.git',
    +        pluginOldName       = 'org.apache.cordova.console',
    +        pluginOldVersion    = '0.2.11',
    +        variablePluginName  = 'com.phonegap.plugins.facebookconnect',
    +        variablePluginUrl   = 'https://github.com/Wizcorp/phonegap-facebook-plugin',
    +        localPluginName     = 'org.apache.cordova.fakeplugin1',
    +        localPluginPath     = path.join(__dirname, 'fixtures', 'plugins', 'fake1'),
    +        timeout             = 60 * 1000;
    +
    +    //mocks
    +    var is_cordova, cd_project_root, prepare,
    +        revert_copy_cordova_js, revert_copy_cordovajs_src, revert_install_plugins_for_new_platform;
    +
    +    beforeEach(function (done) {
    +        is_cordova = spyOn(util, 'isCordova').andReturn(appPath);
    +        cd_project_root = spyOn(util, 'cdProjectRoot').andReturn(appPath);
    +        prepare = spyOn(cordova.raw, 'prepare').andReturn(Q());
    +
    +        fs.exists(appPath, function (exists) {
    +            if (exists) {
    +                cordova.raw.platform('rm', platformName).then(done, done);
    +            } else {
    +                done();
    +            }
    +        });
    +    });
    +
    +    describe('(preparing fixtures)', function () {
    +        it('preparing temp dir', function () {
    +            shell.rm('-rf', tempPath);
    +            shell.mkdir(tempPath);
    +        });
    +
    +        it('creating mocks', function () {
    +            revert_copy_cordova_js = platform.__set__('copy_cordova_js', function () {});
    +            revert_copy_cordovajs_src = platform.__set__('copy_cordovajs_src', function () {});
    +            revert_install_plugins_for_new_platform = platform.__set__('installPluginsForNewPlatform', function () { return Q(); });
    +        });
    +
    +        it('creating test app', function (done) {
    +            cordova.raw.create(appPath, undefined, undefined, {}).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();
    +            });
    +        });
    +
    +        it('cloning platform', function (done) {
    +            shell.exec('git clone ' + platformGitUrl + ' --depth 1 ' + platformLocalPath, { silent: true }, function (err) {
    +                expect(err).toBe(0);
    +                done();
    +            });
    +        }, timeout);
    +    });
    +
    +    describe('(platform add)', function () {
    +        it('spec.1 cusom tgz support: cordova platform add android@url_to_tgz', function (done) {
    +            helpers.removeEngine(appPath);
    +            platform('add', platformName + '@' + platformTgzUrl, { 'save': true })
    +            .then(function () {
    +                expect(helpers.getEngineSpec(appPath)).toBe(platformTgzUrl);
    +                done();
    +            }).catch(function (err) {
    +                console.log(err);
    +                expect(false).toBe(true);
    +                done();
    +            });
    +        }, timeout);
    +
    +        it('spec.2 cordova platform add android --save [empty config.xml]', function (done) {
    +            helpers.removeEngine(appPath);
    +            platform('add', platformName, { 'save': true })
    +            .then(function () {
    +                expect(helpers.getEngineSpec(appPath)).not.toBe(null);
    +                done();
    +            }).catch(function (err) {
    +                console.log(err);
    +                expect(false).toBe(true);
    +                done();
    +            });
    +        }, timeout);
    +
    +        it('spec.3 cordova platform add android --save [config.xml already contains android@4.0.0]', function (done) {
    +            helpers.setEngineSpec(appPath, platformVersionOld);
    +            platform('add', platformName, { 'save': true })
    +            .then(function () {
    +                expect(helpers.getEngineSpec(appPath)).toBe('^' + platformVersionOld);
    +                done();
    +            }).catch(function (err) {
    +                console.log(err);
    +                expect(false).toBe(true);
    +                done();
    +            });
    +        }, timeout);
    +
    +        it('spec.4 cordova platform add android --save [config.xml contains android@file://C:/path/to/android]', function (done) {
    +            helpers.setEngineSpec(appPath, platformLocalPath);
    +            platform('add', platformName, { 'save': true })
    +            .then(function () {
    +                expect(helpers.getEngineSpec(appPath)).toBe(platformLocalPath);
    +                done();
    +            }).catch(function (err) {
    +                console.log(err);
    +                expect(false).toBe(true);
    +                done();
    +            });
    +        }, timeout);
    +
    +        it('spec.5 cordova platform add android@3.969.696 --save [invalid version => should fail and should not update config.xml]', function (done) {
    +            helpers.removeEngine(appPath);
    +            platform('add', helpers.testPlatform + '@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)).toBe(null);
    +                done();
    +            });
    +        });
    +
    +        it('spec.6 cordova platform add C://path/to/android/platform --save', function (done) {
    +            helpers.removeEngine(appPath);
    +            platform('add', platformLocalPath, { 'save': true })
    +            .then(function () {
    +                expect(helpers.getEngineSpec(appPath)).toBe(platformLocalPath);
    +                done();
    +            }).catch(function (err) {
    +                console.log(err);
    +                expect(false).toBe(true);
    +                done();
    +            });
    +        }, timeout);
    +
    +        it('spec.7 should support cordova platform add https://github.com/apache/cordova-android.git#4.0.x', function (done) {
    +            var platformUrl = platformGitUrl + '#' + platformGitRef;
    +            helpers.removeEngine(appPath);
    +            platform('add', platformUrl, { 'save': true })
    +            .then(function () {
    +                expect(helpers.getEngineSpec(appPath)).toBe(platformUrl);
    +                done();
    +            }).catch(function (err) {
    +                console.log(err);
    +                expect(false).toBe(true);
    +                done();
    +            });
    +        }, timeout);
    +    });
    +
    +    describe('(platform remove)', function () {
    +        it('spec.8 cordova platform remove android --save [config.xml is empty]', function (done) {
    +            helpers.removeEngine(appPath);
    +            platform('add', platformLocalPath)
    +            .then(function () {
    +                return cordova.raw.platform('rm', platformName, { 'save': true });
    +            }).then(function () {
    +                expect(helpers.getEngineSpec(appPath)).toBe(null);
    +                done();
    +            }).catch(function (err) {
    +                console.log(err);
    +                expect(false).toBe(true);
    +                done();
    +            });
    +        }, timeout);
    +
    +        it('spec.9 cordova platform remove android --save [config.xml contains android@C:/path/to/android/platform]', function (done) {
    +            helpers.setEngineSpec(appPath, platformLocalPath);
    +            platform('add', platformLocalPath)
    +            .then(function () {
    +                return cordova.raw.platform('rm', platformName, { 'save': true });
    +            }).then(function () {
    +                expect(helpers.getEngineSpec(appPath)).toBe(null);
    +                done();
    +            }).catch(function (err) {
    +                console.log(err);
    +                expect(false).toBe(true);
    +                done();
    +            });
    +        }, timeout);
    +    });
    +
    +    describe('(platform update)', function () {
    +        it('spec. 10 cordova platform update android@4.0.0  --save [config.xml already contains android@4.0.1]', function (done) {
    +            helpers.setEngineSpec(appPath, platformVersionNew);
    +            platform('add', platformName + '@' + platformVersionNew)
    +            .then(function () {
    +                return cordova.raw.platform('update', platformName + '@' + platformVersionOld, { 'save': true });
    +            }).then(function () {
    +                expect(helpers.getEngineSpec(appPath)).toBe('^' + platformVersionOld);
    +                done();
    +            }).catch(function (err) {
    +                console.log(err);
    +                expect(false).toBe(true);
    +                done();
    +            });
    +        }, timeout);
    +
    +        it('spec.11 support for git-urls: cordova platform update https://github.com/apache/cordova-android.git –save', function (done) {
    +            helpers.setEngineSpec(appPath, platformVersionNew);
    +            platform('add', platformName + '@' + platformVersionNew)
    +            .then(function () {
    +                return cordova.raw.platform('update', platformGitUrl, { 'save': true });
    +            }).then(function () {
    +                expect(helpers.getEngineSpec(appPath)).not.toBe(null);
    +                expect(helpers.getEngineSpec(appPath)).not.toBe(platformVersionNew);
    +                done();
    +            }).catch(function (err) {
    +                console.log(err);
    +                expect(false).toBe(true);
    +                done();
    +            });
    +        }, timeout);
    +    });
    +
    +    describe('(plugin add)', function () {
    +        beforeEach(function (done) {
    +            cordova.raw.plugin('rm', [ pluginName, pluginOldName, variablePluginName, localPluginName ])
    +            .finally(function () {
    +                helpers.removePlugin(appPath, pluginName);
    +                helpers.removePlugin(appPath, pluginOldName);
    +                helpers.removePlugin(appPath, variablePluginName);
    +                helpers.removePlugin(appPath, localPluginName);
    +                done();
    +            });
    +        });
    +
    +        it('spec.12 cordova plugin add cordova-plugin-console –-save [config.xml empty]', function (done) {
    +            platform('add', platformLocalPath)
    +            .then(function () {
    +                return cordova.raw.plugin('add', pluginName, { 'save': true });
    +            }).then(function () {
    +                expect(helpers.getPluginSpec(appPath, pluginName)).not.toBe(null);
    +                done();
    +            }).catch(function (err) {
    +                expect(true).toBe(false);
    +                console.log(err.message);
    +                done();
    +            });
    +        }, timeout);
    +
    +        it('spec.13 cordova plugin add cordova-plugin-console –-save [config.xml already contains cordova-plugin-console@0.2.11]', function (done) {
    +            platform('add', platformLocalPath)
    +            .then(function () {
    +                helpers.setPluginSpec(appPath, pluginName, pluginOldVersion);
    +                return cordova.raw.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('spec.14 cordova plugin add facebook-plugins –-variables … -–save [testing variables support]', function (done) {
    +            platform('add', platformLocalPath)
    +            .then(function () {
    +                return cordova.raw.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();
    +            });
    +        }, timeout);
    +
    +        it('spec.15 cordova plugin add git_url --save', function (done) {
    +            platform('add', platformLocalPath)
    +            .then(function () {
    +                return cordova.raw.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('spec.16 cordova plugin add local_folder --save', function (done) {
    +            platform('add', platformLocalPath)
    +            .then(function () {
    +                return cordova.raw.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);
    +    });
    +
    +    describe('(plugin remove)', function () {
    +        it('spec.17 cordova plugin remove plugin-id --save [config.xml is empty]', function (done) {
    +            platform('add', platformLocalPath)
    +            .then(function () {
    +                return cordova.raw.plugin('add', pluginName);
    +            }).then(function () {
    +                return cordova.raw.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('spec.18 cordova plugin remove plugin-id --save [config.xml contains git-url of plugin]', function (done) {
    +            platform('add', platformLocalPath)
    +            .then(function () {
    +                return cordova.raw.plugin('add', pluginName);
    +            }).then(function () {
    +                helpers.setPluginSpec(appPath, pluginName, pluginGitUrl);
    +                return cordova.raw.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('plugin update', function () {
    +        //plugin update functionality is not yet implemented in cordova-cli
    +        xit('spec.19 cordova plugin update cordova-plugin-console --save', function (done) {
    --- End diff --
    
    I didn't find this functionality in cordova code (and the test always fails) so I decided to mark it pending. Should I leave it failing?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] cordova-lib pull request: CB-9122 Added tests for platform/plugin ...

Posted by alsorokin <gi...@git.apache.org>.
Github user alsorokin commented on the pull request:

    https://github.com/apache/cordova-lib/pull/246#issuecomment-115596356
  
    - Disabling console logging seems to be really tricky in this case.Most of it comes from android platform code which runs in child_process.spawn.
    i've tried wrapping it and always pass stdout: 'ignore' option to it, but it seem to break some functionality so I decided to leave it as is.
    - the underscore library which is included to cordova-lib doesn't have the module for string processing, so it doesn't have 'endsWith' function. I've just added a clarifying comment.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] cordova-lib pull request: CB-9122 Added tests for platform/plugin ...

Posted by omefire <gi...@git.apache.org>.
Github user omefire commented on a diff in the pull request:

    https://github.com/apache/cordova-lib/pull/246#discussion_r32271456
  
    --- Diff: cordova-lib/spec-cordova/save.spec.js ---
    @@ -0,0 +1,435 @@
    +/**
    +    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('./helpers'),
    +        path        = require('path'),
    +        Q           = require('q'),
    +        fs          = require('fs'),
    +        shell       = require('shelljs'),
    +        util        = require('../src/cordova/util'),
    +        platform    = rewire('../src/cordova/platform.js');
    +
    +    var appName             = 'testApp',
    +        tempPath            = path.join(__dirname, 'temp'),
    +        appPath             = path.join(tempPath, appName),
    +        platformName        = helpers.testPlatform,
    +        platformVersionOld  = '4.0.0',
    +        platformVersionNew  = '4.0.1',
    +        platformLocalPath   = path.join(tempPath, 'cordova-' + platformName),
    +        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',
    +        pluginName          = 'cordova-plugin-console',
    +        pluginVersion       = '1.0.0',
    +        pluginGitUrl        = 'https://github.com/apache/cordova-plugin-console.git',
    +        pluginOldName       = 'org.apache.cordova.console',
    +        pluginOldVersion    = '0.2.11',
    +        variablePluginName  = 'com.phonegap.plugins.facebookconnect',
    +        variablePluginUrl   = 'https://github.com/Wizcorp/phonegap-facebook-plugin',
    +        localPluginName     = 'org.apache.cordova.fakeplugin1',
    +        localPluginPath     = path.join(__dirname, 'fixtures', 'plugins', 'fake1'),
    +        timeout             = 60 * 1000;
    +
    +    //mocks
    +    var is_cordova, cd_project_root, prepare,
    +        revert_copy_cordova_js, revert_copy_cordovajs_src, revert_install_plugins_for_new_platform;
    +
    +    beforeEach(function (done) {
    +        is_cordova = spyOn(util, 'isCordova').andReturn(appPath);
    +        cd_project_root = spyOn(util, 'cdProjectRoot').andReturn(appPath);
    +        prepare = spyOn(cordova.raw, 'prepare').andReturn(Q());
    +
    +        fs.exists(appPath, function (exists) {
    +            if (exists) {
    +                cordova.raw.platform('rm', platformName).then(done, done);
    +            } else {
    +                done();
    +            }
    +        });
    +    });
    +
    +    describe('(preparing fixtures)', function () {
    +        it('preparing temp dir', function () {
    --- End diff --
    
    Move this to 'beforeEach'.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] cordova-lib pull request: CB-9122 Added tests for platform/plugin ...

Posted by omefire <gi...@git.apache.org>.
Github user omefire commented on the pull request:

    https://github.com/apache/cordova-lib/pull/246#issuecomment-115362721
  
    LGTM !
    @alsorokin, can you please:
     - Disable console logging (if possible, if not that's ok too.) ?
     - Use underscore's endWith function instead writing that hard to understand logic


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] cordova-lib pull request: CB-9122 Added tests for platform/plugin ...

Posted by omefire <gi...@git.apache.org>.
Github user omefire commented on the pull request:

    https://github.com/apache/cordova-lib/pull/246#issuecomment-115695959
  
    @alsorokin, sounds good. Thanks!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] cordova-lib pull request: CB-9122 Added tests for platform/plugin ...

Posted by omefire <gi...@git.apache.org>.
Github user omefire commented on a diff in the pull request:

    https://github.com/apache/cordova-lib/pull/246#discussion_r32539540
  
    --- Diff: cordova-lib/spec-cordova/save.spec.js ---
    @@ -0,0 +1,435 @@
    +/**
    +    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('./helpers'),
    +        path        = require('path'),
    +        Q           = require('q'),
    +        fs          = require('fs'),
    +        shell       = require('shelljs'),
    +        util        = require('../src/cordova/util'),
    +        platform    = rewire('../src/cordova/platform.js');
    +
    +    var appName             = 'testApp',
    +        tempPath            = path.join(__dirname, 'temp'),
    +        appPath             = path.join(tempPath, appName),
    +        platformName        = helpers.testPlatform,
    +        platformVersionOld  = '4.0.0',
    +        platformVersionNew  = '4.0.1',
    +        platformLocalPath   = path.join(tempPath, 'cordova-' + platformName),
    +        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',
    +        pluginName          = 'cordova-plugin-console',
    +        pluginVersion       = '1.0.0',
    +        pluginGitUrl        = 'https://github.com/apache/cordova-plugin-console.git',
    +        pluginOldName       = 'org.apache.cordova.console',
    +        pluginOldVersion    = '0.2.11',
    +        variablePluginName  = 'com.phonegap.plugins.facebookconnect',
    +        variablePluginUrl   = 'https://github.com/Wizcorp/phonegap-facebook-plugin',
    +        localPluginName     = 'org.apache.cordova.fakeplugin1',
    +        localPluginPath     = path.join(__dirname, 'fixtures', 'plugins', 'fake1'),
    +        timeout             = 60 * 1000;
    +
    +    //mocks
    +    var is_cordova, cd_project_root, prepare,
    +        revert_copy_cordova_js, revert_copy_cordovajs_src, revert_install_plugins_for_new_platform;
    +
    +    beforeEach(function (done) {
    +        is_cordova = spyOn(util, 'isCordova').andReturn(appPath);
    +        cd_project_root = spyOn(util, 'cdProjectRoot').andReturn(appPath);
    +        prepare = spyOn(cordova.raw, 'prepare').andReturn(Q());
    +
    +        fs.exists(appPath, function (exists) {
    +            if (exists) {
    +                cordova.raw.platform('rm', platformName).then(done, done);
    +            } else {
    +                done();
    +            }
    +        });
    +    });
    +
    +    describe('(preparing fixtures)', function () {
    +        it('preparing temp dir', function () {
    +            shell.rm('-rf', tempPath);
    +            shell.mkdir(tempPath);
    +        });
    +
    +        it('creating mocks', function () {
    +            revert_copy_cordova_js = platform.__set__('copy_cordova_js', function () {});
    +            revert_copy_cordovajs_src = platform.__set__('copy_cordovajs_src', function () {});
    +            revert_install_plugins_for_new_platform = platform.__set__('installPluginsForNewPlatform', function () { return Q(); });
    +        });
    +
    +        it('creating test app', function (done) {
    +            cordova.raw.create(appPath, undefined, undefined, {}).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();
    +            });
    +        });
    +
    +        it('cloning platform', function (done) {
    +            shell.exec('git clone ' + platformGitUrl + ' --depth 1 ' + platformLocalPath, { silent: true }, function (err) {
    +                expect(err).toBe(0);
    +                done();
    +            });
    +        }, timeout);
    +    });
    +
    +    describe('(platform add)', function () {
    +        it('spec.1 cusom tgz support: cordova platform add android@url_to_tgz', function (done) {
    +            helpers.removeEngine(appPath);
    +            platform('add', platformName + '@' + platformTgzUrl, { 'save': true })
    +            .then(function () {
    +                expect(helpers.getEngineSpec(appPath)).toBe(platformTgzUrl);
    +                done();
    +            }).catch(function (err) {
    +                console.log(err);
    +                expect(false).toBe(true);
    +                done();
    +            });
    +        }, timeout);
    +
    +        it('spec.2 cordova platform add android --save [empty config.xml]', function (done) {
    +            helpers.removeEngine(appPath);
    +            platform('add', platformName, { 'save': true })
    +            .then(function () {
    +                expect(helpers.getEngineSpec(appPath)).not.toBe(null);
    +                done();
    +            }).catch(function (err) {
    +                console.log(err);
    +                expect(false).toBe(true);
    +                done();
    +            });
    +        }, timeout);
    +
    +        it('spec.3 cordova platform add android --save [config.xml already contains android@4.0.0]', function (done) {
    +            helpers.setEngineSpec(appPath, platformVersionOld);
    +            platform('add', platformName, { 'save': true })
    +            .then(function () {
    +                expect(helpers.getEngineSpec(appPath)).toBe('^' + platformVersionOld);
    +                done();
    +            }).catch(function (err) {
    +                console.log(err);
    +                expect(false).toBe(true);
    +                done();
    +            });
    +        }, timeout);
    +
    +        it('spec.4 cordova platform add android --save [config.xml contains android@file://C:/path/to/android]', function (done) {
    +            helpers.setEngineSpec(appPath, platformLocalPath);
    +            platform('add', platformName, { 'save': true })
    +            .then(function () {
    +                expect(helpers.getEngineSpec(appPath)).toBe(platformLocalPath);
    +                done();
    +            }).catch(function (err) {
    +                console.log(err);
    +                expect(false).toBe(true);
    +                done();
    +            });
    +        }, timeout);
    +
    +        it('spec.5 cordova platform add android@3.969.696 --save [invalid version => should fail and should not update config.xml]', function (done) {
    +            helpers.removeEngine(appPath);
    +            platform('add', helpers.testPlatform + '@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)).toBe(null);
    +                done();
    +            });
    +        });
    +
    +        it('spec.6 cordova platform add C://path/to/android/platform --save', function (done) {
    +            helpers.removeEngine(appPath);
    +            platform('add', platformLocalPath, { 'save': true })
    +            .then(function () {
    +                expect(helpers.getEngineSpec(appPath)).toBe(platformLocalPath);
    +                done();
    +            }).catch(function (err) {
    +                console.log(err);
    +                expect(false).toBe(true);
    +                done();
    +            });
    +        }, timeout);
    +
    +        it('spec.7 should support cordova platform add https://github.com/apache/cordova-android.git#4.0.x', function (done) {
    +            var platformUrl = platformGitUrl + '#' + platformGitRef;
    +            helpers.removeEngine(appPath);
    +            platform('add', platformUrl, { 'save': true })
    +            .then(function () {
    +                expect(helpers.getEngineSpec(appPath)).toBe(platformUrl);
    +                done();
    +            }).catch(function (err) {
    +                console.log(err);
    +                expect(false).toBe(true);
    +                done();
    +            });
    +        }, timeout);
    +    });
    +
    +    describe('(platform remove)', function () {
    +        it('spec.8 cordova platform remove android --save [config.xml is empty]', function (done) {
    +            helpers.removeEngine(appPath);
    +            platform('add', platformLocalPath)
    +            .then(function () {
    +                return cordova.raw.platform('rm', platformName, { 'save': true });
    +            }).then(function () {
    +                expect(helpers.getEngineSpec(appPath)).toBe(null);
    +                done();
    +            }).catch(function (err) {
    +                console.log(err);
    +                expect(false).toBe(true);
    +                done();
    +            });
    +        }, timeout);
    +
    +        it('spec.9 cordova platform remove android --save [config.xml contains android@C:/path/to/android/platform]', function (done) {
    +            helpers.setEngineSpec(appPath, platformLocalPath);
    +            platform('add', platformLocalPath)
    +            .then(function () {
    +                return cordova.raw.platform('rm', platformName, { 'save': true });
    +            }).then(function () {
    +                expect(helpers.getEngineSpec(appPath)).toBe(null);
    +                done();
    +            }).catch(function (err) {
    +                console.log(err);
    +                expect(false).toBe(true);
    +                done();
    +            });
    +        }, timeout);
    +    });
    +
    +    describe('(platform update)', function () {
    +        it('spec. 10 cordova platform update android@4.0.0  --save [config.xml already contains android@4.0.1]', function (done) {
    +            helpers.setEngineSpec(appPath, platformVersionNew);
    +            platform('add', platformName + '@' + platformVersionNew)
    +            .then(function () {
    +                return cordova.raw.platform('update', platformName + '@' + platformVersionOld, { 'save': true });
    +            }).then(function () {
    +                expect(helpers.getEngineSpec(appPath)).toBe('^' + platformVersionOld);
    +                done();
    +            }).catch(function (err) {
    +                console.log(err);
    +                expect(false).toBe(true);
    +                done();
    +            });
    +        }, timeout);
    +
    +        it('spec.11 support for git-urls: cordova platform update https://github.com/apache/cordova-android.git –save', function (done) {
    +            helpers.setEngineSpec(appPath, platformVersionNew);
    +            platform('add', platformName + '@' + platformVersionNew)
    +            .then(function () {
    +                return cordova.raw.platform('update', platformGitUrl, { 'save': true });
    +            }).then(function () {
    +                expect(helpers.getEngineSpec(appPath)).not.toBe(null);
    +                expect(helpers.getEngineSpec(appPath)).not.toBe(platformVersionNew);
    +                done();
    +            }).catch(function (err) {
    +                console.log(err);
    +                expect(false).toBe(true);
    +                done();
    +            });
    +        }, timeout);
    +    });
    +
    +    describe('(plugin add)', function () {
    +        beforeEach(function (done) {
    +            cordova.raw.plugin('rm', [ pluginName, pluginOldName, variablePluginName, localPluginName ])
    +            .finally(function () {
    +                helpers.removePlugin(appPath, pluginName);
    +                helpers.removePlugin(appPath, pluginOldName);
    +                helpers.removePlugin(appPath, variablePluginName);
    +                helpers.removePlugin(appPath, localPluginName);
    +                done();
    +            });
    +        });
    +
    +        it('spec.12 cordova plugin add cordova-plugin-console –-save [config.xml empty]', function (done) {
    +            platform('add', platformLocalPath)
    +            .then(function () {
    +                return cordova.raw.plugin('add', pluginName, { 'save': true });
    +            }).then(function () {
    +                expect(helpers.getPluginSpec(appPath, pluginName)).not.toBe(null);
    +                done();
    +            }).catch(function (err) {
    +                expect(true).toBe(false);
    +                console.log(err.message);
    +                done();
    +            });
    +        }, timeout);
    +
    +        it('spec.13 cordova plugin add cordova-plugin-console –-save [config.xml already contains cordova-plugin-console@0.2.11]', function (done) {
    +            platform('add', platformLocalPath)
    +            .then(function () {
    +                helpers.setPluginSpec(appPath, pluginName, pluginOldVersion);
    +                return cordova.raw.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('spec.14 cordova plugin add facebook-plugins –-variables … -–save [testing variables support]', function (done) {
    +            platform('add', platformLocalPath)
    +            .then(function () {
    +                return cordova.raw.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();
    +            });
    +        }, timeout);
    +
    +        it('spec.15 cordova plugin add git_url --save', function (done) {
    +            platform('add', platformLocalPath)
    +            .then(function () {
    +                return cordova.raw.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('spec.16 cordova plugin add local_folder --save', function (done) {
    +            platform('add', platformLocalPath)
    +            .then(function () {
    +                return cordova.raw.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);
    +    });
    +
    +    describe('(plugin remove)', function () {
    +        it('spec.17 cordova plugin remove plugin-id --save [config.xml is empty]', function (done) {
    +            platform('add', platformLocalPath)
    +            .then(function () {
    +                return cordova.raw.plugin('add', pluginName);
    +            }).then(function () {
    +                return cordova.raw.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('spec.18 cordova plugin remove plugin-id --save [config.xml contains git-url of plugin]', function (done) {
    +            platform('add', platformLocalPath)
    +            .then(function () {
    +                return cordova.raw.plugin('add', pluginName);
    +            }).then(function () {
    +                helpers.setPluginSpec(appPath, pluginName, pluginGitUrl);
    +                return cordova.raw.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('plugin update', function () {
    +        //plugin update functionality is not yet implemented in cordova-cli
    +        xit('spec.19 cordova plugin update cordova-plugin-console --save', function (done) {
    --- End diff --
    
    That's because there's no 'cordova plugin update' functionality. Please, delete those tests.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] cordova-lib pull request: CB-9122 Added tests for platform/plugin ...

Posted by omefire <gi...@git.apache.org>.
Github user omefire commented on a diff in the pull request:

    https://github.com/apache/cordova-lib/pull/246#discussion_r32273251
  
    --- Diff: cordova-lib/spec-cordova/save.spec.js ---
    @@ -0,0 +1,435 @@
    +/**
    +    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('./helpers'),
    +        path        = require('path'),
    +        Q           = require('q'),
    +        fs          = require('fs'),
    +        shell       = require('shelljs'),
    +        util        = require('../src/cordova/util'),
    +        platform    = rewire('../src/cordova/platform.js');
    +
    +    var appName             = 'testApp',
    +        tempPath            = path.join(__dirname, 'temp'),
    +        appPath             = path.join(tempPath, appName),
    +        platformName        = helpers.testPlatform,
    +        platformVersionOld  = '4.0.0',
    +        platformVersionNew  = '4.0.1',
    +        platformLocalPath   = path.join(tempPath, 'cordova-' + platformName),
    +        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',
    +        pluginName          = 'cordova-plugin-console',
    +        pluginVersion       = '1.0.0',
    +        pluginGitUrl        = 'https://github.com/apache/cordova-plugin-console.git',
    +        pluginOldName       = 'org.apache.cordova.console',
    +        pluginOldVersion    = '0.2.11',
    +        variablePluginName  = 'com.phonegap.plugins.facebookconnect',
    +        variablePluginUrl   = 'https://github.com/Wizcorp/phonegap-facebook-plugin',
    +        localPluginName     = 'org.apache.cordova.fakeplugin1',
    +        localPluginPath     = path.join(__dirname, 'fixtures', 'plugins', 'fake1'),
    +        timeout             = 60 * 1000;
    +
    +    //mocks
    +    var is_cordova, cd_project_root, prepare,
    +        revert_copy_cordova_js, revert_copy_cordovajs_src, revert_install_plugins_for_new_platform;
    +
    +    beforeEach(function (done) {
    +        is_cordova = spyOn(util, 'isCordova').andReturn(appPath);
    +        cd_project_root = spyOn(util, 'cdProjectRoot').andReturn(appPath);
    +        prepare = spyOn(cordova.raw, 'prepare').andReturn(Q());
    +
    +        fs.exists(appPath, function (exists) {
    +            if (exists) {
    +                cordova.raw.platform('rm', platformName).then(done, done);
    +            } else {
    +                done();
    +            }
    +        });
    +    });
    +
    +    describe('(preparing fixtures)', function () {
    +        it('preparing temp dir', function () {
    +            shell.rm('-rf', tempPath);
    +            shell.mkdir(tempPath);
    +        });
    +
    +        it('creating mocks', function () {
    +            revert_copy_cordova_js = platform.__set__('copy_cordova_js', function () {});
    +            revert_copy_cordovajs_src = platform.__set__('copy_cordovajs_src', function () {});
    +            revert_install_plugins_for_new_platform = platform.__set__('installPluginsForNewPlatform', function () { return Q(); });
    +        });
    +
    +        it('creating test app', function (done) {
    +            cordova.raw.create(appPath, undefined, undefined, {}).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();
    +            });
    +        });
    +
    +        it('cloning platform', function (done) {
    +            shell.exec('git clone ' + platformGitUrl + ' --depth 1 ' + platformLocalPath, { silent: true }, function (err) {
    +                expect(err).toBe(0);
    +                done();
    +            });
    +        }, timeout);
    +    });
    +
    +    describe('(platform add)', function () {
    +        it('spec.1 cusom tgz support: cordova platform add android@url_to_tgz', function (done) {
    +            helpers.removeEngine(appPath);
    +            platform('add', platformName + '@' + platformTgzUrl, { 'save': true })
    +            .then(function () {
    +                expect(helpers.getEngineSpec(appPath)).toBe(platformTgzUrl);
    +                done();
    +            }).catch(function (err) {
    +                console.log(err);
    +                expect(false).toBe(true);
    +                done();
    +            });
    +        }, timeout);
    +
    +        it('spec.2 cordova platform add android --save [empty config.xml]', function (done) {
    +            helpers.removeEngine(appPath);
    +            platform('add', platformName, { 'save': true })
    +            .then(function () {
    +                expect(helpers.getEngineSpec(appPath)).not.toBe(null);
    +                done();
    +            }).catch(function (err) {
    +                console.log(err);
    +                expect(false).toBe(true);
    +                done();
    +            });
    +        }, timeout);
    +
    +        it('spec.3 cordova platform add android --save [config.xml already contains android@4.0.0]', function (done) {
    +            helpers.setEngineSpec(appPath, platformVersionOld);
    +            platform('add', platformName, { 'save': true })
    +            .then(function () {
    +                expect(helpers.getEngineSpec(appPath)).toBe('^' + platformVersionOld);
    +                done();
    +            }).catch(function (err) {
    +                console.log(err);
    +                expect(false).toBe(true);
    +                done();
    +            });
    +        }, timeout);
    +
    +        it('spec.4 cordova platform add android --save [config.xml contains android@file://C:/path/to/android]', function (done) {
    +            helpers.setEngineSpec(appPath, platformLocalPath);
    +            platform('add', platformName, { 'save': true })
    +            .then(function () {
    +                expect(helpers.getEngineSpec(appPath)).toBe(platformLocalPath);
    +                done();
    +            }).catch(function (err) {
    +                console.log(err);
    +                expect(false).toBe(true);
    +                done();
    +            });
    +        }, timeout);
    +
    +        it('spec.5 cordova platform add android@3.969.696 --save [invalid version => should fail and should not update config.xml]', function (done) {
    +            helpers.removeEngine(appPath);
    +            platform('add', helpers.testPlatform + '@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)).toBe(null);
    +                done();
    +            });
    +        });
    +
    +        it('spec.6 cordova platform add C://path/to/android/platform --save', function (done) {
    +            helpers.removeEngine(appPath);
    +            platform('add', platformLocalPath, { 'save': true })
    +            .then(function () {
    +                expect(helpers.getEngineSpec(appPath)).toBe(platformLocalPath);
    +                done();
    +            }).catch(function (err) {
    +                console.log(err);
    +                expect(false).toBe(true);
    +                done();
    +            });
    +        }, timeout);
    +
    +        it('spec.7 should support cordova platform add https://github.com/apache/cordova-android.git#4.0.x', function (done) {
    +            var platformUrl = platformGitUrl + '#' + platformGitRef;
    +            helpers.removeEngine(appPath);
    +            platform('add', platformUrl, { 'save': true })
    +            .then(function () {
    +                expect(helpers.getEngineSpec(appPath)).toBe(platformUrl);
    +                done();
    +            }).catch(function (err) {
    +                console.log(err);
    +                expect(false).toBe(true);
    +                done();
    +            });
    +        }, timeout);
    +    });
    +
    +    describe('(platform remove)', function () {
    +        it('spec.8 cordova platform remove android --save [config.xml is empty]', function (done) {
    +            helpers.removeEngine(appPath);
    +            platform('add', platformLocalPath)
    +            .then(function () {
    +                return cordova.raw.platform('rm', platformName, { 'save': true });
    +            }).then(function () {
    +                expect(helpers.getEngineSpec(appPath)).toBe(null);
    +                done();
    +            }).catch(function (err) {
    +                console.log(err);
    +                expect(false).toBe(true);
    +                done();
    +            });
    +        }, timeout);
    +
    +        it('spec.9 cordova platform remove android --save [config.xml contains android@C:/path/to/android/platform]', function (done) {
    +            helpers.setEngineSpec(appPath, platformLocalPath);
    +            platform('add', platformLocalPath)
    +            .then(function () {
    +                return cordova.raw.platform('rm', platformName, { 'save': true });
    +            }).then(function () {
    +                expect(helpers.getEngineSpec(appPath)).toBe(null);
    +                done();
    +            }).catch(function (err) {
    +                console.log(err);
    +                expect(false).toBe(true);
    +                done();
    +            });
    +        }, timeout);
    +    });
    +
    +    describe('(platform update)', function () {
    +        it('spec. 10 cordova platform update android@4.0.0  --save [config.xml already contains android@4.0.1]', function (done) {
    +            helpers.setEngineSpec(appPath, platformVersionNew);
    +            platform('add', platformName + '@' + platformVersionNew)
    +            .then(function () {
    +                return cordova.raw.platform('update', platformName + '@' + platformVersionOld, { 'save': true });
    +            }).then(function () {
    +                expect(helpers.getEngineSpec(appPath)).toBe('^' + platformVersionOld);
    +                done();
    +            }).catch(function (err) {
    +                console.log(err);
    +                expect(false).toBe(true);
    +                done();
    +            });
    +        }, timeout);
    +
    +        it('spec.11 support for git-urls: cordova platform update https://github.com/apache/cordova-android.git –save', function (done) {
    +            helpers.setEngineSpec(appPath, platformVersionNew);
    +            platform('add', platformName + '@' + platformVersionNew)
    +            .then(function () {
    +                return cordova.raw.platform('update', platformGitUrl, { 'save': true });
    +            }).then(function () {
    +                expect(helpers.getEngineSpec(appPath)).not.toBe(null);
    +                expect(helpers.getEngineSpec(appPath)).not.toBe(platformVersionNew);
    +                done();
    +            }).catch(function (err) {
    +                console.log(err);
    +                expect(false).toBe(true);
    +                done();
    +            });
    +        }, timeout);
    +    });
    +
    +    describe('(plugin add)', function () {
    +        beforeEach(function (done) {
    +            cordova.raw.plugin('rm', [ pluginName, pluginOldName, variablePluginName, localPluginName ])
    +            .finally(function () {
    +                helpers.removePlugin(appPath, pluginName);
    +                helpers.removePlugin(appPath, pluginOldName);
    +                helpers.removePlugin(appPath, variablePluginName);
    +                helpers.removePlugin(appPath, localPluginName);
    +                done();
    +            });
    +        });
    +
    +        it('spec.12 cordova plugin add cordova-plugin-console –-save [config.xml empty]', function (done) {
    +            platform('add', platformLocalPath)
    +            .then(function () {
    +                return cordova.raw.plugin('add', pluginName, { 'save': true });
    +            }).then(function () {
    +                expect(helpers.getPluginSpec(appPath, pluginName)).not.toBe(null);
    +                done();
    +            }).catch(function (err) {
    +                expect(true).toBe(false);
    +                console.log(err.message);
    +                done();
    +            });
    +        }, timeout);
    +
    +        it('spec.13 cordova plugin add cordova-plugin-console –-save [config.xml already contains cordova-plugin-console@0.2.11]', function (done) {
    +            platform('add', platformLocalPath)
    +            .then(function () {
    +                helpers.setPluginSpec(appPath, pluginName, pluginOldVersion);
    +                return cordova.raw.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('spec.14 cordova plugin add facebook-plugins –-variables … -–save [testing variables support]', function (done) {
    +            platform('add', platformLocalPath)
    +            .then(function () {
    +                return cordova.raw.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();
    +            });
    +        }, timeout);
    +
    +        it('spec.15 cordova plugin add git_url --save', function (done) {
    +            platform('add', platformLocalPath)
    +            .then(function () {
    +                return cordova.raw.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('spec.16 cordova plugin add local_folder --save', function (done) {
    +            platform('add', platformLocalPath)
    +            .then(function () {
    +                return cordova.raw.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);
    +    });
    +
    +    describe('(plugin remove)', function () {
    +        it('spec.17 cordova plugin remove plugin-id --save [config.xml is empty]', function (done) {
    +            platform('add', platformLocalPath)
    +            .then(function () {
    +                return cordova.raw.plugin('add', pluginName);
    +            }).then(function () {
    +                return cordova.raw.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('spec.18 cordova plugin remove plugin-id --save [config.xml contains git-url of plugin]', function (done) {
    +            platform('add', platformLocalPath)
    +            .then(function () {
    +                return cordova.raw.plugin('add', pluginName);
    +            }).then(function () {
    +                helpers.setPluginSpec(appPath, pluginName, pluginGitUrl);
    +                return cordova.raw.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('plugin update', function () {
    +        //plugin update functionality is not yet implemented in cordova-cli
    +        xit('spec.19 cordova plugin update cordova-plugin-console --save', function (done) {
    +            platform('add', platformLocalPath)
    +            .then(function () {
    +                return cordova.raw.plugin('add', pluginName + '@' + pluginVersion);
    +            }).then(function () {
    +                return cordova.raw.plugin('update', pluginName, {'save': true});
    +            }).then(function () {
    +                expect(helpers.getPluginSpec(appPath, pluginName)).not.toBe(null);
    +                expect(helpers.getPluginSpec(appPath, pluginName)).not.toBe(pluginVersion);
    +                done();
    +            }).catch(function (err) {
    +                expect(true).toBe(false);
    +                console.log(err.message);
    +                done();
    +            });
    +        }, timeout);
    +
    +        //plugin update functionality is not yet implemented in cordova-cli
    +        xit('spec.20 cordova plugin update cordova-plugin-console@0.3.12 --save', function (done) {
    --- End diff --
    
    forgot to change this back to 'it' ?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] cordova-lib pull request: CB-9122 Added tests for platform/plugin ...

Posted by alsorokin <gi...@git.apache.org>.
Github user alsorokin commented on the pull request:

    https://github.com/apache/cordova-lib/pull/246#issuecomment-115158684
  
    Done. Is it good to go?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] cordova-lib pull request: CB-9122 Added tests for platform/plugin ...

Posted by omefire <gi...@git.apache.org>.
Github user omefire commented on a diff in the pull request:

    https://github.com/apache/cordova-lib/pull/246#discussion_r33290055
  
    --- Diff: cordova-lib/spec-cordova/helpers.js ---
    @@ -17,12 +17,23 @@
         under the License.
     */
     
    -var path = require('path'),
    -    fs = require('fs'),
    -    shell = require('shelljs'),
    -    os = require('os');
    +var path         = require('path'),
    +    fs           = require('fs'),
    +    shell        = require('shelljs'),
    +    os           = require('os'),
    +    ConfigParser = require('../src/configparser/ConfigParser');
     
    -module.exports.tmpDir = function(subdir) {
    +// Just use Android everywhere; we're mocking out any calls to the `android` binary.
    +module.exports.testPlatform = 'android';
    +
    +function getConfigPath(dir) {
    +    if (dir.indexOf('config.xml') !== dir.length - 10) {
    --- End diff --
    
    I see what you're doing there. I think you should use underscore (which we already include) to do that: http://aganov.github.io/underscore-strings/docs/underscore.strings.html#section-10


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] cordova-lib pull request: CB-9122 Added tests for platform/plugin ...

Posted by omefire <gi...@git.apache.org>.
Github user omefire commented on a diff in the pull request:

    https://github.com/apache/cordova-lib/pull/246#discussion_r32271532
  
    --- Diff: cordova-lib/spec-cordova/save.spec.js ---
    @@ -0,0 +1,435 @@
    +/**
    +    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('./helpers'),
    +        path        = require('path'),
    +        Q           = require('q'),
    +        fs          = require('fs'),
    +        shell       = require('shelljs'),
    +        util        = require('../src/cordova/util'),
    +        platform    = rewire('../src/cordova/platform.js');
    +
    +    var appName             = 'testApp',
    +        tempPath            = path.join(__dirname, 'temp'),
    +        appPath             = path.join(tempPath, appName),
    +        platformName        = helpers.testPlatform,
    +        platformVersionOld  = '4.0.0',
    +        platformVersionNew  = '4.0.1',
    +        platformLocalPath   = path.join(tempPath, 'cordova-' + platformName),
    +        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',
    +        pluginName          = 'cordova-plugin-console',
    +        pluginVersion       = '1.0.0',
    +        pluginGitUrl        = 'https://github.com/apache/cordova-plugin-console.git',
    +        pluginOldName       = 'org.apache.cordova.console',
    +        pluginOldVersion    = '0.2.11',
    +        variablePluginName  = 'com.phonegap.plugins.facebookconnect',
    +        variablePluginUrl   = 'https://github.com/Wizcorp/phonegap-facebook-plugin',
    +        localPluginName     = 'org.apache.cordova.fakeplugin1',
    +        localPluginPath     = path.join(__dirname, 'fixtures', 'plugins', 'fake1'),
    +        timeout             = 60 * 1000;
    +
    +    //mocks
    +    var is_cordova, cd_project_root, prepare,
    +        revert_copy_cordova_js, revert_copy_cordovajs_src, revert_install_plugins_for_new_platform;
    +
    +    beforeEach(function (done) {
    +        is_cordova = spyOn(util, 'isCordova').andReturn(appPath);
    +        cd_project_root = spyOn(util, 'cdProjectRoot').andReturn(appPath);
    +        prepare = spyOn(cordova.raw, 'prepare').andReturn(Q());
    +
    +        fs.exists(appPath, function (exists) {
    +            if (exists) {
    +                cordova.raw.platform('rm', platformName).then(done, done);
    +            } else {
    +                done();
    +            }
    +        });
    +    });
    +
    +    describe('(preparing fixtures)', function () {
    +        it('preparing temp dir', function () {
    +            shell.rm('-rf', tempPath);
    +            shell.mkdir(tempPath);
    +        });
    +
    +        it('creating mocks', function () {
    +            revert_copy_cordova_js = platform.__set__('copy_cordova_js', function () {});
    --- End diff --
    
    Please, move this to 'beforeEach'.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] cordova-lib pull request: CB-9122 Added tests for platform/plugin ...

Posted by omefire <gi...@git.apache.org>.
Github user omefire commented on the pull request:

    https://github.com/apache/cordova-lib/pull/246#issuecomment-114947739
  
    Added a few minor comments.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] cordova-lib pull request: CB-9122 Added tests for platform/plugin ...

Posted by alsorokin <gi...@git.apache.org>.
Github user alsorokin commented on the pull request:

    https://github.com/apache/cordova-lib/pull/246#issuecomment-115107676
  
    This commit came from you, @omefire 
    I can delete it if you want.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] cordova-lib pull request: CB-9122 Added tests for platform/plugin ...

Posted by purplecabbage <gi...@git.apache.org>.
Github user purplecabbage commented on a diff in the pull request:

    https://github.com/apache/cordova-lib/pull/246#discussion_r33293060
  
    --- Diff: cordova-lib/spec-cordova/helpers.js ---
    @@ -17,12 +17,23 @@
         under the License.
     */
     
    -var path = require('path'),
    -    fs = require('fs'),
    -    shell = require('shelljs'),
    -    os = require('os');
    +var path         = require('path'),
    +    fs           = require('fs'),
    +    shell        = require('shelljs'),
    +    os           = require('os'),
    +    ConfigParser = require('../src/configparser/ConfigParser');
     
    -module.exports.tmpDir = function(subdir) {
    +// Just use Android everywhere; we're mocking out any calls to the `android` binary.
    +module.exports.testPlatform = 'android';
    +
    +function getConfigPath(dir) {
    +    if (dir.indexOf('config.xml') !== dir.length - 10) {
    --- End diff --
    
    A simple line comment stating the intent to see if dir 'endsWith' config.xml would be helpful.
    underscore would probably be overkill for this one method.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] cordova-lib pull request: CB-9122 Added tests for platform/plugin ...

Posted by omefire <gi...@git.apache.org>.
Github user omefire commented on a diff in the pull request:

    https://github.com/apache/cordova-lib/pull/246#discussion_r33293439
  
    --- Diff: cordova-lib/spec-cordova/helpers.js ---
    @@ -17,12 +17,23 @@
         under the License.
     */
     
    -var path = require('path'),
    -    fs = require('fs'),
    -    shell = require('shelljs'),
    -    os = require('os');
    +var path         = require('path'),
    +    fs           = require('fs'),
    +    shell        = require('shelljs'),
    +    os           = require('os'),
    +    ConfigParser = require('../src/configparser/ConfigParser');
     
    -module.exports.tmpDir = function(subdir) {
    +// Just use Android everywhere; we're mocking out any calls to the `android` binary.
    +module.exports.testPlatform = 'android';
    +
    +function getConfigPath(dir) {
    +    if (dir.indexOf('config.xml') !== dir.length - 10) {
    --- End diff --
    
    @purplecabbage, I was leaning towards a comment at first, but then I realized we already have underscore which provides this functionality. I think we should just use it and I don't find it to be overkill.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] cordova-lib pull request: CB-9122 Added tests for platform/plugin ...

Posted by omefire <gi...@git.apache.org>.
Github user omefire commented on a diff in the pull request:

    https://github.com/apache/cordova-lib/pull/246#discussion_r32273230
  
    --- Diff: cordova-lib/spec-cordova/save.spec.js ---
    @@ -0,0 +1,435 @@
    +/**
    +    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('./helpers'),
    +        path        = require('path'),
    +        Q           = require('q'),
    +        fs          = require('fs'),
    +        shell       = require('shelljs'),
    +        util        = require('../src/cordova/util'),
    +        platform    = rewire('../src/cordova/platform.js');
    +
    +    var appName             = 'testApp',
    +        tempPath            = path.join(__dirname, 'temp'),
    +        appPath             = path.join(tempPath, appName),
    +        platformName        = helpers.testPlatform,
    +        platformVersionOld  = '4.0.0',
    +        platformVersionNew  = '4.0.1',
    +        platformLocalPath   = path.join(tempPath, 'cordova-' + platformName),
    +        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',
    +        pluginName          = 'cordova-plugin-console',
    +        pluginVersion       = '1.0.0',
    +        pluginGitUrl        = 'https://github.com/apache/cordova-plugin-console.git',
    +        pluginOldName       = 'org.apache.cordova.console',
    +        pluginOldVersion    = '0.2.11',
    +        variablePluginName  = 'com.phonegap.plugins.facebookconnect',
    +        variablePluginUrl   = 'https://github.com/Wizcorp/phonegap-facebook-plugin',
    +        localPluginName     = 'org.apache.cordova.fakeplugin1',
    +        localPluginPath     = path.join(__dirname, 'fixtures', 'plugins', 'fake1'),
    +        timeout             = 60 * 1000;
    +
    +    //mocks
    +    var is_cordova, cd_project_root, prepare,
    +        revert_copy_cordova_js, revert_copy_cordovajs_src, revert_install_plugins_for_new_platform;
    +
    +    beforeEach(function (done) {
    +        is_cordova = spyOn(util, 'isCordova').andReturn(appPath);
    +        cd_project_root = spyOn(util, 'cdProjectRoot').andReturn(appPath);
    +        prepare = spyOn(cordova.raw, 'prepare').andReturn(Q());
    +
    +        fs.exists(appPath, function (exists) {
    +            if (exists) {
    +                cordova.raw.platform('rm', platformName).then(done, done);
    +            } else {
    +                done();
    +            }
    +        });
    +    });
    +
    +    describe('(preparing fixtures)', function () {
    +        it('preparing temp dir', function () {
    +            shell.rm('-rf', tempPath);
    +            shell.mkdir(tempPath);
    +        });
    +
    +        it('creating mocks', function () {
    +            revert_copy_cordova_js = platform.__set__('copy_cordova_js', function () {});
    +            revert_copy_cordovajs_src = platform.__set__('copy_cordovajs_src', function () {});
    +            revert_install_plugins_for_new_platform = platform.__set__('installPluginsForNewPlatform', function () { return Q(); });
    +        });
    +
    +        it('creating test app', function (done) {
    +            cordova.raw.create(appPath, undefined, undefined, {}).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();
    +            });
    +        });
    +
    +        it('cloning platform', function (done) {
    +            shell.exec('git clone ' + platformGitUrl + ' --depth 1 ' + platformLocalPath, { silent: true }, function (err) {
    +                expect(err).toBe(0);
    +                done();
    +            });
    +        }, timeout);
    +    });
    +
    +    describe('(platform add)', function () {
    +        it('spec.1 cusom tgz support: cordova platform add android@url_to_tgz', function (done) {
    +            helpers.removeEngine(appPath);
    +            platform('add', platformName + '@' + platformTgzUrl, { 'save': true })
    +            .then(function () {
    +                expect(helpers.getEngineSpec(appPath)).toBe(platformTgzUrl);
    +                done();
    +            }).catch(function (err) {
    +                console.log(err);
    +                expect(false).toBe(true);
    +                done();
    +            });
    +        }, timeout);
    +
    +        it('spec.2 cordova platform add android --save [empty config.xml]', function (done) {
    +            helpers.removeEngine(appPath);
    +            platform('add', platformName, { 'save': true })
    +            .then(function () {
    +                expect(helpers.getEngineSpec(appPath)).not.toBe(null);
    +                done();
    +            }).catch(function (err) {
    +                console.log(err);
    +                expect(false).toBe(true);
    +                done();
    +            });
    +        }, timeout);
    +
    +        it('spec.3 cordova platform add android --save [config.xml already contains android@4.0.0]', function (done) {
    +            helpers.setEngineSpec(appPath, platformVersionOld);
    +            platform('add', platformName, { 'save': true })
    +            .then(function () {
    +                expect(helpers.getEngineSpec(appPath)).toBe('^' + platformVersionOld);
    +                done();
    +            }).catch(function (err) {
    +                console.log(err);
    +                expect(false).toBe(true);
    +                done();
    +            });
    +        }, timeout);
    +
    +        it('spec.4 cordova platform add android --save [config.xml contains android@file://C:/path/to/android]', function (done) {
    +            helpers.setEngineSpec(appPath, platformLocalPath);
    +            platform('add', platformName, { 'save': true })
    +            .then(function () {
    +                expect(helpers.getEngineSpec(appPath)).toBe(platformLocalPath);
    +                done();
    +            }).catch(function (err) {
    +                console.log(err);
    +                expect(false).toBe(true);
    +                done();
    +            });
    +        }, timeout);
    +
    +        it('spec.5 cordova platform add android@3.969.696 --save [invalid version => should fail and should not update config.xml]', function (done) {
    +            helpers.removeEngine(appPath);
    +            platform('add', helpers.testPlatform + '@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)).toBe(null);
    +                done();
    +            });
    +        });
    +
    +        it('spec.6 cordova platform add C://path/to/android/platform --save', function (done) {
    +            helpers.removeEngine(appPath);
    +            platform('add', platformLocalPath, { 'save': true })
    +            .then(function () {
    +                expect(helpers.getEngineSpec(appPath)).toBe(platformLocalPath);
    +                done();
    +            }).catch(function (err) {
    +                console.log(err);
    +                expect(false).toBe(true);
    +                done();
    +            });
    +        }, timeout);
    +
    +        it('spec.7 should support cordova platform add https://github.com/apache/cordova-android.git#4.0.x', function (done) {
    +            var platformUrl = platformGitUrl + '#' + platformGitRef;
    +            helpers.removeEngine(appPath);
    +            platform('add', platformUrl, { 'save': true })
    +            .then(function () {
    +                expect(helpers.getEngineSpec(appPath)).toBe(platformUrl);
    +                done();
    +            }).catch(function (err) {
    +                console.log(err);
    +                expect(false).toBe(true);
    +                done();
    +            });
    +        }, timeout);
    +    });
    +
    +    describe('(platform remove)', function () {
    +        it('spec.8 cordova platform remove android --save [config.xml is empty]', function (done) {
    +            helpers.removeEngine(appPath);
    +            platform('add', platformLocalPath)
    +            .then(function () {
    +                return cordova.raw.platform('rm', platformName, { 'save': true });
    +            }).then(function () {
    +                expect(helpers.getEngineSpec(appPath)).toBe(null);
    +                done();
    +            }).catch(function (err) {
    +                console.log(err);
    +                expect(false).toBe(true);
    +                done();
    +            });
    +        }, timeout);
    +
    +        it('spec.9 cordova platform remove android --save [config.xml contains android@C:/path/to/android/platform]', function (done) {
    +            helpers.setEngineSpec(appPath, platformLocalPath);
    +            platform('add', platformLocalPath)
    +            .then(function () {
    +                return cordova.raw.platform('rm', platformName, { 'save': true });
    +            }).then(function () {
    +                expect(helpers.getEngineSpec(appPath)).toBe(null);
    +                done();
    +            }).catch(function (err) {
    +                console.log(err);
    +                expect(false).toBe(true);
    +                done();
    +            });
    +        }, timeout);
    +    });
    +
    +    describe('(platform update)', function () {
    +        it('spec. 10 cordova platform update android@4.0.0  --save [config.xml already contains android@4.0.1]', function (done) {
    +            helpers.setEngineSpec(appPath, platformVersionNew);
    +            platform('add', platformName + '@' + platformVersionNew)
    +            .then(function () {
    +                return cordova.raw.platform('update', platformName + '@' + platformVersionOld, { 'save': true });
    +            }).then(function () {
    +                expect(helpers.getEngineSpec(appPath)).toBe('^' + platformVersionOld);
    +                done();
    +            }).catch(function (err) {
    +                console.log(err);
    +                expect(false).toBe(true);
    +                done();
    +            });
    +        }, timeout);
    +
    +        it('spec.11 support for git-urls: cordova platform update https://github.com/apache/cordova-android.git –save', function (done) {
    +            helpers.setEngineSpec(appPath, platformVersionNew);
    +            platform('add', platformName + '@' + platformVersionNew)
    +            .then(function () {
    +                return cordova.raw.platform('update', platformGitUrl, { 'save': true });
    +            }).then(function () {
    +                expect(helpers.getEngineSpec(appPath)).not.toBe(null);
    +                expect(helpers.getEngineSpec(appPath)).not.toBe(platformVersionNew);
    +                done();
    +            }).catch(function (err) {
    +                console.log(err);
    +                expect(false).toBe(true);
    +                done();
    +            });
    +        }, timeout);
    +    });
    +
    +    describe('(plugin add)', function () {
    +        beforeEach(function (done) {
    +            cordova.raw.plugin('rm', [ pluginName, pluginOldName, variablePluginName, localPluginName ])
    +            .finally(function () {
    +                helpers.removePlugin(appPath, pluginName);
    +                helpers.removePlugin(appPath, pluginOldName);
    +                helpers.removePlugin(appPath, variablePluginName);
    +                helpers.removePlugin(appPath, localPluginName);
    +                done();
    +            });
    +        });
    +
    +        it('spec.12 cordova plugin add cordova-plugin-console –-save [config.xml empty]', function (done) {
    +            platform('add', platformLocalPath)
    +            .then(function () {
    +                return cordova.raw.plugin('add', pluginName, { 'save': true });
    +            }).then(function () {
    +                expect(helpers.getPluginSpec(appPath, pluginName)).not.toBe(null);
    +                done();
    +            }).catch(function (err) {
    +                expect(true).toBe(false);
    +                console.log(err.message);
    +                done();
    +            });
    +        }, timeout);
    +
    +        it('spec.13 cordova plugin add cordova-plugin-console –-save [config.xml already contains cordova-plugin-console@0.2.11]', function (done) {
    +            platform('add', platformLocalPath)
    +            .then(function () {
    +                helpers.setPluginSpec(appPath, pluginName, pluginOldVersion);
    +                return cordova.raw.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('spec.14 cordova plugin add facebook-plugins –-variables … -–save [testing variables support]', function (done) {
    +            platform('add', platformLocalPath)
    +            .then(function () {
    +                return cordova.raw.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();
    +            });
    +        }, timeout);
    +
    +        it('spec.15 cordova plugin add git_url --save', function (done) {
    +            platform('add', platformLocalPath)
    +            .then(function () {
    +                return cordova.raw.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('spec.16 cordova plugin add local_folder --save', function (done) {
    +            platform('add', platformLocalPath)
    +            .then(function () {
    +                return cordova.raw.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);
    +    });
    +
    +    describe('(plugin remove)', function () {
    +        it('spec.17 cordova plugin remove plugin-id --save [config.xml is empty]', function (done) {
    +            platform('add', platformLocalPath)
    +            .then(function () {
    +                return cordova.raw.plugin('add', pluginName);
    +            }).then(function () {
    +                return cordova.raw.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('spec.18 cordova plugin remove plugin-id --save [config.xml contains git-url of plugin]', function (done) {
    +            platform('add', platformLocalPath)
    +            .then(function () {
    +                return cordova.raw.plugin('add', pluginName);
    +            }).then(function () {
    +                helpers.setPluginSpec(appPath, pluginName, pluginGitUrl);
    +                return cordova.raw.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('plugin update', function () {
    +        //plugin update functionality is not yet implemented in cordova-cli
    +        xit('spec.19 cordova plugin update cordova-plugin-console --save', function (done) {
    --- End diff --
    
    forgot to change this back to 'it' ?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] cordova-lib pull request: CB-9122 Added tests for platform/plugin ...

Posted by omefire <gi...@git.apache.org>.
Github user omefire commented on a diff in the pull request:

    https://github.com/apache/cordova-lib/pull/246#discussion_r32275447
  
    --- Diff: cordova-lib/spec-cordova/helpers.js ---
    @@ -43,17 +54,101 @@ if (host.match(/win/)) {
     }
     */
     
    -// Just use Android everywhere; we're mocking out any calls to the `android` binary.
    -module.exports.testPlatform = 'android';
    +module.exports.setEngineSpec = function (appPath, spec) {
    +    appPath = getConfigPath(appPath);
    +    var parser = new ConfigParser(appPath);
    +
    +    parser.removeEngine(module.exports.testPlatform);
    +    parser.addEngine(module.exports.testPlatform, spec);
    +    parser.write();
    +};
    +
    +module.exports.getEngineSpec = function (appPath) {
    +    appPath = getConfigPath(appPath);
    +    var parser = new ConfigParser(appPath),
    +        engines = parser.getEngines();
    +
    +    for (var i = 0; i < engines.length; i++) {
    +        if (engines[i].name === module.exports.testPlatform) {
    +            return engines[i].spec;
    +        }
    +    }
    +    return null;
    +};
    +
    +module.exports.removeEngine = function (appPath) {
    --- End diff --
    
    please, pass in the engine to be removed as a separate parameter. I think that makes the intent of the function clearer.
    Hate global vars, :)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] cordova-lib pull request: CB-9122 Added tests for platform/plugin ...

Posted by omefire <gi...@git.apache.org>.
Github user omefire commented on a diff in the pull request:

    https://github.com/apache/cordova-lib/pull/246#discussion_r33288898
  
    --- Diff: cordova-lib/spec-cordova/helpers.js ---
    @@ -17,12 +17,23 @@
         under the License.
     */
     
    -var path = require('path'),
    -    fs = require('fs'),
    -    shell = require('shelljs'),
    -    os = require('os');
    +var path         = require('path'),
    +    fs           = require('fs'),
    +    shell        = require('shelljs'),
    +    os           = require('os'),
    +    ConfigParser = require('../src/configparser/ConfigParser');
     
    -module.exports.tmpDir = function(subdir) {
    +// Just use Android everywhere; we're mocking out any calls to the `android` binary.
    +module.exports.testPlatform = 'android';
    +
    +function getConfigPath(dir) {
    +    if (dir.indexOf('config.xml') !== dir.length - 10) {
    --- End diff --
    
    Hey Alex, why 'dir.length - 10' ? I don't understand.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] cordova-lib pull request: CB-9122 Added tests for platform/plugin ...

Posted by vladimir-kotikov <gi...@git.apache.org>.
Github user vladimir-kotikov commented on the pull request:

    https://github.com/apache/cordova-lib/pull/246#issuecomment-115693183
  
    Merging. The AppVeyor failures, caused by node-xcode fixed in https://github.com/apache/cordova-lib/pull/253


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] cordova-lib pull request: CB-9122 Added tests for platform/plugin ...

Posted by omefire <gi...@git.apache.org>.
Github user omefire commented on the pull request:

    https://github.com/apache/cordova-lib/pull/246#issuecomment-114949477
  
    Hmm @alsorokin review your second commit. it seems like you mistakenly committed something else ?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] cordova-lib pull request: CB-9122 Added tests for platform/plugin ...

Posted by omefire <gi...@git.apache.org>.
Github user omefire commented on the pull request:

    https://github.com/apache/cordova-lib/pull/246#issuecomment-115113713
  
    Please, do.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] cordova-lib pull request: CB-9122 Added tests for platform/plugin ...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/cordova-lib/pull/246


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] cordova-lib pull request: CB-9122 Added tests for platform/plugin ...

Posted by omefire <gi...@git.apache.org>.
Github user omefire commented on the pull request:

    https://github.com/apache/cordova-lib/pull/246#issuecomment-114948512
  
    strange thing, why is there a commit from me saying: 'omefire reviewing alsorokin's code changes' ? :)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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