You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ag...@apache.org on 2014/04/25 16:51:28 UTC

git commit: Fix unit tests when running node v0.11

Repository: cordova-plugman
Updated Branches:
  refs/heads/master 0a0d3841e -> 21ae0e499


Fix unit tests when running node v0.11


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/21ae0e49
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/21ae0e49
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/21ae0e49

Branch: refs/heads/master
Commit: 21ae0e4994183ce0e8e09839cdf770b4e7e12948
Parents: 0a0d384
Author: Andrew Grieve <ag...@chromium.org>
Authored: Fri Apr 25 10:51:10 2014 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Fri Apr 25 10:51:10 2014 -0400

----------------------------------------------------------------------
 package.json                   | 2 +-
 spec/add_platform.spec.js      | 4 ++--
 spec/create.spec.js            | 2 +-
 spec/fetch.spec.js             | 8 ++++----
 spec/install.spec.js           | 8 ++++----
 spec/uninstall.spec.js         | 8 ++++----
 spec/util/action-stack.spec.js | 6 +++---
 spec/wrappers.spec.js          | 5 +++--
 8 files changed, 22 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/21ae0e49/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index 01634a5..a70e882 100644
--- a/package.json
+++ b/package.json
@@ -35,7 +35,7 @@
   },
   "devDependencies": {
     "temp": "0.6.x",
-    "jasmine-node": "1.7.0",
+    "jasmine-node": "~1",
     "osenv": "0.0.x"
   },
   "bin" : { "plugman" : "./main.js" },

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/21ae0e49/spec/add_platform.spec.js
----------------------------------------------------------------------
diff --git a/spec/add_platform.spec.js b/spec/add_platform.spec.js
index 3984de4..18bad02 100644
--- a/spec/add_platform.spec.js
+++ b/spec/add_platform.spec.js
@@ -34,7 +34,7 @@ describe( 'platform add', function() {
         });
         waitsFor(function() { return done; }, 'platform promise never resolved', 500);
         runs(function() {
-            expect( done ).toEqual( new Error( "can't find a plugin.xml.  Are you in the plugin?" ) );
+            expect(''+ done ).toContain( "can't find a plugin.xml.  Are you in the plugin?"  );
         });
     });
 });
@@ -58,7 +58,7 @@ describe( 'platform remove', function() {
         });
         waitsFor(function() { return done; }, 'platform promise never resolved', 500);
         runs(function() {
-            expect( done ).toEqual( new Error( "can't find a plugin.xml.  Are you in the plugin?" ) );
+            expect(''+ done ).toContain( "can't find a plugin.xml.  Are you in the plugin?"  );
         });
     });
 });

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/21ae0e49/spec/create.spec.js
----------------------------------------------------------------------
diff --git a/spec/create.spec.js b/spec/create.spec.js
index 2fd171b..afc034a 100644
--- a/spec/create.spec.js
+++ b/spec/create.spec.js
@@ -56,7 +56,7 @@ describe( 'create plugin in existing plugin', function() {
         });
         waitsFor(function() { return done; }, 'create promise never resolved', 500);
         runs(function() {
-            expect( done ).toEqual( new Error( 'Error: plugin.xml already exists. Are you already in a plugin?' ) );
+            expect(''+ done ).toContain( 'Error: plugin.xml already exists. Are you already in a plugin?'  );
         });
     });
 });

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/21ae0e49/spec/fetch.spec.js
----------------------------------------------------------------------
diff --git a/spec/fetch.spec.js b/spec/fetch.spec.js
index b2f6dac..2a0b660 100644
--- a/spec/fetch.spec.js
+++ b/spec/fetch.spec.js
@@ -54,7 +54,7 @@ describe('fetch', function() {
             .then(function() {
                 expect('this call').toBe('fail');
             }, function(err) {
-                expect(err).toEqual(new Error('Expected fetched plugin to have ID "wrongID" but got "id".'));
+                expect(''+err).toContain('Expected fetched plugin to have ID "wrongID" but got "id".');
             }).fin(done);
         });
         it('should succeed when the expected ID is correct', function(done) {
@@ -157,7 +157,7 @@ describe('fetch', function() {
             });
             waitsFor(function() { return done; }, 'fetch promise never resolved', 250);
             runs(function() {
-                expect(done).toEqual(new Error('--link is not supported for git URLs'));
+                expect(''+done).toContain('--link is not supported for git URLs');
             });
         });
         it('should fail when the expected ID doesn\'t match', function(done) {
@@ -165,7 +165,7 @@ describe('fetch', function() {
             .then(function() {
                 expect('this call').toBe('fail');
             }, function(err) {
-                expect(err).toEqual(new Error('Expected fetched plugin to have ID "wrongID" but got "id".'));
+                expect(''+err).toContain('Expected fetched plugin to have ID "wrongID" but got "id".');
             }).fin(done);
         });
         it('should succeed when the expected ID is correct', function(done) {
@@ -199,7 +199,7 @@ describe('fetch', function() {
             .then(function() {
                 expect('this call').toBe('fail');
             }, function(err) {
-                expect(err).toEqual(new Error('Expected fetched plugin to have ID "wrongID" but got "id".'));
+                expect(''+err).toContain('Expected fetched plugin to have ID "wrongID" but got "id".');
             }).fin(done);
         });
         it('should succeed when the expected ID is correct', function(done) {

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/21ae0e49/spec/install.spec.js
----------------------------------------------------------------------
diff --git a/spec/install.spec.js b/spec/install.spec.js
index 732eb24..20a3d37 100644
--- a/spec/install.spec.js
+++ b/spec/install.spec.js
@@ -413,7 +413,7 @@ describe('install', function() {
             });
             waitsFor(function() { return done; }, 'install promise never resolved', 200);
             runs(function() {
-                expect(done).toEqual(new Error('atari not supported.'));
+                expect(''+done).toContain('atari not supported.');
             });
         });
         it('should throw if variables are missing', function() {
@@ -422,7 +422,7 @@ describe('install', function() {
             });
             waitsFor(function(){ return done; }, 'install promise never resolved', 200);
             runs(function() {
-                expect(done).toEqual(new Error('Variable(s) missing: API_KEY'));
+                expect(''+done).toContain('Variable(s) missing: API_KEY');
             });
         });
         it('should throw if git is not found on the path and a remote url is requested', function() {
@@ -433,7 +433,7 @@ describe('install', function() {
             });
             waitsFor(function(){ return done; }, 'install promise never resolved', 200);
             runs(function() {
-                expect(done).toEqual(new Error('"git" command line tool is not installed: make sure it is accessible on your PATH.'));
+                expect(''+done).toContain('"git" command line tool is not installed: make sure it is accessible on your PATH.');
             });
         });
         it('should throw if plugin version is less than the minimum requirement', function(){
@@ -446,7 +446,7 @@ describe('install', function() {
             });
             waitsFor(function(){ return done; }, 'install promise never resolved', 200);
             runs(function() {
-                expect(done).toEqual(new Error('Plugin doesn\'t support this project\'s cordova version. cordova: 0.0.1, failed version requirement: >=2.3.0'));
+                expect(''+done).toContain('Plugin doesn\'t support this project\'s cordova version. cordova: 0.0.1, failed version requirement: >=2.3.0');
             });
         });
     });

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/21ae0e49/spec/uninstall.spec.js
----------------------------------------------------------------------
diff --git a/spec/uninstall.spec.js b/spec/uninstall.spec.js
index a0c903c..a8c2b97 100644
--- a/spec/uninstall.spec.js
+++ b/spec/uninstall.spec.js
@@ -127,7 +127,7 @@ describe('uninstallPlatform', function() {
             });
             waitsFor(function() { return done; }, 'promise never resolved', 200);
             runs(function() {
-                expect(done).toEqual(new Error('atari not supported.'));
+                expect(''+done).toContain('atari not supported.');
             });
         });
         it('should throw if plugin is missing', function() {
@@ -136,7 +136,7 @@ describe('uninstallPlatform', function() {
             });
             waitsFor(function() { return done; }, 'promise never resolved', 200);
             runs(function() {
-                expect(done).toEqual(new Error('Plugin "SomePluginThatDoesntExist" not found. Already uninstalled?'));
+                expect(''+done).toContain('Plugin "SomePluginThatDoesntExist" not found. Already uninstalled?');
             });
         });
     });
