You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ra...@apache.org on 2019/11/22 15:43:24 UTC

[cordova-coho] branch master updated: chore: lint everything (#249)

This is an automated email from the ASF dual-hosted git repository.

raphinesse pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-coho.git


The following commit(s) were added to refs/heads/master by this push:
     new ba95176  chore: lint everything (#249)
ba95176 is described below

commit ba951761b7047c7dbed1f89c455cb3cab556b7ec
Author: Raphael von der GrĂ¼n <ra...@gmail.com>
AuthorDate: Fri Nov 22 16:43:18 2019 +0100

    chore: lint everything (#249)
    
    * chore: lint everything
    
    * chore: apply automatic ESLint fixes
    
    * chore: manual code style fixes
---
 package.json             |   2 +-
 spec/.eslintrc.yml       |   2 +
 spec/apputil.spec.js     |  46 +++++------
 spec/executil.spec.js    | 104 ++++++++++++------------
 spec/flagutil.spec.js    |  92 ++++++++++-----------
 spec/gitutil.spec.js     |  92 +++++++++------------
 spec/repoutil.spec.js    |  76 +++++++++---------
 spec/versionutil.spec.js | 205 +++++++++++++++++++++++------------------------
 8 files changed, 298 insertions(+), 321 deletions(-)

diff --git a/package.json b/package.json
index 5d5a6bb..d3664da 100644
--- a/package.json
+++ b/package.json
@@ -45,7 +45,7 @@
     "tape-test": "node test/test.js | tap-spec",
     "cover": "istanbul cover --root src --print detail jasmine",
     "jasmine": "jasmine",
-    "eslint": "eslint test && eslint src"
+    "eslint": "eslint ."
   },
   "repository": {
     "type": "git",
diff --git a/spec/.eslintrc.yml b/spec/.eslintrc.yml
new file mode 100644
index 0000000..4a1b243
--- /dev/null
+++ b/spec/.eslintrc.yml
@@ -0,0 +1,2 @@
+env:
+  jasmine: true
\ No newline at end of file
diff --git a/spec/apputil.spec.js b/spec/apputil.spec.js
index fa1351d..1385343 100644
--- a/spec/apputil.spec.js
+++ b/spec/apputil.spec.js
@@ -18,32 +18,30 @@ under the License.
 */
 
 var path = require('path');
-var chalk = require('chalk');
-var shell = require('shelljs');
 var apputil = require('../src/apputil');
 
-describe("apputil unit tests", function () {
+describe('apputil unit tests', function () {
 
-	it("Test#001 : print", function() {
-		spyOn(path, "relative").and.returnValue(true);
-		spyOn(console.log,"apply").and.returnValue(true);
-		apputil.print();
-		expect(path.relative.calls.count()).toEqual(0);
-		expect(console.log.apply.calls.count()).toEqual(1);
-	});
+    it('Test#001 : print', function () {
+        spyOn(path, 'relative').and.returnValue(true);
+        spyOn(console.log, 'apply').and.returnValue(true);
+        apputil.print();
+        expect(path.relative.calls.count()).toEqual(0);
+        expect(console.log.apply.calls.count()).toEqual(1);
+    });
 
-	it("Test#002 : fatal", function() {
-		spyOn(console.error,"apply").and.returnValue(false);
-		spyOn(process,"exit").and.returnValue(false);
-		apputil.fatal();
-		expect(console.error.apply.calls.count()).toEqual(1);
-		expect(process.exit.calls.count()).toEqual(1);
-	});
+    it('Test#002 : fatal', function () {
+        spyOn(console.error, 'apply').and.returnValue(false);
+        spyOn(process, 'exit').and.returnValue(false);
+        apputil.fatal();
+        expect(console.error.apply.calls.count()).toEqual(1);
+        expect(process.exit.calls.count()).toEqual(1);
+    });
 
-	it("Test#003 : initWorkingDir", function() {
-		spyOn(console,"log").and.returnValue(false);
-		apputil.initWorkingDir(true);
-		expect(console.log.calls.count()).toEqual(1);
-		expect(console.log.calls.allArgs()).toMatch("Running from");
-	});
-});
\ No newline at end of file
+    it('Test#003 : initWorkingDir', function () {
+        spyOn(console, 'log').and.returnValue(false);
+        apputil.initWorkingDir(true);
+        expect(console.log.calls.count()).toEqual(1);
+        expect(console.log.calls.allArgs()).toMatch('Running from');
+    });
+});
diff --git a/spec/executil.spec.js b/spec/executil.spec.js
index 6701761..4799087 100644
--- a/spec/executil.spec.js
+++ b/spec/executil.spec.js
@@ -17,68 +17,68 @@ specific language governing permissions and limitations
 under the License.
 */
 
-var jasmine_co = require('jasmine-co').install();
+require('jasmine-co').install();
 var executil = require('../src/executil');
 var superspawn = require('../src/superspawn');
 var apputil = require('../src/apputil');
-var Q = require("q");
+var Q = require('q');
 var deferred = Q.defer();
 var TIMEOUT = 60000;
-var androidRepo = { title: 'Android', 
-	id: 'android',
-	repoName: 'cordova-android',
-	jiraComponentName: 'Android',
-	cordovaJsPaths: [ 'bin/templates/project/assets/www/cordova.js' ],
-	remoteName: 'origin' };
+var androidRepo = { title: 'Android',
+    id: 'android',
+    repoName: 'cordova-android',
+    jiraComponentName: 'Android',
+    cordovaJsPaths: [ 'bin/templates/project/assets/www/cordova.js' ],
+    remoteName: 'origin' };
 
-describe("executil unit tests", function () {
-	beforeEach(function () {
-		spyOn(apputil, "print").and.returnValue(true);
-		spyOn(superspawn, "spawn").and.returnValue(deferred.promise);
-	});
+describe('executil unit tests', function () {
+    beforeEach(function () {
+        spyOn(apputil, 'print').and.returnValue(true);
+        spyOn(superspawn, 'spawn').and.returnValue(deferred.promise);
+    });
 
-	afterEach(function () {
-		apputil.print.calls.reset();
-	});
+    afterEach(function () {
+        apputil.print.calls.reset();
+    });
 
-	it("Test#001 : no commits are made", function () {
-		executil.reportGitPushResult(androidRepo, ['master', 'null']);
-		expect(apputil.print.calls.count()).toEqual(2);
-		expect(apputil.print.calls.argsFor(1)[0]).toEqual('All work complete. No commits were made.');
-	},TIMEOUT);
+    it('Test#001 : no commits are made', function () {
+        executil.reportGitPushResult(androidRepo, ['master', 'null']);
+        expect(apputil.print.calls.count()).toEqual(2);
+        expect(apputil.print.calls.argsFor(1)[0]).toEqual('All work complete. No commits were made.');
+    }, TIMEOUT);
 
-	it("Test#002 : Don't print command, don't print output", function () {
-		executil.execHelper([ 'git', 'symbolic-ref', 'HEAD' ], true, true);
-		expect(apputil.print.calls.count()).toEqual(0);
-		expect(apputil.print.calls.allArgs()).toEqual([  ]);
-		expect(superspawn.spawn.calls.argsFor(0)[2]).toEqual(Object({ stdio: 'default' }));
-	},TIMEOUT);
+    it("Test#002 : Don't print command, don't print output", function () {
+        executil.execHelper([ 'git', 'symbolic-ref', 'HEAD' ], true, true);
+        expect(apputil.print.calls.count()).toEqual(0);
+        expect(apputil.print.calls.allArgs()).toEqual([ ]);
+        expect(superspawn.spawn.calls.argsFor(0)[2]).toEqual(Object({ stdio: 'default' }));
+    }, TIMEOUT);
 
-	it("Test#003 : Print command and output", function () {
-		executil.execHelper([ 'git', 'symbolic-ref', 'HEAD' ], false, true);
-		expect(apputil.print.calls.count()).toEqual(1);
-		expect(apputil.print.calls.argsFor(0)[0]).toEqual('Executing:');
-		expect(apputil.print.calls.argsFor(0)[1]).toEqual('git symbolic-ref HEAD');
-		expect(superspawn.spawn.calls.argsFor(0)[2]).toEqual(Object({ stdio: 'inherit' }));
-	},TIMEOUT);
+    it('Test#003 : Print command and output', function () {
+        executil.execHelper([ 'git', 'symbolic-ref', 'HEAD' ], false, true);
+        expect(apputil.print.calls.count()).toEqual(1);
+        expect(apputil.print.calls.argsFor(0)[0]).toEqual('Executing:');
+        expect(apputil.print.calls.argsFor(0)[1]).toEqual('git symbolic-ref HEAD');
+        expect(superspawn.spawn.calls.argsFor(0)[2]).toEqual(Object({ stdio: 'inherit' }));
+    }, TIMEOUT);
 
-	it("Test#004 : Don't print command, print output", function () {
-		executil.execHelper([ 'git', 'symbolic-ref', 'HEAD' ], 2, true);
-		expect(apputil.print.calls.count()).toEqual(0);
-		expect(superspawn.spawn.calls.argsFor(0)[2]).toEqual(Object({ stdio: 'inherit' }));
-	},TIMEOUT);
+    it("Test#004 : Don't print command, print output", function () {
+        executil.execHelper([ 'git', 'symbolic-ref', 'HEAD' ], 2, true);
+        expect(apputil.print.calls.count()).toEqual(0);
+        expect(superspawn.spawn.calls.argsFor(0)[2]).toEqual(Object({ stdio: 'inherit' }));
+    }, TIMEOUT);
 
-	it("Test#005 : Print command, don't print output", function () {
-		executil.execHelper([ 'git', 'symbolic-ref', 'HEAD' ], 3, true);
-		expect(apputil.print.calls.count()).toEqual(1);
-		expect(apputil.print.calls.argsFor(0)[0]).toEqual('Executing:');
-		expect(apputil.print.calls.argsFor(0)[1]).toEqual('git symbolic-ref HEAD');
-		expect(superspawn.spawn.calls.argsFor(0)[2]).toEqual(Object({ stdio: 'default' }));
-	},TIMEOUT);
+    it("Test#005 : Print command, don't print output", function () {
+        executil.execHelper([ 'git', 'symbolic-ref', 'HEAD' ], 3, true);
+        expect(apputil.print.calls.count()).toEqual(1);
+        expect(apputil.print.calls.argsFor(0)[0]).toEqual('Executing:');
+        expect(apputil.print.calls.argsFor(0)[1]).toEqual('git symbolic-ref HEAD');
+        expect(superspawn.spawn.calls.argsFor(0)[2]).toEqual(Object({ stdio: 'default' }));
+    }, TIMEOUT);
 
-	it("Test#006 : pretending to run", function* () {
-		var executilExecOrPretend = yield executil.execOrPretend([ 'git', 'symbolic-ref', 'HEAD' ], 'pretend');
-		expect(apputil.print.calls.count()).toEqual(1);
-		expect(apputil.print.calls.argsFor(0)[0]).toEqual('PRETENDING TO RUN: git symbolic-ref HEAD');
-	},TIMEOUT);
-});
\ No newline at end of file
+    it('Test#006 : pretending to run', function * () {
+        yield executil.execOrPretend([ 'git', 'symbolic-ref', 'HEAD' ], 'pretend');
+        expect(apputil.print.calls.count()).toEqual(1);
+        expect(apputil.print.calls.argsFor(0)[0]).toEqual('PRETENDING TO RUN: git symbolic-ref HEAD');
+    }, TIMEOUT);
+});
diff --git a/spec/flagutil.spec.js b/spec/flagutil.spec.js
index 476353f..13f70cd 100644
--- a/spec/flagutil.spec.js
+++ b/spec/flagutil.spec.js
@@ -17,62 +17,58 @@ specific language governing permissions and limitations
 under the License.
 */
 
-var path = require('path');
-
 var apputil = require('../src/apputil');
-var repoutil = require('../src/repoutil');
 var flagutil = require('../src/flagutil');
 
 var TIMEOUT = 60000;
 
-describe("flagutil unit tests", function () {
+describe('flagutil unit tests', function () {
 
-	it("Test#001 : validate the version that is passed in", function () {
-		spyOn(console,"log").and.returnValue(false);
-		spyOn(apputil, "fatal");
-		flagutil.validateVersionString('6.3.0');
-		expect(flagutil.validateVersionString('6.3.0')).toEqual('6.3.0');
-		expect(apputil.fatal.calls.count()).toEqual(0);
-	},TIMEOUT);
+    it('Test#001 : validate the version that is passed in', function () {
+        spyOn(console, 'log').and.returnValue(false);
+        spyOn(apputil, 'fatal');
+        flagutil.validateVersionString('6.3.0');
+        expect(flagutil.validateVersionString('6.3.0')).toEqual('6.3.0');
+        expect(apputil.fatal.calls.count()).toEqual(0);
+    }, TIMEOUT);
 
-	it("Test#002 : computeReposFromFlag returns correct repo (platform) info", function () {
-		var repo = flagutil.computeReposFromFlag('android');
-		expect(repo).toEqual(
-			[ Object({
-			title: 'Android',
-			versions: [ '4.4', '5.0', '5.1', '6.0', '7.0', '7.1' ],
-			id: 'android',
-			repoName: 'cordova-android',
-			jiraComponentName: 'cordova-android',
-			cordovaJsPaths: [ 'bin/templates/project/assets/www/cordova.js' ] }) ]
-		);
-	},TIMEOUT);
+    it('Test#002 : computeReposFromFlag returns correct repo (platform) info', function () {
+        var repo = flagutil.computeReposFromFlag('android');
+        expect(repo).toEqual(
+            [ Object({
+                title: 'Android',
+                versions: [ '4.4', '5.0', '5.1', '6.0', '7.0', '7.1' ],
+                id: 'android',
+                repoName: 'cordova-android',
+                jiraComponentName: 'cordova-android',
+                cordovaJsPaths: [ 'bin/templates/project/assets/www/cordova.js' ] }) ]
+        );
+    }, TIMEOUT);
 
-	it("Test#003 : computeReposFromFlag returns correct repo (plugin) info", function () {
-		var repo = flagutil.computeReposFromFlag('plugin-camera');
-		expect(repo).toEqual(
-		[ { title: 'Plugin - Camera',
-		    id: 'plugin-camera',
-		    repoName: 'cordova-plugin-camera',
-		    jiraComponentName: 'cordova-plugin-camera' } ]
-		);
-	},TIMEOUT);
+    it('Test#003 : computeReposFromFlag returns correct repo (plugin) info', function () {
+        var repo = flagutil.computeReposFromFlag('plugin-camera');
+        expect(repo).toEqual(
+            [ { title: 'Plugin - Camera',
+                id: 'plugin-camera',
+                repoName: 'cordova-plugin-camera',
+                jiraComponentName: 'cordova-plugin-camera' } ]
+        );
+    }, TIMEOUT);
 
-	it("Test#004 : computeReposFromFlag returns correct repo (docs) info", function () {
-		var repo = flagutil.computeReposFromFlag('docs');
-		expect(repo).toEqual(
-		[ { title: 'Docs',
-		    id: 'docs',
-		    repoName: 'cordova-docs',
-		    jiraComponentName: 'cordova-docs' } ]
-		);
-	},TIMEOUT);
+    it('Test#004 : computeReposFromFlag returns correct repo (docs) info', function () {
+        var repo = flagutil.computeReposFromFlag('docs');
+        expect(repo).toEqual(
+            [ { title: 'Docs',
+                id: 'docs',
+                repoName: 'cordova-docs',
+                jiraComponentName: 'cordova-docs' } ]
+        );
+    }, TIMEOUT);
 
-	it("Test#005 : passing in a non-repo is invalid", function () {
-		spyOn(apputil, "fatal");
-		var nonRepo = flagutil.computeReposFromFlag('nonRepo');
-		expect(apputil.fatal.calls.count()).toEqual(1);
-		expect(apputil.fatal.calls.argsFor(0)[0]).toMatch('Invalid repo value: nonRepo');
-	},TIMEOUT);
+    it('Test#005 : passing in a non-repo is invalid', function () {
+        spyOn(apputil, 'fatal');
+        flagutil.computeReposFromFlag('nonRepo');
+        expect(apputil.fatal.calls.count()).toEqual(1);
+        expect(apputil.fatal.calls.argsFor(0)[0]).toMatch('Invalid repo value: nonRepo');
+    }, TIMEOUT);
 });
-
diff --git a/spec/gitutil.spec.js b/spec/gitutil.spec.js
index 1bc09d0..1588055 100644
--- a/spec/gitutil.spec.js
+++ b/spec/gitutil.spec.js
@@ -17,63 +17,45 @@ specific language governing permissions and limitations
 under the License.
 */
 
-var jasmine_co = require('jasmine-co').install();
-var path = require('path');
+require('jasmine-co').install();
 var executil = require('../src/executil');
 var gitutilJS = require('../src/gitutil');
-var gitutil = exports;
-var semver = require('semver');
 var TIMEOUT = 60000;
-var androidRepo = { title: 'Android', 
-	id: 'android',
-	repoName: 'cordova-android',
-	jiraComponentName: 'Android',
-	cordovaJsPaths: [ 'bin/templates/project/assets/www/cordova.js' ],
-	remoteName: 'origin' };
 
-describe("gitutil unit tests", function () {
-	beforeEach(function* () {
-		spyOn(executil,'execHelper').and.callFake(function() {
-			return function* (){return true};
-		});
-		spyOn(executil,'ARGS').and.callFake(function() {
-			return function* (){return true};
-		});
-	});
-	it("Test#001 : validate the version that is passed in", function* () {
-		var gitutilTagExists = yield gitutilJS.tagExists('6.3.0');
-		expect(executil.execHelper.calls.count()).toEqual(1);
-		expect(executil.ARGS.calls.count()).toEqual(1);
-		expect(executil.ARGS.calls.argsFor(0)[0]).toEqual("git tag --list 6.3.0");
-	},TIMEOUT);
-
-	/* XXX TBD LOOKS BROKEN:
-	it("Test#002 : validate remote branch", function* () {
-		var gitutilRemoteBranch = yield gitutilJS.remoteBranchExists('android', 'name');
-		expect(executil.execHelper.calls.count()).toEqual(1);
-		expect(executil.ARGS.calls.count()).toEqual(1);
-		expect(executil.ARGS.calls.argsFor(0)[0]).toEqual("git branch -r --list undefined/name");
-	},TIMEOUT);
-	// */
-
-	it("Test#003 : validate pending changes", function* () {
-		var gitutilPendingChanges = yield gitutilJS.pendingChangesExist();
-		expect(executil.execHelper.calls.count()).toEqual(1);
-		expect(executil.ARGS.calls.count()).toEqual(1);
-		expect(executil.ARGS.calls.argsFor(0)[0]).toEqual("git status --porcelain");
-	},TIMEOUT);
-
-	it("Test#004 : reseting from origin", function* () {
-		var gitutilReset = yield gitutilJS.resetFromOrigin();
-		expect(executil.execHelper.calls.count()).toEqual(1);
-		expect(executil.ARGS.calls.count()).toEqual(1);
-		expect(executil.ARGS.calls.argsFor(0)[0]).toEqual("git reset --hard origin/master");
-	},TIMEOUT);
-
-	it("Test#005 : git clean", function* () {
-		var gitutilClean = yield gitutilJS.gitClean();
-		expect(executil.execHelper.calls.count()).toEqual(1);
-		expect(executil.ARGS.calls.count()).toEqual(1);
-		expect(executil.ARGS.calls.argsFor(0)[0]).toEqual("git clean -d -f");
-	},TIMEOUT);
+describe('gitutil unit tests', function () {
+    beforeEach(function * () {
+        spyOn(executil, 'execHelper').and.callFake(function () {
+            return function * () { return true; };
+        });
+        spyOn(executil, 'ARGS').and.callFake(function () {
+            return function * () { return true; };
+        });
+    });
+    it('Test#001 : validate the version that is passed in', function * () {
+        yield gitutilJS.tagExists('6.3.0');
+        expect(executil.execHelper.calls.count()).toEqual(1);
+        expect(executil.ARGS.calls.count()).toEqual(1);
+        expect(executil.ARGS.calls.argsFor(0)[0]).toEqual('git tag --list 6.3.0');
+    }, TIMEOUT);
+
+    it('Test#003 : validate pending changes', function * () {
+        yield gitutilJS.pendingChangesExist();
+        expect(executil.execHelper.calls.count()).toEqual(1);
+        expect(executil.ARGS.calls.count()).toEqual(1);
+        expect(executil.ARGS.calls.argsFor(0)[0]).toEqual('git status --porcelain');
+    }, TIMEOUT);
+
+    it('Test#004 : reseting from origin', function * () {
+        yield gitutilJS.resetFromOrigin();
+        expect(executil.execHelper.calls.count()).toEqual(1);
+        expect(executil.ARGS.calls.count()).toEqual(1);
+        expect(executil.ARGS.calls.argsFor(0)[0]).toEqual('git reset --hard origin/master');
+    }, TIMEOUT);
+
+    it('Test#005 : git clean', function * () {
+        yield gitutilJS.gitClean();
+        expect(executil.execHelper.calls.count()).toEqual(1);
+        expect(executil.ARGS.calls.count()).toEqual(1);
+        expect(executil.ARGS.calls.argsFor(0)[0]).toEqual('git clean -d -f');
+    }, TIMEOUT);
 });
diff --git a/spec/repoutil.spec.js b/spec/repoutil.spec.js
index 7a0b464..1aa11af 100644
--- a/spec/repoutil.spec.js
+++ b/spec/repoutil.spec.js
@@ -17,9 +17,8 @@ specific language governing permissions and limitations
 under the License.
 */
 
-var jasmine_co = require('jasmine-co').install();
+require('jasmine-co').install();
 
-var fs = require('fs');
 var path = require('path');
 
 var shelljs = require('shelljs');
@@ -30,11 +29,11 @@ var repoutil = require('../src/repoutil');
 var TIMEOUT = 60000;
 
 var androidRepo = { title: 'Android',
-	id: 'android',
-	repoName: 'cordova-android',
-	jiraComponentName: 'Android',
-	cordovaJsPaths: [ 'bin/templates/project/assets/www/cordova.js' ],
-	remoteName: 'origin' };
+    id: 'android',
+    repoName: 'cordova-android',
+    jiraComponentName: 'Android',
+    cordovaJsPaths: [ 'bin/templates/project/assets/www/cordova.js' ],
+    remoteName: 'origin' };
 
 var commonRepo = {
     title: 'Cordova Common',
@@ -45,44 +44,45 @@ var commonRepo = {
     versionPrefix: 'common',
     isModule: true };
 
-describe("check functionality of repoutil", function () {
-	it("Test#001 : getRepoDir", function () {
-		spyOn(apputil, "getBaseDir").and.returnValue('path');
-		spyOn(path, "join").and.returnValue(true);
-		repoutil.getRepoDir(commonRepo);
-		expect(apputil.getBaseDir.calls.count()).toEqual(1);
-		expect(path.join.calls.count()).toEqual(2);
-	}, TIMEOUT);
+describe('check functionality of repoutil', function () {
+    it('Test#001 : getRepoDir', function () {
+        spyOn(apputil, 'getBaseDir').and.returnValue('path');
+        spyOn(path, 'join').and.returnValue(true);
+        repoutil.getRepoDir(commonRepo);
+        expect(apputil.getBaseDir.calls.count()).toEqual(1);
+        expect(path.join.calls.count()).toEqual(2);
+    }, TIMEOUT);
 
-	it("Test#002 : repo listed in group, should be true", function () {
-		repoutil.isInRepoGroup(androidRepo, 'platform');
-		expect(repoutil.isInRepoGroup(androidRepo, 'platform')).toEqual(true);
-	}, TIMEOUT);
+    it('Test#002 : repo listed in group, should be true', function () {
+        repoutil.isInRepoGroup(androidRepo, 'platform');
+        expect(repoutil.isInRepoGroup(androidRepo, 'platform')).toEqual(true);
+    }, TIMEOUT);
 
-	it("Test#003 : repo not listed in group, should be false", function () {
-		repoutil.isInRepoGroup(commonRepo, 'platform');
-		expect(repoutil.isInRepoGroup(commonRepo, 'platform')).toEqual(false);
-	}, TIMEOUT);
+    it('Test#003 : repo not listed in group, should be false', function () {
+        repoutil.isInRepoGroup(commonRepo, 'platform');
+        expect(repoutil.isInRepoGroup(commonRepo, 'platform')).toEqual(false);
+    }, TIMEOUT);
 
-	it("Test#004 : testing proper calls are made for forEachRepo function", function* (){
-		spyOn(shelljs , "cd").and.returnValue(true);
-		spyOn(shelljs, "error");
-		spyOn(apputil, "fatal");
-		var x = yield repoutil.forEachRepo([repoutil.getRepoById('coho')], function* () {});
-		expect(shelljs.cd.calls.count()).toEqual(2);
-		expect(shelljs.error.calls.count()).toEqual(1);
-		expect(apputil.fatal.calls.count()).toEqual(0);
-	}, TIMEOUT);
+    it('Test#004 : testing proper calls are made for forEachRepo function', function * () {
+        spyOn(shelljs, 'cd').and.returnValue(true);
+        spyOn(shelljs, 'error');
+        spyOn(apputil, 'fatal');
+        yield repoutil.forEachRepo([repoutil.getRepoById('coho')], function * () {});
+        expect(shelljs.cd.calls.count()).toEqual(2);
+        expect(shelljs.error.calls.count()).toEqual(1);
+        expect(apputil.fatal.calls.count()).toEqual(0);
+    }, TIMEOUT);
 
-    it("Test#005 : getRepoById should return correct repo object ", function () {
+    it('Test#005 : getRepoById should return correct repo object ', function () {
         // Return correct repo object
         repoutil.getRepoById('cordova-android');
         expect(repoutil.getRepoById('cordova-android')).toEqual(Object(
-	        { title: 'Android', id: 'android',
-	        versions: [ '4.4', '5.0', '5.1', '6.0', '7.0', '7.1' ],
-	        repoName: 'cordova-android',
-	        jiraComponentName: 'cordova-android',
-	        cordovaJsPaths: [ 'bin/templates/project/assets/www/cordova.js' ] }
+            { title: 'Android',
+                id: 'android',
+                versions: [ '4.4', '5.0', '5.1', '6.0', '7.0', '7.1' ],
+                repoName: 'cordova-android',
+                jiraComponentName: 'cordova-android',
+                cordovaJsPaths: [ 'bin/templates/project/assets/www/cordova.js' ] }
         ));
         // Return null if opt repos are passed in
         repoutil.getRepoById('cordova-android', 'opt_repos');
diff --git a/spec/versionutil.spec.js b/spec/versionutil.spec.js
index c84d342..4d474ab 100644
--- a/spec/versionutil.spec.js
+++ b/spec/versionutil.spec.js
@@ -17,8 +17,8 @@ specific language governing permissions and limitations
 under the License.
 */
 
-var versionutil = require("../src/versionutil");
-var jasmine_co = require('jasmine-co').install();
+var versionutil = require('../src/versionutil');
+require('jasmine-co').install();
 var fs = require('fs');
 var path = require('path');
 var shell = require('shelljs');
@@ -28,18 +28,18 @@ var executil = require('../src/executil');
 var gitutil = require('../src/gitutil');
 var apputil = require('../src/apputil');
 var TIMEOUT = 60000;
-var androidRepo = { title: 'Android', 
-	id: 'android',
-	repoName: 'cordova-android',
-	jiraComponentName: 'Android',
-	cordovaJsPaths: [ 'bin/templates/project/assets/www/cordova.js' ],
-	remoteName: 'origin' };
+var androidRepo = { title: 'Android',
+    id: 'android',
+    repoName: 'cordova-android',
+    jiraComponentName: 'Android',
+    cordovaJsPaths: [ 'bin/templates/project/assets/www/cordova.js' ],
+    remoteName: 'origin' };
 var iosRepo = { title: 'iOS',
     id: 'ios',
     repoName: 'cordova-ios',
     jiraComponentName: 'iOS',
     cordovaJsPaths: ['CordovaLib/cordova.js'],
-    versionFilePaths: [path.join('CordovaLib', 'VERSION')]};
+    versionFilePaths: [path.join('CordovaLib', 'VERSION')] };
 var windowsRepo = { title: 'Windows',
     id: 'windows',
     repoName: 'cordova-windows',
@@ -47,105 +47,104 @@ var windowsRepo = { title: 'Windows',
     cordovaJsSrcName: 'cordova.windows.js',
     cordovaJsPaths: ['template/www/cordova.js'],
     versionFilePaths: ['VERSION'],
-    packageFilePaths: ['package.json']};
+    packageFilePaths: ['package.json'] };
 var browserRepo = { title: 'Browser',
-        id: 'browser',
-        repoName: 'cordova-browser',
-        jiraComponentName: 'Browser',
-        cordovaJsSrcName: 'cordova.browser.js',
-        cordovaJsPaths: ['cordova-lib/cordova.js']};
+    id: 'browser',
+    repoName: 'cordova-browser',
+    jiraComponentName: 'Browser',
+    cordovaJsSrcName: 'cordova.browser.js',
+    cordovaJsPaths: ['cordova-lib/cordova.js'] };
 
-describe("Correct version is passed to gradle.build", function () {
-	var shellSpy;
-	beforeEach(function* () {
-		spyOn(fs, 'writeFileSync').and.returnValue(true);
-		spyOn(fs, 'readFileSync').and.returnValue("{}");
-		spyOn(xml2js, 'parseString').and.returnValue(true);
-		spyOn(fs,'existsSync').and.returnValue(true);
-		shellSpy = spyOn(shell,'sed').and.returnValue(true);
-		spyOn(apputil, 'print').and.returnValue(true);
-		spyOn(repoutil, 'isInRepoGroup').and.returnValue(true);
-		spyOn(gitutil, 'pendingChangesExist').and.callFake(function() {
-			return function* (){return true};
-		});
-		spyOn(executil,'execHelper').and.callFake(function() {
-			return function* (){return true};
-		});
-	});
+describe('Correct version is passed to gradle.build', function () {
+    beforeEach(function * () {
+        spyOn(fs, 'writeFileSync').and.returnValue(true);
+        spyOn(fs, 'readFileSync').and.returnValue('{}');
+        spyOn(xml2js, 'parseString').and.returnValue(true);
+        spyOn(fs, 'existsSync').and.returnValue(true);
+        spyOn(shell, 'sed').and.returnValue(true);
+        spyOn(apputil, 'print').and.returnValue(true);
+        spyOn(repoutil, 'isInRepoGroup').and.returnValue(true);
+        spyOn(gitutil, 'pendingChangesExist').and.callFake(function () {
+            return function * () { return true; };
+        });
+        spyOn(executil, 'execHelper').and.callFake(function () {
+            return function * () { return true; };
+        });
+    });
 
-	afterEach(function () {
-		fs.writeFileSync.calls.reset();
-		fs.readFileSync.calls.reset();
-		fs.existsSync.calls.reset();
-		shell.sed.calls.reset();
-		apputil.print.calls.reset();
-		repoutil.isInRepoGroup.calls.reset();
-		gitutil.pendingChangesExist.calls.reset();
-		executil.execHelper.calls.reset();
-	});
+    afterEach(function () {
+        fs.writeFileSync.calls.reset();
+        fs.readFileSync.calls.reset();
+        fs.existsSync.calls.reset();
+        shell.sed.calls.reset();
+        apputil.print.calls.reset();
+        repoutil.isInRepoGroup.calls.reset();
+        gitutil.pendingChangesExist.calls.reset();
+        executil.execHelper.calls.reset();
+    });
 
-	it("Test#001 : checks that the correct android version is passed in", function* () {
-		var androidVersion = yield versionutil.updateRepoVersion(androidRepo, "6.4.0-dev");
-		// Check call count
-		expect(fs.writeFileSync.calls.count()).toEqual(2);
-		expect(fs.existsSync.calls.count()).toEqual(4);
-		expect(fs.readFileSync.calls.count()).toEqual(3);
-		expect(repoutil.isInRepoGroup.calls.count()).toEqual(2);
-		expect(repoutil.isInRepoGroup.calls.count()).toEqual(2);
-		expect(gitutil.pendingChangesExist.calls.count()).toEqual(4);
-		expect(executil.execHelper.calls.count()).toEqual(1);
-		expect(apputil.print.calls.count()).toEqual(0);
-		expect(shell.sed.calls.count()).toEqual(5);
-		// Check that args are correct
-		expect(shell.sed.calls.argsFor(0)[2]).toEqual('CORDOVA_VERSION = "6.4.0-dev";');
-		expect(shell.sed.calls.argsFor(1)[2]).toEqual('VERSION = "6.4.0-dev";');
-		expect(shell.sed.calls.argsFor(2)[2]).toEqual("version = '6.4.0-dev'");
-		expect(shell.sed.calls.argsFor(3)[2]).toEqual("vcsTag = '6.4.0-dev'");
-		expect(shell.sed.calls.argsFor(4)[2]).toContain("name = '6.4.0-dev");
-	},TIMEOUT);
+    it('Test#001 : checks that the correct android version is passed in', function * () {
+        yield versionutil.updateRepoVersion(androidRepo, '6.4.0-dev');
+        // Check call count
+        expect(fs.writeFileSync.calls.count()).toEqual(2);
+        expect(fs.existsSync.calls.count()).toEqual(4);
+        expect(fs.readFileSync.calls.count()).toEqual(3);
+        expect(repoutil.isInRepoGroup.calls.count()).toEqual(2);
+        expect(repoutil.isInRepoGroup.calls.count()).toEqual(2);
+        expect(gitutil.pendingChangesExist.calls.count()).toEqual(4);
+        expect(executil.execHelper.calls.count()).toEqual(1);
+        expect(apputil.print.calls.count()).toEqual(0);
+        expect(shell.sed.calls.count()).toEqual(5);
+        // Check that args are correct
+        expect(shell.sed.calls.argsFor(0)[2]).toEqual('CORDOVA_VERSION = "6.4.0-dev";');
+        expect(shell.sed.calls.argsFor(1)[2]).toEqual('VERSION = "6.4.0-dev";');
+        expect(shell.sed.calls.argsFor(2)[2]).toEqual("version = '6.4.0-dev'");
+        expect(shell.sed.calls.argsFor(3)[2]).toEqual("vcsTag = '6.4.0-dev'");
+        expect(shell.sed.calls.argsFor(4)[2]).toContain("name = '6.4.0-dev");
+    }, TIMEOUT);
 
-	it("Test#002 : checks that the correct ios version is passed in", function* () {
-		var iosVersion = yield versionutil.updateRepoVersion(iosRepo, "4.2.0-dev");
-		// Check call count
-		expect(fs.writeFileSync.calls.count()).toEqual(2);
-		expect(fs.existsSync.calls.count()).toEqual(4);
-		expect(repoutil.isInRepoGroup.calls.count()).toEqual(2);
-		expect(fs.readFileSync.calls.count()).toEqual(3);
-		expect(gitutil.pendingChangesExist.calls.count()).toEqual(4);
-		expect(shell.sed.calls.count()).toEqual(1);
-		expect(apputil.print.calls.count()).toEqual(0);
-		expect(executil.execHelper.calls.count()).toEqual(1);
-		// Check that args are correct
-		expect(shell.sed.calls.argsFor(0)[2]).toEqual('VERSION="4.2.0-dev";');
-	},TIMEOUT);
+    it('Test#002 : checks that the correct ios version is passed in', function * () {
+        yield versionutil.updateRepoVersion(iosRepo, '4.2.0-dev');
+        // Check call count
+        expect(fs.writeFileSync.calls.count()).toEqual(2);
+        expect(fs.existsSync.calls.count()).toEqual(4);
+        expect(repoutil.isInRepoGroup.calls.count()).toEqual(2);
+        expect(fs.readFileSync.calls.count()).toEqual(3);
+        expect(gitutil.pendingChangesExist.calls.count()).toEqual(4);
+        expect(shell.sed.calls.count()).toEqual(1);
+        expect(apputil.print.calls.count()).toEqual(0);
+        expect(executil.execHelper.calls.count()).toEqual(1);
+        // Check that args are correct
+        expect(shell.sed.calls.argsFor(0)[2]).toEqual('VERSION="4.2.0-dev";');
+    }, TIMEOUT);
 
-	it("Test#003 : checks that the correct windows version is passed in", function* () {
-		var windowsVersion = yield versionutil.updateRepoVersion(windowsRepo, "4.5.0-dev");
-		// Check call count
-		expect(fs.writeFileSync.calls.count()).toEqual(2);
-		expect(fs.existsSync.calls.count()).toEqual(5);
-		expect(repoutil.isInRepoGroup.calls.count()).toEqual(2);
-		expect(gitutil.pendingChangesExist.calls.count()).toEqual(4);
-		expect(fs.readFileSync.calls.count()).toEqual(3);
-		expect(shell.sed.calls.count()).toEqual(1);
-		expect(apputil.print.calls.count()).toEqual(0);
-		expect(executil.execHelper.calls.count()).toEqual(1);
-		// Check that args are correct
-		expect(shell.sed.calls.argsFor(0)[2]).toEqual('VERSION = "4.5.0-dev";');
-	},TIMEOUT);
+    it('Test#003 : checks that the correct windows version is passed in', function * () {
+        yield versionutil.updateRepoVersion(windowsRepo, '4.5.0-dev');
+        // Check call count
+        expect(fs.writeFileSync.calls.count()).toEqual(2);
+        expect(fs.existsSync.calls.count()).toEqual(5);
+        expect(repoutil.isInRepoGroup.calls.count()).toEqual(2);
+        expect(gitutil.pendingChangesExist.calls.count()).toEqual(4);
+        expect(fs.readFileSync.calls.count()).toEqual(3);
+        expect(shell.sed.calls.count()).toEqual(1);
+        expect(apputil.print.calls.count()).toEqual(0);
+        expect(executil.execHelper.calls.count()).toEqual(1);
+        // Check that args are correct
+        expect(shell.sed.calls.argsFor(0)[2]).toEqual('VERSION = "4.5.0-dev";');
+    }, TIMEOUT);
 
-	it("Test#004 : check that the correct browser version is passed in", function* () {
-		var browserVersion = yield versionutil.updateRepoVersion(browserRepo, "4.1.0-dev");
-		//Check call count
-		expect(fs.writeFileSync.calls.count()).toEqual(2);
-		expect(fs.existsSync.calls.count()).toEqual(5);
-		expect(repoutil.isInRepoGroup.calls.count()).toEqual(2);
-		expect(gitutil.pendingChangesExist.calls.count()).toEqual(4);
-		expect(fs.readFileSync.calls.count()).toEqual(3);
-		expect(shell.sed.calls.count()).toEqual(1);
-		expect(apputil.print.calls.count()).toEqual(0);
-		expect(executil.execHelper.calls.count()).toEqual(1);
-		// Check that args are correct
-		expect(shell.sed.calls.argsFor(0)[2]).toEqual('VERSION = "4.1.0-dev";');
-	},TIMEOUT);
+    it('Test#004 : check that the correct browser version is passed in', function * () {
+        yield versionutil.updateRepoVersion(browserRepo, '4.1.0-dev');
+        // Check call count
+        expect(fs.writeFileSync.calls.count()).toEqual(2);
+        expect(fs.existsSync.calls.count()).toEqual(5);
+        expect(repoutil.isInRepoGroup.calls.count()).toEqual(2);
+        expect(gitutil.pendingChangesExist.calls.count()).toEqual(4);
+        expect(fs.readFileSync.calls.count()).toEqual(3);
+        expect(shell.sed.calls.count()).toEqual(1);
+        expect(apputil.print.calls.count()).toEqual(0);
+        expect(executil.execHelper.calls.count()).toEqual(1);
+        // Check that args are correct
+        expect(shell.sed.calls.argsFor(0)[2]).toEqual('VERSION = "4.1.0-dev";');
+    }, TIMEOUT);
 });


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