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 2015/06/25 03:09:35 UTC
[47/50] ios commit: CB-9203 - iOS unit-tests should use tmp instead
of same folder
CB-9203 - iOS unit-tests should use tmp instead of same folder
Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/9f249510
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/9f249510
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/9f249510
Branch: refs/heads/master
Commit: 9f249510ccd6c0509059e2093bf1f2f451e82737
Parents: cf55962
Author: Shazron Abdullah <sh...@gmail.com>
Authored: Wed Jun 17 14:48:08 2015 -0700
Committer: Shazron Abdullah <sh...@gmail.com>
Committed: Wed Jun 17 14:48:08 2015 -0700
----------------------------------------------------------------------
package.json | 3 ++-
tests/spec/cordovalib.spec.js | 22 +++++++++-------------
tests/spec/create.spec.js | 26 +++++++++-----------------
3 files changed, 20 insertions(+), 31 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/9f249510/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index c301d69..6880476 100644
--- a/package.json
+++ b/package.json
@@ -27,6 +27,7 @@
},
"devDependencies": {
"jshint": "^2.6.0",
- "uncrustify": "^0.6.1"
+ "uncrustify": "^0.6.1",
+ "tmp": "^0.0.26"
}
}
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/9f249510/tests/spec/cordovalib.spec.js
----------------------------------------------------------------------
diff --git a/tests/spec/cordovalib.spec.js b/tests/spec/cordovalib.spec.js
index 9657717..e60484a 100644
--- a/tests/spec/cordovalib.spec.js
+++ b/tests/spec/cordovalib.spec.js
@@ -20,37 +20,33 @@
var shell = require('shelljs'),
spec = __dirname,
path = require('path'),
- util = require('util');
-
+ util = require('util'),
+ tmp = require('tmp');
+
var tests_dir = path.join(spec, '..');
- var artifacts_dir = path.join(spec, '..', 'CordovaLibTests', 'build');
-
+
describe('cordova-lib', function() {
it('objective-c unit tests', function() {
var return_code = 0;
var command;
-
+ var artifacts_dir = tmp.dirSync().name;
+
// check iOS Simulator if running
command = 'pgrep "iOS Simulator"';
return_code = shell.exec(command).code;
-
+
// if iOS Simulator is running, kill it
if (return_code === 0) { // found
shell.echo('iOS Simulator is running, we\'re going to kill it.');
return_code = shell.exec('killall "iOS Simulator"').code;
expect(return_code).toBe(0);
}
-
+
// 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);
});
-
- // clean-up last
- it('cleanup artifacts folder', function() {
- shell.rm('-rf', artifacts_dir);
- });
-});
\ No newline at end of file
+});
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/9f249510/tests/spec/create.spec.js
----------------------------------------------------------------------
diff --git a/tests/spec/create.spec.js b/tests/spec/create.spec.js
index c30b593..736d9d6 100644
--- a/tests/spec/create.spec.js
+++ b/tests/spec/create.spec.js
@@ -21,17 +21,14 @@ var shell = require('shelljs'),
spec = __dirname,
path = require('path'),
util = require('util');
-
+
var cordova_bin = path.join(spec, '../..', 'bin');
- var tmp = path.join(spec, '..', 'tmp');
-
+ var tmp = require('tmp').dirSync().name;
+
function createAndBuild(projectname, projectid) {
var return_code = 0;
var command;
-
- // create tmp folder if necessary
- shell.mkdir('-p', tmp);
-
+
// remove existing folder
command = path.join(tmp, projectname);
shell.rm('-rf', command);
@@ -41,7 +38,7 @@ function createAndBuild(projectname, projectid) {
shell.echo(command);
return_code = shell.exec(command).code;
expect(return_code).toBe(0);
-
+
// build the project
command = util.format('"%s/cordova/build"', path.join(tmp, projectname));
shell.echo(command);
@@ -51,9 +48,9 @@ function createAndBuild(projectname, projectid) {
// clean-up
command = path.join(tmp, projectname);
shell.rm('-rf', command);
-}
+}
+
-
describe('create', function() {
it('create project with ascii name, no spaces', function() {
@@ -62,7 +59,7 @@ describe('create', function() {
createAndBuild(projectname, projectid);
});
-
+
it('create project with ascii name, and spaces', function() {
var projectname = 'test create';
var projectid = 'com.test.app2';
@@ -83,7 +80,7 @@ describe('create', function() {
createAndBuild(projectname, projectid);
});
-
+
it('create project with ascii+unicode name, no spaces', function() {
var projectname = '応応応応hello用用用用';
var projectid = 'com.test.app5';
@@ -97,11 +94,6 @@ describe('create', function() {
createAndBuild(projectname, projectid);
});
-
- // clean-up last
- it('cleanup tmp folder', function() {
- shell.rm('-rf', tmp);
- });
});
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org