@@ -237,7 +237,7 @@ describe('uninstall', function() {
             });
             waitsFor(function() { return done; }, 'promise never resolved', 200);
             runs(function() {
-                expect(done).toEqual(new Error('atari not supported.'));
+                expect(''+done).toContain('atari not supported.');
             });
         });
         it('should throw if plugin is missing', function() {
@@ -246,7 +246,7 @@ describe('uninstall', function() {
             });
             waitsFor(function() { return done; }, 'promise never resolved', 200);
             runs(function() {
-                expect(done).toEqual(new Error('Plugin "SomePluginThatDoesntExist" not found. Already uninstalled?'));
+                expect(''+done).toContain('Plugin "SomePluginThatDoesntExist" not found. Already uninstalled?');
             });
         });
     });

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/21ae0e49/spec/util/action-stack.spec.js
----------------------------------------------------------------------
diff --git a/spec/util/action-stack.spec.js b/spec/util/action-stack.spec.js
index 8950240..3aa732f 100644
--- a/spec/util/action-stack.spec.js
+++ b/spec/util/action-stack.spec.js
@@ -28,9 +28,9 @@ describe('action-stack', function() {
             var first_args = [1];
             var first_reverter = jasmine.createSpy();
             var first_reverter_args = [true];
-            var process_err = 'quit peein\' on my rug, man.';
+            var process_err = new Error('process_err');
             var second_spy = jasmine.createSpy().andCallFake(function() {
-                throw new Error(process_err);
+                throw process_err;
             });
             var second_args = [2];
             var third_spy = jasmine.createSpy();
@@ -45,7 +45,7 @@ describe('action-stack', function() {
             });
             waitsFor(function(){ return error; }, 'process promise never resolved', 500);
             runs(function() {
-                expect(error).toEqual(new Error('Uh oh!\n' + process_err));
+                expect(error).toEqual(process_err);
                 // first two actions should have been called, but not the third
                 expect(first_spy).toHaveBeenCalledWith(first_args[0]);
                 expect(second_spy).toHaveBeenCalledWith(second_args[0]);

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/21ae0e49/spec/wrappers.spec.js
----------------------------------------------------------------------
diff --git a/spec/wrappers.spec.js b/spec/wrappers.spec.js
index bec747b..3e61eb7 100644
--- a/spec/wrappers.spec.js
+++ b/spec/wrappers.spec.js
@@ -27,9 +27,10 @@ describe('callback wrapper', function() {
             });
 
             it('should call the callback with the error on failure', function(done) {
-                raw.andCallFake(function() { return Q.reject(new Error('junk'))});
+                var err = new Error('junk');
+                raw.andCallFake(function() { return Q.reject(err)});
                 plugman[call](function(err) {
-                    expect(err).toEqual(new Error('junk'));
+                    expect(err).toEqual(err);
                     done();
                 });
             });