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/06/02 22:43:21 UTC

ios commit: CB-11366 - Break out obj-c tests so they are not called from jasmine

Repository: cordova-ios
Updated Branches:
  refs/heads/master 3d3a746cf -> 2815cb7e2


CB-11366 - Break out obj-c tests so they are not called from jasmine


Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/2815cb7e
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/2815cb7e
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/2815cb7e

Branch: refs/heads/master
Commit: 2815cb7e257c4ce3e8107aef031138f5c1def58c
Parents: 3d3a746
Author: Shazron Abdullah <sh...@apache.org>
Authored: Thu Jun 2 15:43:53 2016 -0700
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Thu Jun 2 15:43:53 2016 -0700

----------------------------------------------------------------------
 package.json                  |  8 +++--
 tests/scripts/killsim.js      | 44 ++++++++++++++++++++++++++
 tests/spec/cordovalib.spec.js | 63 --------------------------------------
 3 files changed, 49 insertions(+), 66 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/2815cb7e/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index 9148622..4e0872f 100644
--- a/package.json
+++ b/package.json
@@ -15,10 +15,12 @@
     "cordova:platform"
   ],
   "scripts": {
-    "test": "npm run jshint && npm run e2e-tests && npm run objc-tests && npm run unit-tests",
+    "test": "npm run e2e-tests && npm run objc-tests && npm run unit-tests",
+        "posttest": "npm run jshint",
     "cover": "istanbul cover node_modules/jasmine-node/bin/jasmine-node -- tests/spec/unit",
-    "e2e-tests": "jasmine-node --captureExceptions --color tests/spec/create.spec.js",
-    "objc-tests": "jasmine-node --captureExceptions --color tests/spec/cordovalib.spec.js",
+    "e2e-tests": "jasmine-node --captureExceptions --color tests/spec",
+    "objc-tests": "xcodebuild test -workspace tests/cordova-ios.xcworkspace -scheme CordovaLibTests -destination \"platform=iOS Simulator,name=iPhone 5\" CONFIGURATION_BUILD_DIR=\"`mktemp -d`\"",
+        "preobjc-tests" : "tests/scripts/killsim.js", 
     "unit-tests": "jasmine-node --captureExceptions --color tests/spec/unit",
     "jshint": "jshint bin tests"
   },

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/2815cb7e/tests/scripts/killsim.js
----------------------------------------------------------------------
diff --git a/tests/scripts/killsim.js b/tests/scripts/killsim.js
new file mode 100755
index 0000000..0a8cdc1
--- /dev/null
+++ b/tests/scripts/killsim.js
@@ -0,0 +1,44 @@
+#!/usr/bin/env node
+
+/*
+ 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 shell = require('shelljs');
+
+function killSimulator(processName) {
+    var result;
+    var return_code = 0;
+    // check iOS Simulator if running
+    var command = 'pgrep -x "' + processName + '" > /dev/null';
+    return_code = shell.exec(command).code;
+
+    // if iOS Simulator is running, kill it
+    if (return_code === 0) { // found
+        shell.echo('iOS Simulator is running as ("'+ processName +'"), we\'re going to kill it.');
+        result = shell.exec('killall "' + processName + '"');
+        if (result.code !== 0) {
+            shell.echo('Failed to kill process: ' + processName);
+        } else {
+            shell.echo('Process was killed: ' + processName);
+        }
+    }
+}
+
+killSimulator('iOS Simulator'); // XCode 6
+killSimulator('Simulator'); // XCode 7 

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/2815cb7e/tests/spec/cordovalib.spec.js
----------------------------------------------------------------------
diff --git a/tests/spec/cordovalib.spec.js b/tests/spec/cordovalib.spec.js
deleted file mode 100644
index 7ff54c7..0000000
--- a/tests/spec/cordovalib.spec.js
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements.  See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership.  The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License.  You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied.  See the License for the
- specific language governing permissions and limitations
- under the License.
- */
-
-var shell = require('shelljs'),
-    spec = __dirname,
-    path = require('path'),
-    util = require('util'),
-    tmp = require('tmp');
-
-    var tests_dir = path.join(spec, '..');
-
-describe('cordova-lib', function() {
-
-    it('objective-c unit tests', function() {
-        var return_code = 0;
-        var command;
-        var artifacts_dir = tmp.dirSync().name;
-
-        function killSimulator(processName) {
-            var result;
-            // check iOS Simulator if running
-            command = 'pgrep "' + processName + '"';
-            return_code = shell.exec(command).code;
-
-            // if iOS Simulator is running, kill it
-            if (return_code === 0) { // found
-                shell.echo('iOS Simulator is running("'+ processName +'"), we\'re going to kill it.');
-                result = shell.exec('killall "' + processName + '"');
-                if (result.code !== 0) {
-                    if (!(result.output &&
-                            result.output.indexOf('No matching processes belonging to you were found') !== -1)) {
-                        expect(result.code).toBe(0);
-                    }
-                }
-            }
-        }
-
-        killSimulator('iOS Simulator'); // XCode6
-        killSimulator('Simulator'); // XCode7
-
-        // run the tests
-        command = util.format('xcodebuild test -workspace %s/cordova-ios.xcworkspace -scheme CordovaLibTests -destination "platform=iOS Simulator,name=iPhone 5" CONFIGURATION_BUILD_DIR="%s"', tests_dir, artifacts_dir);
-        shell.echo(command);
-        return_code = shell.exec(command).code;
-        expect(return_code).toBe(0);
-    });
-});


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