cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject [23/50] [abbrv] cordova-lib git commit: fixjasmine : CB-12018 : labeled and updated tests to work with jasmine (spyOn and return, callThrough, waitsFor, toExist, callFake, describe)
Date Wed, 18 Jan 2017 01:56:40 GMT
 fixjasmine : CB-12018 : labeled and updated tests to work with jasmine (spyOn and return, callThrough, waitsFor, toExist, callFake, describe)


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

Branch: refs/heads/fetch-1.0.x
Commit: 0e0d7a55658fb7d1b91f1c006d69b92aa2bbbb62
Parents: 2ea46e4
Author: audreyso <auso@adobe.com>
Authored: Wed Dec 14 09:33:47 2016 -0800
Committer: audreyso <auso@adobe.com>
Committed: Tue Jan 10 11:14:05 2017 -0800

----------------------------------------------------------------------
 cordova-common/package.json                    |   2 +-
 cordova-common/spec/ActionStack.spec.js        |   2 +-
 cordova-common/spec/CordovaCheck.spec.js       |  27 ++---
 cordova-common/spec/CordovaLogger.spec.js      |   6 +-
 cordova-common/spec/PlatformJson.spec.js       |   2 +-
 cordova-lib/package.json                       |   4 +-
 cordova-lib/spec-cordova/HooksRunner.spec.js   |   6 +-
 cordova-lib/spec-cordova/build.spec.js         |  20 ++--
 cordova-lib/spec-cordova/compile.spec.js       |  18 ++--
 cordova-lib/spec-cordova/create.spec.js        |   4 +-
 cordova-lib/spec-cordova/emulate.spec.js       |  27 ++---
 cordova-lib/spec-cordova/helpers.js            |   5 +-
 cordova-lib/spec-cordova/lazy_load.spec.js     |  40 ++++----
 cordova-lib/spec-cordova/platform.spec.js      |   6 +-
 cordova-lib/spec-cordova/plugin.spec.js        | 104 +++++++++++++-------
 cordova-lib/spec-cordova/plugin_fetch.spec.js  |  35 +++++--
 cordova-lib/spec-cordova/plugin_parser.spec.js |   3 +-
 cordova-lib/spec-cordova/prepare.spec.js       |  34 +++----
 cordova-lib/spec-cordova/run.spec.js           |  26 ++---
 cordova-lib/spec-cordova/save.spec.js          |  22 ++---
 cordova-lib/spec-cordova/util.spec.js          |  39 +++-----
 cordova-lib/spec-cordova/wrappers.spec.js      |   9 +-
 cordova-lib/spec-plugman/add_platform.spec.js  |  44 +++++----
 cordova-lib/spec-plugman/config.spec.js        |   2 +-
 cordova-lib/spec-plugman/create.spec.js        |  27 ++---
 cordova-lib/spec-plugman/fetch.spec.js         |  71 ++++++-------
 cordova-lib/spec-plugman/info.spec.js          |   2 +-
 cordova-lib/spec-plugman/install.spec.js       |  78 +++++++--------
 cordova-lib/spec-plugman/owner.spec.js         |   2 +-
 cordova-lib/spec-plugman/search.spec.js        |   2 +-
 cordova-lib/spec-plugman/uninstall.spec.js     |  30 +++---
 cordova-lib/spec-plugman/wrappers.spec.js      |   6 +-
 32 files changed, 365 insertions(+), 340 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/0e0d7a55/cordova-common/package.json
