You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by sh...@apache.org on 2016/09/07 05:44:20 UTC
cordova-lib git commit: CB-11811 - Moved iOS platform specific tests
to platform.spec.ios.js, added "test-ios" npm run script.
Repository: cordova-lib
Updated Branches:
refs/heads/master 0b574798f -> c9c3e93a5
CB-11811 - Moved iOS platform specific tests to platform.spec.ios.js, added "test-ios" npm run script.
Project: http://git-wip-us.apache.org/repos/asf/cordova-lib/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-lib/commit/c9c3e93a
Tree: http://git-wip-us.apache.org/repos/asf/cordova-lib/tree/c9c3e93a
Diff: http://git-wip-us.apache.org/repos/asf/cordova-lib/diff/c9c3e93a
Branch: refs/heads/master
Commit: c9c3e93a5532ca4b65e7fa9bc960bff38683b2e4
Parents: 0b57479
Author: Shazron Abdullah <sh...@apache.org>
Authored: Tue Sep 6 22:44:17 2016 -0700
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Tue Sep 6 22:44:17 2016 -0700
----------------------------------------------------------------------
cordova-lib/package.json | 2 +
cordova-lib/spec-cordova/platform.spec.ios.js | 140 +++++++++++++++++++++
cordova-lib/spec-cordova/platform.spec.js | 113 -----------------
3 files changed, 142 insertions(+), 113 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/c9c3e93a/cordova-lib/package.json
----------------------------------------------------------------------
diff --git a/cordova-lib/package.json b/cordova-lib/package.json
index 4ceb9ff..65a88a5 100644
--- a/cordova-lib/package.json
+++ b/cordova-lib/package.json
@@ -52,9 +52,11 @@
},
"scripts": {
"test": "npm run jshint && npm run jasmine",
+ "test-ios": "npm run test && npm run jasmine-ios",
"ci": "npm run jshint && npm run cover && codecov",
"jshint": "jshint src spec-cordova spec-plugman",
"jasmine": "jasmine-node --captureExceptions --color spec-plugman spec-cordova",
+ "jasmine-ios": "jasmine-node --captureExceptions --color spec-cordova/platform.spec.ios.js --matchall",
"cover": "istanbul cover --root src --print detail node_modules/jasmine-node/bin/jasmine-node -- spec-cordova spec-plugman"
},
"contributors": [
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/c9c3e93a/cordova-lib/spec-cordova/platform.spec.ios.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/platform.spec.ios.js b/cordova-lib/spec-cordova/platform.spec.ios.js
new file mode 100644
index 0000000..324346a
--- /dev/null
+++ b/cordova-lib/spec-cordova/platform.spec.ios.js
@@ -0,0 +1,140 @@
+/**
+ 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.
+*/
+
+var helpers = require('./helpers'),
+ path = require('path'),
+ fs = require('fs'),
+ shell = require('shelljs'),
+ cordova = require('../src/cordova/cordova');
+
+
+describe('cocoapod plugin add and rm end-to-end', function () {
+
+ var tmpDir = helpers.tmpDir('cocoapod_plugin_test');
+ var project = path.join(tmpDir, 'hello4');
+
+ var samplePlugin = path.join(__dirname, 'fixtures', 'plugins', 'sample-cordova-plugin-cocoapod-dependent');
+ var overlappingDependencyPlugin = path.join(__dirname, 'fixtures', 'plugins', 'sample-cocoapod-plugin-overlapping-dependency');
+ var AFNetworking = 'AFNetworking',
+ CWStatusBarNotification = 'CWStatusBarNotification';
+ var podfile, podsJSON, workspace;
+
+ beforeEach(function() {
+ process.chdir(tmpDir);
+ });
+
+ afterEach(function() {
+ process.chdir(path.join(__dirname, '..')); // Needed to rm the dir on Windows.
+ shell.rm('-rf', tmpDir);
+ });
+
+ it('installs and uninstalls plugin depending on new pod and existing pod', function(done) {
+
+ cordova.raw.create('hello4')
+ .then(function() {
+ process.chdir(project);
+ //return cordova.raw.platform('add', 'https://git-wip-us.apache.org/repos/asf/cordova-ios.git');
+ return cordova.raw.platform('add', '/Users/shazron/Documents/git/apache/cordova-ios');
+ })
+ .then(function() {
+ return cordova.raw.plugin('add', samplePlugin);
+ })
+ .then(function() {
+ podfile = path.resolve('./platforms/ios/Podfile');
+ podsJSON = path.resolve('./platforms/ios/pods.json');
+ workspace = path.resolve('./platforms/ios/HelloCordova.xcworkspace');
+
+ //podfile should have been created
+ fs.exists(podfile, function(podfileExists){
+ expect(podfileExists);
+ });
+
+ //pods.json should have been created
+ fs.exists(podsJSON, function(podsJSONExists){
+ expect(podsJSONExists);
+ });
+
+ //workspace should have been created
+ fs.exists(workspace, function(workspaceCreated){
+ expect(workspaceCreated);
+ });
+
+ var podfileContent = fs.readFileSync(podfile, {'encoding' : 'utf8'});
+ expect(podfileContent.indexOf(AFNetworking) !== -1 );
+
+ var podsJSONContent = require(podsJSON);
+ expect(podsJSONContent[AFNetworking] !== null);
+
+ return cordova.raw.plugin('add', overlappingDependencyPlugin);
+ })
+ .then(function() {
+ var podfileContent = fs.readFileSync(podfile, {'encoding' : 'utf8'});
+ var numberOfTimesAFNetworkingIsInPodfile = podfileContent.match(/AFNetworking/g || []).length;
+
+ expect(podfileContent.indexOf(CWStatusBarNotification) !== -1);
+ expect(numberOfTimesAFNetworkingIsInPodfile).toEqual(1);
+
+ delete require.cache[require.resolve(podsJSON)];
+ var podsJSONContent = require(podsJSON);
+
+ var countPropertyOfAFNetworkingInPodsJSON = podsJSONContent[AFNetworking].count;
+ var specPropertyOfAFNetworkingInPodsJSON = podsJSONContent[AFNetworking].spec;
+
+ expect(countPropertyOfAFNetworkingInPodsJSON).toEqual(2);
+ //spec property should not be changed because of overlapping dependency
+ expect(specPropertyOfAFNetworkingInPodsJSON).toEqual('~> 3.0');
+
+ return cordova.raw.plugin('rm','sample-cocoapod-plugin-overlapping-dependency');
+ })
+ .then(function() {
+ //expect only AFNetworking
+ var podfileContent = fs.readFileSync(podfile, {'encoding' : 'utf8'});
+
+ expect(podfileContent.indexOf(CWStatusBarNotification) === -1);
+ expect(podfileContent.indexOf(AFNetworking) !== -1);
+
+ delete require.cache[require.resolve(podsJSON)];
+ var podsJSONContent = require(podsJSON);
+
+ expect(podsJSONContent[AFNetworking]);
+ expect(podsJSONContent[CWStatusBarNotification] === undefined);
+
+ return cordova.raw.plugin('rm', 'sample-cordova-plugin-cocoapod-dependent');
+ })
+ .then(function() {
+ //expect no pods
+ delete require.cache[require.resolve(podfile)];
+ var podfileContent = fs.readFileSync(podfile, {'encoding' : 'utf8'});
+
+ expect(podfileContent.indexOf(CWStatusBarNotification) === -1);
+ expect(podfileContent.indexOf(AFNetworking) === -1);
+
+ delete require.cache[require.resolve(podsJSON)];
+ var podsJSONContent = require(podsJSON);
+
+ expect(podsJSONContent[AFNetworking] === undefined);
+ expect(podsJSONContent[CWStatusBarNotification] === undefined);
+ })
+ .fail(function(err) {
+ console.error(err);
+ expect(err).toBeUndefined();
+ })
+ .fin(done);
+ }, 60000);
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/c9c3e93a/cordova-lib/spec-cordova/platform.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/platform.spec.js b/cordova-lib/spec-cordova/platform.spec.js
index feaf813..a944a24 100644
--- a/cordova-lib/spec-cordova/platform.spec.js
+++ b/cordova-lib/spec-cordova/platform.spec.js
@@ -356,116 +356,3 @@ describe('plugin add and rm end-to-end --fetch', function () {
.fin(done);
}, 60000);
});
-
-xdescribe('cocoapod plugin add and rm end-to-end', function () {
-
- var tmpDir = helpers.tmpDir('cocoapod_plugin_test');
- var project = path.join(tmpDir, 'hello4');
-
- var samplePlugin = path.join(__dirname, 'fixtures', 'plugins', 'sample-cordova-plugin-cocoapod-dependent');
- var overlappingDependencyPlugin = path.join(__dirname, 'fixtures', 'plugins', 'sample-cocoapod-plugin-overlapping-dependency');
- var AFNetworking = 'AFNetworking',
- CWStatusBarNotification = 'CWStatusBarNotification';
- var podfile, podsJSON, workspace;
-
- beforeEach(function() {
- process.chdir(tmpDir);
- });
-
- afterEach(function() {
- process.chdir(path.join(__dirname, '..')); // Needed to rm the dir on Windows.
- shell.rm('-rf', tmpDir);
- });
-
- it('installs and uninstalls plugin depending on new pod and existing pod', function(done) {
-
- cordova.raw.create('hello4')
- .then(function() {
- process.chdir(project);
- return cordova.raw.platform('add', 'https://git-wip-us.apache.org/repos/asf/cordova-ios.git');
- })
- .then(function() {
- return cordova.raw.plugin('add', samplePlugin);
- })
- .then(function() {
- podfile = path.resolve('./platforms/ios/Podfile');
- podsJSON = path.resolve('./platforms/ios/pods.json');
- workspace = path.resolve('./platforms/ios/HelloCordova.xcworkspace');
-
- //podfile should have been created
- fs.exists(podfile, function(podfileExists){
- expect(podfileExists);
- });
-
- //pods.json should have been created
- fs.exists(podsJSON, function(podsJSONExists){
- expect(podsJSONExists);
- });
-
- //workspace should have been created
- fs.exists(workspace, function(workspaceCreated){
- expect(workspaceCreated);
- });
-
- var podfileContent = fs.readFileSync(podfile, {'encoding' : 'utf8'});
- expect(podfileContent.indexOf(AFNetworking) !== -1 );
-
- var podsJSONContent = require(podsJSON);
- expect(podsJSONContent[AFNetworking] !== null);
-
- return cordova.raw.plugin('add', overlappingDependencyPlugin);
- })
- .then(function() {
- var podfileContent = fs.readFileSync(podfile, {'encoding' : 'utf8'});
- var numberOfTimesAFNetworkingIsInPodfile = podfileContent.match(/AFNetworking/g || []).length;
-
- expect(podfileContent.indexOf(CWStatusBarNotification) !== -1);
- expect(numberOfTimesAFNetworkingIsInPodfile).toEqual(1);
-
- delete require.cache[require.resolve(podsJSON)];
- var podsJSONContent = require(podsJSON);
- var countPropertyOfAFNetworkingInPodsJSON = podsJSONContent[AFNetworking].count;
- var specPropertyOfAFNetworkingInPodsJSON = podsJSONContent[AFNetworking].spec;
-
- expect(countPropertyOfAFNetworkingInPodsJSON).toEqual(2);
- //spec property should not be changed because of overlapping dependency
- expect(specPropertyOfAFNetworkingInPodsJSON).toEqual('~> 3.0');
-
- return cordova.raw.plugin('rm','sample-cocoapod-plugin-overlapping-dependency');
- })
- .then(function() {
- //expect only AFNetworking
- var podfileContent = fs.readFileSync(podfile, {'encoding' : 'utf8'});
-
- expect(podfileContent.indexOf(CWStatusBarNotification) === -1);
- expect(podfileContent.indexOf(AFNetworking) !== -1);
-
- delete require.cache[require.resolve(podsJSON)];
- var podsJSONContent = require(podsJSON);
-
- expect(podsJSONContent[AFNetworking]);
- expect(podsJSONContent[CWStatusBarNotification] === undefined);
-
- return cordova.raw.plugin('rm', 'sample-cordova-plugin-cocoapod-dependent');
- })
- .then(function() {
- //expect no pods
- delete require.cache[require.resolve(podfile)];
- var podfileContent = fs.readFileSync(podfile, {'encoding' : 'utf8'});
-
- expect(podfileContent.indexOf(CWStatusBarNotification) === -1);
- expect(podfileContent.indexOf(AFNetworking) === -1);
-
- delete require.cache[require.resolve(podsJSON)];
- var podsJSONContent = require(podsJSON);
-
- expect(podsJSONContent[AFNetworking] === undefined);
- expect(podsJSONContent[CWStatusBarNotification] === undefined);
- })
- .fail(function(err) {
- console.error(err);
- expect(err).toBeUndefined();
- })
- .fin(done);
- }, 60000);
-});
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org