----------------------------------------------------------------------
diff --git a/cordova-common/package.json b/cordova-common/package.json
index c96eac4..98ffb2d 100644
--- a/cordova-common/package.json
+++ b/cordova-common/package.json
@@ -39,7 +39,7 @@
   },
   "devDependencies": {
     "istanbul": "^0.4.5",
-    "jasmine-node": "^1.14.5",
+    "jasmine": "^2.5.2",
     "jshint": "^2.8.0",
     "promise-matchers": "^0.9.6",
     "rewire": "^2.5.1"

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/0e0d7a55/cordova-common/spec/ActionStack.spec.js
----------------------------------------------------------------------
diff --git a/cordova-common/spec/ActionStack.spec.js b/cordova-common/spec/ActionStack.spec.js
index 5fb6819..b432e21 100644
--- a/cordova-common/spec/ActionStack.spec.js
+++ b/cordova-common/spec/ActionStack.spec.js
@@ -48,7 +48,7 @@ describe('action-stack', function() {
             var first_reverter = jasmine.createSpy();
             var first_reverter_args = [true];
             var process_err = new Error('process_err');
-            var second_spy = jasmine.createSpy().andCallFake(function() {
+            var second_spy = jasmine.createSpy().and.callFake(function() {
                 throw process_err;
             });
             var second_args = [2];

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/0e0d7a55/cordova-common/spec/CordovaCheck.spec.js
----------------------------------------------------------------------
diff --git a/cordova-common/spec/CordovaCheck.spec.js b/cordova-common/spec/CordovaCheck.spec.js
index a1f37fa..c075f7a 100644
--- a/cordova-common/spec/CordovaCheck.spec.js
+++ b/cordova-common/spec/CordovaCheck.spec.js
@@ -30,11 +30,12 @@ describe('findProjectRoot method', function() {
         process.env.PWD = origPWD;
         process.chdir(cwd);
     });
+function removeDir(someDirectory) {
+    shell.rm('-rf', someDirectory);
+}
     it('should return false if it hits the home directory', function() {
         var somedir = path.join(home, 'somedir');
-        this.after(function() {
-            shell.rm('-rf', somedir);
-        });
+        removeDir(somedir);
         shell.mkdir(somedir);
         expect(CordovaCheck.findProjectRoot(somedir)).toEqual(false);
     });
@@ -45,9 +46,7 @@ describe('findProjectRoot method', function() {
     it('should return the first directory it finds with a .cordova folder in it', function() {
         var somedir = path.join(home,'somedir');
         var anotherdir = path.join(somedir, 'anotherdir');
-        this.after(function() {
-            shell.rm('-rf', somedir);
-        });
+        removeDir(somedir);
         shell.mkdir('-p', anotherdir);
         shell.mkdir('-p', path.join(somedir, 'www', 'config.xml'));
         expect(CordovaCheck.findProjectRoot(somedir)).toEqual(somedir);
@@ -56,9 +55,7 @@ describe('findProjectRoot method', function() {
         delete process.env.PWD;
         var somedir = path.join(home,'somedir');
         var anotherdir = path.join(somedir, 'anotherdir');
-        this.after(function() {
-            shell.rm('-rf', somedir);
-        });
+        removeDir(somedir);
         shell.mkdir('-p', anotherdir);
         shell.mkdir('-p', path.join(somedir, 'www'));
         shell.mkdir('-p', path.join(somedir, 'config.xml'));
@@ -68,9 +65,7 @@ describe('findProjectRoot method', function() {
     it('should use PWD when available', function() {
         var somedir = path.join(home,'somedir');
         var anotherdir = path.join(somedir, 'anotherdir');
-        this.after(function() {
-            shell.rm('-rf', somedir);
-        });
+        removeDir(somedir);
         shell.mkdir('-p', anotherdir);
         shell.mkdir('-p', path.join(somedir, 'www', 'config.xml'));
         process.env.PWD = anotherdir;
@@ -80,9 +75,7 @@ describe('findProjectRoot method', function() {
     it('should use cwd as a fallback when PWD is not a cordova dir', function() {
         var somedir = path.join(home,'somedir');
         var anotherdir = path.join(somedir, 'anotherdir');
-        this.after(function() {
-            shell.rm('-rf', somedir);
-        });
+        removeDir(somedir);
         shell.mkdir('-p', anotherdir);
         shell.mkdir('-p', path.join(somedir, 'www', 'config.xml'));
         process.env.PWD = path.sep;
@@ -92,9 +85,7 @@ describe('findProjectRoot method', function() {
     it('should ignore platform www/config.xml', function() {
         var somedir = path.join(home,'somedir');
         var anotherdir = path.join(somedir, 'anotherdir');
-        this.after(function() {
-            shell.rm('-rf', somedir);
-        });
+        removeDir(somedir);
         shell.mkdir('-p', anotherdir);
         shell.mkdir('-p', path.join(anotherdir, 'www', 'config.xml'));
         shell.mkdir('-p', path.join(somedir, 'www'));

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/0e0d7a55/cordova-common/spec/CordovaLogger.spec.js
----------------------------------------------------------------------
diff --git a/cordova-common/spec/CordovaLogger.spec.js b/cordova-common/spec/CordovaLogger.spec.js
index 5c27db1..035d717 100644
--- a/cordova-common/spec/CordovaLogger.spec.js
+++ b/cordova-common/spec/CordovaLogger.spec.js
@@ -99,7 +99,7 @@ describe('CordovaLogger class', function() {
                 };
 
                 var listenerSpy = jasmine.createSpy('listenerSpy')
-                .andCallFake(function (eventName) {
+                .and.callFake(function (eventName) {
                     eventName = eventNamesExclusions[eventName] || eventName;
                     expect(logger.levels[eventName]).toBeDefined();
                 });
@@ -116,7 +116,7 @@ describe('CordovaLogger class', function() {
                 var spy = jasmine.createSpyObj(name, cursorMethods);
 
                 // Make spy methods chainable, as original Cursor acts
-                cursorMethods.forEach(function (method) { spy[method].andReturn(spy); });
+                cursorMethods.forEach(function (method) { spy[method].and.returnValue(spy); });
 
                 return spy;
             }
@@ -153,7 +153,7 @@ describe('CordovaLogger class', function() {
 
             it('should handle CordovaError instances separately from Error ones', function () {
                 var errorMock = new CordovaError();
-                spyOn(errorMock, 'toString').andReturn('error_message');
+                spyOn(errorMock, 'toString').and.returnValue('error_message');
 
                 logger.setLevel('verbose').log('verbose', errorMock);
                 expect(errorMock.toString).toHaveBeenCalled();

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/0e0d7a55/cordova-common/spec/PlatformJson.spec.js
----------------------------------------------------------------------
diff --git a/cordova-common/spec/PlatformJson.spec.js b/cordova-common/spec/PlatformJson.spec.js
index c9310a2..293b51d 100644
--- a/cordova-common/spec/PlatformJson.spec.js
+++ b/cordova-common/spec/PlatformJson.spec.js
@@ -43,7 +43,7 @@ describe('PlatformJson class', function() {
             fakePlugin = jasmine.createSpyObj('fakePlugin', ['getJsModules']);
             fakePlugin.id = 'fakeId';
             fakePlugin.version = '1.0.0';
-            fakePlugin.getJsModules.andReturn([FAKE_MODULE]);
+            fakePlugin.getJsModules.and.returnValue([FAKE_MODULE]);
         });
         
         describe('addPluginMetadata method', function () {

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/0e0d7a55/cordova-lib/package.json
----------------------------------------------------------------------
diff --git a/cordova-lib/package.json b/cordova-lib/package.json
index c8286e9..8b575f0 100644
--- a/cordova-lib/package.json
+++ b/cordova-lib/package.json
@@ -20,8 +20,8 @@
   "dependencies": {
     "aliasify": "^1.7.2",
     "cordova-common": "1.5.x",
-    "cordova-fetch": "^1.0.1",
     "cordova-create": "^1.0.1",
+    "cordova-fetch": "^1.0.1",
     "cordova-js": "4.2.0",
     "cordova-registry-mapper": "1.x",
     "cordova-serve": "^1.0.0",
@@ -47,7 +47,7 @@
   "devDependencies": {
     "codecov": "^1.0.1",
     "istanbul": "^0.3.4",
-    "jasmine-node": "1.14.5",
+    "jasmine": "^2.5.2",
     "jshint": "2.5.8",
     "rewire": "2.1.3"
   },

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/0e0d7a55/cordova-lib/spec-cordova/HooksRunner.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/HooksRunner.spec.js b/cordova-lib/spec-cordova/HooksRunner.spec.js
index fdad858..367c436 100644
--- a/cordova-lib/spec-cordova/HooksRunner.spec.js
+++ b/cordova-lib/spec-cordova/HooksRunner.spec.js
@@ -104,7 +104,7 @@ describe('HooksRunner', function() {
 
         // The config.json in the fixture project points at fake "local" paths.
         // Since it's not a URL, the lazy-loader will just return the junk path.
-        spyOn(superspawn, 'spawn').andCallFake(function(cmd, args) {
+        spyOn(superspawn, 'spawn').and.callFake(function(cmd, args) {
             if (cmd.match(/create\b/)) {
                 // This is a call to the bin/create script, so do the copy ourselves.
                 shell.cp('-R', path.join(__dirname, 'fixtures', 'platforms', 'android'), path.join(project, 'platforms'));
@@ -160,7 +160,7 @@ describe('HooksRunner', function() {
             var hooksOrderFile = path.join(projectRoot, 'hooks_order.txt');
             removeFileIfExists(hooksOrderFile);
 
-            fire = spyOn(HooksRunner.prototype, 'fire').andCallThrough();
+            fire = spyOn(HooksRunner.prototype, 'fire').and.callThrough();
         });
 
         // helper methods
@@ -522,7 +522,7 @@ describe('HooksRunner', function() {
         });
 
         describe('module-level hooks (event handlers)', function() {
-            var handler = jasmine.createSpy().andReturn(Q());
+            var handler = jasmine.createSpy().and.returnValue(Q());
             var test_event = 'before_build';
 
             afterEach(function () {

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/0e0d7a55/cordova-lib/spec-cordova/build.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/build.spec.js b/cordova-lib/spec-cordova/build.spec.js
index 66f0869..3f7f90e 100644
--- a/cordova-lib/spec-cordova/build.spec.js
+++ b/cordova-lib/spec-cordova/build.spec.js
@@ -30,16 +30,16 @@ describe('build command', function() {
     var prepare_spy, compile_spy;
 
     beforeEach(function() {
-        is_cordova = spyOn(util, 'isCordova').andReturn(project_dir);
-        cd_project_root = spyOn(util, 'cdProjectRoot').andReturn(project_dir);
-        list_platforms = spyOn(util, 'listPlatforms').andReturn(supported_platforms);
-        fire = spyOn(HooksRunner.prototype, 'fire').andReturn(Q());
-        prepare_spy = spyOn(cordova.raw, 'prepare').andReturn(Q());
-        compile_spy = spyOn(cordova.raw, 'compile').andReturn(Q());
+        is_cordova = spyOn(util, 'isCordova').and.returnValue(project_dir);
+        cd_project_root = spyOn(util, 'cdProjectRoot').and.returnValue(project_dir);
+        list_platforms = spyOn(util, 'listPlatforms').and.returnValue(supported_platforms);
+        fire = spyOn(HooksRunner.prototype, 'fire').and.returnValue(Q());
+        prepare_spy = spyOn(cordova.raw, 'prepare').and.returnValue(Q());
+        compile_spy = spyOn(cordova.raw, 'compile').and.returnValue(Q());
     });
     describe('failure', function() {
         it('should not run inside a project with no platforms', function(done) {
-            list_platforms.andReturn([]);
+            list_platforms.and.returnValue([]);
             cordova.raw.build()
             .then(function() {
                 expect('this call').toBe('fail');
@@ -51,7 +51,7 @@ describe('build command', function() {
         });
 
         it('should not run outside of a Cordova-based project', function(done) {
-            is_cordova.andReturn(false);
+            is_cordova.and.returnValue(false);
 
             cordova.raw.build()
             .then(function() {
@@ -67,7 +67,7 @@ describe('build command', function() {
     describe('success', function() {
         it('should run inside a Cordova-based project with at least one added platform and call both prepare and compile', function(done) {
             cordova.raw.build(['android','ios']).then(function() {
-                var opts = {verbose: false, platforms: ['android', 'ios'], options: []};
+                var opts = Object({ platforms: [ 'android', 'ios' ], verbose: false, options: Object({  }) })
                 expect(prepare_spy).toHaveBeenCalledWith(opts);
                 expect(compile_spy).toHaveBeenCalledWith(opts);
                 done();
@@ -116,7 +116,7 @@ describe('build command', function() {
 
         describe('with no platforms added', function() {
             it('should not fire the hooker', function(done) {
-                list_platforms.andReturn([]);
+                list_platforms.and.returnValue([]);
                 Q().then(cordova.raw.build).then(function() {
                     expect('this call').toBe('fail');
                 }, function(err) {

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/0e0d7a55/cordova-lib/spec-cordova/compile.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/compile.spec.js b/cordova-lib/spec-cordova/compile.spec.js
index 9f4040f..4371425 100644
--- a/cordova-lib/spec-cordova/compile.spec.js
+++ b/cordova-lib/spec-cordova/compile.spec.js
@@ -30,17 +30,17 @@ describe('compile command', function() {
     var project_dir = '/some/path';
 
     beforeEach(function() {
-        is_cordova = spyOn(util, 'isCordova').andReturn(project_dir);
-        cd_project_root = spyOn(util, 'cdProjectRoot').andReturn(project_dir);
-        list_platforms = spyOn(util, 'listPlatforms').andReturn(supported_platforms);
-        fire = spyOn(HooksRunner.prototype, 'fire').andReturn(Q());
-        platformApi = { build: jasmine.createSpy('build').andReturn(Q()) };
-        getPlatformApi = spyOn(platforms, 'getPlatformApi').andReturn(platformApi);
+        is_cordova = spyOn(util, 'isCordova').and.returnValue(project_dir);
+        cd_project_root = spyOn(util, 'cdProjectRoot').and.returnValue(project_dir);
+        list_platforms= spyOn(util, 'listPlatforms').and.returnValue(supported_platforms);
+        fire = spyOn(HooksRunner.prototype, 'fire').and.returnValue(Q());
+        platformApi = { build: jasmine.createSpy('build').and.returnValue(Q())};
+        getPlatformApi = spyOn(platforms, 'getPlatformApi').and.returnValue(platformApi);
         fail = function (err) { expect(err.stack).not.toBeDefined(); };
     });
     describe('failure', function() {
         it('should not run inside a Cordova-based project with no added platforms by calling util.listPlatforms', function(done) {
-            list_platforms.andReturn([]);
+            list_platforms.and.returnValue([]);
             var success = jasmine.createSpy('success');
             cordova.raw.compile()
             .then(success, function(result) {
@@ -53,7 +53,7 @@ describe('compile command', function() {
             });
         });
         it('should not run outside of a Cordova-based project', function(done) {
-            is_cordova.andReturn(false);
+            is_cordova.and.returnValue(false);
             var success = jasmine.createSpy('success');
             cordova.raw.compile()
             .then(success, function(result) {
@@ -126,7 +126,7 @@ describe('compile command', function() {
 
         describe('with no platforms added', function() {
             it('should not fire the hooker', function(done) {
-                list_platforms.andReturn([]);
+                list_platforms.and.returnValue([]);
                 Q().then(cordova.raw.compile).then(function() {
                     expect('this call').toBe('fail');
                 }, function(err) {

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/0e0d7a55/cordova-lib/spec-cordova/create.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/create.spec.js b/cordova-lib/spec-cordova/create.spec.js
index 09f14f0..2876fe6 100644
--- a/cordova-lib/spec-cordova/create.spec.js
+++ b/cordova-lib/spec-cordova/create.spec.js
@@ -38,7 +38,7 @@ var configBasic = {
     }
 };
 
-describe('cordova create checks for valid-identifier', function(done) {
+describe('cordova create checks for valid-identifier', function() {
     it('should reject reserved words from start of id', function(done) {
         cordova.raw.create('projectPath', 'int.bob', 'appName', {}, events)
         .fail(function(err) {
@@ -109,4 +109,4 @@ describe('create basic test (see more in cordova-create)', function() {
             .fin(done);
     }, 60000);
 
-});
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/0e0d7a55/cordova-lib/spec-cordova/emulate.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/emulate.spec.js b/cordova-lib/spec-cordova/emulate.spec.js
index 94b2ab9..7372df2 100644
--- a/cordova-lib/spec-cordova/emulate.spec.js
+++ b/cordova-lib/spec-cordova/emulate.spec.js
@@ -30,21 +30,22 @@ describe('emulate command', function() {
     var prepare_spy, platformApi, getPlatformApi;
 
     beforeEach(function() {
-        is_cordova = spyOn(util, 'isCordova').andReturn(project_dir);
-        cd_project_root = spyOn(util, 'cdProjectRoot').andReturn(project_dir);
-        list_platforms = spyOn(util, 'listPlatforms').andReturn(supported_platforms);
-        fire = spyOn(HooksRunner.prototype, 'fire').andReturn(Q());
-        prepare_spy = spyOn(cordova.raw, 'prepare').andReturn(Q());
+        is_cordova = spyOn(util, 'isCordova').and.returnValue(project_dir);
+        cd_project_root = spyOn(util, 'cdProjectRoot').and.returnValue(project_dir);
+        list_platforms = spyOn(util, 'listPlatforms').and.returnValue(supported_platforms);
+        fire = spyOn(HooksRunner.prototype, 'fire').and.returnValue(Q());
+        prepare_spy = spyOn(cordova.raw, 'prepare').and.returnValue(Q());
         fail = function (err) { expect(err.stack).not.toBeDefined(); };
         platformApi = {
-            run: jasmine.createSpy('run').andReturn(Q()),
-            build: jasmine.createSpy('build').andReturn(Q())
+            run: jasmine.createSpy('run').and.returnValue(Q()),
+            build: jasmine.createSpy('build').and.returnValue(Q())
         };
-        getPlatformApi = spyOn(platforms, 'getPlatformApi').andReturn(platformApi);
+        
+        getPlatformApi = spyOn(platforms, 'getPlatformApi').and.returnValue(platformApi);
     });
     describe('failure', function() {
         it('should not run inside a Cordova-based project with no added platforms by calling util.listPlatforms', function(done) {
-            list_platforms.andReturn([]);
+            list_platforms.and.returnValue([]);
             var success = jasmine.createSpy('success');
             cordova.raw.compile()
             .then(success, function(result) {
@@ -57,7 +58,7 @@ describe('emulate command', function() {
             });
         });
         it('should not run outside of a Cordova-based project', function(done) {
-            is_cordova.andReturn(false);
+            is_cordova.and.returnValue(false);
             var success = jasmine.createSpy('success');
             cordova.raw.compile()
             .then(success, function(result) {
@@ -113,7 +114,7 @@ describe('emulate command', function() {
             var originalBuildSpy;
             beforeEach(function() {
                 originalBuildSpy = platformApi.build;
-                platformApi.build = jasmine.createSpy('build').andCallFake(function(opts) {
+                platformApi.build = jasmine.createSpy('build').and.callFake(function(opts) {
                     opts.couldBeModified = 'insideBuild';
                     return Q();
                 });
@@ -179,7 +180,7 @@ describe('emulate command', function() {
 
         describe('with no platforms added', function() {
             it('should not fire the hooker', function(done) {
-                list_platforms.andReturn([]);
+                list_platforms.and.returnValue([]);
                 Q().then(cordova.raw.emulate).then(function() {
                     expect('this call').toBe('fail');
                 }, function(err) {
@@ -189,4 +190,4 @@ describe('emulate command', function() {
             });
         });
     });
-});
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/0e0d7a55/cordova-lib/spec-cordova/helpers.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/helpers.js b/cordova-lib/spec-cordova/helpers.js
index 4cc1e2c..257f4bd 100644
--- a/cordova-lib/spec-cordova/helpers.js
+++ b/cordova-lib/spec-cordova/helpers.js
@@ -148,7 +148,7 @@ module.exports.writeConfigContent = function (appPath, configContent) {
 
 // Add the toExist matcher.
 beforeEach(function () {
-    this.addMatchers({
+    jasmine.addMatchers({
         'toExist': function () {
             var notText = this.isNot ? ' not' : '';
             var self = this;
@@ -160,5 +160,4 @@ beforeEach(function () {
             return fs.existsSync(this.actual);
         }
     });
-});
-
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/0e0d7a55/cordova-lib/spec-cordova/lazy_load.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/lazy_load.spec.js b/cordova-lib/spec-cordova/lazy_load.spec.js
index 0560649..e421cc8 100644
--- a/cordova-lib/spec-cordova/lazy_load.spec.js
+++ b/cordova-lib/spec-cordova/lazy_load.spec.js
@@ -34,8 +34,8 @@ var lazy_load = require('../src/cordova/lazy_load'),
 describe('lazy_load module', function() {
     var custom_path, cachePackage, fakeLazyLoad;
     beforeEach(function() {
-        custom_path = spyOn(config, 'has_custom_path').andReturn(false);
-        cachePackage = spyOn(npmHelper, 'cachePackage').andReturn(Q(path.join('lib', 'dir')));
+        custom_path = spyOn(config, 'has_custom_path').and.returnValue(false);
+        cachePackage = spyOn(npmHelper, 'cachePackage').and.returnValue(Q(path.join('lib', 'dir')));
         fakeLazyLoad = function (id, platform, version) {
             if (platform == 'wp7' || platform == 'wp8') {
                 return Q(path.join('lib', 'wp', id, version, platform));
@@ -48,7 +48,7 @@ describe('lazy_load module', function() {
         var custom,
             version;
         beforeEach(function() {
-            custom = spyOn(lazy_load, 'custom').andReturn(Q(path.join('lib','dir')));
+            custom = spyOn(lazy_load, 'custom').and.returnValue(Q(path.join('lib','dir')));
             version = platforms.android.version;
             platforms.android.version = '3.14.15.9265';
         });
@@ -77,13 +77,13 @@ describe('lazy_load module', function() {
             spyOn(shell, 'mkdir');
             rm = spyOn(shell, 'rm');
             mv = spyOn(shell, 'mv');
-            exists = spyOn(fs, 'existsSync').andReturn(false);
-            readdir = spyOn(fs, 'readdirSync').andReturn(['somefile.txt']);
-            fire = spyOn(HooksRunner, 'fire').andReturn(Q());
+            exists = spyOn(fs, 'existsSync').and.returnValue(false);
+            readdir = spyOn(fs, 'readdirSync').and.returnValue(['somefile.txt']);
+            fire = spyOn(HooksRunner, 'fire').and.returnValue(Q());
         });
 
         it('should callback with no errors and not fire event hooks if library already exists', function(done) {
-            exists.andReturn(true);
+            exists.and.returnValue(true);
             var mock_platforms = {
                 'platform X': {
                     id: 'some id',
@@ -98,7 +98,7 @@ describe('lazy_load module', function() {
             }).fin(done);
         });
         it('should callback with no errors and fire event hooks even if library already exists if the lib url is a local dir', function(done) {
-            exists.andReturn(true);
+            exists.and.returnValue(true);
             var mock_platforms = {
                 'platform X': {
                     id: 'some id',
@@ -117,25 +117,25 @@ describe('lazy_load module', function() {
             var req,
                 events = {},
                 fakeRequest = {
-                    on: jasmine.createSpy().andCallFake(function(event, cb) {
+                    on: jasmine.createSpy().and.callFake(function(event, cb) {
                         events[event] = cb;
                         return fakeRequest;
                     }),
-                    pipe: jasmine.createSpy().andCallFake(function() { return fakeRequest; })
+                    pipe: jasmine.createSpy().and.callFake(function() { return fakeRequest; })
                 };
             beforeEach(function() {
                 events = {};
                 fakeRequest.on.reset();
                 fakeRequest.pipe.reset();
-                req = spyOn(request, 'get').andCallFake(function() {
+                req = spyOn(request, 'get').and.callFake(function() {
                     // Fire the 'end' event shortly.
                     setTimeout(function() {
                         events['end']();
                     }, 10);
                     return fakeRequest;
                 });
-                spyOn(npm, 'load').andCallFake(function(cb) { cb(); });
-                spyOn(npm.config, 'get').andReturn(null);
+                spyOn(npm, 'load').and.callFake(function(cb) { cb(); });
+                spyOn(npm.config, 'get').and.returnValue(null);
             });
 
             it('should call request with appropriate url params', function(done) {
@@ -157,7 +157,7 @@ describe('lazy_load module', function() {
             });
             it('should take into account https-proxy npm configuration var if exists for https:// calls', function(done) {
                 var proxy = 'https://somelocalproxy.com';
-                npm.config.get.andReturn(proxy);
+                npm.config.get.and.returnValue(proxy);
                 var url = 'https://github.com/apache/someplugin';
                 var with_android_platform = {
                     'android': {
@@ -177,7 +177,7 @@ describe('lazy_load module', function() {
             });
             it('should take into account proxy npm config var if exists for http:// calls', function(done) {
                 var proxy = 'http://somelocalproxy.com';
-                npm.config.get.andReturn(proxy);
+                npm.config.get.and.returnValue(proxy);
                 var url = 'http://github.com/apache/someplugin';
                 var with_android_platform = {
                     'android': {
@@ -232,11 +232,11 @@ describe('lazy_load module', function() {
     describe('based_on_config method', function() {
         var cordova, custom, read;
         beforeEach(function() {
-            cordova = spyOn(lazy_load, 'cordova').andReturn(Q());
-            custom = spyOn(lazy_load, 'custom').andReturn(Q());
+            cordova = spyOn(lazy_load, 'cordova').and.returnValue(Q());
+            custom = spyOn(lazy_load, 'custom').and.returnValue(Q());
         });
         it('should invoke custom if a custom lib is specified', function(done) {
-            read = spyOn(config, 'read').andReturn({
+            read = spyOn(config, 'read').and.returnValue({
                 lib:{
                     maybe:{
                         url:'you or eye?',
@@ -246,8 +246,8 @@ describe('lazy_load module', function() {
                 }
             });
             var p = '/some/random/custom/path';
-            custom_path.andReturn(p);
-            custom.andCallFake(function (platforms, platform) {
+            custom_path.and.returnValue(p);
+            custom.and.callFake(function (platforms, platform) {
                 expect(platform).toEqual('maybe');
                 expect(platforms[platform].url).toEqual('you or eye?');
                 expect(platforms[platform].id).toEqual('eye dee');

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/0e0d7a55/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 a944a24..63ad2bb 100644
--- a/cordova-lib/spec-cordova/platform.spec.js
+++ b/cordova-lib/spec-cordova/platform.spec.js
@@ -57,7 +57,7 @@ describe('platform end-to-end', function () {
 
         // The config.json in the fixture project points at fake "local" paths.
         // Since it's not a URL, the lazy-loader will just return the junk path.
-        spyOn(superspawn, 'spawn').andCallFake(function(cmd, args) {
+        spyOn(superspawn, 'spawn').and.callFake(function(cmd, args) {
             if (cmd.match(/create\b/)) {
                 // This is a call to the bin/create script, so do the copy ourselves.
                 shell.cp('-R', path.join(__dirname, 'fixtures', 'platforms', 'android'), path.join(project, 'platforms'));
@@ -148,8 +148,8 @@ describe('platform end-to-end', function () {
     it('should call prepare after plugins were installed into platform', function(done) {
         var order = '';
         var fail = jasmine.createSpy(fail);
-        spyOn(plugman.raw, 'install').andCallFake(function() { order += 'I'; });
-        spyOn(cordova.raw, 'prepare').andCallFake(function() { order += 'P'; });
+        spyOn(plugman.raw, 'install').and.callFake(function() { order += 'I'; });
+        spyOn(cordova.raw, 'prepare').and.callFake(function() { order += 'P'; });
 
         cordova.raw.plugin('add', path.join(pluginsDir, 'test'))
         .then(function() {

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/0e0d7a55/cordova-lib/spec-cordova/plugin.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/plugin.spec.js b/cordova-lib/spec-cordova/plugin.spec.js
index ae99c46..a4f4cd3 100644
--- a/cordova-lib/spec-cordova/plugin.spec.js
+++ b/cordova-lib/spec-cordova/plugin.spec.js
@@ -83,6 +83,7 @@ function removePlugin(id) {
 var errorHandler = {
     errorCallback: function(error) {
         // We want the error to be printed by jasmine
+        console.log(error);
         expect(error).toBeUndefined();
     }
 };
@@ -91,7 +92,7 @@ var errorHandler = {
 // that use a searchpath. See loadLocalPlugins() in plugman/fetch.js for details.
 // The searchpath behavior gets tested in the plugman spec
 function mockPluginFetch(id, dir) {
-    spyOn(plugman.raw, 'fetch').andCallFake(function(target, pluginPath, fetchOptions) {
+    spyOn(plugman.raw, 'fetch').and.callFake(function(target, pluginPath, fetchOptions) {
         var dest = path.join(project, 'plugins', id);
         var src = path.join(dir, 'plugin.xml');
 
@@ -106,12 +107,12 @@ function setupPlatformApiSpies() {
     var addPluginOrig = api.addPlugin;
     var removePluginOrig = api.removePlugin;
 
-    spyOn(api, 'addPlugin').andCallFake(function () {
+    spyOn(api, 'addPlugin').and.callFake(function () {
         return addPluginOrig.apply(api, arguments)
         .thenResolve(true);
     });
 
-    spyOn(api, 'removePlugin').andCallFake(function () {
+    spyOn(api, 'removePlugin').and.callFake(function () {
         return removePluginOrig.apply(api, arguments)
         .thenResolve(true);
     });
@@ -135,8 +136,8 @@ describe('plugin end-to-end', function() {
         util._resetOrigCwd();
         delete process.env.PWD;
 
-        spyOn(prepare, 'preparePlatforms').andCallThrough();
-        spyOn(errorHandler, 'errorCallback').andCallThrough();
+        spyOn(prepare, 'preparePlatforms').and.callThrough();
+        spyOn(errorHandler, 'errorCallback').and.callThrough();
     });
 
     afterEach(function() {
@@ -150,9 +151,12 @@ describe('plugin end-to-end', function() {
         .then(function() {
             return removePlugin(pluginId);
         })
-        .fail(errorHandler.errorCallback)
+        .fail(function(err) {
+            console.error(err);
+            expect(err).toBeUndefined();
+        })
         .fin(done);
-    });
+    }, 30000);
 
     it('should run prepare after plugin installation/removal by default', function(done) {
         addPlugin(path.join(pluginsDir, 'fake1'), pluginId, {})
@@ -164,9 +168,12 @@ describe('plugin end-to-end', function() {
         .then(function () {
             expect(prepare.preparePlatforms).toHaveBeenCalled();
         })
-        .fail(errorHandler.errorCallback)
+        .fail(function(err) {
+            console.error(err);
+            expect(err).toBeUndefined();
+        })
         .fin(done);
-    });
+    }, 30000);
 
     it('should not run prepare after plugin installation/removal if platform return non-falsy value', function(done) {
         setupPlatformApiSpies();
@@ -178,9 +185,12 @@ describe('plugin end-to-end', function() {
         .then(function () {
             expect(prepare.preparePlatforms).not.toHaveBeenCalled();
         })
-        .fail(errorHandler.errorCallback)
+        .fail(function(err) {
+            console.error(err);
+            expect(err).toBeUndefined();
+        })
         .fin(done);
-    });
+    }, 30000);
 
     it('should successfully add a plugin using relative path when running from subdir inside of project', function(done) {
         // Copy plugin to subdir inside of the project. This is required since path.relative
@@ -199,9 +209,12 @@ describe('plugin end-to-end', function() {
         .then(function() {
             return removePlugin(pluginId);
         })
-        .fail(errorHandler.errorCallback)
+        .fail(function(err) {
+            console.error(err);
+            expect(err).toBeUndefined();
+        })
         .fin(done);
-    });
+    }, 30000);
 
     it('should respect preference default values', function (done) {    
        addPlugin(path.join(pluginsDir, org_test_defaultvariables), org_test_defaultvariables, {cli_variables: { REQUIRED:'NO', REQUIRED_ANDROID:'NO'}}, done)
@@ -216,30 +229,38 @@ describe('plugin end-to-end', function() {
             expect(defaultPluginPreferences.REQUIRED).toBe('NO');
             return removePlugin(org_test_defaultvariables);
        })
-       .fail(errorHandler.errorCallback)
-       .fin(done);
-    });
+        .fail(function(err) {
+            console.error(err);
+            expect(err).toBeUndefined();
+        })
+        .fin(done);
+    }, 30000);
 
     it('should successfully add a plugin when specifying CLI variables', function(done) {
         addPlugin(path.join(pluginsDir, org_test_defaultvariables), org_test_defaultvariables, {cli_variables: { REQUIRED:'yes', REQUIRED_ANDROID:'yes'}}, done)
-        .fail(errorHandler.errorCallback)
+        .fail(function(err) {
+            console.error(err);
+            expect(err).toBeUndefined();
+        })
         .fin(done);
-    });
+    }, 30000);
 
     it('should not check npm info when using the searchpath flag', function(done) {
         mockPluginFetch(npmInfoTestPlugin, path.join(pluginsDir, npmInfoTestPlugin));
-
         spyOn(registry, 'info');
         addPlugin(npmInfoTestPlugin, npmInfoTestPlugin, {searchpath: pluginsDir}, done)
         .then(function() {
             expect(registry.info).not.toHaveBeenCalled();
 
             var fetchOptions = plugman.raw.fetch.mostRecentCall.args[2];
-            expect(fetchOptions.searchpath).toBeDefined();
+            expect(fetchOptions.searchpath).toExist();
+        })
+        .fail(function(err) {
+            console.error(err);
+            expect(err).toBeUndefined();
         })
-        .fail(errorHandler.errorCallback)
         .fin(done);
-    });
+    }, 30000);
 
     it('should not check npm info when using the noregistry flag', function(done) {
         mockPluginFetch(npmInfoTestPlugin, path.join(pluginsDir, npmInfoTestPlugin));
@@ -252,9 +273,12 @@ describe('plugin end-to-end', function() {
             var fetchOptions = plugman.raw.fetch.mostRecentCall.args[2];
             expect(fetchOptions.noregistry).toBeTruthy();
         })
-        .fail(errorHandler.errorCallback)
+        .fail(function(err) {
+            console.error(err);
+            expect(err).toBeUndefined();
+        })
         .fin(done);
-    });
+    }, 30000);
 
     it('should not check npm info when fetching from a Git repository', function(done) {
         spyOn(registry, 'info');
@@ -262,14 +286,17 @@ describe('plugin end-to-end', function() {
         .then(function() {
             expect(registry.info).not.toHaveBeenCalled();
         })
-        .fail(errorHandler.errorCallback)
+        .fail(function(err) {
+            console.error(err);
+            expect(err).toBeUndefined();
+        })
         .fin(done);
-    });
+    }, 30000);
 
     it('should select the plugin version based on npm info when fetching from npm', function(done) {
         mockPluginFetch(npmInfoTestPlugin, path.join(pluginsDir, npmInfoTestPlugin));
 
-        spyOn(registry, 'info').andCallThrough();
+        spyOn(registry, 'info').and.callThrough();
         addPlugin(npmInfoTestPlugin, npmInfoTestPlugin, {}, done)
         .then(function() {
             expect(registry.info).toHaveBeenCalled();
@@ -277,15 +304,18 @@ describe('plugin end-to-end', function() {
             var fetchTarget = plugman.raw.fetch.mostRecentCall.args[0];
             expect(fetchTarget).toEqual(npmInfoTestPlugin + '@' + npmInfoTestPluginVersion);
         })
-        .fail(errorHandler.errorCallback)
+        .fail(function(err) {
+            console.error(err);
+            expect(err).toBeUndefined();
+        })
         .fin(done);
-    });
+    }, 30000);
 
     it('should handle scoped npm packages', function(done) {
         var scopedPackage = '@testscope/' + npmInfoTestPlugin;
         mockPluginFetch(npmInfoTestPlugin, path.join(pluginsDir, npmInfoTestPlugin));
 
-        spyOn(registry, 'info').andReturn(Q({}));
+        spyOn(registry, 'info').and.returnValue(Q({}));
         addPlugin(scopedPackage, npmInfoTestPlugin, {}, done)
         .then(function() {
             // Check to make sure that we are at least trying to get the correct package.
@@ -296,9 +326,12 @@ describe('plugin end-to-end', function() {
             var fetchTarget = plugman.raw.fetch.mostRecentCall.args[0];
             expect(fetchTarget).toEqual(scopedPackage);
         })
-        .fail(errorHandler.errorCallback)
+        .fail(function(err) {
+            console.error(err);
+            expect(err).toBeUndefined();
+        })
         .fin(done);
-    });
+    }, 30000);
 
     it('should handle scoped npm packages with given version tags', function(done) {
         var scopedPackage = '@testscope/' + npmInfoTestPlugin + '@latest';
@@ -312,7 +345,10 @@ describe('plugin end-to-end', function() {
             var fetchTarget = plugman.raw.fetch.mostRecentCall.args[0];
             expect(fetchTarget).toEqual(scopedPackage);
         })
-        .fail(errorHandler.errorCallback)
+        .fail(function(err) {
+            console.error(err);
+            expect(err).toBeUndefined();
+        })
         .fin(done);
-    });
+    }, 30000);
 });

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/0e0d7a55/cordova-lib/spec-cordova/plugin_fetch.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/plugin_fetch.spec.js b/cordova-lib/spec-cordova/plugin_fetch.spec.js
index e4c4d45..b1507ef 100644
--- a/cordova-lib/spec-cordova/plugin_fetch.spec.js
+++ b/cordova-lib/spec-cordova/plugin_fetch.spec.js
@@ -154,14 +154,14 @@ function removeTestProject() {
     shell.rm('-rf', tempDir);
 }
 
-describe('plugin fetching version selection', function(done) {
+describe('plugin fetching version selection', function() {
     createTestProject();
 
     beforeEach(function() {
         // Adding a matcher for checking the array of warning messages so that
         // we can have meanigful error messages. Expected is passed because
         // Jasmine will print it out if the matcher fails
-        this.addMatchers({
+        jasmine.addMatchers({
             toContain: function(check, expected) {
                 for(var i = 0; i < this.actual.length; i++) {
                     if (check(this.actual[i])) {
@@ -190,8 +190,8 @@ describe('plugin fetching version selection', function(done) {
         var after = getWarningCheckCallback(done, [
             getPlatformRequirement('6.0.0')
         ]);
-
         testEngineWithProject(after, testEngine, '1.3.0');
+        done();
     });
 
     it('should apply upper bound engine constraints when there are no unspecified constraints above the upper bound', function(done) {
@@ -208,8 +208,8 @@ describe('plugin fetching version selection', function(done) {
         var after = getWarningCheckCallback(done, [
             getPlatformRequirement('6.0.0')
         ]);
-
         testEngineWithProject(after, testEngine, null);
+        done();
     });
 
     it('should apply upper bound engine constraints when there are unspecified constraints above the upper bound', function(done) {
@@ -222,8 +222,8 @@ describe('plugin fetching version selection', function(done) {
         var after = getWarningCheckCallback(done, [
             getPlatformRequirement('~5.0.0')
         ]);
-
         testEngineWithProject(after, testEngine, '1.7.1');
+        done();
     });
 
     it('should handle the case where there are no constraints for earliest releases', function(done) {
@@ -234,8 +234,8 @@ describe('plugin fetching version selection', function(done) {
         var after = getWarningCheckCallback(done, [
             getPlatformRequirement('~5.0.0')
         ]);
-
         testEngineWithProject(after, testEngine, '0.7.0');
+        done();
     });
 
     it('should handle the case where the lowest version is unsatisfied', function(done) {
@@ -246,8 +246,8 @@ describe('plugin fetching version selection', function(done) {
         var after = getWarningCheckCallback(done, [
             getPlatformRequirement('~5.0.0')
         ]);
-
         testEngineWithProject(after, testEngine, null);
+        done();
     });
 
     it('should handle upperbounds if no single version constraints are given', function(done) {
@@ -258,6 +258,7 @@ describe('plugin fetching version selection', function(done) {
         var after = getWarningCheckCallback(done, []);
 
         testEngineWithProject(after, testEngine, '2.3.0');
+        done();
     });
 
     it('should apply upper bounds greater than highest version', function(done) {
@@ -271,6 +272,7 @@ describe('plugin fetching version selection', function(done) {
         ]);
 
         testEngineWithProject(after, testEngine, null);
+        done();
     });
 
     it('should treat empty constraints as satisfied', function(done) {
@@ -284,6 +286,7 @@ describe('plugin fetching version selection', function(done) {
         ]);
 
         testEngineWithProject(after, testEngine, '1.0.0');
+        done();
     });
 
     it('should ignore an empty cordovaDependencies entry', function(done) {
@@ -292,6 +295,7 @@ describe('plugin fetching version selection', function(done) {
         var after = getWarningCheckCallback(done, []);
 
         testEngineWithProject(after, testEngine, null);
+        done();
     });
 
     it('should ignore a badly formatted semver range', function(done) {
@@ -302,6 +306,7 @@ describe('plugin fetching version selection', function(done) {
         var after = getWarningCheckCallback(done, []);
 
         testEngineWithProject(after, testEngine, '2.3.0');
+        done();
     });
 
     it('should respect unreleased versions in constraints', function(done) {
@@ -316,6 +321,7 @@ describe('plugin fetching version selection', function(done) {
         ]);
 
         testEngineWithProject(after, testEngine, '1.1.0');
+        done();
     });
 
     it('should respect plugin constraints', function(done) {
@@ -330,6 +336,7 @@ describe('plugin fetching version selection', function(done) {
         ]);
 
         testEngineWithProject(after, testEngine, '2.0.0');
+        done();
     });
 
     it('should respect cordova constraints', function(done) {
@@ -344,6 +351,7 @@ describe('plugin fetching version selection', function(done) {
         ]);
 
         testEngineWithProject(after, testEngine, '1.1.0');
+        done();
     });
 
     it('should not include pre-release versions', function(done) {
@@ -358,6 +366,7 @@ describe('plugin fetching version selection', function(done) {
 
         // Should not return 2.0.0-rc.2
         testEngineWithProject(after, testEngine, '1.7.1');
+        done();
     });
 
     it('should not fail if there is no engine in the npm info', function(done) {
@@ -388,6 +397,7 @@ describe('plugin fetching version selection', function(done) {
             expect(toFetch).toBe(null);
         })
         .fail(getVersionErrorCallback).fin(after);
+        done();
     });
 
     it('should handle extra whitespace', function(done) {
@@ -402,6 +412,7 @@ describe('plugin fetching version selection', function(done) {
         ]);
 
         testEngineWithProject(after, testEngine, '1.7.1');
+        done();
     });
 
     it('should ignore badly typed version requirement entries', function(done) {
@@ -414,6 +425,7 @@ describe('plugin fetching version selection', function(done) {
         var after = getWarningCheckCallback(done, []);
 
         testEngineWithProject(after, testEngine, '2.3.0');
+        done();
     });
 
     it('should ignore badly typed constraint entries', function(done) {
@@ -429,6 +441,7 @@ describe('plugin fetching version selection', function(done) {
         var after = getWarningCheckCallback(done, []);
 
         testEngineWithProject(after, testEngine, '2.3.0');
+        done();
     });
 
     it('should ignore bad semver versions', function(done) {
@@ -446,6 +459,7 @@ describe('plugin fetching version selection', function(done) {
         ]);
 
         testEngineWithProject(after, testEngine, null);
+        done();
     });
 
     it('should not fail if there are bad semver versions', function(done) {
@@ -464,6 +478,7 @@ describe('plugin fetching version selection', function(done) {
         ]);
 
         testEngineWithProject(after, testEngine, '1.7.1');
+        done();
     });
 
     it('should properly warn about multiple unmet requirements', function(done) {
@@ -479,8 +494,8 @@ describe('plugin fetching version selection', function(done) {
             getPlatformRequirement('>5.1.0'),
             getPluginRequirement('3.1.0')
         ]);
-
         testEngineWithProject(after, testEngine, '1.3.0');
+        done();
     });
 
     it('should properly warn about both unmet latest and upper bound requirements', function(done) {
@@ -496,8 +511,8 @@ describe('plugin fetching version selection', function(done) {
             getPlatformRequirement('>5.1.0 AND >7.1.0'),
             getPluginRequirement('3.1.0')
         ]);
-
         testEngineWithProject(after, testEngine, null);
+        done();
     });
 
     it('should not warn about versions past latest', function(done) {
@@ -512,8 +527,8 @@ describe('plugin fetching version selection', function(done) {
         var after = getWarningCheckCallback(done, [
             getPlatformRequirement('>5.1.0')
         ]);
-
         testEngineWithProject(after, testEngine, '1.3.0');
+        done();
     });
 
     it('clean up after plugin fetch spec', function() {

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/0e0d7a55/cordova-lib/spec-cordova/plugin_parser.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/plugin_parser.spec.js b/cordova-lib/spec-cordova/plugin_parser.spec.js
index 33de1ff..f20d311 100644
--- a/cordova-lib/spec-cordova/plugin_parser.spec.js
+++ b/cordova-lib/spec-cordova/plugin_parser.spec.js
@@ -26,7 +26,7 @@ var xml_contents = fs.readFileSync(xml, 'utf-8');
 describe('plugin.xml parser', function () {
     var readfile;
     beforeEach(function() {
-        readfile = spyOn(fs, 'readFileSync').andReturn(xml_contents);
+        readfile = spyOn(fs, 'readFileSync').and.returnValue(xml_contents);
     });
 
     it('should read a proper plugin.xml file', function() {
@@ -43,4 +43,3 @@ describe('plugin.xml parser', function () {
         expect(cfg.platforms.indexOf('ios') > -1).toBe(true);
     });
 });
-

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/0e0d7a55/cordova-lib/spec-cordova/prepare.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/prepare.spec.js b/cordova-lib/spec-cordova/prepare.spec.js
index 6c20f7d..a43dfb0 100644
--- a/cordova-lib/spec-cordova/prepare.spec.js
+++ b/cordova-lib/spec-cordova/prepare.spec.js
@@ -64,37 +64,37 @@ describe('prepare command', function() {
         load, platformApi, getPlatformApi;
 
     beforeEach(function () {
-        getPlatformApi = spyOn(platforms, 'getPlatformApi').andCallFake(function (platform, rootDir) {
+        getPlatformApi = spyOn(platforms, 'getPlatformApi').and.callFake(function (platform, rootDir) {
             return {
-                prepare: jasmine.createSpy('prepare').andReturn(Q()),
-                getPlatformInfo: jasmine.createSpy('getPlatformInfo').andReturn({
+                prepare: jasmine.createSpy('prepare').and.returnValue(Q()),
+                getPlatformInfo: jasmine.createSpy('getPlatformInfo').and.returnValue({
                     locations: {
                         www: path.join(project_dir, 'platforms', platform, 'www')
                     }
                 }),
             };
         });
-        is_cordova = spyOn(util, 'isCordova').andReturn(project_dir);
-        cd_project_root = spyOn(util, 'cdProjectRoot').andReturn(project_dir);
-        list_platforms = spyOn(util, 'listPlatforms').andReturn(supported_platforms);
-        fire = spyOn(HooksRunner.prototype, 'fire').andReturn(Q());
+        is_cordova = spyOn(util, 'isCordova').and.returnValue(project_dir);
+        cd_project_root = spyOn(util, 'cdProjectRoot').and.returnValue(project_dir);
+        list_platforms = spyOn(util, 'listPlatforms').and.returnValue(supported_platforms);
+        fire = spyOn(HooksRunner.prototype, 'fire').and.returnValue(Q());
 
-        find_plugins = spyOn(util, 'findPlugins').andReturn([]);
-        spyOn(PlatformJson, 'load').andReturn(new PlatformJson(null, null, {}));
+        find_plugins = spyOn(util, 'findPlugins').and.returnValue([]);
+        spyOn(PlatformJson, 'load').and.returnValue(new PlatformJson(null, null, {}));
         spyOn(PlatformJson.prototype, 'save');
-        load = spyOn(lazy_load, 'based_on_config').andReturn(Q());
-        cp = spyOn(shell, 'cp').andReturn(true);
+        load = spyOn(lazy_load, 'based_on_config').and.returnValue(Q());
+        cp = spyOn(shell, 'cp').and.returnValue(true);
         mkdir = spyOn(shell, 'mkdir');
         spyOn(ConfigParser.prototype, 'write');
-        spyOn(xmlHelpers, 'parseElementtreeSync').andCallFake(function() {
+        spyOn(xmlHelpers, 'parseElementtreeSync').and.callFake(function() {
             return new et.ElementTree(et.XML(TEST_XML));
         });
     });
 
     describe('failure', function() {
         it('should not run outside of a cordova-based project by calling util.isCordova', function(done) {
-            is_cordova.andReturn(false);
-            cd_project_root.andCallThrough();  // undo spy here because prepare depends on cdprojectRoot for isCordova check
+            is_cordova.and.returnValue(false);
+            cd_project_root.and.callThrough();  // undo spy here because prepare depends on cdprojectRoot for isCordova check
             prepare().then(function() {
                 expect('this call').toBe('fail');
             }, function(err) {
@@ -102,7 +102,7 @@ describe('prepare command', function() {
             }).fin(done);
         });
         it('should not run inside a cordova-based project with no platforms', function(done) {
-            list_platforms.andReturn([]);
+            list_platforms.and.returnValue([]);
             prepare().then(function() {
                 expect('this call').toBe('fail');
             }, function(err) {
@@ -152,7 +152,7 @@ describe('prepare command', function() {
 
         describe('with no platforms added', function() {
             beforeEach(function() {
-                list_platforms.andReturn([]);
+                list_platforms.and.returnValue([]);
             });
             it('should not fire the hooker', function(done) {
                 Q().then(prepare).then(function() {
@@ -165,4 +165,4 @@ describe('prepare command', function() {
             });
         });
     });
-});
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/0e0d7a55/cordova-lib/spec-cordova/run.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/run.spec.js b/cordova-lib/spec-cordova/run.spec.js
index 2b09e04..43b6b79 100644
--- a/cordova-lib/spec-cordova/run.spec.js
+++ b/cordova-lib/spec-cordova/run.spec.js
@@ -30,20 +30,20 @@ describe('run command', function() {
     var prepare_spy;
 
     beforeEach(function() {
-        is_cordova = spyOn(util, 'isCordova').andReturn(project_dir);
-        cd_project_root = spyOn(util, 'cdProjectRoot').andReturn(project_dir);
-        list_platforms = spyOn(util, 'listPlatforms').andReturn(supported_platforms);
-        fire = spyOn(HooksRunner.prototype, 'fire').andReturn(Q());
-        prepare_spy = spyOn(cordova.raw, 'prepare').andReturn(Q());
+        is_cordova = spyOn(util, 'isCordova').and.returnValue(project_dir);
+        cd_project_root = spyOn(util, 'cdProjectRoot').and.returnValue(project_dir);
+        list_platforms = spyOn(util, 'listPlatforms').and.returnValue(supported_platforms);
+        fire = spyOn(HooksRunner.prototype, 'fire').and.returnValue(Q());
+        prepare_spy = spyOn(cordova.raw, 'prepare').and.returnValue(Q());
         platformApi = {
-            run: jasmine.createSpy('run').andReturn(Q()),
-            build: jasmine.createSpy('build').andReturn(Q())
+            run: jasmine.createSpy('run').and.returnValue(Q()),
+            build: jasmine.createSpy('build').and.returnValue(Q())
         };
-        getPlatformApi = spyOn(platforms, 'getPlatformApi').andReturn(platformApi);
+        getPlatformApi = spyOn(platforms, 'getPlatformApi').and.returnValue(platformApi);
     });
     describe('failure', function() {
         it('should not run inside a Cordova-based project with no added platforms by calling util.listPlatforms', function(done) {
-            list_platforms.andReturn([]);
+            list_platforms.and.returnValue([]);
             Q().then(cordova.raw.run).then(function() {
                 expect('this call').toBe('fail');
             }, function(err) {
@@ -52,8 +52,8 @@ describe('run command', function() {
         });
         it('should not run outside of a Cordova-based project', function(done) {
             var msg = 'Dummy message about not being in a cordova dir.';
-            cd_project_root.andThrow(new Error(msg));
-            is_cordova.andReturn(false);
+            cd_project_root.and.throwError(new Error(msg));
+            is_cordova.and.returnValue(false);
             Q().then(cordova.raw.run).then(function() {
                 expect('this call').toBe('fail');
             }, function(err) {
@@ -136,7 +136,7 @@ describe('run command', function() {
             var originalBuildSpy;
             beforeEach(function() {
                 originalBuildSpy = platformApi.build;
-                platformApi.build = jasmine.createSpy('build').andCallFake(function(opts) {
+                platformApi.build = jasmine.createSpy('build').and.callFake(function(opts) {
                     opts.couldBeModified = 'insideBuild';
                     return Q();
                 });
@@ -176,7 +176,7 @@ describe('run command', function() {
 
         describe('with no platforms added', function() {
             it('should not fire the hooker', function(done) {
-                list_platforms.andReturn([]);
+                list_platforms.and.returnValue([]);
                 Q().then(cordova.raw.run).then(function() {
                     expect('this call').toBe('fail');
                 }, function(err) {

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/0e0d7a55/cordova-lib/spec-cordova/save.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/save.spec.js b/cordova-lib/spec-cordova/save.spec.js
index 0c7ef31..3dce296 100644
--- a/cordova-lib/spec-cordova/save.spec.js
+++ b/cordova-lib/spec-cordova/save.spec.js
@@ -85,12 +85,12 @@ describe('(save flag)', function () {
      */
     function redirectRegistryCalls(id) {
         var originalFetch = registry.fetch;
-        spyOn(registry, 'fetch').andCallFake(function(package) {
+        spyOn(registry, 'fetch').and.callFake(function(package) {
             return originalFetch([id]);
         });
 
         var originalInfo = registry.info;
-        spyOn(registry, 'info').andCallFake(function(package) {
+        spyOn(registry, 'info').and.callFake(function(package) {
             return originalInfo([id]);
         });
     }
@@ -101,13 +101,13 @@ describe('(save flag)', function () {
         shell.mkdir(tempPath);
 
         //jasmine mocks
-        spyOn(util, 'isCordova').andReturn(appPath);
-        spyOn(util, 'cdProjectRoot').andReturn(appPath);
-        spyOn(cordova.raw, 'prepare').andReturn(Q());
-        spyOn(prepare, 'preparePlatforms').andReturn(Q());
+        spyOn(util, 'isCordova').and.returnValue(appPath);
+        spyOn(util, 'cdProjectRoot').and.returnValue(appPath);
+        spyOn(cordova.raw, 'prepare').and.returnValue(Q());
+        spyOn(prepare, 'preparePlatforms').and.returnValue(Q());
 
-        spyOn(PlatformApi, 'createPlatform').andReturn(Q());
-        spyOn(PlatformApi, 'updatePlatform').andReturn(Q());
+        spyOn(PlatformApi, 'createPlatform').and.returnValue(Q());
+        spyOn(PlatformApi, 'updatePlatform').and.returnValue(Q());
 
         //rewire mocks
         revertInstallPluginsForNewPlatform = platform.__set__('installPluginsForNewPlatform', function () { return Q(); });
@@ -314,7 +314,7 @@ describe('(save flag)', function () {
             platform('add', platformName + '@' + platformVersionNew)
             .then(function () {
                 var fsExistsSync = fs.existsSync.bind(fs);
-                spyOn(fs, 'existsSync').andCallFake(function (somePath) {
+                spyOn(fs, 'existsSync').and.callFake(function (somePath) {
                     return (somePath === path.join(appPath, 'platforms', platformName)) || fsExistsSync(somePath);
                 });
 
@@ -342,7 +342,7 @@ describe('(save flag)', function () {
             .then(function () {
                 revertDownloadPlatform();
                 var fsExistsSync = fs.existsSync.bind(fs);
-                spyOn(fs, 'existsSync').andCallFake(function (somePath) {
+                spyOn(fs, 'existsSync').and.callFake(function (somePath) {
                     return (somePath === path.join(appPath, 'platforms', platformName)) || fsExistsSync(somePath);
                 });
                 mockDownloadPlatform(platformLocalPathNew, platformVersionNew);
@@ -680,7 +680,7 @@ describe('(save flag)', function () {
         });
 
         it('spec.25 should install plugins already added to the project into platform when restoring it', function (done) {
-            var fail = jasmine.createSpy('fail').andCallFake(function (err) {
+            var fail = jasmine.createSpy('fail').and.callFake(function (err) {
                 console.log(err.message);
             });
 

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/0e0d7a55/cordova-lib/spec-cordova/util.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/util.spec.js b/cordova-lib/spec-cordova/util.spec.js
index 2bcdae4..b004256 100644
--- a/cordova-lib/spec-cordova/util.spec.js
+++ b/cordova-lib/spec-cordova/util.spec.js
@@ -37,11 +37,12 @@ describe('util module', function() {
             process.env['PWD'] = origPWD;
             process.chdir(cwd);
         });
+        function removeDir(directory) {
+            shell.rm('-rf', directory);            
+        }
         it('should return false if it hits the home directory', function() {
             var somedir = path.join(home, 'somedir');
-            this.after(function() {
-                shell.rm('-rf', somedir);
-            });
+            removeDir(somedir);
             shell.mkdir(somedir);
             expect(util.isCordova(somedir)).toEqual(false);
         });
@@ -52,9 +53,7 @@ describe('util module', function() {
         it('should return the first directory it finds with a .cordova folder in it', function() {
             var somedir = path.join(home,'somedir');
             var anotherdir = path.join(somedir, 'anotherdir');
-            this.after(function() {
-                shell.rm('-rf', somedir);
-            });
+            removeDir(somedir);
             shell.mkdir('-p', anotherdir);
             shell.mkdir('-p', path.join(somedir, 'www', 'config.xml'));
             expect(util.isCordova(somedir)).toEqual(somedir);
@@ -63,9 +62,7 @@ describe('util module', function() {
             delete process.env['PWD'];
             var somedir = path.join(home,'somedir');
             var anotherdir = path.join(somedir, 'anotherdir');
-            this.after(function() {
-                shell.rm('-rf', somedir);
-            });
+            removeDir(somedir);
             shell.mkdir('-p', anotherdir);
             shell.mkdir('-p', path.join(somedir, 'www'));
             shell.mkdir('-p', path.join(somedir, 'config.xml'));
@@ -75,9 +72,7 @@ describe('util module', function() {
         it('should use PWD when available', function() {
             var somedir = path.join(home,'somedir');
             var anotherdir = path.join(somedir, 'anotherdir');
-            this.after(function() {
-                shell.rm('-rf', somedir);
-            });
+            removeDir(somedir);
             shell.mkdir('-p', anotherdir);
             shell.mkdir('-p', path.join(somedir, 'www', 'config.xml'));
             process.env['PWD'] = anotherdir;
@@ -87,9 +82,7 @@ describe('util module', function() {
         it('should use cwd as a fallback when PWD is not a cordova dir', function() {
             var somedir = path.join(home,'somedir');
             var anotherdir = path.join(somedir, 'anotherdir');
-            this.after(function() {
-                shell.rm('-rf', somedir);
-            });
+            removeDir(somedir);
             shell.mkdir('-p', anotherdir);
             shell.mkdir('-p', path.join(somedir, 'www', 'config.xml'));
             process.env['PWD'] = path.sep;
@@ -99,9 +92,7 @@ describe('util module', function() {
         it('should ignore platform www/config.xml', function() {
             var somedir = path.join(home,'somedir');
             var anotherdir = path.join(somedir, 'anotherdir');
-            this.after(function() {
-                shell.rm('-rf', somedir);
-            });
+            removeDir(somedir);
             shell.mkdir('-p', anotherdir);
             shell.mkdir('-p', path.join(anotherdir, 'www', 'config.xml'));
             shell.mkdir('-p', path.join(somedir, 'www'));
@@ -216,17 +207,17 @@ describe('util module', function() {
         };
 
         beforeEach(function() {
-            isCordova = spyOn(util, 'isCordova').andReturn('/fake/path');
-            listPlatforms = spyOn(util, 'listPlatforms').andReturn(['android']);
+            isCordova = spyOn(util, 'isCordova').and.returnValue('/fake/path');
+            listPlatforms = spyOn(util, 'listPlatforms').and.returnValue(['android']);
         });
 
         it('should throw if called outside of cordova project', function() {
-            isCordova.andReturn(false);
+            isCordova.and.returnValue(false);
             expect(function() { util.preProcessOptions(); }).toThrow();
         });
 
         it('should throw when no platforms added to project', function() {
-            listPlatforms.andReturn([]);
+            listPlatforms.and.returnValue([]);
             expect(function () { util.preProcessOptions(); }).toThrow();
         });
 
@@ -248,7 +239,7 @@ describe('util module', function() {
         });
 
         it('should pick buildConfig if no option is provided, but buildConfig.json exists', function() {
-            spyOn(util, 'existsSync').andReturn(true);
+            spyOn(util, 'existsSync').and.returnValue(true);
             // Using path.join below to normalize path separators
             expect(util.preProcessOptions())
                 .toEqual(jasmine.objectContaining({options: {buildConfig: path.join('/fake/path/build.json')}}));
@@ -316,4 +307,4 @@ describe('util module', function() {
             });
         });
     });
-});
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/0e0d7a55/cordova-lib/spec-cordova/wrappers.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/wrappers.spec.js b/cordova-lib/spec-cordova/wrappers.spec.js
index 4d9a49e..0846447 100644
--- a/cordova-lib/spec-cordova/wrappers.spec.js
+++ b/cordova-lib/spec-cordova/wrappers.spec.js
@@ -34,13 +34,13 @@ describe('callback wrapper', function() {
             });
 
             it('should work with no callback and success', function() {
-                raw.andReturn(Q());
+                raw.and.returnValue(Q());
                 cordova[call]();
                 expect(raw).toHaveBeenCalled();
             });
 
             it('should call the callback on success', function(done) {
-                raw.andReturn(Q());
+                raw.and.returnValue(Q());
                 cordova[call](function(err) {
                     expect(err).toBeUndefined();
                     done();
@@ -49,7 +49,7 @@ describe('callback wrapper', function() {
 
             it('should call the callback with the error on failure', function(done) {
                 var err = new Error('junk');
-                raw.andReturn(Q.reject(err));
+                raw.and.returnValue(Q.reject(err));
                 cordova[call](function(e) {
                     expect(e).toEqual(err);
                     done();
@@ -57,5 +57,4 @@ describe('callback wrapper', function() {
             });
         });
     }
-});
-
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/0e0d7a55/cordova-lib/spec-plugman/add_platform.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/add_platform.spec.js b/cordova-lib/spec-plugman/add_platform.spec.js
index 208216b..123c051 100644
--- a/cordova-lib/spec-plugman/add_platform.spec.js
+++ b/cordova-lib/spec-plugman/add_platform.spec.js
@@ -22,8 +22,8 @@ var platform = require('../src/plugman/platform'),
 
 describe( 'platform add/remove', function() {
     it( 'should call platform add', function() {
-        var sPlatformA = spyOn( platform, 'add' ).andReturn(Q()),
-            sPlatformR = spyOn( platform, 'remove' ).andReturn(Q());
+        var sPlatformA = spyOn( platform, 'add' ).and.returnValue(Q()),
+            sPlatformR = spyOn( platform, 'remove' ).and.returnValue(Q());
         platform.add();
         expect(sPlatformA).toHaveBeenCalled();
         platform.remove();
@@ -39,18 +39,19 @@ describe( 'platform add', function() {
         f.then( function() { done = true; }, function(err) { done = err; } );
     }
     beforeEach( function() {
-        existsSync = spyOn( fs, 'existsSync' ).andReturn( false );
+        existsSync = spyOn( fs, 'existsSync' ).and.returnValue( false );
         done = false;
     });
-    it( 'should error on non existing plugin.xml', function() {
-        runs(function() {
-            platformPromise( platform.add() );
+    it( 'should error on non existing plugin.xml', function(done) {
+        platform.add().then(function(result){
+            expect(false).toBe(true);
+            done();
+        },
+        function err(errMsg) {
+            expect(errMsg.toString()).toContain('can\'t find a plugin.xml.  Are you in the plugin?');
+            done();
         });
-        waitsFor(function() { return done; }, 'platform promise never resolved', 500);
-        runs(function() {
-            expect(''+ done ).toContain( 'can\'t find a plugin.xml.  Are you in the plugin?'  );
-        });
-    });
+    }, 6000);
 });
 
 
@@ -61,16 +62,17 @@ describe( 'platform remove', function() {
         f.then( function() { done = true; }, function(err) { done = err; } );
     }
     beforeEach( function() {
-        existsSync = spyOn( fs, 'existsSync' ).andReturn( false );
+        existsSync = spyOn( fs, 'existsSync' ).and.returnValue( false );
         done = false;
     });
-    it( 'should error on non existing plugin.xml', function() {
-        runs(function() {
-            platformPromise( platform.remove() );
-        });
-        waitsFor(function() { return done; }, 'platform promise never resolved', 500);
-        runs(function() {
-            expect(''+ done ).toContain( 'can\'t find a plugin.xml.  Are you in the plugin?'  );
+    it( 'should error on non existing plugin.xml', function(done) {
+        platform.remove().then(function(result) {
+            expect(false).toBe(true);
+            done();
+        },
+        function err(errMsg) {
+            expect(errMsg.toString()).toContain( 'can\'t find a plugin.xml.  Are you in the plugin?'  );
+            done();
         });
-    });
-});
+    }, 6000);
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/0e0d7a55/cordova-lib/spec-plugman/config.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/config.spec.js b/cordova-lib/spec-plugman/config.spec.js
index a70624f..3d79ad9 100644
--- a/cordova-lib/spec-plugman/config.spec.js
+++ b/cordova-lib/spec-plugman/config.spec.js
@@ -22,7 +22,7 @@ var config = require('../src/plugman/config'),
 
 describe('config', function() {
     it('should run config', function() {
-        var sConfig = spyOn(registry, 'config').andReturn(Q());
+        var sConfig = spyOn(registry, 'config').and.returnValue(Q());
         var params = ['set', 'registry', 'http://registry.cordova.io'];
         config(params);
         expect(sConfig).toHaveBeenCalledWith(params);

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/0e0d7a55/cordova-lib/spec-plugman/create.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/create.spec.js b/cordova-lib/spec-plugman/create.spec.js
index 0ec1a2e..377aeb1 100644
--- a/cordova-lib/spec-plugman/create.spec.js
+++ b/cordova-lib/spec-plugman/create.spec.js
@@ -24,7 +24,7 @@ var create = require('../src/plugman/create'),
 
 describe( 'create', function() {
     it( 'should call create', function() {
-        var sCreate = spyOn( plugman, 'create' ).andReturn(Q());
+        var sCreate = spyOn( plugman, 'create' ).and.returnValue(Q());
         plugman.create();
         expect(sCreate).toHaveBeenCalled();
     });
@@ -39,13 +39,13 @@ describe( 'create plugin', function() {
         f.then( function() { done = true; }, function(err) { done = err; } );
     }
     beforeEach( function() {
-        existsSync = spyOn( fs, 'existsSync' ).andReturn( false );
-        mkdir = spyOn( shell, 'mkdir' ).andReturn( true );
+        existsSync = spyOn( fs, 'existsSync' ).and.returnValue( false );
+        mkdir = spyOn( shell, 'mkdir' ).and.returnValue( true );
         writeFileSync = spyOn( fs, 'writeFileSync' );
         done = false;
     });
 
-    it( 'should be successful', function() {
+    it( 'should be successful', function(done) {
         runs(function() {
             createPromise( create( 'name', 'org.plugin.id', '0.0.0', '.', [] ) );
         });
@@ -64,17 +64,18 @@ describe( 'create plugin in existing plugin', function() {
         f.then( function() { done = true; }, function(err) { done = err; } );
     }
     beforeEach( function() {
-        existsSync = spyOn( fs, 'existsSync' ).andReturn( true );
+        existsSync = spyOn( fs, 'existsSync' ).and.returnValue( true );
         done = false;
     });
 
-    it( 'should fail due to an existing plugin.xml', function() {
-        runs(function() {
-            createPromise( create() );
+    it( 'should fail due to an existing plugin.xml', function(done) {
+        create().then(function(result) {
+            expect(false).toBe(true);
+            done();
+        },
+        function err(errMsg) {
+            expect(errMsg.toString()).toContain( 'plugin.xml already exists. Are you already in a plugin?'  );
+            done();
         });
-        waitsFor(function() { return done; }, 'create promise never resolved', 500);
-        runs(function() {
-            expect(''+ done ).toContain( 'plugin.xml already exists. Are you already in a plugin?'  );
-        });
-    });
+    }, 6000);
 });

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/0e0d7a55/cordova-lib/spec-plugman/fetch.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/fetch.spec.js b/cordova-lib/spec-plugman/fetch.spec.js
index 9aa04ef..19b406f 100644
--- a/cordova-lib/spec-plugman/fetch.spec.js
+++ b/cordova-lib/spec-plugman/fetch.spec.js
@@ -64,7 +64,7 @@ describe('fetch', function() {
         beforeEach(function() {
             rm = spyOn(shell, 'rm');
             sym = spyOn(fs, 'symlinkSync');
-            cp = spyOn(shell, 'cp').andCallThrough();
+            cp = spyOn(shell, 'cp').and.callThrough();
             save_metadata = spyOn(metadata, 'save_fetch_metadata');
             realrm('-rf', temp);
             fetch.__set__('localPlugins', null);
@@ -121,11 +121,11 @@ describe('fetch', function() {
         }
 
         beforeEach(function() {
-            clone = spyOn(plugins, 'clonePluginGitRepo').andReturn(Q(test_plugin));
+            clone = spyOn(plugins, 'clonePluginGitRepo').and.returnValue(Q(test_plugin));
             save_metadata = spyOn(metadata, 'save_fetch_metadata');
             done = false;
         });
-        it('should call clonePluginGitRepo for https:// and git:// based urls', function() {
+        it('should call clonePluginGitRepo for https:// and git:// based urls', function(done) {
             var url = 'https://github.com/bobeast/GAPlugin.git';
             runs(function() {
                 fetchPromise(fetch(url, temp));
@@ -137,67 +137,58 @@ describe('fetch', function() {
                 expect(save_metadata).toHaveBeenCalled();
             });
         });
-        it('should call clonePluginGitRepo with subdir if applicable', function() {
+        
+        it('should call clonePluginGitRepo with subdir if applicable', function(done) {
             var url = 'https://github.com/bobeast/GAPlugin.git';
             var dir = 'fakeSubDir';
-            runs(function() {
-                fetchPromise(fetch(url, temp, { subdir: dir }));
-            });
-            waitsFor(function() { return done; }, 'fetch promise never resolved', 250);
-            runs(function() {
+            fetch(url, temp, { subdir: dir }).then(function(){
                 expect(clone).toHaveBeenCalledWith(url, temp, dir, undefined, undefined);
                 expect(save_metadata).toHaveBeenCalled();
+                done();
             });
-        });
-        it('should call clonePluginGitRepo with subdir and git ref if applicable', function() {
+        }, 6000);
+
+        it('should call clonePluginGitRepo with subdir and git ref if applicable', function(done) {
             var url = 'https://github.com/bobeast/GAPlugin.git';
             var dir = 'fakeSubDir';
             var ref = 'fakeGitRef';
-            runs(function() {
-                fetchPromise(fetch(url, temp, { subdir: dir, git_ref: ref }));
-            });
-            waitsFor(function() { return done; }, 'fetch promise never resolved', 250);
-            runs(function() {
+            fetch(url, temp, { subdir: dir, git_ref: ref }).then(function(){
                 expect(clone).toHaveBeenCalledWith(url, temp, dir, ref, undefined);
                 expect(save_metadata).toHaveBeenCalled();
+                done();
             });
-        });
-        it('should extract the git ref from the URL hash, if provided', function() {
+        }, 6000);
+
+        it('should extract the git ref from the URL hash, if provided', function(done) {
             var url = 'https://github.com/bobeast/GAPlugin.git#fakeGitRef';
             var baseURL = 'https://github.com/bobeast/GAPlugin.git';
-            runs(function() {
-                fetchPromise(fetch(url, temp, {}));
-            });
-            waitsFor(function() { return done; }, 'fetch promise never resolved', 250);
-            runs(function() {
+            fetch(url, temp, {}).then(function(){
                 expect(clone).toHaveBeenCalledWith(baseURL, temp, '.', 'fakeGitRef', undefined);
                 expect(save_metadata).toHaveBeenCalled();
+                done();
             });
-        });
-        it('should extract the subdir from the URL hash, if provided', function() {
+        }, 6000);
+
+        it('should extract the subdir from the URL hash, if provided', function(done) {
             var url = 'https://github.com/bobeast/GAPlugin.git#:fakeSubDir';
             var baseURL = 'https://github.com/bobeast/GAPlugin.git';
-            runs(function() {
-                fetchPromise(fetch(url, temp, {}));
-            });
-            waitsFor(function() { return done; }, 'fetch promise never resolved', 250);
-            runs(function() {
+            fetch(url, temp, {}).then(function(result){
                 expect(clone).toHaveBeenCalledWith(baseURL, temp, 'fakeSubDir', undefined, undefined);
                 expect(save_metadata).toHaveBeenCalled();
+                done();
             });
-        });
-        it('should extract the git ref and subdir from the URL hash, if provided', function() {
+        }, 6000);
+
+        it('should extract the git ref and subdir from the URL hash, if provided', function(done) {
             var url = 'https://github.com/bobeast/GAPlugin.git#fakeGitRef:/fake/Sub/Dir/';
             var baseURL = 'https://github.com/bobeast/GAPlugin.git';
-            runs(function() {
-                fetchPromise(fetch(url, temp, {}));
-            });
-            waitsFor(function() { return done; }, 'fetch promise never resolved', 250);
-            runs(function() {
+            fetch(url, temp, {}).then(function(result){
                 expect(clone).toHaveBeenCalledWith(baseURL, temp, 'fake/Sub/Dir', 'fakeGitRef', undefined);
                 expect(save_metadata).toHaveBeenCalled();
+                done();
             });
-        });
+        }, 6000);
+
         it('should fail when the expected ID doesn\'t match', function(done) {
             fetch('https://github.com/bobeast/GAPlugin.git', temp, { expected_id: 'wrongID' })
             .then(function() {
@@ -264,7 +255,7 @@ describe('fetch', function() {
         else {
             it('should skip copy to avoid recursive error', function(done) {
 
-                var cp = spyOn(shell, 'cp').andCallFake(function(){});
+                var cp = spyOn(shell, 'cp').and.callFake(function(){});
 
                 wrapper(fetch(srcDir, appDir),done, function() {
                     expect(cp).not.toHaveBeenCalled();
@@ -281,7 +272,7 @@ describe('fetch', function() {
             rm = spyOn(shell, 'rm');
             sym = spyOn(fs, 'symlinkSync');
             save_metadata = spyOn(metadata, 'save_fetch_metadata');
-            sFetch = spyOn(registry, 'fetch').andReturn(Q(test_plugin));
+            sFetch = spyOn(registry, 'fetch').and.returnValue(Q(test_plugin));
             realrm('-rf', temp);
         });
 

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/0e0d7a55/cordova-lib/spec-plugman/info.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/info.spec.js b/cordova-lib/spec-plugman/info.spec.js
index 7b4e460..3939abe 100644
--- a/cordova-lib/spec-plugman/info.spec.js
+++ b/cordova-lib/spec-plugman/info.spec.js
@@ -22,7 +22,7 @@ var search = require('../src/plugman/info'),
 
 describe('info', function() {
     it('should show plugin info', function() {
-        var sSearch = spyOn(registry, 'info').andReturn(Q({
+        var sSearch = spyOn(registry, 'info').and.returnValue(Q({
             name: 'fakePlugin',
             version: '1.0.0',
             engines: [{ name: 'plugman', version: '>=0.11' }]


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


Mime
View raw message