[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-12-08 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16284016#comment-16284016
 ] 

ASF subversion and git services commented on CB-12361:
--

Commit c3cd66df53bf03007447c2a0d14d057a63d71b97 in cordova-lib's branch 
refs/heads/master from [~stevegill]
[ https://gitbox.apache.org/repos/asf?p=cordova-lib.git;h=c3cd66d ]

Merge pull request #603 from audreyso/CB-12361-check.js

CB-12361 : added unit tests for check.js

> Speed up cordova-lib tests
> --
>
> Key: CB-12361
> URL: https://issues.apache.org/jira/browse/CB-12361
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: cordova-lib
>Reporter: Steve Gill
>Assignee: Steve Gill
>  Labels: cordova-next
>
> * Split out e2e tests into own folder
> * stub i/o and network requests
> * use local fixtures when possible & makes sense



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-12-08 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16284014#comment-16284014
 ] 

ASF subversion and git services commented on CB-12361:
--

Commit d6a9afe9087327268e0e4c2d5cffb4424908f4d4 in cordova-lib's branch 
refs/heads/master from [~auso]
[ https://gitbox.apache.org/repos/asf?p=cordova-lib.git;h=d6a9afe ]

CB-12361 : added unit tests for check.js


> Speed up cordova-lib tests
> --
>
> Key: CB-12361
> URL: https://issues.apache.org/jira/browse/CB-12361
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: cordova-lib
>Reporter: Steve Gill
>Assignee: Steve Gill
>  Labels: cordova-next
>
> * Split out e2e tests into own folder
> * stub i/o and network requests
> * use local fixtures when possible & makes sense



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-12-08 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16284015#comment-16284015
 ] 

ASF subversion and git services commented on CB-12361:
--

Commit c3cd66df53bf03007447c2a0d14d057a63d71b97 in cordova-lib's branch 
refs/heads/master from [~stevegill]
[ https://gitbox.apache.org/repos/asf?p=cordova-lib.git;h=c3cd66d ]

Merge pull request #603 from audreyso/CB-12361-check.js

CB-12361 : added unit tests for check.js

> Speed up cordova-lib tests
> --
>
> Key: CB-12361
> URL: https://issues.apache.org/jira/browse/CB-12361
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: cordova-lib
>Reporter: Steve Gill
>Assignee: Steve Gill
>  Labels: cordova-next
>
> * Split out e2e tests into own folder
> * stub i/o and network requests
> * use local fixtures when possible & makes sense



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-12-08 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16284013#comment-16284013
 ] 

ASF GitHub Bot commented on CB-12361:
-

stevengill closed pull request #603: CB-12361 : added unit tests for check.js
URL: https://github.com/apache/cordova-lib/pull/603
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/spec/cordova/platform/check.spec.js 
b/spec/cordova/platform/check.spec.js
new file mode 100644
index 0..bb4456d29
--- /dev/null
+++ b/spec/cordova/platform/check.spec.js
@@ -0,0 +1,83 @@
+/**
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+http://www.apache.org/licenses/LICENSE-2.0
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+*/
+
+var Q = require('q');
+var shell = require('shelljs');
+var events = require('cordova-common').events;
+var superspawn = require('cordova-common').superspawn;
+var rewire = require('rewire');
+var platform_check = rewire('../../../src/cordova/platform/check');
+var cordova_util = require('../../../src/cordova/util');
+
+describe('cordova/platform/check', function () {
+var projectRoot = '/some/path';
+var hooks_mock;
+
+beforeEach(function () {
+spyOn(events, 'emit');
+spyOn(superspawn, 'spawn').and.callThrough();
+spyOn(shell, 'rm');
+spyOn(cordova_util, 'listPlatforms');
+});
+
+it('If no results, platforms cannot be updated', function (done) {
+cordova_util.listPlatforms.and.callThrough();
+platform_check(hooks_mock, projectRoot).then(function () {
+expect(events.emit).toHaveBeenCalledWith('results', 
jasmine.stringMatching(/No platforms can be updated/));
+expect(superspawn.spawn).toHaveBeenCalledWith('npm', 
['--loglevel=silent', '--json', 'outdated', 'cordova-lib'], 
jasmine.any(Object));
+expect(shell.rm).toHaveBeenCalledWith('-rf', jasmine.any(String));
+}).fail(function (err) {
+fail('unexpected failure handler invoked!');
+console.error(err);
+}).done(done);
+});
+
+it('Should warn if install failed', function (done) {
+cordova_util.listPlatforms.and.returnValue(['ios']);
+platform_check(hooks_mock, projectRoot).then(function () {
+expect(events.emit).toHaveBeenCalledWith('results', 
jasmine.stringMatching(/current did not install/));
+}).fail(function (err) {
+fail('unexpected failure handler invoked!');
+console.error(err);
+}).done(done);
+});
+
+it('Should warn if version-empty', function (done) {
+cordova_util.listPlatforms.and.returnValue(['ios']);
+spyOn(require('../../../src/cordova/platform/index'), 
'add').and.returnValue(Q());
+superspawn.spawn.and.returnValue(Q());
+platform_check(hooks_mock, projectRoot).then(function () {
+expect(events.emit).toHaveBeenCalledWith('results', 
jasmine.stringMatching(/current version script failed to return a version/));
+}).fail(function (err) {
+fail('unexpected failure handler invoked!');
+console.error(err);
+}).done(done);
+});
+
+it('Should warn if version-failed', function (done) {
+cordova_util.listPlatforms.and.returnValue(['ios']);
+spyOn(require('../../../src/cordova/platform/index'), 
'add').and.returnValue(Q());
+spyOn(superspawn, 'maybeSpawn').and.returnValue(Q('version-failed'));
+spyOn(Q.defer(), 'resolve').and.returnValue('version-failed');
+platform_check(hooks_mock, projectRoot).then(function () {
+expect(events.emit).toHaveBeenCalledWith('results', 
jasmine.stringMatching(/current version script failed, and/));
+}).fail(function (err) {
+fail('unexpected failure handler invoked!');
+console.error(err);
+}).done(done);
+});
+});


 


This is an automated message from the Apache Git Service.
To respon

[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-10-27 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16222549#comment-16222549
 ] 

ASF GitHub Bot commented on CB-12361:
-

GitHub user audreyso opened a pull request:

https://github.com/apache/cordova-lib/pull/603

CB-12361 : added unit tests for check.js



### Platforms affected


### What does this PR do?
Added unit tests for check.js to increase coverage

### What testing has been done on this change?


### Checklist
- [X] [Reported an issue](http://cordova.apache.org/contribute/issues.html) 
in the JIRA database
- [X] Commit message follows the format: "CB-3232: (android) Fix bug with 
resolving file paths", where CB- is the JIRA ID & "android" is the platform 
affected.
- [X] Added automated test coverage as appropriate for this change.


You can merge this pull request into a Git repository by running:

$ git pull https://github.com/audreyso/cordova-lib CB-12361-check.js

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/cordova-lib/pull/603.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #603


commit d6a9afe9087327268e0e4c2d5cffb4424908f4d4
Author: Audrey So 
Date:   2017-10-24T22:26:41Z

CB-12361 : added unit tests for check.js




> Speed up cordova-lib tests
> --
>
> Key: CB-12361
> URL: https://issues.apache.org/jira/browse/CB-12361
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: cordova-lib
>Reporter: Steve Gill
>Assignee: Steve Gill
>  Labels: cordova-next
>
> * Split out e2e tests into own folder
> * stub i/o and network requests
> * use local fixtures when possible & makes sense



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-10-04 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16191832#comment-16191832
 ] 

ASF subversion and git services commented on CB-12361:
--

Commit 1a834a99dc4880b6a52834e682c7bf3b063b26c9 in cordova-lib's branch 
refs/heads/master from [~auso]
[ https://git-wip-us.apache.org/repos/asf?p=cordova-lib.git;h=1a834a9 ]

CB-12361 : updated and added unit tests for add.spec.js

 This closes #595


> Speed up cordova-lib tests
> --
>
> Key: CB-12361
> URL: https://issues.apache.org/jira/browse/CB-12361
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: cordova-lib
>Reporter: Steve Gill
>Assignee: Steve Gill
>  Labels: cordova-next
>
> * Split out e2e tests into own folder
> * stub i/o and network requests
> * use local fixtures when possible & makes sense



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-10-04 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16191833#comment-16191833
 ] 

ASF GitHub Bot commented on CB-12361:
-

Github user asfgit closed the pull request at:

https://github.com/apache/cordova-lib/pull/595


> Speed up cordova-lib tests
> --
>
> Key: CB-12361
> URL: https://issues.apache.org/jira/browse/CB-12361
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: cordova-lib
>Reporter: Steve Gill
>Assignee: Steve Gill
>  Labels: cordova-next
>
> * Split out e2e tests into own folder
> * stub i/o and network requests
> * use local fixtures when possible & makes sense



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-10-04 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16191812#comment-16191812
 ] 

ASF GitHub Bot commented on CB-12361:
-

Github user asfgit closed the pull request at:

https://github.com/apache/cordova-lib/pull/593


> Speed up cordova-lib tests
> --
>
> Key: CB-12361
> URL: https://issues.apache.org/jira/browse/CB-12361
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: cordova-lib
>Reporter: Steve Gill
>Assignee: Steve Gill
>  Labels: cordova-next
>
> * Split out e2e tests into own folder
> * stub i/o and network requests
> * use local fixtures when possible & makes sense



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-10-04 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16191811#comment-16191811
 ] 

ASF subversion and git services commented on CB-12361:
--

Commit 2632de65b9a856cd04bc9af342f906edb7b002d8 in cordova-lib's branch 
refs/heads/master from [~auso]
[ https://git-wip-us.apache.org/repos/asf?p=cordova-lib.git;h=2632de6 ]

CB-12361 : added plugin tests for plugin list

 This closes #593


> Speed up cordova-lib tests
> --
>
> Key: CB-12361
> URL: https://issues.apache.org/jira/browse/CB-12361
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: cordova-lib
>Reporter: Steve Gill
>Assignee: Steve Gill
>  Labels: cordova-next
>
> * Split out e2e tests into own folder
> * stub i/o and network requests
> * use local fixtures when possible & makes sense



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-09-25 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16179414#comment-16179414
 ] 

ASF GitHub Bot commented on CB-12361:
-

Github user asfgit closed the pull request at:

https://github.com/apache/cordova-lib/pull/584


> Speed up cordova-lib tests
> --
>
> Key: CB-12361
> URL: https://issues.apache.org/jira/browse/CB-12361
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: cordova-lib
>Reporter: Steve Gill
>Assignee: Steve Gill
>  Labels: cordova-next
>
> * Split out e2e tests into own folder
> * stub i/o and network requests
> * use local fixtures when possible & makes sense



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-09-25 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16179413#comment-16179413
 ] 

ASF subversion and git services commented on CB-12361:
--

Commit a4d91e4011e47d44f1c70a1f44e3d6d40decb986 in cordova-lib's branch 
refs/heads/master from [~auso]
[ https://git-wip-us.apache.org/repos/asf?p=cordova-lib.git;h=a4d91e4 ]

CB-12361 : added tests for plugin/save.js


> Speed up cordova-lib tests
> --
>
> Key: CB-12361
> URL: https://issues.apache.org/jira/browse/CB-12361
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: cordova-lib
>Reporter: Steve Gill
>Assignee: Steve Gill
>  Labels: cordova-next
>
> * Split out e2e tests into own folder
> * stub i/o and network requests
> * use local fixtures when possible & makes sense



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-09-19 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16171936#comment-16171936
 ] 

ASF GitHub Bot commented on CB-12361:
-

GitHub user audreyso opened a pull request:

https://github.com/apache/cordova-lib/pull/595

CB-12361 : updated and added unit tests for add.spec.js



### Platforms affected


### What does this PR do?

Updated and added "to-do" unit tests for add.spec.js

### What testing has been done on this change?


### Checklist
- [X] [Reported an issue](http://cordova.apache.org/contribute/issues.html) 
in the JIRA database
- [X] Commit message follows the format: "CB-3232: (android) Fix bug with 
resolving file paths", where CB- is the JIRA ID & "android" is the platform 
affected.
- [X] Added automated test coverage as appropriate for this change.


You can merge this pull request into a Git repository by running:

$ git pull https://github.com/audreyso/cordova-lib CB-12361-plugin_fetch

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/cordova-lib/pull/595.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #595


commit ec07983d1ed587358a30fc003e9f86edd47e9bce
Author: Audrey So 
Date:   2017-09-18T20:37:45Z

CB-12361 : updated and added unit tests for add.spec.js




> Speed up cordova-lib tests
> --
>
> Key: CB-12361
> URL: https://issues.apache.org/jira/browse/CB-12361
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: cordova-lib
>Reporter: Steve Gill
>Assignee: Steve Gill
>  Labels: cordova-next
>
> * Split out e2e tests into own folder
> * stub i/o and network requests
> * use local fixtures when possible & makes sense



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-09-15 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16168138#comment-16168138
 ] 

ASF GitHub Bot commented on CB-12361:
-

GitHub user audreyso opened a pull request:

https://github.com/apache/cordova-lib/pull/593

CB-12361 : added plugin unit tests for plugin list



### Platforms affected


### What does this PR do?
Added plugin unit tests for plugin list

### What testing has been done on this change?


### Checklist
- [X] [Reported an issue](http://cordova.apache.org/contribute/issues.html) 
in the JIRA database
- [X] Commit message follows the format: "CB-3232: (android) Fix bug with 
resolving file paths", where CB- is the JIRA ID & "android" is the platform 
affected.
- [X] Added automated test coverage as appropriate for this change.


You can merge this pull request into a Git repository by running:

$ git pull https://github.com/audreyso/cordova-lib CB-12361-list_spec

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/cordova-lib/pull/593.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #593


commit e956fe7c8d0cbd8c7663bed4e66d5b1f78411e68
Author: Audrey So 
Date:   2017-09-15T16:32:55Z

CB-12361 : added plugin tests for plugin list




> Speed up cordova-lib tests
> --
>
> Key: CB-12361
> URL: https://issues.apache.org/jira/browse/CB-12361
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: cordova-lib
>Reporter: Steve Gill
>Assignee: Steve Gill
>  Labels: cordova-next
>
> * Split out e2e tests into own folder
> * stub i/o and network requests
> * use local fixtures when possible & makes sense



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-09-15 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16168139#comment-16168139
 ] 

ASF GitHub Bot commented on CB-12361:
-

Github user audreyso closed the pull request at:

https://github.com/apache/cordova-lib/pull/592


> Speed up cordova-lib tests
> --
>
> Key: CB-12361
> URL: https://issues.apache.org/jira/browse/CB-12361
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: cordova-lib
>Reporter: Steve Gill
>Assignee: Steve Gill
>  Labels: cordova-next
>
> * Split out e2e tests into own folder
> * stub i/o and network requests
> * use local fixtures when possible & makes sense



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-09-14 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16166782#comment-16166782
 ] 

ASF GitHub Bot commented on CB-12361:
-

GitHub user audreyso opened a pull request:

https://github.com/apache/cordova-lib/pull/592

CB-12361 : added some unit tests for plugman



### Platforms affected


### What does this PR do?

Added some unit tests for plugman

### What testing has been done on this change?


### Checklist
- [X] [Reported an issue](http://cordova.apache.org/contribute/issues.html) 
in the JIRA database
- [X] Commit message follows the format: "CB-3232: (android) Fix bug with 
resolving file paths", where CB- is the JIRA ID & "android" is the platform 
affected.
- [X] Added automated test coverage as appropriate for this change.


You can merge this pull request into a Git repository by running:

$ git pull https://github.com/audreyso/cordova-lib CB-12361-plugman

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/cordova-lib/pull/592.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #592


commit d61c084b2192dbe3831c8448d35bdeeafb36636d
Author: Audrey So 
Date:   2017-08-23T17:43:34Z

CB-12361 : added unit tests for plugman




> Speed up cordova-lib tests
> --
>
> Key: CB-12361
> URL: https://issues.apache.org/jira/browse/CB-12361
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: cordova-lib
>Reporter: Steve Gill
>Assignee: Steve Gill
>  Labels: cordova-next
>
> * Split out e2e tests into own folder
> * stub i/o and network requests
> * use local fixtures when possible & makes sense



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-09-06 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16156420#comment-16156420
 ] 

ASF GitHub Bot commented on CB-12361:
-

Github user stevengill commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/584#discussion_r137442765
  
--- Diff: spec/cordova/plugin/save.spec.js ---
@@ -54,15 +62,131 @@ describe('cordova/plugin/save', function () {
 });
 });
 describe('happy path', function () {
-it('should remove all plugins from config.xml and re-add new ones 
based on those retrieved from fetch.json');
-it('should only add top-level plugins to config.xml');
-it('should write individual plugin specs to config.xml');
-it('should write individual plugin variables to config.xml');
+it('check that existing plugins are getting removed', function 
(done) {
+save(projectRoot).then(function () {
+
expect(cfg_parser_mock.prototype.removePlugin).toHaveBeenCalledWith('VRPlugin');
+
expect(cfg_parser_mock.prototype.removePlugin).toHaveBeenCalledWith('MastodonSocialPlugin');
+}).fail(function (e) {
+expect(e).toBeUndefined();
+fail('did not expect fail handler to be invoked');
+}).done(done);
+});
+
+it('plugins are being removed first and then only top level 
plugins are being restored', function (done) {
+var fake_fetch_json =
+{'VRPlugin': {'source': {
+'type': 'registry',
+'id': 'id'
+},
+'is_top_level': true
+},
+'MastodonSocialPlugin': { 'source': {
+'type': 'registry',
+'id': 'id'
+},
+'is_top_level': false }};
+
+
fs.readFileSync.and.returnValue(JSON.stringify(fake_fetch_json));
+save(projectRoot).then(function () {
+
expect(cfg_parser_mock.prototype.removePlugin).toHaveBeenCalledWith('VRPlugin');
+
expect(cfg_parser_mock.prototype.removePlugin).toHaveBeenCalledWith('MastodonSocialPlugin');
+
expect(cfg_parser_mock.prototype.addPlugin).toHaveBeenCalledWith(Object({ name: 
'VRPlugin' }), [ ]);
+
expect(cfg_parser_mock.prototype.addPlugin).not.toHaveBeenCalledWith(Object({ 
name: 'MastodonSocialPlugin' }), [ ]);
+expect(cfg_parser_mock.prototype.write).toHaveBeenCalled();
+}).fail(function (e) {
+expect(e).toBeUndefined();
+fail('did not expect fail handler to be invoked');
+}).done(done);
+});
+
+it('should write individual plugin specs to config.xml', function 
(done) {
+var fake_fetch_json =
+{'VRPlugin': {'source': {
+'type': 'registry',
+'id': 'id'
+},
+'is_top_level': true }};
+
fs.readFileSync.and.returnValue(JSON.stringify(fake_fetch_json));
+spyOn(save, 'getSpec').and.returnValue('1.0.0');
+save(projectRoot).then(function () {
+
expect(cfg_parser_mock.prototype.addPlugin).toHaveBeenCalledWith(Object({ name: 
'VRPlugin', spec: '1.0.0' }), jasmine.any(Object));
+expect(cfg_parser_mock.prototype.write).toHaveBeenCalled();
+}).fail(function (e) {
+expect(e).toBeUndefined();
+fail('did not expect fail handler to be invoked');
+}).done(done);
+});
+
+it('should write individual plugin variables to config.xml', 
function (done) {
+var fake_fetch_json =
+{'VRPlugin': {'source': {
+'type': 'registry',
+'id': 'id'
+},
+'is_top_level': true,
+'variables': {
+'var 1': ' '
+}}};
+
fs.readFileSync.and.returnValue(JSON.stringify(fake_fetch_json));
+save(projectRoot).then(function () {
+
expect(cfg_parser_mock.prototype.addPlugin).toHaveBeenCalledWith(jasmine.any(Object),
 [ Object({ name: 'var 1', value: ' ' }) ]);
+expect(cfg_parser_mock.prototype.write).toHaveBeenCalled();
+}).fail(function (e) {
+expect(e).toBeUndefined();
+fail('did not expect fail handler to be invoked');
+}).done(done);
+});

[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-09-06 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16156419#comment-16156419
 ] 

ASF GitHub Bot commented on CB-12361:
-

Github user stevengill commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/584#discussion_r137442686
  
--- Diff: spec/cordova/plugin/save.spec.js ---
@@ -54,15 +62,131 @@ describe('cordova/plugin/save', function () {
 });
 });
 describe('happy path', function () {
-it('should remove all plugins from config.xml and re-add new ones 
based on those retrieved from fetch.json');
-it('should only add top-level plugins to config.xml');
-it('should write individual plugin specs to config.xml');
-it('should write individual plugin variables to config.xml');
+it('check that existing plugins are getting removed', function 
(done) {
+save(projectRoot).then(function () {
+
expect(cfg_parser_mock.prototype.removePlugin).toHaveBeenCalledWith('VRPlugin');
+
expect(cfg_parser_mock.prototype.removePlugin).toHaveBeenCalledWith('MastodonSocialPlugin');
+}).fail(function (e) {
+expect(e).toBeUndefined();
+fail('did not expect fail handler to be invoked');
+}).done(done);
+});
+
+it('plugins are being removed first and then only top level 
plugins are being restored', function (done) {
+var fake_fetch_json =
+{'VRPlugin': {'source': {
+'type': 'registry',
+'id': 'id'
+},
+'is_top_level': true
+},
+'MastodonSocialPlugin': { 'source': {
+'type': 'registry',
+'id': 'id'
+},
+'is_top_level': false }};
+
+
fs.readFileSync.and.returnValue(JSON.stringify(fake_fetch_json));
+save(projectRoot).then(function () {
+
expect(cfg_parser_mock.prototype.removePlugin).toHaveBeenCalledWith('VRPlugin');
+
expect(cfg_parser_mock.prototype.removePlugin).toHaveBeenCalledWith('MastodonSocialPlugin');
+
expect(cfg_parser_mock.prototype.addPlugin).toHaveBeenCalledWith(Object({ name: 
'VRPlugin' }), [ ]);
+
expect(cfg_parser_mock.prototype.addPlugin).not.toHaveBeenCalledWith(Object({ 
name: 'MastodonSocialPlugin' }), [ ]);
+expect(cfg_parser_mock.prototype.write).toHaveBeenCalled();
+}).fail(function (e) {
+expect(e).toBeUndefined();
+fail('did not expect fail handler to be invoked');
+}).done(done);
+});
+
+it('should write individual plugin specs to config.xml', function 
(done) {
+var fake_fetch_json =
+{'VRPlugin': {'source': {
+'type': 'registry',
+'id': 'id'
+},
+'is_top_level': true }};
+
fs.readFileSync.and.returnValue(JSON.stringify(fake_fetch_json));
+spyOn(save, 'getSpec').and.returnValue('1.0.0');
+save(projectRoot).then(function () {
+
expect(cfg_parser_mock.prototype.addPlugin).toHaveBeenCalledWith(Object({ name: 
'VRPlugin', spec: '1.0.0' }), jasmine.any(Object));
+expect(cfg_parser_mock.prototype.write).toHaveBeenCalled();
+}).fail(function (e) {
+expect(e).toBeUndefined();
+fail('did not expect fail handler to be invoked');
+}).done(done);
+});
+
+it('should write individual plugin variables to config.xml', 
function (done) {
+var fake_fetch_json =
+{'VRPlugin': {'source': {
+'type': 'registry',
+'id': 'id'
+},
+'is_top_level': true,
+'variables': {
+'var 1': ' '
+}}};
+
fs.readFileSync.and.returnValue(JSON.stringify(fake_fetch_json));
+save(projectRoot).then(function () {
+
expect(cfg_parser_mock.prototype.addPlugin).toHaveBeenCalledWith(jasmine.any(Object),
 [ Object({ name: 'var 1', value: ' ' }) ]);
+expect(cfg_parser_mock.prototype.write).toHaveBeenCalled();
+}).fail(function (e) {
+expect(e).toBeUndefined();
+fail('did not expect fail handler to be invoked');
+}).done(done);
+});

[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-09-06 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16156409#comment-16156409
 ] 

ASF GitHub Bot commented on CB-12361:
-

Github user stevengill commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/584#discussion_r137442083
  
--- Diff: spec/cordova/plugin/save.spec.js ---
@@ -54,15 +62,131 @@ describe('cordova/plugin/save', function () {
 });
 });
 describe('happy path', function () {
-it('should remove all plugins from config.xml and re-add new ones 
based on those retrieved from fetch.json');
-it('should only add top-level plugins to config.xml');
-it('should write individual plugin specs to config.xml');
-it('should write individual plugin variables to config.xml');
+it('check that existing plugins are getting removed', function 
(done) {
+save(projectRoot).then(function () {
+
expect(cfg_parser_mock.prototype.removePlugin).toHaveBeenCalledWith('VRPlugin');
+
expect(cfg_parser_mock.prototype.removePlugin).toHaveBeenCalledWith('MastodonSocialPlugin');
+}).fail(function (e) {
+expect(e).toBeUndefined();
+fail('did not expect fail handler to be invoked');
+}).done(done);
+});
+
+it('plugins are being removed first and then only top level 
plugins are being restored', function (done) {
+var fake_fetch_json =
+{'VRPlugin': {'source': {
+'type': 'registry',
+'id': 'id'
+},
+'is_top_level': true
+},
+'MastodonSocialPlugin': { 'source': {
+'type': 'registry',
+'id': 'id'
+},
+'is_top_level': false }};
+
+
fs.readFileSync.and.returnValue(JSON.stringify(fake_fetch_json));
+save(projectRoot).then(function () {
+
expect(cfg_parser_mock.prototype.removePlugin).toHaveBeenCalledWith('VRPlugin');
+
expect(cfg_parser_mock.prototype.removePlugin).toHaveBeenCalledWith('MastodonSocialPlugin');
+
expect(cfg_parser_mock.prototype.addPlugin).toHaveBeenCalledWith(Object({ name: 
'VRPlugin' }), [ ]);
+
expect(cfg_parser_mock.prototype.addPlugin).not.toHaveBeenCalledWith(Object({ 
name: 'MastodonSocialPlugin' }), [ ]);
+expect(cfg_parser_mock.prototype.write).toHaveBeenCalled();
+}).fail(function (e) {
+expect(e).toBeUndefined();
+fail('did not expect fail handler to be invoked');
+}).done(done);
+});
+
+it('should write individual plugin specs to config.xml', function 
(done) {
+var fake_fetch_json =
+{'VRPlugin': {'source': {
+'type': 'registry',
+'id': 'id'
+},
+'is_top_level': true }};
+
fs.readFileSync.and.returnValue(JSON.stringify(fake_fetch_json));
+spyOn(save, 'getSpec').and.returnValue('1.0.0');
+save(projectRoot).then(function () {
+
expect(cfg_parser_mock.prototype.addPlugin).toHaveBeenCalledWith(Object({ name: 
'VRPlugin', spec: '1.0.0' }), jasmine.any(Object));
+expect(cfg_parser_mock.prototype.write).toHaveBeenCalled();
+}).fail(function (e) {
+expect(e).toBeUndefined();
+fail('did not expect fail handler to be invoked');
+}).done(done);
+});
+
+it('should write individual plugin variables to config.xml', 
function (done) {
+var fake_fetch_json =
+{'VRPlugin': {'source': {
+'type': 'registry',
+'id': 'id'
+},
+'is_top_level': true,
+'variables': {
+'var 1': ' '
+}}};
+
fs.readFileSync.and.returnValue(JSON.stringify(fake_fetch_json));
+save(projectRoot).then(function () {
+
expect(cfg_parser_mock.prototype.addPlugin).toHaveBeenCalledWith(jasmine.any(Object),
 [ Object({ name: 'var 1', value: ' ' }) ]);
+expect(cfg_parser_mock.prototype.write).toHaveBeenCalled();
+}).fail(function (e) {
+expect(e).toBeUndefined();
+fail('did not expect fail handler to be invoked');
+}).done(done);
+});

[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-09-06 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16156412#comment-16156412
 ] 

ASF GitHub Bot commented on CB-12361:
-

Github user stevengill commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/584#discussion_r137442253
  
--- Diff: spec/cordova/plugin/save.spec.js ---
@@ -54,15 +62,131 @@ describe('cordova/plugin/save', function () {
 });
 });
 describe('happy path', function () {
-it('should remove all plugins from config.xml and re-add new ones 
based on those retrieved from fetch.json');
-it('should only add top-level plugins to config.xml');
-it('should write individual plugin specs to config.xml');
-it('should write individual plugin variables to config.xml');
+it('check that existing plugins are getting removed', function 
(done) {
+save(projectRoot).then(function () {
+
expect(cfg_parser_mock.prototype.removePlugin).toHaveBeenCalledWith('VRPlugin');
+
expect(cfg_parser_mock.prototype.removePlugin).toHaveBeenCalledWith('MastodonSocialPlugin');
+}).fail(function (e) {
+expect(e).toBeUndefined();
+fail('did not expect fail handler to be invoked');
+}).done(done);
+});
+
+it('plugins are being removed first and then only top level 
plugins are being restored', function (done) {
+var fake_fetch_json =
+{'VRPlugin': {'source': {
+'type': 'registry',
+'id': 'id'
+},
+'is_top_level': true
+},
+'MastodonSocialPlugin': { 'source': {
+'type': 'registry',
+'id': 'id'
+},
+'is_top_level': false }};
+
+
fs.readFileSync.and.returnValue(JSON.stringify(fake_fetch_json));
+save(projectRoot).then(function () {
+
expect(cfg_parser_mock.prototype.removePlugin).toHaveBeenCalledWith('VRPlugin');
+
expect(cfg_parser_mock.prototype.removePlugin).toHaveBeenCalledWith('MastodonSocialPlugin');
+
expect(cfg_parser_mock.prototype.addPlugin).toHaveBeenCalledWith(Object({ name: 
'VRPlugin' }), [ ]);
+
expect(cfg_parser_mock.prototype.addPlugin).not.toHaveBeenCalledWith(Object({ 
name: 'MastodonSocialPlugin' }), [ ]);
+expect(cfg_parser_mock.prototype.write).toHaveBeenCalled();
+}).fail(function (e) {
+expect(e).toBeUndefined();
+fail('did not expect fail handler to be invoked');
+}).done(done);
+});
+
+it('should write individual plugin specs to config.xml', function 
(done) {
+var fake_fetch_json =
+{'VRPlugin': {'source': {
+'type': 'registry',
+'id': 'id'
+},
+'is_top_level': true }};
+
fs.readFileSync.and.returnValue(JSON.stringify(fake_fetch_json));
+spyOn(save, 'getSpec').and.returnValue('1.0.0');
+save(projectRoot).then(function () {
+
expect(cfg_parser_mock.prototype.addPlugin).toHaveBeenCalledWith(Object({ name: 
'VRPlugin', spec: '1.0.0' }), jasmine.any(Object));
+expect(cfg_parser_mock.prototype.write).toHaveBeenCalled();
+}).fail(function (e) {
+expect(e).toBeUndefined();
+fail('did not expect fail handler to be invoked');
+}).done(done);
+});
+
+it('should write individual plugin variables to config.xml', 
function (done) {
+var fake_fetch_json =
+{'VRPlugin': {'source': {
+'type': 'registry',
+'id': 'id'
+},
+'is_top_level': true,
+'variables': {
+'var 1': ' '
+}}};
+
fs.readFileSync.and.returnValue(JSON.stringify(fake_fetch_json));
+save(projectRoot).then(function () {
+
expect(cfg_parser_mock.prototype.addPlugin).toHaveBeenCalledWith(jasmine.any(Object),
 [ Object({ name: 'var 1', value: ' ' }) ]);
+expect(cfg_parser_mock.prototype.write).toHaveBeenCalled();
+}).fail(function (e) {
+expect(e).toBeUndefined();
+fail('did not expect fail handler to be invoked');
+}).done(done);
+});

[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-09-06 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16156385#comment-16156385
 ] 

ASF subversion and git services commented on CB-12361:
--

Commit d3e5fd7bae6758c5829650ce3f1b650dc5fd36cb in cordova-lib's branch 
refs/heads/master from [~stevegill]
[ https://git-wip-us.apache.org/repos/asf?p=cordova-lib.git;h=d3e5fd7 ]

CB-12361: added more unit tests for plugin add.spec.js


> Speed up cordova-lib tests
> --
>
> Key: CB-12361
> URL: https://issues.apache.org/jira/browse/CB-12361
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: cordova-lib
>Reporter: Steve Gill
>Assignee: Steve Gill
>  Labels: cordova-next
>
> * Split out e2e tests into own folder
> * stub i/o and network requests
> * use local fixtures when possible & makes sense



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-09-06 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16156388#comment-16156388
 ] 

ASF GitHub Bot commented on CB-12361:
-

Github user asfgit closed the pull request at:

https://github.com/apache/cordova-lib/pull/569


> Speed up cordova-lib tests
> --
>
> Key: CB-12361
> URL: https://issues.apache.org/jira/browse/CB-12361
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: cordova-lib
>Reporter: Steve Gill
>Assignee: Steve Gill
>  Labels: cordova-next
>
> * Split out e2e tests into own folder
> * stub i/o and network requests
> * use local fixtures when possible & makes sense



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-09-06 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16156387#comment-16156387
 ] 

ASF subversion and git services commented on CB-12361:
--

Commit 701c15fe4cfdbe759a5111b9b75e18616b73be3a in cordova-lib's branch 
refs/heads/master from [~stevegill]
[ https://git-wip-us.apache.org/repos/asf?p=cordova-lib.git;h=701c15f ]

CB-12361: added comment for plugin add tests

 This closes #569


> Speed up cordova-lib tests
> --
>
> Key: CB-12361
> URL: https://issues.apache.org/jira/browse/CB-12361
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: cordova-lib
>Reporter: Steve Gill
>Assignee: Steve Gill
>  Labels: cordova-next
>
> * Split out e2e tests into own folder
> * stub i/o and network requests
> * use local fixtures when possible & makes sense



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-09-06 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16156384#comment-16156384
 ] 

ASF subversion and git services commented on CB-12361:
--

Commit 7e136aba2099767c0cf24376b068bf513d89e21c in cordova-lib's branch 
refs/heads/master from [~stevegill]
[ https://git-wip-us.apache.org/repos/asf?p=cordova-lib.git;h=7e136ab ]

CB-12361: added main function unit tests for plugin add.spec.js


> Speed up cordova-lib tests
> --
>
> Key: CB-12361
> URL: https://issues.apache.org/jira/browse/CB-12361
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: cordova-lib
>Reporter: Steve Gill
>Assignee: Steve Gill
>  Labels: cordova-next
>
> * Split out e2e tests into own folder
> * stub i/o and network requests
> * use local fixtures when possible & makes sense



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-08-31 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16149963#comment-16149963
 ] 

ASF GitHub Bot commented on CB-12361:
-

Github user stevengill commented on the issue:

https://github.com/apache/cordova-lib/pull/584
  
Make sure to run `npm run cover` to see the coverage report for save.js


> Speed up cordova-lib tests
> --
>
> Key: CB-12361
> URL: https://issues.apache.org/jira/browse/CB-12361
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: cordova-lib
>Reporter: Steve Gill
>Assignee: Steve Gill
>  Labels: cordova-next
>
> * Split out e2e tests into own folder
> * stub i/o and network requests
> * use local fixtures when possible & makes sense



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-08-31 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16149962#comment-16149962
 ] 

ASF GitHub Bot commented on CB-12361:
-

Github user stevengill commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/584#discussion_r136490386
  
--- Diff: spec/cordova/plugin/save.spec.js ---
@@ -54,15 +61,145 @@ describe('cordova/plugin/save', function () {
 });
 });
 describe('happy path', function () {
-it('should remove all plugins from config.xml and re-add new ones 
based on those retrieved from fetch.json');
-it('should only add top-level plugins to config.xml');
-it('should write individual plugin specs to config.xml');
-it('should write individual plugin variables to config.xml');
+it('should remove all plugins from config.xml and re-add new ones 
based on those retrieved from fetch.json', function (done) {
+save(projectRoot).then(function () {
+
expect(cfg_parser_mock.prototype.removePlugin).toHaveBeenCalledWith('VRPlugin');
+
expect(cfg_parser_mock.prototype.removePlugin).toHaveBeenCalledWith('MastodonSocialPlugin');
+}).fail(function (e) {
+expect(e).toBeUndefined();
+fail('did not expect fail handler to be invoked');
+}).done(done);
+});
+
+it('should only add top-level plugins to config.xml', function 
(done) {
+var fake_fetch_json =
+{'VRPlugin': {'source': {
+'type': 'registry',
+'id': 'id'
+},
+'is_top_level': true
+},
+'MastodonSocialPlugin': { 'source': {
+'type': 'registry',
+'id': 'id'
+},
+'is_top_level': false }};
+
+
fs.readFileSync.and.returnValue(JSON.stringify(fake_fetch_json));
+save(projectRoot).then(function () {
+
expect(cfg_parser_mock.prototype.addPlugin).toHaveBeenCalledWith(Object({ name: 
'VRPlugin' }), [ ]);
+expect(cfg_parser_mock.prototype.write).toHaveBeenCalled();
+}).fail(function (e) {
+expect(e).toBeUndefined();
+fail('did not expect fail handler to be invoked');
+}).done(done);
+});
+
+it('should write individual plugin specs to config.xml', function 
(done) {
+var fake_fetch_json =
+{'VRPlugin': {'source': {
+'type': 'registry',
+'id': 'id'
+},
+'is_top_level': true }};
+
fs.readFileSync.and.returnValue(JSON.stringify(fake_fetch_json));
+spyOn(save, 'getSpec').and.returnValue('1.0.0');
+save(projectRoot).then(function () {
+
expect(cfg_parser_mock.prototype.addPlugin).toHaveBeenCalledWith(Object({ name: 
'VRPlugin', spec: '1.0.0' }), jasmine.any(Object));
+expect(cfg_parser_mock.prototype.write).toHaveBeenCalled();
+}).fail(function (e) {
+expect(e).toBeUndefined();
+fail('did not expect fail handler to be invoked');
+}).done(done);
+});
+
+it('should write individual plugin variables to config.xml', 
function (done) {
+var fake_fetch_json =
+{'VRPlugin': {'source': {
+'type': 'registry',
+'id': 'id'
+},
+'is_top_level': true,
+'variables': {
+'var 1': ' '
+}}};
+
fs.readFileSync.and.returnValue(JSON.stringify(fake_fetch_json));
+save(projectRoot).then(function () {
+
expect(cfg_parser_mock.prototype.addPlugin).toHaveBeenCalledWith(jasmine.any(Object),
 [ Object({ name: 'var 1', value: ' ' }) ]);
+expect(cfg_parser_mock.prototype.write).toHaveBeenCalled();
+}).fail(function (e) {
+expect(e).toBeUndefined();
+fail('did not expect fail handler to be invoked');
+}).done(done);
+});
 });
 describe('getSpec helper method', function () {
-it('should return a plugin source\'s url or path property 
immediately');
-it('should return a version if a version was provided to plugin 
id');
-it('should return a version that includes scope if scope was part 
of plugin id');

[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-08-31 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16149961#comment-16149961
 ] 

ASF GitHub Bot commented on CB-12361:
-

Github user stevengill commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/584#discussion_r136489451
  
--- Diff: spec/cordova/plugin/save.spec.js ---
@@ -54,15 +61,145 @@ describe('cordova/plugin/save', function () {
 });
 });
 describe('happy path', function () {
-it('should remove all plugins from config.xml and re-add new ones 
based on those retrieved from fetch.json');
-it('should only add top-level plugins to config.xml');
-it('should write individual plugin specs to config.xml');
-it('should write individual plugin variables to config.xml');
+it('should remove all plugins from config.xml and re-add new ones 
based on those retrieved from fetch.json', function (done) {
+save(projectRoot).then(function () {
+
expect(cfg_parser_mock.prototype.removePlugin).toHaveBeenCalledWith('VRPlugin');
+
expect(cfg_parser_mock.prototype.removePlugin).toHaveBeenCalledWith('MastodonSocialPlugin');
+}).fail(function (e) {
+expect(e).toBeUndefined();
+fail('did not expect fail handler to be invoked');
+}).done(done);
+});
+
+it('should only add top-level plugins to config.xml', function 
(done) {
+var fake_fetch_json =
+{'VRPlugin': {'source': {
+'type': 'registry',
+'id': 'id'
+},
+'is_top_level': true
+},
+'MastodonSocialPlugin': { 'source': {
+'type': 'registry',
+'id': 'id'
+},
+'is_top_level': false }};
+
+
fs.readFileSync.and.returnValue(JSON.stringify(fake_fetch_json));
+save(projectRoot).then(function () {
+
expect(cfg_parser_mock.prototype.addPlugin).toHaveBeenCalledWith(Object({ name: 
'VRPlugin' }), [ ]);
+expect(cfg_parser_mock.prototype.write).toHaveBeenCalled();
+}).fail(function (e) {
+expect(e).toBeUndefined();
+fail('did not expect fail handler to be invoked');
+}).done(done);
+});
+
+it('should write individual plugin specs to config.xml', function 
(done) {
+var fake_fetch_json =
+{'VRPlugin': {'source': {
+'type': 'registry',
+'id': 'id'
+},
+'is_top_level': true }};
+
fs.readFileSync.and.returnValue(JSON.stringify(fake_fetch_json));
+spyOn(save, 'getSpec').and.returnValue('1.0.0');
+save(projectRoot).then(function () {
+
expect(cfg_parser_mock.prototype.addPlugin).toHaveBeenCalledWith(Object({ name: 
'VRPlugin', spec: '1.0.0' }), jasmine.any(Object));
+expect(cfg_parser_mock.prototype.write).toHaveBeenCalled();
+}).fail(function (e) {
+expect(e).toBeUndefined();
+fail('did not expect fail handler to be invoked');
+}).done(done);
+});
+
+it('should write individual plugin variables to config.xml', 
function (done) {
+var fake_fetch_json =
+{'VRPlugin': {'source': {
+'type': 'registry',
+'id': 'id'
+},
+'is_top_level': true,
+'variables': {
+'var 1': ' '
+}}};
+
fs.readFileSync.and.returnValue(JSON.stringify(fake_fetch_json));
+save(projectRoot).then(function () {
+
expect(cfg_parser_mock.prototype.addPlugin).toHaveBeenCalledWith(jasmine.any(Object),
 [ Object({ name: 'var 1', value: ' ' }) ]);
+expect(cfg_parser_mock.prototype.write).toHaveBeenCalled();
+}).fail(function (e) {
+expect(e).toBeUndefined();
+fail('did not expect fail handler to be invoked');
+}).done(done);
+});
 });
 describe('getSpec helper method', function () {
-it('should return a plugin source\'s url or path property 
immediately');
-it('should return a version if a version was provided to plugin 
id');
-it('should return a version that includes scope if scope was part 
of plugin id');

[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-08-31 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16149960#comment-16149960
 ] 

ASF GitHub Bot commented on CB-12361:
-

Github user stevengill commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/584#discussion_r136487019
  
--- Diff: spec/cordova/plugin/save.spec.js ---
@@ -54,15 +61,145 @@ describe('cordova/plugin/save', function () {
 });
 });
 describe('happy path', function () {
-it('should remove all plugins from config.xml and re-add new ones 
based on those retrieved from fetch.json');
-it('should only add top-level plugins to config.xml');
-it('should write individual plugin specs to config.xml');
-it('should write individual plugin variables to config.xml');
+it('should remove all plugins from config.xml and re-add new ones 
based on those retrieved from fetch.json', function (done) {
+save(projectRoot).then(function () {
+
expect(cfg_parser_mock.prototype.removePlugin).toHaveBeenCalledWith('VRPlugin');
+
expect(cfg_parser_mock.prototype.removePlugin).toHaveBeenCalledWith('MastodonSocialPlugin');
+}).fail(function (e) {
+expect(e).toBeUndefined();
+fail('did not expect fail handler to be invoked');
+}).done(done);
+});
+
+it('should only add top-level plugins to config.xml', function 
(done) {
+var fake_fetch_json =
+{'VRPlugin': {'source': {
+'type': 'registry',
+'id': 'id'
+},
+'is_top_level': true
+},
+'MastodonSocialPlugin': { 'source': {
+'type': 'registry',
+'id': 'id'
+},
+'is_top_level': false }};
+
+
fs.readFileSync.and.returnValue(JSON.stringify(fake_fetch_json));
+save(projectRoot).then(function () {
+
expect(cfg_parser_mock.prototype.addPlugin).toHaveBeenCalledWith(Object({ name: 
'VRPlugin' }), [ ]);
--- End diff --

Maybe add another expect to show that the non top level plugin didn't get 
installed. Something like 
```
expect(cfg_parser_mock.prototype.addPlugin).toHaveBeenCalledWith(Object({ 
name: 'MastodonSocialPlugin' }), [ ]);```


> Speed up cordova-lib tests
> --
>
> Key: CB-12361
> URL: https://issues.apache.org/jira/browse/CB-12361
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: cordova-lib
>Reporter: Steve Gill
>Assignee: Steve Gill
>  Labels: cordova-next
>
> * Split out e2e tests into own folder
> * stub i/o and network requests
> * use local fixtures when possible & makes sense



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-08-31 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16149957#comment-16149957
 ] 

ASF GitHub Bot commented on CB-12361:
-

Github user stevengill commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/584#discussion_r136487749
  
--- Diff: spec/cordova/plugin/save.spec.js ---
@@ -54,15 +61,145 @@ describe('cordova/plugin/save', function () {
 });
 });
 describe('happy path', function () {
-it('should remove all plugins from config.xml and re-add new ones 
based on those retrieved from fetch.json');
-it('should only add top-level plugins to config.xml');
-it('should write individual plugin specs to config.xml');
-it('should write individual plugin variables to config.xml');
+it('should remove all plugins from config.xml and re-add new ones 
based on those retrieved from fetch.json', function (done) {
+save(projectRoot).then(function () {
+
expect(cfg_parser_mock.prototype.removePlugin).toHaveBeenCalledWith('VRPlugin');
+
expect(cfg_parser_mock.prototype.removePlugin).toHaveBeenCalledWith('MastodonSocialPlugin');
+}).fail(function (e) {
+expect(e).toBeUndefined();
+fail('did not expect fail handler to be invoked');
+}).done(done);
+});
+
+it('should only add top-level plugins to config.xml', function 
(done) {
+var fake_fetch_json =
+{'VRPlugin': {'source': {
+'type': 'registry',
+'id': 'id'
+},
+'is_top_level': true
+},
+'MastodonSocialPlugin': { 'source': {
+'type': 'registry',
+'id': 'id'
+},
+'is_top_level': false }};
+
+
fs.readFileSync.and.returnValue(JSON.stringify(fake_fetch_json));
+save(projectRoot).then(function () {
+
expect(cfg_parser_mock.prototype.addPlugin).toHaveBeenCalledWith(Object({ name: 
'VRPlugin' }), [ ]);
--- End diff --

Maybe for this test, you can redo the checks from the first test. That is 
confirm that these two expects are run before the addPlugin one

```

expect(cfg_parser_mock.prototype.removePlugin).toHaveBeenCalledWith('VRPlugin');

expect(cfg_parser_mock.prototype.removePlugin).toHaveBeenCalledWith('MastodonSocialPlugin');
```

I think they should pass. If they do, you can also update the description 
of this test to reflect that the plugins are being removed first and then only 
top level plugins are being restored. 


> Speed up cordova-lib tests
> --
>
> Key: CB-12361
> URL: https://issues.apache.org/jira/browse/CB-12361
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: cordova-lib
>Reporter: Steve Gill
>Assignee: Steve Gill
>  Labels: cordova-next
>
> * Split out e2e tests into own folder
> * stub i/o and network requests
> * use local fixtures when possible & makes sense



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-08-31 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16149956#comment-16149956
 ] 

ASF GitHub Bot commented on CB-12361:
-

Github user stevengill commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/584#discussion_r136490187
  
--- Diff: spec/cordova/plugin/save.spec.js ---
@@ -54,15 +61,145 @@ describe('cordova/plugin/save', function () {
 });
 });
 describe('happy path', function () {
-it('should remove all plugins from config.xml and re-add new ones 
based on those retrieved from fetch.json');
-it('should only add top-level plugins to config.xml');
-it('should write individual plugin specs to config.xml');
-it('should write individual plugin variables to config.xml');
+it('should remove all plugins from config.xml and re-add new ones 
based on those retrieved from fetch.json', function (done) {
+save(projectRoot).then(function () {
+
expect(cfg_parser_mock.prototype.removePlugin).toHaveBeenCalledWith('VRPlugin');
+
expect(cfg_parser_mock.prototype.removePlugin).toHaveBeenCalledWith('MastodonSocialPlugin');
+}).fail(function (e) {
+expect(e).toBeUndefined();
+fail('did not expect fail handler to be invoked');
+}).done(done);
+});
+
+it('should only add top-level plugins to config.xml', function 
(done) {
+var fake_fetch_json =
+{'VRPlugin': {'source': {
+'type': 'registry',
+'id': 'id'
+},
+'is_top_level': true
+},
+'MastodonSocialPlugin': { 'source': {
+'type': 'registry',
+'id': 'id'
+},
+'is_top_level': false }};
+
+
fs.readFileSync.and.returnValue(JSON.stringify(fake_fetch_json));
+save(projectRoot).then(function () {
+
expect(cfg_parser_mock.prototype.addPlugin).toHaveBeenCalledWith(Object({ name: 
'VRPlugin' }), [ ]);
+expect(cfg_parser_mock.prototype.write).toHaveBeenCalled();
+}).fail(function (e) {
+expect(e).toBeUndefined();
+fail('did not expect fail handler to be invoked');
+}).done(done);
+});
+
+it('should write individual plugin specs to config.xml', function 
(done) {
+var fake_fetch_json =
+{'VRPlugin': {'source': {
+'type': 'registry',
+'id': 'id'
+},
+'is_top_level': true }};
+
fs.readFileSync.and.returnValue(JSON.stringify(fake_fetch_json));
+spyOn(save, 'getSpec').and.returnValue('1.0.0');
+save(projectRoot).then(function () {
+
expect(cfg_parser_mock.prototype.addPlugin).toHaveBeenCalledWith(Object({ name: 
'VRPlugin', spec: '1.0.0' }), jasmine.any(Object));
+expect(cfg_parser_mock.prototype.write).toHaveBeenCalled();
+}).fail(function (e) {
+expect(e).toBeUndefined();
+fail('did not expect fail handler to be invoked');
+}).done(done);
+});
+
+it('should write individual plugin variables to config.xml', 
function (done) {
+var fake_fetch_json =
+{'VRPlugin': {'source': {
+'type': 'registry',
+'id': 'id'
+},
+'is_top_level': true,
+'variables': {
+'var 1': ' '
+}}};
+
fs.readFileSync.and.returnValue(JSON.stringify(fake_fetch_json));
+save(projectRoot).then(function () {
+
expect(cfg_parser_mock.prototype.addPlugin).toHaveBeenCalledWith(jasmine.any(Object),
 [ Object({ name: 'var 1', value: ' ' }) ]);
+expect(cfg_parser_mock.prototype.write).toHaveBeenCalled();
+}).fail(function (e) {
+expect(e).toBeUndefined();
+fail('did not expect fail handler to be invoked');
+}).done(done);
+});
 });
 describe('getSpec helper method', function () {
--- End diff --

So with all of these `getSpec` tests, you want to test getSpec directly. 
Right now, you are doing `save(projectRoot)` but instead you want to do 
`save.getSpec({ url: 
'https://git-wip-us.apache.org/repos/asf/cordova-plugin-camera.git' }

[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-08-31 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16149959#comment-16149959
 ] 

ASF GitHub Bot commented on CB-12361:
-

Github user stevengill commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/584#discussion_r136486774
  
--- Diff: spec/cordova/plugin/save.spec.js ---
@@ -54,15 +61,145 @@ describe('cordova/plugin/save', function () {
 });
 });
 describe('happy path', function () {
-it('should remove all plugins from config.xml and re-add new ones 
based on those retrieved from fetch.json');
-it('should only add top-level plugins to config.xml');
-it('should write individual plugin specs to config.xml');
-it('should write individual plugin variables to config.xml');
+it('should remove all plugins from config.xml and re-add new ones 
based on those retrieved from fetch.json', function (done) {
--- End diff --

This test checks that the plugins get removed but not if the new ones get 
re-added (based on description). I think the description should be updated to 
just check that existing plugins are getting removed


> Speed up cordova-lib tests
> --
>
> Key: CB-12361
> URL: https://issues.apache.org/jira/browse/CB-12361
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: cordova-lib
>Reporter: Steve Gill
>Assignee: Steve Gill
>  Labels: cordova-next
>
> * Split out e2e tests into own folder
> * stub i/o and network requests
> * use local fixtures when possible & makes sense



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-08-31 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16149958#comment-16149958
 ] 

ASF GitHub Bot commented on CB-12361:
-

Github user stevengill commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/584#discussion_r136488898
  
--- Diff: spec/cordova/plugin/save.spec.js ---
@@ -54,15 +61,145 @@ describe('cordova/plugin/save', function () {
 });
 });
 describe('happy path', function () {
-it('should remove all plugins from config.xml and re-add new ones 
based on those retrieved from fetch.json');
-it('should only add top-level plugins to config.xml');
-it('should write individual plugin specs to config.xml');
-it('should write individual plugin variables to config.xml');
+it('should remove all plugins from config.xml and re-add new ones 
based on those retrieved from fetch.json', function (done) {
+save(projectRoot).then(function () {
+
expect(cfg_parser_mock.prototype.removePlugin).toHaveBeenCalledWith('VRPlugin');
+
expect(cfg_parser_mock.prototype.removePlugin).toHaveBeenCalledWith('MastodonSocialPlugin');
+}).fail(function (e) {
+expect(e).toBeUndefined();
+fail('did not expect fail handler to be invoked');
+}).done(done);
+});
+
+it('should only add top-level plugins to config.xml', function 
(done) {
+var fake_fetch_json =
+{'VRPlugin': {'source': {
+'type': 'registry',
+'id': 'id'
+},
+'is_top_level': true
+},
+'MastodonSocialPlugin': { 'source': {
+'type': 'registry',
+'id': 'id'
+},
+'is_top_level': false }};
+
+
fs.readFileSync.and.returnValue(JSON.stringify(fake_fetch_json));
+save(projectRoot).then(function () {
+
expect(cfg_parser_mock.prototype.addPlugin).toHaveBeenCalledWith(Object({ name: 
'VRPlugin' }), [ ]);
+expect(cfg_parser_mock.prototype.write).toHaveBeenCalled();
+}).fail(function (e) {
+expect(e).toBeUndefined();
+fail('did not expect fail handler to be invoked');
+}).done(done);
+});
+
+it('should write individual plugin specs to config.xml', function 
(done) {
+var fake_fetch_json =
+{'VRPlugin': {'source': {
+'type': 'registry',
+'id': 'id'
+},
+'is_top_level': true }};
+
fs.readFileSync.and.returnValue(JSON.stringify(fake_fetch_json));
+spyOn(save, 'getSpec').and.returnValue('1.0.0');
+save(projectRoot).then(function () {
+
expect(cfg_parser_mock.prototype.addPlugin).toHaveBeenCalledWith(Object({ name: 
'VRPlugin', spec: '1.0.0' }), jasmine.any(Object));
+expect(cfg_parser_mock.prototype.write).toHaveBeenCalled();
+}).fail(function (e) {
+expect(e).toBeUndefined();
+fail('did not expect fail handler to be invoked');
+}).done(done);
+});
+
+it('should write individual plugin variables to config.xml', 
function (done) {
+var fake_fetch_json =
+{'VRPlugin': {'source': {
+'type': 'registry',
+'id': 'id'
+},
+'is_top_level': true,
+'variables': {
+'var 1': ' '
+}}};
+
fs.readFileSync.and.returnValue(JSON.stringify(fake_fetch_json));
+save(projectRoot).then(function () {
+
expect(cfg_parser_mock.prototype.addPlugin).toHaveBeenCalledWith(jasmine.any(Object),
 [ Object({ name: 'var 1', value: ' ' }) ]);
+expect(cfg_parser_mock.prototype.write).toHaveBeenCalled();
+}).fail(function (e) {
+expect(e).toBeUndefined();
+fail('did not expect fail handler to be invoked');
+}).done(done);
+});
 });
 describe('getSpec helper method', function () {
-it('should return a plugin source\'s url or path property 
immediately');
-it('should return a version if a version was provided to plugin 
id');
-it('should return a version that includes scope if scope was part 
of plugin id');

[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-08-25 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16142036#comment-16142036
 ] 

ASF GitHub Bot commented on CB-12361:
-

Github user stevengill commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/569#discussion_r135331136
  
--- Diff: spec/cordova/plugin/add.spec.js ---
@@ -21,16 +21,82 @@
 /* globals fail */
 
 var Q = require('q');
-var add = require('../../../src/cordova/plugin/add');
+var rewire = require('rewire');
+var add = rewire('../../../src/cordova/plugin/add');
+var plugman = require('../../../src/plugman/plugman');
+var cordova_util = require('../../../src/cordova/util');
+var path = require('path');
+var fs = require('fs');
+var config = require('../../../src/cordova/config');
+var events = require('cordova-common').events;
+var registry = require('../../../src/plugman/registry/registry');
+var plugin_util = require('../../../src/cordova/plugin/util');
 
-describe('cordova/plugin/add', function () {
+fdescribe('cordova/plugin/add', function () {
 var projectRoot = '/some/path';
 var hook_mock;
+var Cfg_parser_mock = function () {};
+var cfg_parser_revert_mock;
+var plugin_info_provider_mock = function () {};
+var plugin_info_provider_revert_mock;
+var plugin_info;
+var package_json_mock;
+
 beforeEach(function () {
 hook_mock = jasmine.createSpyObj('hooks runner mock', ['fire']);
 hook_mock.fire.and.returnValue(Q());
+Cfg_parser_mock.prototype = jasmine.createSpyObj('config parser 
prototype mock', ['getPlugin', 'removePlugin', 'addPlugin', 'write']);
+/* eslint-disable */
+Cfg_parser_mock.prototype.getPlugin;
+Cfg_parser_mock.prototype.getPlugin;
--- End diff --

good catch!


> Speed up cordova-lib tests
> --
>
> Key: CB-12361
> URL: https://issues.apache.org/jira/browse/CB-12361
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: cordova-lib
>Reporter: Steve Gill
>Assignee: Steve Gill
>  Labels: cordova-next
>
> * Split out e2e tests into own folder
> * stub i/o and network requests
> * use local fixtures when possible & makes sense



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-08-25 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16141905#comment-16141905
 ] 

ASF GitHub Bot commented on CB-12361:
-

Github user audreyso commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/569#discussion_r135308470
  
--- Diff: spec/cordova/plugin/add.spec.js ---
@@ -21,16 +21,82 @@
 /* globals fail */
 
 var Q = require('q');
-var add = require('../../../src/cordova/plugin/add');
+var rewire = require('rewire');
+var add = rewire('../../../src/cordova/plugin/add');
+var plugman = require('../../../src/plugman/plugman');
+var cordova_util = require('../../../src/cordova/util');
+var path = require('path');
+var fs = require('fs');
+var config = require('../../../src/cordova/config');
+var events = require('cordova-common').events;
+var registry = require('../../../src/plugman/registry/registry');
+var plugin_util = require('../../../src/cordova/plugin/util');
 
-describe('cordova/plugin/add', function () {
+fdescribe('cordova/plugin/add', function () {
 var projectRoot = '/some/path';
 var hook_mock;
+var Cfg_parser_mock = function () {};
+var cfg_parser_revert_mock;
+var plugin_info_provider_mock = function () {};
+var plugin_info_provider_revert_mock;
+var plugin_info;
+var package_json_mock;
+
 beforeEach(function () {
 hook_mock = jasmine.createSpyObj('hooks runner mock', ['fire']);
 hook_mock.fire.and.returnValue(Q());
+Cfg_parser_mock.prototype = jasmine.createSpyObj('config parser 
prototype mock', ['getPlugin', 'removePlugin', 'addPlugin', 'write']);
+/* eslint-disable */
+Cfg_parser_mock.prototype.getPlugin;
+Cfg_parser_mock.prototype.getPlugin;
--- End diff --

Hi! I think you have "getPlugin" twice?


> Speed up cordova-lib tests
> --
>
> Key: CB-12361
> URL: https://issues.apache.org/jira/browse/CB-12361
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: cordova-lib
>Reporter: Steve Gill
>Assignee: Steve Gill
>  Labels: cordova-next
>
> * Split out e2e tests into own folder
> * stub i/o and network requests
> * use local fixtures when possible & makes sense



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-08-11 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16124053#comment-16124053
 ] 

ASF GitHub Bot commented on CB-12361:
-

Github user asfgit closed the pull request at:

https://github.com/apache/cordova-lib/pull/581


> Speed up cordova-lib tests
> --
>
> Key: CB-12361
> URL: https://issues.apache.org/jira/browse/CB-12361
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: cordova-lib
>Reporter: Steve Gill
>Assignee: Steve Gill
>  Labels: cordova-next
>
> * Split out e2e tests into own folder
> * stub i/o and network requests
> * use local fixtures when possible & makes sense



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-08-11 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16124051#comment-16124051
 ] 

ASF subversion and git services commented on CB-12361:
--

Commit fbad9b8ee830fd5718ebb220119bdf34a4390b7b in cordova-lib's branch 
refs/heads/master from [~auso]
[ https://git-wip-us.apache.org/repos/asf?p=cordova-lib.git;h=fbad9b8 ]

CB-12361 : added plugin remove tests


> Speed up cordova-lib tests
> --
>
> Key: CB-12361
> URL: https://issues.apache.org/jira/browse/CB-12361
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: cordova-lib
>Reporter: Steve Gill
>Assignee: Steve Gill
>  Labels: cordova-next
>
> * Split out e2e tests into own folder
> * stub i/o and network requests
> * use local fixtures when possible & makes sense



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-08-11 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16123972#comment-16123972
 ] 

ASF GitHub Bot commented on CB-12361:
-

Github user asfgit closed the pull request at:

https://github.com/apache/cordova-lib/pull/583


> Speed up cordova-lib tests
> --
>
> Key: CB-12361
> URL: https://issues.apache.org/jira/browse/CB-12361
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: cordova-lib
>Reporter: Steve Gill
>Assignee: Steve Gill
>  Labels: cordova-next
>
> * Split out e2e tests into own folder
> * stub i/o and network requests
> * use local fixtures when possible & makes sense



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-08-11 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16123971#comment-16123971
 ] 

ASF subversion and git services commented on CB-12361:
--

Commit acbd9e7547ddb0f2d632031535510e8705c08033 in cordova-lib's branch 
refs/heads/master from [~auso]
[ https://git-wip-us.apache.org/repos/asf?p=cordova-lib.git;h=acbd9e7 ]

CB-12361 : added tests for plugin/index.js


> Speed up cordova-lib tests
> --
>
> Key: CB-12361
> URL: https://issues.apache.org/jira/browse/CB-12361
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: cordova-lib
>Reporter: Steve Gill
>Assignee: Steve Gill
>  Labels: cordova-next
>
> * Split out e2e tests into own folder
> * stub i/o and network requests
> * use local fixtures when possible & makes sense



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-08-11 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16123853#comment-16123853
 ] 

ASF GitHub Bot commented on CB-12361:
-

Github user stevengill commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/581#discussion_r132758854
  
--- Diff: spec/cordova/plugin/remove.spec.js ---
@@ -32,18 +66,123 @@ describe('cordova/plugin/remove', function () {
 expect(e.message).toContain('No plugin specified');
 }).done(done);
 });
-it('should require that a provided plugin be installed in the 
current project');
+
+it('should require that a provided plugin be installed in the 
current project', function (done) {
+var opts = { plugins: [ undefined ] };
+remove(projectRoot, 'plugin', hook_mock, opts).then(function 
() {
+fail('success handler unexpectedly invoked');
+}).fail(function (e) {
+expect(e.message).toContain('is not present in the 
project');
+}).done(done);
+});
 });
 describe('happy path', function () {
-it('should fire the before_plugin_rm hook');
-it('should call plugman.uninstall.uninstallPlatform for each 
platform installed in the project and for each provided plugin');
-it('should trigger a prepare if 
plugman.uninstall.uninstallPlatform returned something falsy');
-it('should call plugman.uninstall.uninstallPlugin once plugin has 
been uninstalled for each platform');
+it('should fire the before_plugin_rm hook', function (done) {
+var opts = { important: 'options', plugins: [] };
+remove(projectRoot, 'cordova-plugin-splashscreen', hook_mock, 
opts).then(function () {
+
expect(hook_mock.fire).toHaveBeenCalledWith('before_plugin_rm', opts);
+}).fail(function (e) {
+fail('fail handler unexpectedly invoked');
+console.error(e);
+}).done(done);
+});
+
+it('should call plugman.uninstall.uninstallPlatform for each 
platform installed in the project and for each provided plugin', function 
(done) {
+
remove.validatePluginId.and.returnValue('cordova-plugin-splashscreen');
+var opts = {important: 'options', plugins: 
['cordova-plugin-splashscreen']};
+remove(projectRoot, 'cordova-plugin-splashscreen', hook_mock, 
opts).then(function () {
+
expect(plugman.uninstall.uninstallPlatform).toHaveBeenCalled();
+expect(events.emit).toHaveBeenCalledWith('verbose', 
jasmine.stringMatching('plugman.uninstall on plugin 
"cordova-plugin-splashscreen" for platform "ios"'));
+expect(events.emit).toHaveBeenCalledWith('verbose', 
jasmine.stringMatching('plugman.uninstall on plugin 
"cordova-plugin-splashscreen" for platform "android"'));
+}).fail(function (e) {
+fail('fail handler unexpectedly invoked');
+console.error(e);
+}).done(done);
+});
+
+it('should trigger a prepare if 
plugman.uninstall.uninstallPlatform returned something falsy', function (done) {
+
remove.validatePluginId.and.returnValue('cordova-plugin-splashscreen');
+plugman.uninstall.uninstallPlatform.and.returnValue(Q(false));
+var opts = {important: 'options', plugins: 
['cordova-plugin-splashscreen']};
+remove(projectRoot, 'cordova-plugin-splashscreen', hook_mock, 
opts).then(function () {
+
expect(plugman.uninstall.uninstallPlatform).toHaveBeenCalled();
+expect(events.emit).toHaveBeenCalledWith('verbose', 
'Calling prepare.');
--- End diff --

i'd suggest removing this expect event due to my other comment


> Speed up cordova-lib tests
> --
>
> Key: CB-12361
> URL: https://issues.apache.org/jira/browse/CB-12361
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: cordova-lib
>Reporter: Steve Gill
>Assignee: Steve Gill
>  Labels: cordova-next
>
> * Split out e2e tests into own folder
> * stub i/o and network requests
> * use local fixtures when possible & makes sense



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-08-11 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16123852#comment-16123852
 ] 

ASF GitHub Bot commented on CB-12361:
-

Github user stevengill commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/581#discussion_r132758763
  
--- Diff: src/cordova/plugin/remove.js ---
@@ -68,6 +68,7 @@ function remove (projectRoot, targets, hooksRunner, opts) 
{
 // If platform does not returned anything 
we'll need
 // to trigger a prepare after all plugins 
installed
 // TODO: if didPrepare is falsy, what does 
that imply? WHY are we doing this?
+events.emit('verbose', 'Calling prepare.');
--- End diff --

I think you might want to remove this event. Since Prepare will only be 
called if `didPrepare` is falsy. So you could get the output `calling prepare` 
when you actually don't call prepare


> Speed up cordova-lib tests
> --
>
> Key: CB-12361
> URL: https://issues.apache.org/jira/browse/CB-12361
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: cordova-lib
>Reporter: Steve Gill
>Assignee: Steve Gill
>  Labels: cordova-next
>
> * Split out e2e tests into own folder
> * stub i/o and network requests
> * use local fixtures when possible & makes sense



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-08-11 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16123791#comment-16123791
 ] 

ASF GitHub Bot commented on CB-12361:
-

Github user asfgit closed the pull request at:

https://github.com/apache/cordova-lib/pull/577


> Speed up cordova-lib tests
> --
>
> Key: CB-12361
> URL: https://issues.apache.org/jira/browse/CB-12361
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: cordova-lib
>Reporter: Steve Gill
>Assignee: Steve Gill
>  Labels: cordova-next
>
> * Split out e2e tests into own folder
> * stub i/o and network requests
> * use local fixtures when possible & makes sense



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-08-11 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16123790#comment-16123790
 ] 

ASF subversion and git services commented on CB-12361:
--

Commit 9cdc0f2b1af7663a3db2659ef279d97164f8991a in cordova-lib's branch 
refs/heads/master from [~auso]
[ https://git-wip-us.apache.org/repos/asf?p=cordova-lib.git;h=9cdc0f2 ]

CB-12361 : added tests for list platform


> Speed up cordova-lib tests
> --
>
> Key: CB-12361
> URL: https://issues.apache.org/jira/browse/CB-12361
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: cordova-lib
>Reporter: Steve Gill
>Assignee: Steve Gill
>  Labels: cordova-next
>
> * Split out e2e tests into own folder
> * stub i/o and network requests
> * use local fixtures when possible & makes sense



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-08-11 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16123715#comment-16123715
 ] 

ASF GitHub Bot commented on CB-12361:
-

Github user asfgit closed the pull request at:

https://github.com/apache/cordova-lib/pull/582


> Speed up cordova-lib tests
> --
>
> Key: CB-12361
> URL: https://issues.apache.org/jira/browse/CB-12361
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: cordova-lib
>Reporter: Steve Gill
>Assignee: Steve Gill
>  Labels: cordova-next
>
> * Split out e2e tests into own folder
> * stub i/o and network requests
> * use local fixtures when possible & makes sense



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-08-11 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16123713#comment-16123713
 ] 

ASF subversion and git services commented on CB-12361:
--

Commit f399c739bc6ed2a6dcc96eff8bd93a058e5122a8 in cordova-lib's branch 
refs/heads/master from [~auso]
[ https://git-wip-us.apache.org/repos/asf?p=cordova-lib.git;h=f399c73 ]

CB-12361 : added tests for plugin/search.js and rebased


> Speed up cordova-lib tests
> --
>
> Key: CB-12361
> URL: https://issues.apache.org/jira/browse/CB-12361
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: cordova-lib
>Reporter: Steve Gill
>Assignee: Steve Gill
>  Labels: cordova-next
>
> * Split out e2e tests into own folder
> * stub i/o and network requests
> * use local fixtures when possible & makes sense



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-08-11 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16123709#comment-16123709
 ] 

ASF GitHub Bot commented on CB-12361:
-

Github user stevengill commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/577#discussion_r132738598
  
--- Diff: spec/cordova/platform/list.spec.js ---
@@ -0,0 +1,75 @@
+/**
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+http://www.apache.org/licenses/LICENSE-2.0
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+*/
+
+var events = require('cordova-common').events;
+var Q = require('q');
+var rewire = require('rewire');
+var platform_list = rewire('../../../src/cordova/platform/list');
--- End diff --

i don't think you use rewire anywhere in this file


> Speed up cordova-lib tests
> --
>
> Key: CB-12361
> URL: https://issues.apache.org/jira/browse/CB-12361
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: cordova-lib
>Reporter: Steve Gill
>Assignee: Steve Gill
>  Labels: cordova-next
>
> * Split out e2e tests into own folder
> * stub i/o and network requests
> * use local fixtures when possible & makes sense



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-08-11 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16123708#comment-16123708
 ] 

ASF GitHub Bot commented on CB-12361:
-

Github user stevengill commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/577#discussion_r132742737
  
--- Diff: spec/cordova/platform/list.spec.js ---
@@ -0,0 +1,75 @@
+/**
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+http://www.apache.org/licenses/LICENSE-2.0
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+*/
+
+var events = require('cordova-common').events;
+var Q = require('q');
+var rewire = require('rewire');
+var platform_list = rewire('../../../src/cordova/platform/list');
+var platform_metadata = require('../../../src/cordova/platform_metadata');
+var cordova_util = require('../../../src/cordova/util');
+var fail;
+
+describe('cordova/platform/list', function () {
+var hooks_mock;
+var projectRoot = '/some/path';
+
+beforeEach(function () {
+hooks_mock = jasmine.createSpyObj('hooksRunner mock', ['fire']);
+hooks_mock.fire.and.returnValue(Q());
+spyOn(cordova_util, 
'getInstalledPlatformsWithVersions').and.callThrough();
+spyOn(events, 'emit');
+spyOn(platform_metadata, 'save');
+spyOn(cordova_util, 'requireNoCache').and.returnValue({});
+});
+
+it('should fire the before_platform_ls hook', function () {
+platform_list(hooks_mock, projectRoot, {save: true});
+expect(hooks_mock.fire).toHaveBeenCalledWith('before_platform_ls', 
Object({ save: true }));
+});
+
+it('should file the after_platform_ls hook', function (done) {
--- End diff --

type. Should be fire


> Speed up cordova-lib tests
> --
>
> Key: CB-12361
> URL: https://issues.apache.org/jira/browse/CB-12361
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: cordova-lib
>Reporter: Steve Gill
>Assignee: Steve Gill
>  Labels: cordova-next
>
> * Split out e2e tests into own folder
> * stub i/o and network requests
> * use local fixtures when possible & makes sense



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-08-11 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16123640#comment-16123640
 ] 

ASF GitHub Bot commented on CB-12361:
-

Github user stevengill commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/582#discussion_r132736159
  
--- Diff: spec/cordova/plugin/search.spec.js ---
@@ -44,7 +44,36 @@ describe('cordova/plugin/search', function () {
 console.error(e);
 }).done(done);
 });
-it('should open a link to cordova.apache.org/plugins if no plugins are 
provided as parameter');
-it('should open a link to cordova.apache.org/plugins, providing the 
plugins passed in as a query-string parameter');
-it('should fire the after_plugin_search hook');
+
+it('should open a link to cordova.apache.org/plugins if no plugins are 
provided as parameter', function (done) {
+var opts = {important: 'options', plugins: []};
+search(hook_mock, opts).then(function () {
+expect(opener_mock).toHaveBeenCalled();
+}).fail(function (e) {
+console.log(e);
+fail('fail handler unexpectedly invoked');
+console.error(e);
+}).done(done);
+});
+
+it('should open a link to cordova.apache.org/plugins, providing the 
plugins passed in as a query-string parameter', function (done) {
+var opts = {important: 'options', plugins: 
['cordova-plugin-camera', 'cordova-plugin-splashscreen']};
+search(hook_mock, opts).then(function () {
+expect(opener_mock).toHaveBeenCalled();
+}).fail(function (e) {
+console.log(e);
--- End diff --

same


> Speed up cordova-lib tests
> --
>
> Key: CB-12361
> URL: https://issues.apache.org/jira/browse/CB-12361
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: cordova-lib
>Reporter: Steve Gill
>Assignee: Steve Gill
>  Labels: cordova-next
>
> * Split out e2e tests into own folder
> * stub i/o and network requests
> * use local fixtures when possible & makes sense



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-08-11 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16123639#comment-16123639
 ] 

ASF GitHub Bot commented on CB-12361:
-

Github user stevengill commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/582#discussion_r132736117
  
--- Diff: spec/cordova/plugin/search.spec.js ---
@@ -44,7 +44,36 @@ describe('cordova/plugin/search', function () {
 console.error(e);
 }).done(done);
 });
-it('should open a link to cordova.apache.org/plugins if no plugins are 
provided as parameter');
-it('should open a link to cordova.apache.org/plugins, providing the 
plugins passed in as a query-string parameter');
-it('should fire the after_plugin_search hook');
+
+it('should open a link to cordova.apache.org/plugins if no plugins are 
provided as parameter', function (done) {
+var opts = {important: 'options', plugins: []};
+search(hook_mock, opts).then(function () {
+expect(opener_mock).toHaveBeenCalled();
+}).fail(function (e) {
+console.log(e);
--- End diff --

Don't think you need console.log(e) since you console.error two lines below


> Speed up cordova-lib tests
> --
>
> Key: CB-12361
> URL: https://issues.apache.org/jira/browse/CB-12361
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: cordova-lib
>Reporter: Steve Gill
>Assignee: Steve Gill
>  Labels: cordova-next
>
> * Split out e2e tests into own folder
> * stub i/o and network requests
> * use local fixtures when possible & makes sense



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-07-28 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16105611#comment-16105611
 ] 

ASF subversion and git services commented on CB-12361:
--

Commit 620d45c41f2deac377f523653395b669a01f3cfd in cordova-lib's branch 
refs/heads/master from [~auso]
[ https://git-wip-us.apache.org/repos/asf?p=cordova-lib.git;h=620d45c ]

CB-12361 : added tests for save.js and rebased


> Speed up cordova-lib tests
> --
>
> Key: CB-12361
> URL: https://issues.apache.org/jira/browse/CB-12361
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: cordova-lib
>Reporter: Steve Gill
>Assignee: Steve Gill
>  Labels: cordova-next
>
> * Split out e2e tests into own folder
> * stub i/o and network requests
> * use local fixtures when possible & makes sense



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-07-28 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16105612#comment-16105612
 ] 

ASF GitHub Bot commented on CB-12361:
-

Github user asfgit closed the pull request at:

https://github.com/apache/cordova-lib/pull/579


> Speed up cordova-lib tests
> --
>
> Key: CB-12361
> URL: https://issues.apache.org/jira/browse/CB-12361
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: cordova-lib
>Reporter: Steve Gill
>Assignee: Steve Gill
>  Labels: cordova-next
>
> * Split out e2e tests into own folder
> * stub i/o and network requests
> * use local fixtures when possible & makes sense



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-07-28 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16105341#comment-16105341
 ] 

ASF subversion and git services commented on CB-12361:
--

Commit 0fe718e27367ef64358e4e8d0075c094a9c1b843 in cordova-lib's branch 
refs/heads/master from [~auso]
[ https://git-wip-us.apache.org/repos/asf?p=cordova-lib.git;h=0fe718e ]

CB-12361 : added unit-tests for getPlatformDetailsFromDir


> Speed up cordova-lib tests
> --
>
> Key: CB-12361
> URL: https://issues.apache.org/jira/browse/CB-12361
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: cordova-lib
>Reporter: Steve Gill
>Assignee: Steve Gill
>  Labels: cordova-next
>
> * Split out e2e tests into own folder
> * stub i/o and network requests
> * use local fixtures when possible & makes sense



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-07-28 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16105342#comment-16105342
 ] 

ASF subversion and git services commented on CB-12361:
--

Commit 02e734ce97ffbb0f3c2a0e8ad3b469b50451c042 in cordova-lib's branch 
refs/heads/master from [~auso]
[ https://git-wip-us.apache.org/repos/asf?p=cordova-lib.git;h=02e734c ]

CB-12361 : rebased and revised get platform details test


> Speed up cordova-lib tests
> --
>
> Key: CB-12361
> URL: https://issues.apache.org/jira/browse/CB-12361
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: cordova-lib
>Reporter: Steve Gill
>Assignee: Steve Gill
>  Labels: cordova-next
>
> * Split out e2e tests into own folder
> * stub i/o and network requests
> * use local fixtures when possible & makes sense



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-07-28 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16105344#comment-16105344
 ] 

ASF GitHub Bot commented on CB-12361:
-

Github user asfgit closed the pull request at:

https://github.com/apache/cordova-lib/pull/578


> Speed up cordova-lib tests
> --
>
> Key: CB-12361
> URL: https://issues.apache.org/jira/browse/CB-12361
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: cordova-lib
>Reporter: Steve Gill
>Assignee: Steve Gill
>  Labels: cordova-next
>
> * Split out e2e tests into own folder
> * stub i/o and network requests
> * use local fixtures when possible & makes sense



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-07-27 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16104285#comment-16104285
 ] 

ASF GitHub Bot commented on CB-12361:
-

Github user stevengill commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/578#discussion_r129996355
  
--- Diff: spec/cordova/platform/getPlatformDetailsFromDir.spec.js ---
@@ -0,0 +1,79 @@
+/**
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+http://www.apache.org/licenses/LICENSE-2.0
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+*/
+
+var path = require('path');
+var fs = require('fs');
+var Q = require('q');
+var rewire = require('rewire');
+var cordova_util = require('../../../src/cordova/util');
+var platform_getPlatformDetails = 
rewire('../../../src/cordova/platform/getPlatformDetailsFromDir');
+var events = require('cordova-common').events;
+var fail;
+
+describe('cordova/platform/getPlatformDetailsFromDir', function () {
+var package_json_mock;
+package_json_mock = jasmine.createSpyObj('package json mock', 
['cordova', 'dependencies']);
+package_json_mock.name = 'io.cordova.hellocordova';
+package_json_mock.version = '1.0.0';
+
+beforeEach(function () {
+spyOn(Q, 'reject');
+spyOn(fs, 'existsSync');
+spyOn(cordova_util, 'requireNoCache');
+spyOn(events, 'emit');
+});
+
+it('should throw if no config.xml or pkgJson', function (done) {
+platform_getPlatformDetails('dir', ['ios']);
+expect(Q.reject).toHaveBeenCalledWith(jasmine.stringMatching(/does 
not seem to contain a valid package.json or a valid Cordova platform/));
+done();
+});
+
+it('should throw if no platform is provided', function (done) {
+cordova_util.requireNoCache.and.returnValue({});
+platform_getPlatformDetails('dir');
+expect(Q.reject).toHaveBeenCalledWith(jasmine.stringMatching(/does 
not seem to contain a Cordova platform:/));
+done();
+});
+
+it('should return a promise with platform and version', function 
(done) {
+fs.existsSync.and.callFake(function(filePath) {
+if(path.basename(filePath) === 'package.json') {
+return true;
+} else {
+return false;
+}
+});
+cordova_util.requireNoCache.and.returnValue(package_json_mock);
+platform_getPlatformDetails('dir', ['cordova-android'])
+.then(function(result) {
+expect(result.platform).toBe('io.cordova.hellocordova');
+expect(result.version).toBe('1.0.0');
+expect(Q.reject).not.toHaveBeenCalled();
+}).fail(function (err) {
+fail('unexpected failure handler invoked!');
+console.error(err);
+}).done(done);
+});
+
+it('should remove the cordova- prefix from the platform name for known 
platforms', function (done) {
+platform_getPlatformDetails.platformFromName('cordova-ios');
+expect(events.emit).toHaveBeenCalledWith('verbose', 
jasmine.stringMatching(/Removing "cordova-" prefix/));
+
expect(platform_getPlatformDetails.platformFromName('cordova-ios')).toBe('ios');
--- End diff --

yup


> Speed up cordova-lib tests
> --
>
> Key: CB-12361
> URL: https://issues.apache.org/jira/browse/CB-12361
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: cordova-lib
>Reporter: Steve Gill
>Assignee: Steve Gill
>  Labels: cordova-next
>
> * Split out e2e tests into own folder
> * stub i/o and network requests
> * use local fixtures when possible & makes sense



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For addi

[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-07-27 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16104069#comment-16104069
 ] 

ASF GitHub Bot commented on CB-12361:
-

Github user stevengill commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/579#discussion_r129981726
  
--- Diff: spec/cordova/platform/save.spec.js ---
@@ -0,0 +1,71 @@
+/**
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+http://www.apache.org/licenses/LICENSE-2.0
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+*/
+
+var Q = require('q');
+var rewire = require('rewire');
+var platform_save = rewire('../../../src/cordova/platform/save');
+var platform_metadata = require('../../../src/cordova/platform_metadata');
+var fail;
+var semver = require('semver');
+
+describe('cordova/platform/save', function () {
+var hooks_mock;
+var projectRoot = '/some/path';
+var cfg_parser_mock = function () {};
+var cfg_parser_revert_mock;
+
+beforeEach(function () {
+spyOn(semver, 'valid');
+cfg_parser_mock.prototype = jasmine.createSpyObj('config parser 
mock', ['write', 'removeEngine', 'addEngine','getEngines']);
+cfg_parser_revert_mock = platform_save.__set__('ConfigParser', 
cfg_parser_mock);
+cfg_parser_mock.prototype.getEngines.and.returnValue(['android']);
+});
+
+afterEach(function () {
+cfg_parser_revert_mock();
+});
+
+it('should first remove platforms already in config.xml', function 
(done) {
+platform_save(hooks_mock, projectRoot, {save : true})
+.then(function(res){
+
expect(cfg_parser_mock.prototype.getEngines).toHaveBeenCalled();
+
expect(cfg_parser_mock.prototype.removeEngine).toHaveBeenCalled();
+}).fail(function (err) {
+fail('unexpected failure handler invoked!');
+console.error(err);
+}).done(done);
+});
+
+it('add and write to config.xml', function (done) {
+spyOn(platform_metadata, 
'getPlatformVersions').and.returnValue(Q(['6.3.0']));
+semver.valid.and.returnValue('6.0.0');
+platform_save(hooks_mock, projectRoot, {save : true})
+.then(function(result) {
+
expect(cfg_parser_mock.prototype.addEngine).toHaveBeenCalledWith(undefined, 
'~6.0.0');
+expect(cfg_parser_mock.prototype.write).toHaveBeenCalled();
+}).fail(function (err) {
+fail('unexpected failure handler invoked!');
+console.error(err);
+}).done(done);
+});
+
+it('should first remove platforms already in config.xml', function 
(done) {
--- End diff --

I think you forgot to update the description here when you copied the first 
test :)


> Speed up cordova-lib tests
> --
>
> Key: CB-12361
> URL: https://issues.apache.org/jira/browse/CB-12361
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: cordova-lib
>Reporter: Steve Gill
>Assignee: Steve Gill
>  Labels: cordova-next
>
> * Split out e2e tests into own folder
> * stub i/o and network requests
> * use local fixtures when possible & makes sense



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-07-27 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16104070#comment-16104070
 ] 

ASF GitHub Bot commented on CB-12361:
-

Github user stevengill commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/579#discussion_r129981636
  
--- Diff: spec/cordova/platform/save.spec.js ---
@@ -0,0 +1,71 @@
+/**
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+http://www.apache.org/licenses/LICENSE-2.0
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+*/
+
+var Q = require('q');
+var rewire = require('rewire');
+var platform_save = rewire('../../../src/cordova/platform/save');
+var platform_metadata = require('../../../src/cordova/platform_metadata');
+var fail;
+var semver = require('semver');
+
+describe('cordova/platform/save', function () {
+var hooks_mock;
+var projectRoot = '/some/path';
+var cfg_parser_mock = function () {};
+var cfg_parser_revert_mock;
+
+beforeEach(function () {
+spyOn(semver, 'valid');
+cfg_parser_mock.prototype = jasmine.createSpyObj('config parser 
mock', ['write', 'removeEngine', 'addEngine','getEngines']);
+cfg_parser_revert_mock = platform_save.__set__('ConfigParser', 
cfg_parser_mock);
+cfg_parser_mock.prototype.getEngines.and.returnValue(['android']);
+});
+
+afterEach(function () {
+cfg_parser_revert_mock();
+});
+
+it('should first remove platforms already in config.xml', function 
(done) {
+platform_save(hooks_mock, projectRoot, {save : true})
+.then(function(res){
+
expect(cfg_parser_mock.prototype.getEngines).toHaveBeenCalled();
+
expect(cfg_parser_mock.prototype.removeEngine).toHaveBeenCalled();
+}).fail(function (err) {
+fail('unexpected failure handler invoked!');
+console.error(err);
+}).done(done);
+});
+
+it('add and write to config.xml', function (done) {
+spyOn(platform_metadata, 
'getPlatformVersions').and.returnValue(Q(['6.3.0']));
--- End diff --

so getPlatformVersions returns in the format of `{platform: platform, 
version: version}`. So instead of returning `Q([6.3.0])`, you could return 
`Q({platform: 'android', version: 6.3.0})`. That way the first argument for 
line 58 won't be undefined. 


> Speed up cordova-lib tests
> --
>
> Key: CB-12361
> URL: https://issues.apache.org/jira/browse/CB-12361
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: cordova-lib
>Reporter: Steve Gill
>Assignee: Steve Gill
>  Labels: cordova-next
>
> * Split out e2e tests into own folder
> * stub i/o and network requests
> * use local fixtures when possible & makes sense



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-07-27 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16103976#comment-16103976
 ] 

ASF GitHub Bot commented on CB-12361:
-

Github user audreyso commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/578#discussion_r129969368
  
--- Diff: spec/cordova/platform/getPlatformDetailsFromDir.spec.js ---
@@ -0,0 +1,79 @@
+/**
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+http://www.apache.org/licenses/LICENSE-2.0
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+*/
+
+var path = require('path');
+var fs = require('fs');
+var Q = require('q');
+var rewire = require('rewire');
+var cordova_util = require('../../../src/cordova/util');
+var platform_getPlatformDetails = 
rewire('../../../src/cordova/platform/getPlatformDetailsFromDir');
+var events = require('cordova-common').events;
+var fail;
+
+describe('cordova/platform/getPlatformDetailsFromDir', function () {
+var package_json_mock;
+package_json_mock = jasmine.createSpyObj('package json mock', 
['cordova', 'dependencies']);
+package_json_mock.name = 'io.cordova.hellocordova';
+package_json_mock.version = '1.0.0';
+
+beforeEach(function () {
+spyOn(Q, 'reject');
+spyOn(fs, 'existsSync');
+spyOn(cordova_util, 'requireNoCache');
+spyOn(events, 'emit');
+});
+
+it('should throw if no config.xml or pkgJson', function (done) {
+platform_getPlatformDetails('dir', ['ios']);
+expect(Q.reject).toHaveBeenCalledWith(jasmine.stringMatching(/does 
not seem to contain a valid package.json or a valid Cordova platform/));
+done();
+});
+
+it('should throw if no platform is provided', function (done) {
+cordova_util.requireNoCache.and.returnValue({});
+platform_getPlatformDetails('dir');
+expect(Q.reject).toHaveBeenCalledWith(jasmine.stringMatching(/does 
not seem to contain a Cordova platform:/));
+done();
+});
+
+it('should return a promise with platform and version', function 
(done) {
+fs.existsSync.and.callFake(function(filePath) {
+if(path.basename(filePath) === 'package.json') {
+return true;
+} else {
+return false;
+}
+});
+cordova_util.requireNoCache.and.returnValue(package_json_mock);
+platform_getPlatformDetails('dir', ['cordova-android'])
+.then(function(result) {
+expect(result.platform).toBe('io.cordova.hellocordova');
+expect(result.version).toBe('1.0.0');
+expect(Q.reject).not.toHaveBeenCalled();
+}).fail(function (err) {
+fail('unexpected failure handler invoked!');
+console.error(err);
+}).done(done);
+});
+
+it('should remove the cordova- prefix from the platform name for known 
platforms', function (done) {
+platform_getPlatformDetails.platformFromName('cordova-ios');
+expect(events.emit).toHaveBeenCalledWith('verbose', 
jasmine.stringMatching(/Removing "cordova-" prefix/));
+
expect(platform_getPlatformDetails.platformFromName('cordova-ios')).toBe('ios');
--- End diff --

ohh okay do you mean just like this?

```
 it('should remove the cordova- prefix from the platform name for known 
platforms', function (done) {

expect(platform_getPlatformDetails.platformFromName('cordova-ios')).toBe('ios');
expect(events.emit).toHaveBeenCalledWith('verbose', 
jasmine.stringMatching(/Removing "cordova-" prefix/));
done();
});
```


> Speed up cordova-lib tests
> --
>
> Key: CB-12361
> URL: https://issues.apache.org/jira/browse/CB-12361
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: cordova-lib
>Reporter: Steve 

[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-07-27 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16103681#comment-16103681
 ] 

ASF GitHub Bot commented on CB-12361:
-

Github user stevengill commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/578#discussion_r129926425
  
--- Diff: spec/cordova/platform/getPlatformDetailsFromDir.spec.js ---
@@ -0,0 +1,79 @@
+/**
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+http://www.apache.org/licenses/LICENSE-2.0
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+*/
+
+var path = require('path');
+var fs = require('fs');
+var Q = require('q');
+var rewire = require('rewire');
+var cordova_util = require('../../../src/cordova/util');
+var platform_getPlatformDetails = 
rewire('../../../src/cordova/platform/getPlatformDetailsFromDir');
+var events = require('cordova-common').events;
+var fail;
+
+describe('cordova/platform/getPlatformDetailsFromDir', function () {
+var package_json_mock;
+package_json_mock = jasmine.createSpyObj('package json mock', 
['cordova', 'dependencies']);
+package_json_mock.name = 'io.cordova.hellocordova';
+package_json_mock.version = '1.0.0';
+
+beforeEach(function () {
+spyOn(Q, 'reject');
+spyOn(fs, 'existsSync');
+spyOn(cordova_util, 'requireNoCache');
+spyOn(events, 'emit');
+});
+
+it('should throw if no config.xml or pkgJson', function (done) {
+platform_getPlatformDetails('dir', ['ios']);
+expect(Q.reject).toHaveBeenCalledWith(jasmine.stringMatching(/does 
not seem to contain a valid package.json or a valid Cordova platform/));
+done();
+});
+
+it('should throw if no platform is provided', function (done) {
+cordova_util.requireNoCache.and.returnValue({});
+platform_getPlatformDetails('dir');
+expect(Q.reject).toHaveBeenCalledWith(jasmine.stringMatching(/does 
not seem to contain a Cordova platform:/));
+done();
+});
+
+it('should return a promise with platform and version', function 
(done) {
+fs.existsSync.and.callFake(function(filePath) {
+if(path.basename(filePath) === 'package.json') {
+return true;
+} else {
+return false;
+}
+});
+cordova_util.requireNoCache.and.returnValue(package_json_mock);
+platform_getPlatformDetails('dir', ['cordova-android'])
+.then(function(result) {
+expect(result.platform).toBe('io.cordova.hellocordova');
+expect(result.version).toBe('1.0.0');
+expect(Q.reject).not.toHaveBeenCalled();
+}).fail(function (err) {
+fail('unexpected failure handler invoked!');
+console.error(err);
+}).done(done);
+});
+
+it('should remove the cordova- prefix from the platform name for known 
platforms', function (done) {
+platform_getPlatformDetails.platformFromName('cordova-ios');
+expect(events.emit).toHaveBeenCalledWith('verbose', 
jasmine.stringMatching(/Removing "cordova-" prefix/));
+
expect(platform_getPlatformDetails.platformFromName('cordova-ios')).toBe('ios');
--- End diff --

You can take the expect from line 76 and combine it with line 74 and delete 
76. So line 74 gets replaced by line 76. Line 75 should still pass


> Speed up cordova-lib tests
> --
>
> Key: CB-12361
> URL: https://issues.apache.org/jira/browse/CB-12361
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: cordova-lib
>Reporter: Steve Gill
>Assignee: Steve Gill
>  Labels: cordova-next
>
> * Split out e2e tests into own folder
> * stub i/o and network requests
> * use local fixtures when possible & makes sense



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-07-27 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16103655#comment-16103655
 ] 

ASF GitHub Bot commented on CB-12361:
-

GitHub user audreyso opened a pull request:

https://github.com/apache/cordova-lib/pull/584

CB-12361 : added tests for plugin/save.js



### Platforms affected


### What does this PR do?

 added tests for plugin/save.js

### What testing has been done on this change?


### Checklist
- [X] [Reported an issue](http://cordova.apache.org/contribute/issues.html) 
in the JIRA database
- [X] Commit message follows the format: "CB-3232: (android) Fix bug with 
resolving file paths", where CB- is the JIRA ID & "android" is the platform 
affected.
- [X] Added automated test coverage as appropriate for this change.


You can merge this pull request into a Git repository by running:

$ git pull https://github.com/audreyso/cordova-lib CB-12361-16-plugin

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/cordova-lib/pull/584.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #584






> Speed up cordova-lib tests
> --
>
> Key: CB-12361
> URL: https://issues.apache.org/jira/browse/CB-12361
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: cordova-lib
>Reporter: Steve Gill
>Assignee: Steve Gill
>  Labels: cordova-next
>
> * Split out e2e tests into own folder
> * stub i/o and network requests
> * use local fixtures when possible & makes sense



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-07-26 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16102532#comment-16102532
 ] 

ASF GitHub Bot commented on CB-12361:
-

Github user stevengill commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/577#discussion_r129730654
  
--- Diff: spec/cordova/platform/list.spec.js ---
@@ -0,0 +1,66 @@
+/**
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+http://www.apache.org/licenses/LICENSE-2.0
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+*/
+
+var events = require('cordova-common').events;
+var Q = require('q');
+var events = require('cordova-common').events;
+var rewire = require('rewire');
+var platform_list = rewire('../../../src/cordova/platform/list');
+var platform_metadata = require('../../../src/cordova/platform_metadata');
+var cordova_util = require('../../../src/cordova/util');
+var fail;
+
+describe('cordova/platform/list', function () {
+var hooks_mock;
+var projectRoot = '/some/path';
+
+beforeEach(function () {
+hooks_mock = jasmine.createSpyObj('hooksRunner mock', ['fire']);
+hooks_mock.fire.and.returnValue(Q());
+spyOn(cordova_util, 
'getInstalledPlatformsWithVersions').and.callThrough();
+spyOn(events, 'emit');
+spyOn(platform_metadata, 'save');
+spyOn(cordova_util, 'requireNoCache').and.returnValue({});
+});
+
+it('should fire the before_platform_ls hook', function () {
+platform_list(hooks_mock, projectRoot, {save : true});
+expect(hooks_mock.fire).toHaveBeenCalledWith('before_platform_ls', 
Object({ save: true }));
+});
+
+it('should file the after_platform_ls hook',function (done) {
+platform_list(hooks_mock, projectRoot, {save : true})
+.then(function(result) {
+
expect(hooks_mock.fire).toHaveBeenCalledWith('after_platform_ls', Object({ 
save: true }));
+}).fail(function (err) {
+console.log(err.message);
+fail('unexpected failure handler invoked!');
+console.error(err);
+}).done(done);
+});
+
+it('should print results of available platforms',function (done) {
+platform_list(hooks_mock, projectRoot, {save : true})
+.then(function(result) {
+expect(events.emit).toHaveBeenCalledWith('results', 
jasmine.stringMatching(/Installed platforms:/));
+}).fail(function (err) {
+console.log(err.message);
--- End diff --

I don't think your fail function should `console.log(err.message)` and 
`console.log(err)`. Just `console.log(err)` is sufficient. 


> Speed up cordova-lib tests
> --
>
> Key: CB-12361
> URL: https://issues.apache.org/jira/browse/CB-12361
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: cordova-lib
>Reporter: Steve Gill
>Assignee: Steve Gill
>  Labels: cordova-next
>
> * Split out e2e tests into own folder
> * stub i/o and network requests
> * use local fixtures when possible & makes sense



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-07-26 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16102533#comment-16102533
 ] 

ASF GitHub Bot commented on CB-12361:
-

Github user stevengill commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/577#discussion_r129730691
  
--- Diff: spec/cordova/platform/list.spec.js ---
@@ -0,0 +1,66 @@
+/**
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+http://www.apache.org/licenses/LICENSE-2.0
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+*/
+
+var events = require('cordova-common').events;
+var Q = require('q');
+var events = require('cordova-common').events;
+var rewire = require('rewire');
+var platform_list = rewire('../../../src/cordova/platform/list');
+var platform_metadata = require('../../../src/cordova/platform_metadata');
+var cordova_util = require('../../../src/cordova/util');
+var fail;
+
+describe('cordova/platform/list', function () {
+var hooks_mock;
+var projectRoot = '/some/path';
+
+beforeEach(function () {
+hooks_mock = jasmine.createSpyObj('hooksRunner mock', ['fire']);
+hooks_mock.fire.and.returnValue(Q());
+spyOn(cordova_util, 
'getInstalledPlatformsWithVersions').and.callThrough();
+spyOn(events, 'emit');
+spyOn(platform_metadata, 'save');
+spyOn(cordova_util, 'requireNoCache').and.returnValue({});
+});
+
+it('should fire the before_platform_ls hook', function () {
+platform_list(hooks_mock, projectRoot, {save : true});
+expect(hooks_mock.fire).toHaveBeenCalledWith('before_platform_ls', 
Object({ save: true }));
+});
+
+it('should file the after_platform_ls hook',function (done) {
+platform_list(hooks_mock, projectRoot, {save : true})
+.then(function(result) {
+
expect(hooks_mock.fire).toHaveBeenCalledWith('after_platform_ls', Object({ 
save: true }));
+}).fail(function (err) {
+console.log(err.message);
+fail('unexpected failure handler invoked!');
+console.error(err);
+}).done(done);
+});
+
+it('should print results of available platforms',function (done) {
+platform_list(hooks_mock, projectRoot, {save : true})
+.then(function(result) {
+expect(events.emit).toHaveBeenCalledWith('results', 
jasmine.stringMatching(/Installed platforms:/));
+}).fail(function (err) {
+console.log(err.message);
--- End diff --

This is the same case as the previous test too


> Speed up cordova-lib tests
> --
>
> Key: CB-12361
> URL: https://issues.apache.org/jira/browse/CB-12361
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: cordova-lib
>Reporter: Steve Gill
>Assignee: Steve Gill
>  Labels: cordova-next
>
> * Split out e2e tests into own folder
> * stub i/o and network requests
> * use local fixtures when possible & makes sense



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-07-26 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16102424#comment-16102424
 ] 

ASF subversion and git services commented on CB-12361:
--

Commit 61ddb3d78182c51937539bcb8728fe97f9a9259f in cordova-lib's branch 
refs/heads/master from [~auso]
[ https://git-wip-us.apache.org/repos/asf?p=cordova-lib.git;h=61ddb3d ]

CB-12361 : added tests for remove platform


> Speed up cordova-lib tests
> --
>
> Key: CB-12361
> URL: https://issues.apache.org/jira/browse/CB-12361
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: cordova-lib
>Reporter: Steve Gill
>Assignee: Steve Gill
>  Labels: cordova-next
>
> * Split out e2e tests into own folder
> * stub i/o and network requests
> * use local fixtures when possible & makes sense



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-07-26 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16102425#comment-16102425
 ] 

ASF GitHub Bot commented on CB-12361:
-

Github user asfgit closed the pull request at:

https://github.com/apache/cordova-lib/pull/576


> Speed up cordova-lib tests
> --
>
> Key: CB-12361
> URL: https://issues.apache.org/jira/browse/CB-12361
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: cordova-lib
>Reporter: Steve Gill
>Assignee: Steve Gill
>  Labels: cordova-next
>
> * Split out e2e tests into own folder
> * stub i/o and network requests
> * use local fixtures when possible & makes sense



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-07-26 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16102413#comment-16102413
 ] 

ASF GitHub Bot commented on CB-12361:
-

Github user audreyso commented on the issue:

https://github.com/apache/cordova-lib/pull/576
  
Thanks @stevengill I will merge it!


> Speed up cordova-lib tests
> --
>
> Key: CB-12361
> URL: https://issues.apache.org/jira/browse/CB-12361
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: cordova-lib
>Reporter: Steve Gill
>Assignee: Steve Gill
>  Labels: cordova-next
>
> * Split out e2e tests into own folder
> * stub i/o and network requests
> * use local fixtures when possible & makes sense



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-07-26 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16102409#comment-16102409
 ] 

ASF GitHub Bot commented on CB-12361:
-

Github user stevengill commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/576#discussion_r129713116
  
--- Diff: spec/cordova/platform/remove.spec.js ---
@@ -0,0 +1,160 @@
+/**
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+http://www.apache.org/licenses/LICENSE-2.0
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+*/
+
+var path = require('path');
+var fs = require('fs');
+var Q = require('q');
+var events = require('cordova-common').events;
+var rewire = require('rewire');
+var platform_remove = rewire('../../../src/cordova/platform/remove');
+var platform_metadata = require('../../../src/cordova/platform_metadata');
+var cordova_util = require('../../../src/cordova/util');
+var promiseutil = require('../../../src/util/promise-util');
+var fail;
+
+describe('cordova/platform/remove', function () {
+var projectRoot = '/some/path';
+var cfg_parser_mock = function () {};
+var cfg_parser_revert_mock;
+var hooks_mock;
+var package_json_mock;
+package_json_mock = jasmine.createSpyObj('package json mock', 
['cordova', 'dependencies']);
+package_json_mock.dependencies = {};
+package_json_mock.cordova = {};
+
+var hooksRunnerRevert;
+
+beforeEach(function () {
+hooks_mock = jasmine.createSpyObj('hooksRunner mock', ['fire']);
+hooks_mock.fire.and.returnValue(Q());
+hooksRunnerRevert = platform_remove.__set__('HooksRunner', 
function () {});
+cfg_parser_mock.prototype = jasmine.createSpyObj('config parser 
mock', ['write', 'removeEngine']);
+cfg_parser_revert_mock = platform_remove.__set__('ConfigParser', 
cfg_parser_mock);
+spyOn(fs, 'existsSync').and.returnValue(false);
+spyOn(fs, 'writeFileSync');
+spyOn(cordova_util, 'removePlatformPluginsJson');
+spyOn(events, 'emit');
+spyOn(cordova_util, 'requireNoCache').and.returnValue({});
+});
+afterEach(function () {
+cfg_parser_revert_mock();
+hooksRunnerRevert();
+});
+describe('error/warning conditions', function () {
+it('should require specifying at least one platform', function 
(done) {
+platform_remove('remove', hooks_mock).then(function () {
+fail('remove success handler unexpectedly invoked');
+}).fail(function (e) {
+expect(e.message).toContain('No platform(s) specified.');
+}).done(done);
+});
+});
+describe('happy path (success conditions)', function () {
+it('should fire the before_platform_* hook', function () {
--- End diff --

for some reason, when i run this test I get `Parsing false failed`. But the 
test passes


> Speed up cordova-lib tests
> --
>
> Key: CB-12361
> URL: https://issues.apache.org/jira/browse/CB-12361
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: cordova-lib
>Reporter: Steve Gill
>Assignee: Steve Gill
>  Labels: cordova-next
>
> * Split out e2e tests into own folder
> * stub i/o and network requests
> * use local fixtures when possible & makes sense



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-07-26 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16102289#comment-16102289
 ] 

ASF GitHub Bot commented on CB-12361:
-

GitHub user audreyso opened a pull request:

https://github.com/apache/cordova-lib/pull/583

CB-12361 : added tests for plugin/index.js



### Platforms affected


### What does this PR do?

Added tests for plugin/index.js

### What testing has been done on this change?


### Checklist
- [X] [Reported an issue](http://cordova.apache.org/contribute/issues.html) 
in the JIRA database
- [X] Commit message follows the format: "CB-3232: (android) Fix bug with 
resolving file paths", where CB- is the JIRA ID & "android" is the platform 
affected.
- [X] Added automated test coverage as appropriate for this change.


You can merge this pull request into a Git repository by running:

$ git pull https://github.com/audreyso/cordova-lib CB-12361-15-plugin

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/cordova-lib/pull/583.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #583


commit aa955945048b0fac8287ee715e30a49f7219eb5c
Author: Audrey So 
Date:   2017-07-26T18:36:21Z

CB-12361 : added tests for plugin/index.js




> Speed up cordova-lib tests
> --
>
> Key: CB-12361
> URL: https://issues.apache.org/jira/browse/CB-12361
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: cordova-lib
>Reporter: Steve Gill
>Assignee: Steve Gill
>  Labels: cordova-next
>
> * Split out e2e tests into own folder
> * stub i/o and network requests
> * use local fixtures when possible & makes sense



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-07-21 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16096683#comment-16096683
 ] 

ASF GitHub Bot commented on CB-12361:
-

GitHub user audreyso opened a pull request:

https://github.com/apache/cordova-lib/pull/582

CB-12361 : added tests for plugin/search.js



### Platforms affected


### What does this PR do?

Added tests for plugin/search.js.

### What testing has been done on this change?


### Checklist
- [X] [Reported an issue](http://cordova.apache.org/contribute/issues.html) 
in the JIRA database
- [X] Commit message follows the format: "CB-3232: (android) Fix bug with 
resolving file paths", where CB- is the JIRA ID & "android" is the platform 
affected.
- [X] Added automated test coverage as appropriate for this change.


You can merge this pull request into a Git repository by running:

$ git pull https://github.com/audreyso/cordova-lib CB-12361-12-plugin

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/cordova-lib/pull/582.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #582


commit 175513b5eaad88059b0e47257025f122da76a0a5
Author: Audrey So 
Date:   2017-07-20T20:23:11Z

CB-12361 : added tests for plugin/search.js




> Speed up cordova-lib tests
> --
>
> Key: CB-12361
> URL: https://issues.apache.org/jira/browse/CB-12361
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: cordova-lib
>Reporter: Steve Gill
>Assignee: Steve Gill
>  Labels: cordova-next
>
> * Split out e2e tests into own folder
> * stub i/o and network requests
> * use local fixtures when possible & makes sense



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-07-21 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16096659#comment-16096659
 ] 

ASF GitHub Bot commented on CB-12361:
-

GitHub user audreyso opened a pull request:

https://github.com/apache/cordova-lib/pull/581

CB-12361 : added plugin remove tests



### Platforms affected


### What does this PR do?

Added plugin remove tests.

### What testing has been done on this change?


### Checklist
- [X] [Reported an issue](http://cordova.apache.org/contribute/issues.html) 
in the JIRA database
- [X] Commit message follows the format: "CB-3232: (android) Fix bug with 
resolving file paths", where CB- is the JIRA ID & "android" is the platform 
affected.
- [X] Added automated test coverage as appropriate for this change.


You can merge this pull request into a Git repository by running:

$ git pull https://github.com/audreyso/cordova-lib CB-12361-13-plugin

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/cordova-lib/pull/581.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #581


commit f2326ca2b291aef0736b8924d060fe5bd219b1cd
Author: Audrey So 
Date:   2017-07-20T23:19:07Z

CB-12361 : added plugin remove tests




> Speed up cordova-lib tests
> --
>
> Key: CB-12361
> URL: https://issues.apache.org/jira/browse/CB-12361
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: cordova-lib
>Reporter: Steve Gill
>Assignee: Steve Gill
>  Labels: cordova-next
>
> * Split out e2e tests into own folder
> * stub i/o and network requests
> * use local fixtures when possible & makes sense



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-07-20 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16095146#comment-16095146
 ] 

ASF GitHub Bot commented on CB-12361:
-

GitHub user audreyso opened a pull request:

https://github.com/apache/cordova-lib/pull/579

CB-12361 : added tests for save.js



### Platforms affected


### What does this PR do?


### What testing has been done on this change?
added tests for save.js

### Checklist
- [X] [Reported an issue](http://cordova.apache.org/contribute/issues.html) 
in the JIRA database
- [X] Commit message follows the format: "CB-3232: (android) Fix bug with 
resolving file paths", where CB- is the JIRA ID & "android" is the platform 
affected.
- [X] Added automated test coverage as appropriate for this change.


You can merge this pull request into a Git repository by running:

$ git pull https://github.com/audreyso/cordova-lib CB-12361-11

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/cordova-lib/pull/579.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #579






> Speed up cordova-lib tests
> --
>
> Key: CB-12361
> URL: https://issues.apache.org/jira/browse/CB-12361
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: cordova-lib
>Reporter: Steve Gill
>Assignee: Steve Gill
>  Labels: cordova-next
>
> * Split out e2e tests into own folder
> * stub i/o and network requests
> * use local fixtures when possible & makes sense



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-07-18 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16091931#comment-16091931
 ] 

ASF GitHub Bot commented on CB-12361:
-

GitHub user audreyso opened a pull request:

https://github.com/apache/cordova-lib/pull/578

CB-12361 : added unit-tests for getPlatformDetailsFromDir



### Platforms affected


### What does this PR do?

added unit-tests for getPlatformDetailsFromDir

### What testing has been done on this change?


### Checklist
- [X] [Reported an issue](http://cordova.apache.org/contribute/issues.html) 
in the JIRA database
- [X] Commit message follows the format: "CB-3232: (android) Fix bug with 
resolving file paths", where CB- is the JIRA ID & "android" is the platform 
affected.
- [X] Added automated test coverage as appropriate for this change.


You can merge this pull request into a Git repository by running:

$ git pull https://github.com/audreyso/cordova-lib CB-12361-10

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/cordova-lib/pull/578.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #578


commit e8a1cf2c062fd735ffb767dcd1c249de5c35684d
Author: Audrey So 
Date:   2017-07-18T17:35:28Z

CB-12361 : added unit-tests for getPlatformDetailsFromDir




> Speed up cordova-lib tests
> --
>
> Key: CB-12361
> URL: https://issues.apache.org/jira/browse/CB-12361
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: cordova-lib
>Reporter: Steve Gill
>Assignee: Steve Gill
>  Labels: cordova-next
>
> * Split out e2e tests into own folder
> * stub i/o and network requests
> * use local fixtures when possible & makes sense



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-07-18 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16091928#comment-16091928
 ] 

ASF GitHub Bot commented on CB-12361:
-

GitHub user audreyso opened a pull request:

https://github.com/apache/cordova-lib/pull/577

CB-12361 : added tests for platform/list.js



### Platforms affected


### What does this PR do?

 Added tests for platform/list.js

### What testing has been done on this change?


### Checklist
- [X] [Reported an issue](http://cordova.apache.org/contribute/issues.html) 
in the JIRA database
- [X] Commit message follows the format: "CB-3232: (android) Fix bug with 
resolving file paths", where CB- is the JIRA ID & "android" is the platform 
affected.
- [X] Added automated test coverage as appropriate for this change.


You can merge this pull request into a Git repository by running:

$ git pull https://github.com/audreyso/cordova-lib CB-12361-8

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/cordova-lib/pull/577.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #577


commit 558554aea0654a4132feb057a73e3faa5a5bac1a
Author: Audrey So 
Date:   2017-07-17T23:06:37Z

CB-12361 : added tests for list platform




> Speed up cordova-lib tests
> --
>
> Key: CB-12361
> URL: https://issues.apache.org/jira/browse/CB-12361
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: cordova-lib
>Reporter: Steve Gill
>Assignee: Steve Gill
>  Labels: cordova-next
>
> * Split out e2e tests into own folder
> * stub i/o and network requests
> * use local fixtures when possible & makes sense



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-07-17 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16090614#comment-16090614
 ] 

ASF GitHub Bot commented on CB-12361:
-

GitHub user audreyso opened a pull request:

https://github.com/apache/cordova-lib/pull/576

CB-12361 : added unit tests for remove platform



### Platforms affected


### What does this PR do?
Added unit tests for remove platform

### What testing has been done on this change?


### Checklist
- [X] [Reported an issue](http://cordova.apache.org/contribute/issues.html) 
in the JIRA database
- [X] Commit message follows the format: "CB-3232: (android) Fix bug with 
resolving file paths", where CB- is the JIRA ID & "android" is the platform 
affected.
- [X] Added automated test coverage as appropriate for this change.


You can merge this pull request into a Git repository by running:

$ git pull https://github.com/audreyso/cordova-lib CB-12361-7

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/cordova-lib/pull/576.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #576


commit 61ddb3d78182c51937539bcb8728fe97f9a9259f
Author: Audrey So 
Date:   2017-07-17T19:01:20Z

CB-12361 : added tests for remove platform




> Speed up cordova-lib tests
> --
>
> Key: CB-12361
> URL: https://issues.apache.org/jira/browse/CB-12361
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: cordova-lib
>Reporter: Steve Gill
>Assignee: Steve Gill
>  Labels: cordova-next
>
> * Split out e2e tests into own folder
> * stub i/o and network requests
> * use local fixtures when possible & makes sense



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-07-13 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16086120#comment-16086120
 ] 

ASF GitHub Bot commented on CB-12361:
-

Github user asfgit closed the pull request at:

https://github.com/apache/cordova-lib/pull/573


> Speed up cordova-lib tests
> --
>
> Key: CB-12361
> URL: https://issues.apache.org/jira/browse/CB-12361
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: cordova-lib
>Reporter: Steve Gill
>Assignee: Steve Gill
>  Labels: cordova-next
>
> * Split out e2e tests into own folder
> * stub i/o and network requests
> * use local fixtures when possible & makes sense



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-07-13 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16086119#comment-16086119
 ] 

ASF subversion and git services commented on CB-12361:
--

Commit 01ae07220088dd9ec27b5fd76b43a39edd6d2fe3 in cordova-lib's branch 
refs/heads/master from [~auso]
[ https://git-wip-us.apache.org/repos/asf?p=cordova-lib.git;h=01ae072 ]

CB-12361 : made revisions after review and feedback


> Speed up cordova-lib tests
> --
>
> Key: CB-12361
> URL: https://issues.apache.org/jira/browse/CB-12361
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: cordova-lib
>Reporter: Steve Gill
>Assignee: Steve Gill
>  Labels: cordova-next
>
> * Split out e2e tests into own folder
> * stub i/o and network requests
> * use local fixtures when possible & makes sense



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-07-13 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16086116#comment-16086116
 ] 

ASF subversion and git services commented on CB-12361:
--

Commit acda3f4be22c4dbb69bde54adf42ccc185080ba2 in cordova-lib's branch 
refs/heads/master from [~auso]
[ https://git-wip-us.apache.org/repos/asf?p=cordova-lib.git;h=acda3f4 ]

CB-12361 : updated addHelper tests


> Speed up cordova-lib tests
> --
>
> Key: CB-12361
> URL: https://issues.apache.org/jira/browse/CB-12361
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: cordova-lib
>Reporter: Steve Gill
>Assignee: Steve Gill
>  Labels: cordova-next
>
> * Split out e2e tests into own folder
> * stub i/o and network requests
> * use local fixtures when possible & makes sense



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-07-13 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16086118#comment-16086118
 ] 

ASF subversion and git services commented on CB-12361:
--

Commit 7eec3c9ddbf07648fa6cf27ca6aa39b146adeaf2 in cordova-lib's branch 
refs/heads/master from [~auso]
[ https://git-wip-us.apache.org/repos/asf?p=cordova-lib.git;h=7eec3c9 ]

CB-12361 : updated addHelper spec tests


> Speed up cordova-lib tests
> --
>
> Key: CB-12361
> URL: https://issues.apache.org/jira/browse/CB-12361
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: cordova-lib
>Reporter: Steve Gill
>Assignee: Steve Gill
>  Labels: cordova-next
>
> * Split out e2e tests into own folder
> * stub i/o and network requests
> * use local fixtures when possible & makes sense



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-07-12 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16085024#comment-16085024
 ] 

ASF GitHub Bot commented on CB-12361:
-

Github user audreyso commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/573#discussion_r127110528
  
--- Diff: spec/cordova/platform/addHelper.spec.js ---
@@ -16,34 +16,439 @@
 */
 /* eslint-env jasmine */
 
+var path = require('path');
+var fs = require('fs');
+var Q = require('q');
+var shell = require('shelljs');
+var events = require('cordova-common').events;
+var rewire = require('rewire');
+var platform_addHelper = rewire('../../../src/cordova/platform/addHelper');
+var platform_module = require('../../../src/cordova/platform');
+var platform_metadata = require('../../../src/cordova/platform_metadata');
+var cordova_util = require('../../../src/cordova/util');
+var cordova_config = require('../../../src/cordova/config');
+var plugman = require('../../../src/plugman/plugman');
+var fetch_metadata = require('../../../src/plugman/util/metadata');
+var lazy_load = require('../../../src/cordova/lazy_load');
+var prepare = require('../../../src/cordova/prepare');
+var gitclone = require('../../../src/gitclone');
+var fail;
+
 describe('cordova/platform/addHelper', function () {
+var projectRoot = '/some/path';
+// These _mock and _revert_mock objects use rewire as the modules 
these mocks replace
+// during testing all return functions, which we cannot spy on using 
jasmine.
+// Thus, we replace these modules inside the scope of addHelper.js 
using rewire, and shim
+// in these _mock test dummies. The test dummies themselves are 
constructed using
+// jasmine.createSpy inside the first beforeEach.
+var cfg_parser_mock = function () {};
+var cfg_parser_revert_mock;
+var hooks_mock;
+var platform_api_mock;
+var fetch_mock;
+var fetch_revert_mock;
+var prepare_mock;
+var prepare_revert_mock;
+var fake_platform = {
+'platform': 'atari'
+};
+var package_json_mock;
+package_json_mock = jasmine.createSpyObj('package json mock', 
['cordova', 'dependencies']);
+package_json_mock.dependencies = {};
+package_json_mock.cordova = {};
+
+beforeEach(function () {
+hooks_mock = jasmine.createSpyObj('hooksRunner mock', ['fire']);
+hooks_mock.fire.and.returnValue(Q());
+cfg_parser_mock.prototype = jasmine.createSpyObj('config parser 
mock', ['write', 'removeEngine', 'addEngine', 'getHookScripts']);
+cfg_parser_revert_mock = 
platform_addHelper.__set__('ConfigParser', cfg_parser_mock);
+fetch_mock = jasmine.createSpy('fetch mock').and.returnValue(Q());
+fetch_revert_mock = platform_addHelper.__set__('fetch', 
fetch_mock);
+prepare_mock = jasmine.createSpy('prepare 
mock').and.returnValue(Q());
+prepare_mock.preparePlatforms = 
jasmine.createSpy('preparePlatforms mock').and.returnValue(Q());
+prepare_revert_mock = platform_addHelper.__set__('prepare', 
prepare_mock);
+spyOn(shell, 'mkdir');
+spyOn(fs, 'existsSync').and.returnValue(false);
+spyOn(fs, 'writeFileSync');
+spyOn(cordova_util, 
'projectConfig').and.returnValue(path.join(projectRoot, 'config.xml'));
+spyOn(cordova_util, 'isDirectory').and.returnValue(false);
+spyOn(cordova_util, 'fixRelativePath').and.callFake(function 
(input) { return input; });
+spyOn(cordova_util, 'isUrl').and.returnValue(false);
+spyOn(cordova_util, 'hostSupports').and.returnValue(true);
+spyOn(cordova_util, 'removePlatformPluginsJson');
+spyOn(cordova_config, 'read').and.returnValue({});
+spyOn(events, 'emit');
+// Fake platform details we will use for our mocks, returned by 
either
+// getPlatfromDetailsFromDir (in the local-directory case), or
+// downloadPlatform (in every other case)
+spyOn(platform_module, 
'getPlatformDetailsFromDir').and.returnValue(Q(fake_platform));
+spyOn(platform_addHelper, 
'downloadPlatform').and.returnValue(Q(fake_platform));
+spyOn(platform_addHelper, 
'getVersionFromConfigFile').and.returnValue(false);
+spyOn(platform_addHelper, 
'installPluginsForNewPlatform').and.returnValue(Q());
+platform_api_mock = jasmine.createSpyObj('platform api mock', 
['createPlatform', 'updatePlatform']);
+platform_api_mock.createPlatform.and.returnValue(Q());
+platform_api_mock.updatePlatform.and.returnValue(Q());
+spyOn(cordova_util, 
'getPlatformApiFunction'

[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-07-12 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16084647#comment-16084647
 ] 

ASF GitHub Bot commented on CB-12361:
-

Github user audreyso commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/573#discussion_r127066391
  
--- Diff: spec/cordova/platform/addHelper.spec.js ---
@@ -16,34 +16,439 @@
 */
 /* eslint-env jasmine */
 
+var path = require('path');
+var fs = require('fs');
+var Q = require('q');
+var shell = require('shelljs');
+var events = require('cordova-common').events;
+var rewire = require('rewire');
+var platform_addHelper = rewire('../../../src/cordova/platform/addHelper');
+var platform_module = require('../../../src/cordova/platform');
+var platform_metadata = require('../../../src/cordova/platform_metadata');
+var cordova_util = require('../../../src/cordova/util');
+var cordova_config = require('../../../src/cordova/config');
+var plugman = require('../../../src/plugman/plugman');
+var fetch_metadata = require('../../../src/plugman/util/metadata');
+var lazy_load = require('../../../src/cordova/lazy_load');
+var prepare = require('../../../src/cordova/prepare');
+var gitclone = require('../../../src/gitclone');
+var fail;
+
 describe('cordova/platform/addHelper', function () {
+var projectRoot = '/some/path';
+// These _mock and _revert_mock objects use rewire as the modules 
these mocks replace
+// during testing all return functions, which we cannot spy on using 
jasmine.
+// Thus, we replace these modules inside the scope of addHelper.js 
using rewire, and shim
+// in these _mock test dummies. The test dummies themselves are 
constructed using
+// jasmine.createSpy inside the first beforeEach.
+var cfg_parser_mock = function () {};
+var cfg_parser_revert_mock;
+var hooks_mock;
+var platform_api_mock;
+var fetch_mock;
+var fetch_revert_mock;
+var prepare_mock;
+var prepare_revert_mock;
+var fake_platform = {
+'platform': 'atari'
+};
+var package_json_mock;
+package_json_mock = jasmine.createSpyObj('package json mock', 
['cordova', 'dependencies']);
+package_json_mock.dependencies = {};
+package_json_mock.cordova = {};
+
+beforeEach(function () {
+hooks_mock = jasmine.createSpyObj('hooksRunner mock', ['fire']);
+hooks_mock.fire.and.returnValue(Q());
+cfg_parser_mock.prototype = jasmine.createSpyObj('config parser 
mock', ['write', 'removeEngine', 'addEngine', 'getHookScripts']);
+cfg_parser_revert_mock = 
platform_addHelper.__set__('ConfigParser', cfg_parser_mock);
+fetch_mock = jasmine.createSpy('fetch mock').and.returnValue(Q());
+fetch_revert_mock = platform_addHelper.__set__('fetch', 
fetch_mock);
+prepare_mock = jasmine.createSpy('prepare 
mock').and.returnValue(Q());
+prepare_mock.preparePlatforms = 
jasmine.createSpy('preparePlatforms mock').and.returnValue(Q());
+prepare_revert_mock = platform_addHelper.__set__('prepare', 
prepare_mock);
+spyOn(shell, 'mkdir');
+spyOn(fs, 'existsSync').and.returnValue(false);
+spyOn(fs, 'writeFileSync');
+spyOn(cordova_util, 
'projectConfig').and.returnValue(path.join(projectRoot, 'config.xml'));
+spyOn(cordova_util, 'isDirectory').and.returnValue(false);
+spyOn(cordova_util, 'fixRelativePath').and.callFake(function 
(input) { return input; });
+spyOn(cordova_util, 'isUrl').and.returnValue(false);
+spyOn(cordova_util, 'hostSupports').and.returnValue(true);
+spyOn(cordova_util, 'removePlatformPluginsJson');
+spyOn(cordova_config, 'read').and.returnValue({});
+spyOn(events, 'emit');
+// Fake platform details we will use for our mocks, returned by 
either
+// getPlatfromDetailsFromDir (in the local-directory case), or
+// downloadPlatform (in every other case)
+spyOn(platform_module, 
'getPlatformDetailsFromDir').and.returnValue(Q(fake_platform));
+spyOn(platform_addHelper, 
'downloadPlatform').and.returnValue(Q(fake_platform));
+spyOn(platform_addHelper, 
'getVersionFromConfigFile').and.returnValue(false);
+spyOn(platform_addHelper, 
'installPluginsForNewPlatform').and.returnValue(Q());
+platform_api_mock = jasmine.createSpyObj('platform api mock', 
['createPlatform', 'updatePlatform']);
+platform_api_mock.createPlatform.and.returnValue(Q());
+platform_api_mock.updatePlatform.and.returnValue(Q());
+spyOn(cordova_util, 
'getPlatformApiFunction'

[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-07-12 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16084576#comment-16084576
 ] 

ASF GitHub Bot commented on CB-12361:
-

Github user stevengill commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/573#discussion_r127055093
  
--- Diff: spec/cordova/platform/addHelper.spec.js ---
@@ -16,34 +16,439 @@
 */
 /* eslint-env jasmine */
 
+var path = require('path');
+var fs = require('fs');
+var Q = require('q');
+var shell = require('shelljs');
+var events = require('cordova-common').events;
+var rewire = require('rewire');
+var platform_addHelper = rewire('../../../src/cordova/platform/addHelper');
+var platform_module = require('../../../src/cordova/platform');
+var platform_metadata = require('../../../src/cordova/platform_metadata');
+var cordova_util = require('../../../src/cordova/util');
+var cordova_config = require('../../../src/cordova/config');
+var plugman = require('../../../src/plugman/plugman');
+var fetch_metadata = require('../../../src/plugman/util/metadata');
+var lazy_load = require('../../../src/cordova/lazy_load');
+var prepare = require('../../../src/cordova/prepare');
+var gitclone = require('../../../src/gitclone');
+var fail;
+
 describe('cordova/platform/addHelper', function () {
+var projectRoot = '/some/path';
+// These _mock and _revert_mock objects use rewire as the modules 
these mocks replace
+// during testing all return functions, which we cannot spy on using 
jasmine.
+// Thus, we replace these modules inside the scope of addHelper.js 
using rewire, and shim
+// in these _mock test dummies. The test dummies themselves are 
constructed using
+// jasmine.createSpy inside the first beforeEach.
+var cfg_parser_mock = function () {};
+var cfg_parser_revert_mock;
+var hooks_mock;
+var platform_api_mock;
+var fetch_mock;
+var fetch_revert_mock;
+var prepare_mock;
+var prepare_revert_mock;
+var fake_platform = {
+'platform': 'atari'
+};
+var package_json_mock;
+package_json_mock = jasmine.createSpyObj('package json mock', 
['cordova', 'dependencies']);
+package_json_mock.dependencies = {};
+package_json_mock.cordova = {};
+
+beforeEach(function () {
+hooks_mock = jasmine.createSpyObj('hooksRunner mock', ['fire']);
+hooks_mock.fire.and.returnValue(Q());
+cfg_parser_mock.prototype = jasmine.createSpyObj('config parser 
mock', ['write', 'removeEngine', 'addEngine', 'getHookScripts']);
+cfg_parser_revert_mock = 
platform_addHelper.__set__('ConfigParser', cfg_parser_mock);
+fetch_mock = jasmine.createSpy('fetch mock').and.returnValue(Q());
+fetch_revert_mock = platform_addHelper.__set__('fetch', 
fetch_mock);
+prepare_mock = jasmine.createSpy('prepare 
mock').and.returnValue(Q());
+prepare_mock.preparePlatforms = 
jasmine.createSpy('preparePlatforms mock').and.returnValue(Q());
+prepare_revert_mock = platform_addHelper.__set__('prepare', 
prepare_mock);
+spyOn(shell, 'mkdir');
+spyOn(fs, 'existsSync').and.returnValue(false);
+spyOn(fs, 'writeFileSync');
+spyOn(cordova_util, 
'projectConfig').and.returnValue(path.join(projectRoot, 'config.xml'));
+spyOn(cordova_util, 'isDirectory').and.returnValue(false);
+spyOn(cordova_util, 'fixRelativePath').and.callFake(function 
(input) { return input; });
+spyOn(cordova_util, 'isUrl').and.returnValue(false);
+spyOn(cordova_util, 'hostSupports').and.returnValue(true);
+spyOn(cordova_util, 'removePlatformPluginsJson');
+spyOn(cordova_config, 'read').and.returnValue({});
+spyOn(events, 'emit');
+// Fake platform details we will use for our mocks, returned by 
either
+// getPlatfromDetailsFromDir (in the local-directory case), or
+// downloadPlatform (in every other case)
+spyOn(platform_module, 
'getPlatformDetailsFromDir').and.returnValue(Q(fake_platform));
+spyOn(platform_addHelper, 
'downloadPlatform').and.returnValue(Q(fake_platform));
+spyOn(platform_addHelper, 
'getVersionFromConfigFile').and.returnValue(false);
+spyOn(platform_addHelper, 
'installPluginsForNewPlatform').and.returnValue(Q());
+platform_api_mock = jasmine.createSpyObj('platform api mock', 
['createPlatform', 'updatePlatform']);
+platform_api_mock.createPlatform.and.returnValue(Q());
+platform_api_mock.updatePlatform.and.returnValue(Q());
+spyOn(cordova_util, 
'getPlatformApiFunctio

[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-07-12 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16084482#comment-16084482
 ] 

ASF GitHub Bot commented on CB-12361:
-

Github user purplecabbage commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/573#discussion_r127039183
  
--- Diff: spec/cordova/platform/addHelper.spec.js ---
@@ -16,34 +16,439 @@
 */
 /* eslint-env jasmine */
 
+var path = require('path');
+var fs = require('fs');
+var Q = require('q');
+var shell = require('shelljs');
+var events = require('cordova-common').events;
+var rewire = require('rewire');
+var platform_addHelper = rewire('../../../src/cordova/platform/addHelper');
+var platform_module = require('../../../src/cordova/platform');
+var platform_metadata = require('../../../src/cordova/platform_metadata');
+var cordova_util = require('../../../src/cordova/util');
+var cordova_config = require('../../../src/cordova/config');
+var plugman = require('../../../src/plugman/plugman');
+var fetch_metadata = require('../../../src/plugman/util/metadata');
+var lazy_load = require('../../../src/cordova/lazy_load');
+var prepare = require('../../../src/cordova/prepare');
+var gitclone = require('../../../src/gitclone');
+var fail;
+
 describe('cordova/platform/addHelper', function () {
+var projectRoot = '/some/path';
+// These _mock and _revert_mock objects use rewire as the modules 
these mocks replace
+// during testing all return functions, which we cannot spy on using 
jasmine.
+// Thus, we replace these modules inside the scope of addHelper.js 
using rewire, and shim
+// in these _mock test dummies. The test dummies themselves are 
constructed using
+// jasmine.createSpy inside the first beforeEach.
+var cfg_parser_mock = function () {};
+var cfg_parser_revert_mock;
+var hooks_mock;
+var platform_api_mock;
+var fetch_mock;
+var fetch_revert_mock;
+var prepare_mock;
+var prepare_revert_mock;
+var fake_platform = {
+'platform': 'atari'
+};
+var package_json_mock;
+package_json_mock = jasmine.createSpyObj('package json mock', 
['cordova', 'dependencies']);
+package_json_mock.dependencies = {};
+package_json_mock.cordova = {};
+
+beforeEach(function () {
+hooks_mock = jasmine.createSpyObj('hooksRunner mock', ['fire']);
+hooks_mock.fire.and.returnValue(Q());
+cfg_parser_mock.prototype = jasmine.createSpyObj('config parser 
mock', ['write', 'removeEngine', 'addEngine', 'getHookScripts']);
+cfg_parser_revert_mock = 
platform_addHelper.__set__('ConfigParser', cfg_parser_mock);
+fetch_mock = jasmine.createSpy('fetch mock').and.returnValue(Q());
+fetch_revert_mock = platform_addHelper.__set__('fetch', 
fetch_mock);
+prepare_mock = jasmine.createSpy('prepare 
mock').and.returnValue(Q());
+prepare_mock.preparePlatforms = 
jasmine.createSpy('preparePlatforms mock').and.returnValue(Q());
+prepare_revert_mock = platform_addHelper.__set__('prepare', 
prepare_mock);
+spyOn(shell, 'mkdir');
+spyOn(fs, 'existsSync').and.returnValue(false);
+spyOn(fs, 'writeFileSync');
+spyOn(cordova_util, 
'projectConfig').and.returnValue(path.join(projectRoot, 'config.xml'));
+spyOn(cordova_util, 'isDirectory').and.returnValue(false);
+spyOn(cordova_util, 'fixRelativePath').and.callFake(function 
(input) { return input; });
+spyOn(cordova_util, 'isUrl').and.returnValue(false);
+spyOn(cordova_util, 'hostSupports').and.returnValue(true);
+spyOn(cordova_util, 'removePlatformPluginsJson');
+spyOn(cordova_config, 'read').and.returnValue({});
+spyOn(events, 'emit');
+// Fake platform details we will use for our mocks, returned by 
either
+// getPlatfromDetailsFromDir (in the local-directory case), or
+// downloadPlatform (in every other case)
+spyOn(platform_module, 
'getPlatformDetailsFromDir').and.returnValue(Q(fake_platform));
+spyOn(platform_addHelper, 
'downloadPlatform').and.returnValue(Q(fake_platform));
+spyOn(platform_addHelper, 
'getVersionFromConfigFile').and.returnValue(false);
+spyOn(platform_addHelper, 
'installPluginsForNewPlatform').and.returnValue(Q());
+platform_api_mock = jasmine.createSpyObj('platform api mock', 
['createPlatform', 'updatePlatform']);
+platform_api_mock.createPlatform.and.returnValue(Q());
+platform_api_mock.updatePlatform.and.returnValue(Q());
+spyOn(cordova_util, 
'getPlatformApiFunc

[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-07-12 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=1608#comment-1608
 ] 

ASF GitHub Bot commented on CB-12361:
-

Github user stevengill commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/573#discussion_r127032404
  
--- Diff: spec/cordova/platform/addHelper.spec.js ---
@@ -16,34 +16,439 @@
 */
 /* eslint-env jasmine */
 
+var path = require('path');
+var fs = require('fs');
+var Q = require('q');
+var shell = require('shelljs');
+var events = require('cordova-common').events;
+var rewire = require('rewire');
+var platform_addHelper = rewire('../../../src/cordova/platform/addHelper');
+var platform_module = require('../../../src/cordova/platform');
+var platform_metadata = require('../../../src/cordova/platform_metadata');
+var cordova_util = require('../../../src/cordova/util');
+var cordova_config = require('../../../src/cordova/config');
+var plugman = require('../../../src/plugman/plugman');
+var fetch_metadata = require('../../../src/plugman/util/metadata');
+var lazy_load = require('../../../src/cordova/lazy_load');
+var prepare = require('../../../src/cordova/prepare');
+var gitclone = require('../../../src/gitclone');
+var fail;
+
 describe('cordova/platform/addHelper', function () {
+var projectRoot = '/some/path';
+// These _mock and _revert_mock objects use rewire as the modules 
these mocks replace
+// during testing all return functions, which we cannot spy on using 
jasmine.
+// Thus, we replace these modules inside the scope of addHelper.js 
using rewire, and shim
+// in these _mock test dummies. The test dummies themselves are 
constructed using
+// jasmine.createSpy inside the first beforeEach.
+var cfg_parser_mock = function () {};
+var cfg_parser_revert_mock;
+var hooks_mock;
+var platform_api_mock;
+var fetch_mock;
+var fetch_revert_mock;
+var prepare_mock;
+var prepare_revert_mock;
+var fake_platform = {
+'platform': 'atari'
+};
+var package_json_mock;
+package_json_mock = jasmine.createSpyObj('package json mock', 
['cordova', 'dependencies']);
+package_json_mock.dependencies = {};
+package_json_mock.cordova = {};
+
+beforeEach(function () {
+hooks_mock = jasmine.createSpyObj('hooksRunner mock', ['fire']);
+hooks_mock.fire.and.returnValue(Q());
+cfg_parser_mock.prototype = jasmine.createSpyObj('config parser 
mock', ['write', 'removeEngine', 'addEngine', 'getHookScripts']);
+cfg_parser_revert_mock = 
platform_addHelper.__set__('ConfigParser', cfg_parser_mock);
+fetch_mock = jasmine.createSpy('fetch mock').and.returnValue(Q());
+fetch_revert_mock = platform_addHelper.__set__('fetch', 
fetch_mock);
+prepare_mock = jasmine.createSpy('prepare 
mock').and.returnValue(Q());
+prepare_mock.preparePlatforms = 
jasmine.createSpy('preparePlatforms mock').and.returnValue(Q());
+prepare_revert_mock = platform_addHelper.__set__('prepare', 
prepare_mock);
+spyOn(shell, 'mkdir');
+spyOn(fs, 'existsSync').and.returnValue(false);
+spyOn(fs, 'writeFileSync');
+spyOn(cordova_util, 
'projectConfig').and.returnValue(path.join(projectRoot, 'config.xml'));
+spyOn(cordova_util, 'isDirectory').and.returnValue(false);
+spyOn(cordova_util, 'fixRelativePath').and.callFake(function 
(input) { return input; });
+spyOn(cordova_util, 'isUrl').and.returnValue(false);
+spyOn(cordova_util, 'hostSupports').and.returnValue(true);
+spyOn(cordova_util, 'removePlatformPluginsJson');
+spyOn(cordova_config, 'read').and.returnValue({});
+spyOn(events, 'emit');
+// Fake platform details we will use for our mocks, returned by 
either
+// getPlatfromDetailsFromDir (in the local-directory case), or
+// downloadPlatform (in every other case)
+spyOn(platform_module, 
'getPlatformDetailsFromDir').and.returnValue(Q(fake_platform));
+spyOn(platform_addHelper, 
'downloadPlatform').and.returnValue(Q(fake_platform));
+spyOn(platform_addHelper, 
'getVersionFromConfigFile').and.returnValue(false);
+spyOn(platform_addHelper, 
'installPluginsForNewPlatform').and.returnValue(Q());
+platform_api_mock = jasmine.createSpyObj('platform api mock', 
['createPlatform', 'updatePlatform']);
+platform_api_mock.createPlatform.and.returnValue(Q());
+platform_api_mock.updatePlatform.and.returnValue(Q());
+spyOn(cordova_util, 
'getPlatformApiFunctio

[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-07-12 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16084282#comment-16084282
 ] 

ASF GitHub Bot commented on CB-12361:
-

Github user audreyso commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/573#discussion_r127007878
  
--- Diff: spec/cordova/platform/addHelper.spec.js ---
@@ -16,34 +16,439 @@
 */
 /* eslint-env jasmine */
 
+var path = require('path');
+var fs = require('fs');
+var Q = require('q');
+var shell = require('shelljs');
+var events = require('cordova-common').events;
+var rewire = require('rewire');
+var platform_addHelper = rewire('../../../src/cordova/platform/addHelper');
+var platform_module = require('../../../src/cordova/platform');
+var platform_metadata = require('../../../src/cordova/platform_metadata');
+var cordova_util = require('../../../src/cordova/util');
+var cordova_config = require('../../../src/cordova/config');
+var plugman = require('../../../src/plugman/plugman');
+var fetch_metadata = require('../../../src/plugman/util/metadata');
+var lazy_load = require('../../../src/cordova/lazy_load');
+var prepare = require('../../../src/cordova/prepare');
+var gitclone = require('../../../src/gitclone');
+var fail;
+
 describe('cordova/platform/addHelper', function () {
+var projectRoot = '/some/path';
+// These _mock and _revert_mock objects use rewire as the modules 
these mocks replace
+// during testing all return functions, which we cannot spy on using 
jasmine.
+// Thus, we replace these modules inside the scope of addHelper.js 
using rewire, and shim
+// in these _mock test dummies. The test dummies themselves are 
constructed using
+// jasmine.createSpy inside the first beforeEach.
+var cfg_parser_mock = function () {};
+var cfg_parser_revert_mock;
+var hooks_mock;
+var platform_api_mock;
+var fetch_mock;
+var fetch_revert_mock;
+var prepare_mock;
+var prepare_revert_mock;
+var fake_platform = {
+'platform': 'atari'
+};
+var package_json_mock;
+package_json_mock = jasmine.createSpyObj('package json mock', 
['cordova', 'dependencies']);
+package_json_mock.dependencies = {};
+package_json_mock.cordova = {};
+
+beforeEach(function () {
+hooks_mock = jasmine.createSpyObj('hooksRunner mock', ['fire']);
+hooks_mock.fire.and.returnValue(Q());
+cfg_parser_mock.prototype = jasmine.createSpyObj('config parser 
mock', ['write', 'removeEngine', 'addEngine', 'getHookScripts']);
+cfg_parser_revert_mock = 
platform_addHelper.__set__('ConfigParser', cfg_parser_mock);
+fetch_mock = jasmine.createSpy('fetch mock').and.returnValue(Q());
+fetch_revert_mock = platform_addHelper.__set__('fetch', 
fetch_mock);
+prepare_mock = jasmine.createSpy('prepare 
mock').and.returnValue(Q());
+prepare_mock.preparePlatforms = 
jasmine.createSpy('preparePlatforms mock').and.returnValue(Q());
+prepare_revert_mock = platform_addHelper.__set__('prepare', 
prepare_mock);
+spyOn(shell, 'mkdir');
+spyOn(fs, 'existsSync').and.returnValue(false);
+spyOn(fs, 'writeFileSync');
+spyOn(cordova_util, 
'projectConfig').and.returnValue(path.join(projectRoot, 'config.xml'));
+spyOn(cordova_util, 'isDirectory').and.returnValue(false);
+spyOn(cordova_util, 'fixRelativePath').and.callFake(function 
(input) { return input; });
+spyOn(cordova_util, 'isUrl').and.returnValue(false);
+spyOn(cordova_util, 'hostSupports').and.returnValue(true);
+spyOn(cordova_util, 'removePlatformPluginsJson');
+spyOn(cordova_config, 'read').and.returnValue({});
+spyOn(events, 'emit');
+// Fake platform details we will use for our mocks, returned by 
either
+// getPlatfromDetailsFromDir (in the local-directory case), or
+// downloadPlatform (in every other case)
+spyOn(platform_module, 
'getPlatformDetailsFromDir').and.returnValue(Q(fake_platform));
+spyOn(platform_addHelper, 
'downloadPlatform').and.returnValue(Q(fake_platform));
+spyOn(platform_addHelper, 
'getVersionFromConfigFile').and.returnValue(false);
+spyOn(platform_addHelper, 
'installPluginsForNewPlatform').and.returnValue(Q());
+platform_api_mock = jasmine.createSpyObj('platform api mock', 
['createPlatform', 'updatePlatform']);
+platform_api_mock.createPlatform.and.returnValue(Q());
+platform_api_mock.updatePlatform.and.returnValue(Q());
+spyOn(cordova_util, 
'getPlatformApiFunction'

[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-07-12 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16084285#comment-16084285
 ] 

ASF GitHub Bot commented on CB-12361:
-

Github user audreyso commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/573#discussion_r127008421
  
--- Diff: spec/cordova/platform/addHelper.spec.js ---
@@ -16,34 +16,439 @@
 */
 /* eslint-env jasmine */
 
+var path = require('path');
+var fs = require('fs');
+var Q = require('q');
+var shell = require('shelljs');
+var events = require('cordova-common').events;
+var rewire = require('rewire');
+var platform_addHelper = rewire('../../../src/cordova/platform/addHelper');
+var platform_module = require('../../../src/cordova/platform');
+var platform_metadata = require('../../../src/cordova/platform_metadata');
+var cordova_util = require('../../../src/cordova/util');
+var cordova_config = require('../../../src/cordova/config');
+var plugman = require('../../../src/plugman/plugman');
+var fetch_metadata = require('../../../src/plugman/util/metadata');
+var lazy_load = require('../../../src/cordova/lazy_load');
+var prepare = require('../../../src/cordova/prepare');
+var gitclone = require('../../../src/gitclone');
+var fail;
+
 describe('cordova/platform/addHelper', function () {
+var projectRoot = '/some/path';
+// These _mock and _revert_mock objects use rewire as the modules 
these mocks replace
+// during testing all return functions, which we cannot spy on using 
jasmine.
+// Thus, we replace these modules inside the scope of addHelper.js 
using rewire, and shim
+// in these _mock test dummies. The test dummies themselves are 
constructed using
+// jasmine.createSpy inside the first beforeEach.
+var cfg_parser_mock = function () {};
+var cfg_parser_revert_mock;
+var hooks_mock;
+var platform_api_mock;
+var fetch_mock;
+var fetch_revert_mock;
+var prepare_mock;
+var prepare_revert_mock;
+var fake_platform = {
+'platform': 'atari'
+};
+var package_json_mock;
+package_json_mock = jasmine.createSpyObj('package json mock', 
['cordova', 'dependencies']);
+package_json_mock.dependencies = {};
+package_json_mock.cordova = {};
+
+beforeEach(function () {
+hooks_mock = jasmine.createSpyObj('hooksRunner mock', ['fire']);
+hooks_mock.fire.and.returnValue(Q());
+cfg_parser_mock.prototype = jasmine.createSpyObj('config parser 
mock', ['write', 'removeEngine', 'addEngine', 'getHookScripts']);
+cfg_parser_revert_mock = 
platform_addHelper.__set__('ConfigParser', cfg_parser_mock);
+fetch_mock = jasmine.createSpy('fetch mock').and.returnValue(Q());
+fetch_revert_mock = platform_addHelper.__set__('fetch', 
fetch_mock);
+prepare_mock = jasmine.createSpy('prepare 
mock').and.returnValue(Q());
+prepare_mock.preparePlatforms = 
jasmine.createSpy('preparePlatforms mock').and.returnValue(Q());
+prepare_revert_mock = platform_addHelper.__set__('prepare', 
prepare_mock);
+spyOn(shell, 'mkdir');
+spyOn(fs, 'existsSync').and.returnValue(false);
+spyOn(fs, 'writeFileSync');
+spyOn(cordova_util, 
'projectConfig').and.returnValue(path.join(projectRoot, 'config.xml'));
+spyOn(cordova_util, 'isDirectory').and.returnValue(false);
+spyOn(cordova_util, 'fixRelativePath').and.callFake(function 
(input) { return input; });
+spyOn(cordova_util, 'isUrl').and.returnValue(false);
+spyOn(cordova_util, 'hostSupports').and.returnValue(true);
+spyOn(cordova_util, 'removePlatformPluginsJson');
+spyOn(cordova_config, 'read').and.returnValue({});
+spyOn(events, 'emit');
+// Fake platform details we will use for our mocks, returned by 
either
+// getPlatfromDetailsFromDir (in the local-directory case), or
+// downloadPlatform (in every other case)
+spyOn(platform_module, 
'getPlatformDetailsFromDir').and.returnValue(Q(fake_platform));
+spyOn(platform_addHelper, 
'downloadPlatform').and.returnValue(Q(fake_platform));
+spyOn(platform_addHelper, 
'getVersionFromConfigFile').and.returnValue(false);
+spyOn(platform_addHelper, 
'installPluginsForNewPlatform').and.returnValue(Q());
+platform_api_mock = jasmine.createSpyObj('platform api mock', 
['createPlatform', 'updatePlatform']);
+platform_api_mock.createPlatform.and.returnValue(Q());
+platform_api_mock.updatePlatform.and.returnValue(Q());
+spyOn(cordova_util, 
'getPlatformApiFunction'

[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-07-11 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16083274#comment-16083274
 ] 

ASF GitHub Bot commented on CB-12361:
-

Github user stevengill commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/573#discussion_r126843121
  
--- Diff: spec/cordova/platform/addHelper.spec.js ---
@@ -16,34 +16,439 @@
 */
 /* eslint-env jasmine */
 
+var path = require('path');
+var fs = require('fs');
+var Q = require('q');
+var shell = require('shelljs');
+var events = require('cordova-common').events;
+var rewire = require('rewire');
+var platform_addHelper = rewire('../../../src/cordova/platform/addHelper');
+var platform_module = require('../../../src/cordova/platform');
+var platform_metadata = require('../../../src/cordova/platform_metadata');
+var cordova_util = require('../../../src/cordova/util');
+var cordova_config = require('../../../src/cordova/config');
+var plugman = require('../../../src/plugman/plugman');
+var fetch_metadata = require('../../../src/plugman/util/metadata');
+var lazy_load = require('../../../src/cordova/lazy_load');
+var prepare = require('../../../src/cordova/prepare');
+var gitclone = require('../../../src/gitclone');
+var fail;
+
 describe('cordova/platform/addHelper', function () {
+var projectRoot = '/some/path';
+// These _mock and _revert_mock objects use rewire as the modules 
these mocks replace
+// during testing all return functions, which we cannot spy on using 
jasmine.
+// Thus, we replace these modules inside the scope of addHelper.js 
using rewire, and shim
+// in these _mock test dummies. The test dummies themselves are 
constructed using
+// jasmine.createSpy inside the first beforeEach.
+var cfg_parser_mock = function () {};
+var cfg_parser_revert_mock;
+var hooks_mock;
+var platform_api_mock;
+var fetch_mock;
+var fetch_revert_mock;
+var prepare_mock;
+var prepare_revert_mock;
+var fake_platform = {
+'platform': 'atari'
+};
+var package_json_mock;
+package_json_mock = jasmine.createSpyObj('package json mock', 
['cordova', 'dependencies']);
+package_json_mock.dependencies = {};
+package_json_mock.cordova = {};
+
+beforeEach(function () {
+hooks_mock = jasmine.createSpyObj('hooksRunner mock', ['fire']);
+hooks_mock.fire.and.returnValue(Q());
+cfg_parser_mock.prototype = jasmine.createSpyObj('config parser 
mock', ['write', 'removeEngine', 'addEngine', 'getHookScripts']);
+cfg_parser_revert_mock = 
platform_addHelper.__set__('ConfigParser', cfg_parser_mock);
+fetch_mock = jasmine.createSpy('fetch mock').and.returnValue(Q());
+fetch_revert_mock = platform_addHelper.__set__('fetch', 
fetch_mock);
+prepare_mock = jasmine.createSpy('prepare 
mock').and.returnValue(Q());
+prepare_mock.preparePlatforms = 
jasmine.createSpy('preparePlatforms mock').and.returnValue(Q());
+prepare_revert_mock = platform_addHelper.__set__('prepare', 
prepare_mock);
+spyOn(shell, 'mkdir');
+spyOn(fs, 'existsSync').and.returnValue(false);
+spyOn(fs, 'writeFileSync');
+spyOn(cordova_util, 
'projectConfig').and.returnValue(path.join(projectRoot, 'config.xml'));
+spyOn(cordova_util, 'isDirectory').and.returnValue(false);
+spyOn(cordova_util, 'fixRelativePath').and.callFake(function 
(input) { return input; });
+spyOn(cordova_util, 'isUrl').and.returnValue(false);
+spyOn(cordova_util, 'hostSupports').and.returnValue(true);
+spyOn(cordova_util, 'removePlatformPluginsJson');
+spyOn(cordova_config, 'read').and.returnValue({});
+spyOn(events, 'emit');
+// Fake platform details we will use for our mocks, returned by 
either
+// getPlatfromDetailsFromDir (in the local-directory case), or
+// downloadPlatform (in every other case)
+spyOn(platform_module, 
'getPlatformDetailsFromDir').and.returnValue(Q(fake_platform));
+spyOn(platform_addHelper, 
'downloadPlatform').and.returnValue(Q(fake_platform));
+spyOn(platform_addHelper, 
'getVersionFromConfigFile').and.returnValue(false);
+spyOn(platform_addHelper, 
'installPluginsForNewPlatform').and.returnValue(Q());
+platform_api_mock = jasmine.createSpyObj('platform api mock', 
['createPlatform', 'updatePlatform']);
+platform_api_mock.createPlatform.and.returnValue(Q());
+platform_api_mock.updatePlatform.and.returnValue(Q());
+spyOn(cordova_util, 
'getPlatformApiFunctio

[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-07-11 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16083275#comment-16083275
 ] 

ASF GitHub Bot commented on CB-12361:
-

Github user stevengill commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/573#discussion_r126844076
  
--- Diff: spec/cordova/platform/addHelper.spec.js ---
@@ -16,34 +16,439 @@
 */
 /* eslint-env jasmine */
 
+var path = require('path');
+var fs = require('fs');
+var Q = require('q');
+var shell = require('shelljs');
+var events = require('cordova-common').events;
+var rewire = require('rewire');
+var platform_addHelper = rewire('../../../src/cordova/platform/addHelper');
+var platform_module = require('../../../src/cordova/platform');
+var platform_metadata = require('../../../src/cordova/platform_metadata');
+var cordova_util = require('../../../src/cordova/util');
+var cordova_config = require('../../../src/cordova/config');
+var plugman = require('../../../src/plugman/plugman');
+var fetch_metadata = require('../../../src/plugman/util/metadata');
+var lazy_load = require('../../../src/cordova/lazy_load');
+var prepare = require('../../../src/cordova/prepare');
+var gitclone = require('../../../src/gitclone');
+var fail;
+
 describe('cordova/platform/addHelper', function () {
+var projectRoot = '/some/path';
+// These _mock and _revert_mock objects use rewire as the modules 
these mocks replace
+// during testing all return functions, which we cannot spy on using 
jasmine.
+// Thus, we replace these modules inside the scope of addHelper.js 
using rewire, and shim
+// in these _mock test dummies. The test dummies themselves are 
constructed using
+// jasmine.createSpy inside the first beforeEach.
+var cfg_parser_mock = function () {};
+var cfg_parser_revert_mock;
+var hooks_mock;
+var platform_api_mock;
+var fetch_mock;
+var fetch_revert_mock;
+var prepare_mock;
+var prepare_revert_mock;
+var fake_platform = {
+'platform': 'atari'
+};
+var package_json_mock;
+package_json_mock = jasmine.createSpyObj('package json mock', 
['cordova', 'dependencies']);
+package_json_mock.dependencies = {};
+package_json_mock.cordova = {};
+
+beforeEach(function () {
+hooks_mock = jasmine.createSpyObj('hooksRunner mock', ['fire']);
+hooks_mock.fire.and.returnValue(Q());
+cfg_parser_mock.prototype = jasmine.createSpyObj('config parser 
mock', ['write', 'removeEngine', 'addEngine', 'getHookScripts']);
+cfg_parser_revert_mock = 
platform_addHelper.__set__('ConfigParser', cfg_parser_mock);
+fetch_mock = jasmine.createSpy('fetch mock').and.returnValue(Q());
+fetch_revert_mock = platform_addHelper.__set__('fetch', 
fetch_mock);
+prepare_mock = jasmine.createSpy('prepare 
mock').and.returnValue(Q());
+prepare_mock.preparePlatforms = 
jasmine.createSpy('preparePlatforms mock').and.returnValue(Q());
+prepare_revert_mock = platform_addHelper.__set__('prepare', 
prepare_mock);
+spyOn(shell, 'mkdir');
+spyOn(fs, 'existsSync').and.returnValue(false);
+spyOn(fs, 'writeFileSync');
+spyOn(cordova_util, 
'projectConfig').and.returnValue(path.join(projectRoot, 'config.xml'));
+spyOn(cordova_util, 'isDirectory').and.returnValue(false);
+spyOn(cordova_util, 'fixRelativePath').and.callFake(function 
(input) { return input; });
+spyOn(cordova_util, 'isUrl').and.returnValue(false);
+spyOn(cordova_util, 'hostSupports').and.returnValue(true);
+spyOn(cordova_util, 'removePlatformPluginsJson');
+spyOn(cordova_config, 'read').and.returnValue({});
+spyOn(events, 'emit');
+// Fake platform details we will use for our mocks, returned by 
either
+// getPlatfromDetailsFromDir (in the local-directory case), or
+// downloadPlatform (in every other case)
+spyOn(platform_module, 
'getPlatformDetailsFromDir').and.returnValue(Q(fake_platform));
+spyOn(platform_addHelper, 
'downloadPlatform').and.returnValue(Q(fake_platform));
+spyOn(platform_addHelper, 
'getVersionFromConfigFile').and.returnValue(false);
+spyOn(platform_addHelper, 
'installPluginsForNewPlatform').and.returnValue(Q());
+platform_api_mock = jasmine.createSpyObj('platform api mock', 
['createPlatform', 'updatePlatform']);
+platform_api_mock.createPlatform.and.returnValue(Q());
+platform_api_mock.updatePlatform.and.returnValue(Q());
+spyOn(cordova_util, 
'getPlatformApiFunctio

[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-07-11 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16083273#comment-16083273
 ] 

ASF GitHub Bot commented on CB-12361:
-

Github user stevengill commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/573#discussion_r126842836
  
--- Diff: spec/cordova/platform/addHelper.spec.js ---
@@ -16,34 +16,439 @@
 */
 /* eslint-env jasmine */
 
+var path = require('path');
+var fs = require('fs');
+var Q = require('q');
+var shell = require('shelljs');
+var events = require('cordova-common').events;
+var rewire = require('rewire');
+var platform_addHelper = rewire('../../../src/cordova/platform/addHelper');
+var platform_module = require('../../../src/cordova/platform');
+var platform_metadata = require('../../../src/cordova/platform_metadata');
+var cordova_util = require('../../../src/cordova/util');
+var cordova_config = require('../../../src/cordova/config');
+var plugman = require('../../../src/plugman/plugman');
+var fetch_metadata = require('../../../src/plugman/util/metadata');
+var lazy_load = require('../../../src/cordova/lazy_load');
+var prepare = require('../../../src/cordova/prepare');
+var gitclone = require('../../../src/gitclone');
+var fail;
+
 describe('cordova/platform/addHelper', function () {
+var projectRoot = '/some/path';
+// These _mock and _revert_mock objects use rewire as the modules 
these mocks replace
+// during testing all return functions, which we cannot spy on using 
jasmine.
+// Thus, we replace these modules inside the scope of addHelper.js 
using rewire, and shim
+// in these _mock test dummies. The test dummies themselves are 
constructed using
+// jasmine.createSpy inside the first beforeEach.
+var cfg_parser_mock = function () {};
+var cfg_parser_revert_mock;
+var hooks_mock;
+var platform_api_mock;
+var fetch_mock;
+var fetch_revert_mock;
+var prepare_mock;
+var prepare_revert_mock;
+var fake_platform = {
+'platform': 'atari'
+};
+var package_json_mock;
+package_json_mock = jasmine.createSpyObj('package json mock', 
['cordova', 'dependencies']);
+package_json_mock.dependencies = {};
+package_json_mock.cordova = {};
+
+beforeEach(function () {
+hooks_mock = jasmine.createSpyObj('hooksRunner mock', ['fire']);
+hooks_mock.fire.and.returnValue(Q());
+cfg_parser_mock.prototype = jasmine.createSpyObj('config parser 
mock', ['write', 'removeEngine', 'addEngine', 'getHookScripts']);
+cfg_parser_revert_mock = 
platform_addHelper.__set__('ConfigParser', cfg_parser_mock);
+fetch_mock = jasmine.createSpy('fetch mock').and.returnValue(Q());
+fetch_revert_mock = platform_addHelper.__set__('fetch', 
fetch_mock);
+prepare_mock = jasmine.createSpy('prepare 
mock').and.returnValue(Q());
+prepare_mock.preparePlatforms = 
jasmine.createSpy('preparePlatforms mock').and.returnValue(Q());
+prepare_revert_mock = platform_addHelper.__set__('prepare', 
prepare_mock);
+spyOn(shell, 'mkdir');
+spyOn(fs, 'existsSync').and.returnValue(false);
+spyOn(fs, 'writeFileSync');
+spyOn(cordova_util, 
'projectConfig').and.returnValue(path.join(projectRoot, 'config.xml'));
+spyOn(cordova_util, 'isDirectory').and.returnValue(false);
+spyOn(cordova_util, 'fixRelativePath').and.callFake(function 
(input) { return input; });
+spyOn(cordova_util, 'isUrl').and.returnValue(false);
+spyOn(cordova_util, 'hostSupports').and.returnValue(true);
+spyOn(cordova_util, 'removePlatformPluginsJson');
+spyOn(cordova_config, 'read').and.returnValue({});
+spyOn(events, 'emit');
+// Fake platform details we will use for our mocks, returned by 
either
+// getPlatfromDetailsFromDir (in the local-directory case), or
+// downloadPlatform (in every other case)
+spyOn(platform_module, 
'getPlatformDetailsFromDir').and.returnValue(Q(fake_platform));
+spyOn(platform_addHelper, 
'downloadPlatform').and.returnValue(Q(fake_platform));
+spyOn(platform_addHelper, 
'getVersionFromConfigFile').and.returnValue(false);
+spyOn(platform_addHelper, 
'installPluginsForNewPlatform').and.returnValue(Q());
+platform_api_mock = jasmine.createSpyObj('platform api mock', 
['createPlatform', 'updatePlatform']);
+platform_api_mock.createPlatform.and.returnValue(Q());
+platform_api_mock.updatePlatform.and.returnValue(Q());
+spyOn(cordova_util, 
'getPlatformApiFunctio

[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-06-29 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16068852#comment-16068852
 ] 

ASF GitHub Bot commented on CB-12361:
-

Github user stevengill commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/573#discussion_r124874233
  
--- Diff: spec/cordova/platform/addHelper.spec.js ---
@@ -16,34 +16,459 @@
 */
 /* eslint-env jasmine */
 
+var path = require('path');
+var fs = require('fs');
+var Q = require('q');
+var shell = require('shelljs');
+var events = require('cordova-common').events;
+var rewire = require('rewire');
+var platform_addHelper = rewire('../../../src/cordova/platform/addHelper');
+var platform_module = require('../../../src/cordova/platform');
+var platform_metadata = require('../../../src/cordova/platform_metadata');
+var cordova_util = require('../../../src/cordova/util');
+var cordova_config = require('../../../src/cordova/config');
+var plugman = require('../../../src/plugman/plugman');
+var fetch_metadata = require('../../../src/plugman/util/metadata');
+var lazy_load = require('../../../src/cordova/lazy_load');
+// require module here
+// spy on it and return 
+var cordova = require('../../../src/cordova/cordova');
+var prepare = require('../../../src/cordova/prepare');
+var gitclone = require('../../../src/gitclone');
+var fail;
+
 describe('cordova/platform/addHelper', function () {
+var projectRoot = '/some/path';
+// These _mock and _revert_mock objects use rewire as the modules 
these mocks replace
+// during testing all return functions, which we cannot spy on using 
jasmine.
+// Thus, we replace these modules inside the scope of addHelper.js 
using rewire, and shim
+// in these _mock test dummies. The test dummies themselves are 
constructed using
+// jasmine.createSpy inside the first beforeEach.
+var cfg_parser_mock = function () {};
+var cfg_parser_revert_mock;
+var hooks_mock;
+var platform_api_mock;
+var fetch_mock;
+var fetch_revert_mock;
+var prepare_mock;
+var prepare_revert_mock;
+var fake_platform = {
+'platform': 'atari'
+};
+beforeEach(function () {
+hooks_mock = jasmine.createSpyObj('hooksRunner mock', ['fire']);
+hooks_mock.fire.and.returnValue(Q());
+cfg_parser_mock.prototype = jasmine.createSpyObj('config parser 
mock', ['write', 'removeEngine', 'addEngine', 'getHookScripts']);
+cfg_parser_revert_mock = 
platform_addHelper.__set__('ConfigParser', cfg_parser_mock);
+fetch_mock = jasmine.createSpy('fetch mock').and.returnValue(Q());
+fetch_revert_mock = platform_addHelper.__set__('fetch', 
fetch_mock);
+prepare_mock = jasmine.createSpy('prepare 
mock').and.returnValue(Q());
+prepare_mock.preparePlatforms = 
jasmine.createSpy('preparePlatforms mock').and.returnValue(Q());
+prepare_revert_mock = platform_addHelper.__set__('prepare', 
prepare_mock);
+spyOn(shell, 'mkdir');
+spyOn(fs, 'existsSync').and.returnValue(false);
+spyOn(fs, 'writeFileSync');
+spyOn(cordova_util, 
'projectConfig').and.returnValue(path.join(projectRoot, 'config.xml'));
+spyOn(cordova_util, 'isDirectory').and.returnValue(false);
+spyOn(cordova_util, 'fixRelativePath').and.callFake(function 
(input) { return input; });
+spyOn(cordova_util, 'isUrl').and.returnValue(false);
+spyOn(cordova_util, 'hostSupports').and.returnValue(true);
+spyOn(cordova_util, 'removePlatformPluginsJson');
+spyOn(cordova_config, 'read').and.returnValue({});
+// Fake platform details we will use for our mocks, returned by 
either
+// getPlatfromDetailsFromDir (in the local-directory case), or
+// downloadPlatform (in every other case)
+spyOn(platform_module, 
'getPlatformDetailsFromDir').and.returnValue(Q(fake_platform));
+spyOn(platform_addHelper, 
'downloadPlatform').and.returnValue(Q(fake_platform));
+spyOn(platform_addHelper, 
'getVersionFromConfigFile').and.returnValue(false);
+spyOn(platform_addHelper, 
'installPluginsForNewPlatform').and.returnValue(Q());
+platform_api_mock = jasmine.createSpyObj('platform api mock', 
['createPlatform', 'updatePlatform']);
+platform_api_mock.createPlatform.and.returnValue(Q());
+platform_api_mock.updatePlatform.and.returnValue(Q());
+spyOn(cordova_util, 
'getPlatformApiFunction').and.returnValue(platform_api_mock);
+spyOn(platform_metadata, 'save');
+});
+afterEach(function () {
+   

[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-06-29 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16068858#comment-16068858
 ] 

ASF GitHub Bot commented on CB-12361:
-

Github user stevengill commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/573#discussion_r124863854
  
--- Diff: spec/cordova/platform/addHelper.spec.js ---
@@ -16,34 +16,459 @@
 */
 /* eslint-env jasmine */
 
+var path = require('path');
+var fs = require('fs');
+var Q = require('q');
+var shell = require('shelljs');
+var events = require('cordova-common').events;
+var rewire = require('rewire');
+var platform_addHelper = rewire('../../../src/cordova/platform/addHelper');
+var platform_module = require('../../../src/cordova/platform');
+var platform_metadata = require('../../../src/cordova/platform_metadata');
+var cordova_util = require('../../../src/cordova/util');
+var cordova_config = require('../../../src/cordova/config');
+var plugman = require('../../../src/plugman/plugman');
+var fetch_metadata = require('../../../src/plugman/util/metadata');
+var lazy_load = require('../../../src/cordova/lazy_load');
+// require module here
--- End diff --

don't need these comments I take it. 


> Speed up cordova-lib tests
> --
>
> Key: CB-12361
> URL: https://issues.apache.org/jira/browse/CB-12361
> Project: Apache Cordova
>  Issue Type: Improvement
>  Components: cordova-lib
>Reporter: Steve Gill
>Assignee: Steve Gill
>  Labels: cordova-next
>
> * Split out e2e tests into own folder
> * stub i/o and network requests
> * use local fixtures when possible & makes sense



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-06-29 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16068856#comment-16068856
 ] 

ASF GitHub Bot commented on CB-12361:
-

Github user stevengill commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/573#discussion_r124894106
  
--- Diff: spec/cordova/platform/addHelper.spec.js ---
@@ -16,34 +16,459 @@
 */
 /* eslint-env jasmine */
 
+var path = require('path');
+var fs = require('fs');
+var Q = require('q');
+var shell = require('shelljs');
+var events = require('cordova-common').events;
+var rewire = require('rewire');
+var platform_addHelper = rewire('../../../src/cordova/platform/addHelper');
+var platform_module = require('../../../src/cordova/platform');
+var platform_metadata = require('../../../src/cordova/platform_metadata');
+var cordova_util = require('../../../src/cordova/util');
+var cordova_config = require('../../../src/cordova/config');
+var plugman = require('../../../src/plugman/plugman');
+var fetch_metadata = require('../../../src/plugman/util/metadata');
+var lazy_load = require('../../../src/cordova/lazy_load');
+// require module here
+// spy on it and return 
+var cordova = require('../../../src/cordova/cordova');
+var prepare = require('../../../src/cordova/prepare');
+var gitclone = require('../../../src/gitclone');
+var fail;
+
 describe('cordova/platform/addHelper', function () {
+var projectRoot = '/some/path';
+// These _mock and _revert_mock objects use rewire as the modules 
these mocks replace
+// during testing all return functions, which we cannot spy on using 
jasmine.
+// Thus, we replace these modules inside the scope of addHelper.js 
using rewire, and shim
+// in these _mock test dummies. The test dummies themselves are 
constructed using
+// jasmine.createSpy inside the first beforeEach.
+var cfg_parser_mock = function () {};
+var cfg_parser_revert_mock;
+var hooks_mock;
+var platform_api_mock;
+var fetch_mock;
+var fetch_revert_mock;
+var prepare_mock;
+var prepare_revert_mock;
+var fake_platform = {
+'platform': 'atari'
+};
+beforeEach(function () {
+hooks_mock = jasmine.createSpyObj('hooksRunner mock', ['fire']);
+hooks_mock.fire.and.returnValue(Q());
+cfg_parser_mock.prototype = jasmine.createSpyObj('config parser 
mock', ['write', 'removeEngine', 'addEngine', 'getHookScripts']);
+cfg_parser_revert_mock = 
platform_addHelper.__set__('ConfigParser', cfg_parser_mock);
+fetch_mock = jasmine.createSpy('fetch mock').and.returnValue(Q());
+fetch_revert_mock = platform_addHelper.__set__('fetch', 
fetch_mock);
+prepare_mock = jasmine.createSpy('prepare 
mock').and.returnValue(Q());
+prepare_mock.preparePlatforms = 
jasmine.createSpy('preparePlatforms mock').and.returnValue(Q());
+prepare_revert_mock = platform_addHelper.__set__('prepare', 
prepare_mock);
+spyOn(shell, 'mkdir');
+spyOn(fs, 'existsSync').and.returnValue(false);
+spyOn(fs, 'writeFileSync');
+spyOn(cordova_util, 
'projectConfig').and.returnValue(path.join(projectRoot, 'config.xml'));
+spyOn(cordova_util, 'isDirectory').and.returnValue(false);
+spyOn(cordova_util, 'fixRelativePath').and.callFake(function 
(input) { return input; });
+spyOn(cordova_util, 'isUrl').and.returnValue(false);
+spyOn(cordova_util, 'hostSupports').and.returnValue(true);
+spyOn(cordova_util, 'removePlatformPluginsJson');
+spyOn(cordova_config, 'read').and.returnValue({});
+// Fake platform details we will use for our mocks, returned by 
either
+// getPlatfromDetailsFromDir (in the local-directory case), or
+// downloadPlatform (in every other case)
+spyOn(platform_module, 
'getPlatformDetailsFromDir').and.returnValue(Q(fake_platform));
+spyOn(platform_addHelper, 
'downloadPlatform').and.returnValue(Q(fake_platform));
+spyOn(platform_addHelper, 
'getVersionFromConfigFile').and.returnValue(false);
+spyOn(platform_addHelper, 
'installPluginsForNewPlatform').and.returnValue(Q());
+platform_api_mock = jasmine.createSpyObj('platform api mock', 
['createPlatform', 'updatePlatform']);
+platform_api_mock.createPlatform.and.returnValue(Q());
+platform_api_mock.updatePlatform.and.returnValue(Q());
+spyOn(cordova_util, 
'getPlatformApiFunction').and.returnValue(platform_api_mock);
+spyOn(platform_metadata, 'save');
+});
+afterEach(function () {
+   

[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-06-29 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16068849#comment-16068849
 ] 

ASF GitHub Bot commented on CB-12361:
-

Github user stevengill commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/573#discussion_r124890998
  
--- Diff: spec/cordova/platform/addHelper.spec.js ---
@@ -16,34 +16,459 @@
 */
 /* eslint-env jasmine */
 
+var path = require('path');
+var fs = require('fs');
+var Q = require('q');
+var shell = require('shelljs');
+var events = require('cordova-common').events;
+var rewire = require('rewire');
+var platform_addHelper = rewire('../../../src/cordova/platform/addHelper');
+var platform_module = require('../../../src/cordova/platform');
+var platform_metadata = require('../../../src/cordova/platform_metadata');
+var cordova_util = require('../../../src/cordova/util');
+var cordova_config = require('../../../src/cordova/config');
+var plugman = require('../../../src/plugman/plugman');
+var fetch_metadata = require('../../../src/plugman/util/metadata');
+var lazy_load = require('../../../src/cordova/lazy_load');
+// require module here
+// spy on it and return 
+var cordova = require('../../../src/cordova/cordova');
+var prepare = require('../../../src/cordova/prepare');
+var gitclone = require('../../../src/gitclone');
+var fail;
+
 describe('cordova/platform/addHelper', function () {
+var projectRoot = '/some/path';
+// These _mock and _revert_mock objects use rewire as the modules 
these mocks replace
+// during testing all return functions, which we cannot spy on using 
jasmine.
+// Thus, we replace these modules inside the scope of addHelper.js 
using rewire, and shim
+// in these _mock test dummies. The test dummies themselves are 
constructed using
+// jasmine.createSpy inside the first beforeEach.
+var cfg_parser_mock = function () {};
+var cfg_parser_revert_mock;
+var hooks_mock;
+var platform_api_mock;
+var fetch_mock;
+var fetch_revert_mock;
+var prepare_mock;
+var prepare_revert_mock;
+var fake_platform = {
+'platform': 'atari'
+};
+beforeEach(function () {
+hooks_mock = jasmine.createSpyObj('hooksRunner mock', ['fire']);
+hooks_mock.fire.and.returnValue(Q());
+cfg_parser_mock.prototype = jasmine.createSpyObj('config parser 
mock', ['write', 'removeEngine', 'addEngine', 'getHookScripts']);
+cfg_parser_revert_mock = 
platform_addHelper.__set__('ConfigParser', cfg_parser_mock);
+fetch_mock = jasmine.createSpy('fetch mock').and.returnValue(Q());
+fetch_revert_mock = platform_addHelper.__set__('fetch', 
fetch_mock);
+prepare_mock = jasmine.createSpy('prepare 
mock').and.returnValue(Q());
+prepare_mock.preparePlatforms = 
jasmine.createSpy('preparePlatforms mock').and.returnValue(Q());
+prepare_revert_mock = platform_addHelper.__set__('prepare', 
prepare_mock);
+spyOn(shell, 'mkdir');
+spyOn(fs, 'existsSync').and.returnValue(false);
+spyOn(fs, 'writeFileSync');
+spyOn(cordova_util, 
'projectConfig').and.returnValue(path.join(projectRoot, 'config.xml'));
+spyOn(cordova_util, 'isDirectory').and.returnValue(false);
+spyOn(cordova_util, 'fixRelativePath').and.callFake(function 
(input) { return input; });
+spyOn(cordova_util, 'isUrl').and.returnValue(false);
+spyOn(cordova_util, 'hostSupports').and.returnValue(true);
+spyOn(cordova_util, 'removePlatformPluginsJson');
+spyOn(cordova_config, 'read').and.returnValue({});
+// Fake platform details we will use for our mocks, returned by 
either
+// getPlatfromDetailsFromDir (in the local-directory case), or
+// downloadPlatform (in every other case)
+spyOn(platform_module, 
'getPlatformDetailsFromDir').and.returnValue(Q(fake_platform));
+spyOn(platform_addHelper, 
'downloadPlatform').and.returnValue(Q(fake_platform));
+spyOn(platform_addHelper, 
'getVersionFromConfigFile').and.returnValue(false);
+spyOn(platform_addHelper, 
'installPluginsForNewPlatform').and.returnValue(Q());
+platform_api_mock = jasmine.createSpyObj('platform api mock', 
['createPlatform', 'updatePlatform']);
+platform_api_mock.createPlatform.and.returnValue(Q());
+platform_api_mock.updatePlatform.and.returnValue(Q());
+spyOn(cordova_util, 
'getPlatformApiFunction').and.returnValue(platform_api_mock);
+spyOn(platform_metadata, 'save');
+});
+afterEach(function () {
+   

[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-06-29 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16068848#comment-16068848
 ] 

ASF GitHub Bot commented on CB-12361:
-

Github user stevengill commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/573#discussion_r124867315
  
--- Diff: spec/cordova/platform/addHelper.spec.js ---
@@ -16,34 +16,459 @@
 */
 /* eslint-env jasmine */
 
+var path = require('path');
+var fs = require('fs');
+var Q = require('q');
+var shell = require('shelljs');
+var events = require('cordova-common').events;
+var rewire = require('rewire');
+var platform_addHelper = rewire('../../../src/cordova/platform/addHelper');
+var platform_module = require('../../../src/cordova/platform');
+var platform_metadata = require('../../../src/cordova/platform_metadata');
+var cordova_util = require('../../../src/cordova/util');
+var cordova_config = require('../../../src/cordova/config');
+var plugman = require('../../../src/plugman/plugman');
+var fetch_metadata = require('../../../src/plugman/util/metadata');
+var lazy_load = require('../../../src/cordova/lazy_load');
+// require module here
+// spy on it and return 
+var cordova = require('../../../src/cordova/cordova');
+var prepare = require('../../../src/cordova/prepare');
+var gitclone = require('../../../src/gitclone');
+var fail;
+
 describe('cordova/platform/addHelper', function () {
+var projectRoot = '/some/path';
+// These _mock and _revert_mock objects use rewire as the modules 
these mocks replace
+// during testing all return functions, which we cannot spy on using 
jasmine.
+// Thus, we replace these modules inside the scope of addHelper.js 
using rewire, and shim
+// in these _mock test dummies. The test dummies themselves are 
constructed using
+// jasmine.createSpy inside the first beforeEach.
+var cfg_parser_mock = function () {};
+var cfg_parser_revert_mock;
+var hooks_mock;
+var platform_api_mock;
+var fetch_mock;
+var fetch_revert_mock;
+var prepare_mock;
+var prepare_revert_mock;
+var fake_platform = {
+'platform': 'atari'
+};
+beforeEach(function () {
+hooks_mock = jasmine.createSpyObj('hooksRunner mock', ['fire']);
+hooks_mock.fire.and.returnValue(Q());
+cfg_parser_mock.prototype = jasmine.createSpyObj('config parser 
mock', ['write', 'removeEngine', 'addEngine', 'getHookScripts']);
+cfg_parser_revert_mock = 
platform_addHelper.__set__('ConfigParser', cfg_parser_mock);
+fetch_mock = jasmine.createSpy('fetch mock').and.returnValue(Q());
+fetch_revert_mock = platform_addHelper.__set__('fetch', 
fetch_mock);
+prepare_mock = jasmine.createSpy('prepare 
mock').and.returnValue(Q());
+prepare_mock.preparePlatforms = 
jasmine.createSpy('preparePlatforms mock').and.returnValue(Q());
+prepare_revert_mock = platform_addHelper.__set__('prepare', 
prepare_mock);
+spyOn(shell, 'mkdir');
+spyOn(fs, 'existsSync').and.returnValue(false);
+spyOn(fs, 'writeFileSync');
+spyOn(cordova_util, 
'projectConfig').and.returnValue(path.join(projectRoot, 'config.xml'));
+spyOn(cordova_util, 'isDirectory').and.returnValue(false);
+spyOn(cordova_util, 'fixRelativePath').and.callFake(function 
(input) { return input; });
+spyOn(cordova_util, 'isUrl').and.returnValue(false);
+spyOn(cordova_util, 'hostSupports').and.returnValue(true);
+spyOn(cordova_util, 'removePlatformPluginsJson');
+spyOn(cordova_config, 'read').and.returnValue({});
+// Fake platform details we will use for our mocks, returned by 
either
+// getPlatfromDetailsFromDir (in the local-directory case), or
+// downloadPlatform (in every other case)
+spyOn(platform_module, 
'getPlatformDetailsFromDir').and.returnValue(Q(fake_platform));
+spyOn(platform_addHelper, 
'downloadPlatform').and.returnValue(Q(fake_platform));
+spyOn(platform_addHelper, 
'getVersionFromConfigFile').and.returnValue(false);
+spyOn(platform_addHelper, 
'installPluginsForNewPlatform').and.returnValue(Q());
+platform_api_mock = jasmine.createSpyObj('platform api mock', 
['createPlatform', 'updatePlatform']);
+platform_api_mock.createPlatform.and.returnValue(Q());
+platform_api_mock.updatePlatform.and.returnValue(Q());
+spyOn(cordova_util, 
'getPlatformApiFunction').and.returnValue(platform_api_mock);
+spyOn(platform_metadata, 'save');
+});
+afterEach(function () {
+   

[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-06-29 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16068859#comment-16068859
 ] 

ASF GitHub Bot commented on CB-12361:
-

Github user stevengill commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/573#discussion_r124891852
  
--- Diff: spec/cordova/platform/addHelper.spec.js ---
@@ -16,34 +16,459 @@
 */
 /* eslint-env jasmine */
 
+var path = require('path');
+var fs = require('fs');
+var Q = require('q');
+var shell = require('shelljs');
+var events = require('cordova-common').events;
+var rewire = require('rewire');
+var platform_addHelper = rewire('../../../src/cordova/platform/addHelper');
+var platform_module = require('../../../src/cordova/platform');
+var platform_metadata = require('../../../src/cordova/platform_metadata');
+var cordova_util = require('../../../src/cordova/util');
+var cordova_config = require('../../../src/cordova/config');
+var plugman = require('../../../src/plugman/plugman');
+var fetch_metadata = require('../../../src/plugman/util/metadata');
+var lazy_load = require('../../../src/cordova/lazy_load');
+// require module here
+// spy on it and return 
+var cordova = require('../../../src/cordova/cordova');
+var prepare = require('../../../src/cordova/prepare');
+var gitclone = require('../../../src/gitclone');
+var fail;
+
 describe('cordova/platform/addHelper', function () {
+var projectRoot = '/some/path';
+// These _mock and _revert_mock objects use rewire as the modules 
these mocks replace
+// during testing all return functions, which we cannot spy on using 
jasmine.
+// Thus, we replace these modules inside the scope of addHelper.js 
using rewire, and shim
+// in these _mock test dummies. The test dummies themselves are 
constructed using
+// jasmine.createSpy inside the first beforeEach.
+var cfg_parser_mock = function () {};
+var cfg_parser_revert_mock;
+var hooks_mock;
+var platform_api_mock;
+var fetch_mock;
+var fetch_revert_mock;
+var prepare_mock;
+var prepare_revert_mock;
+var fake_platform = {
+'platform': 'atari'
+};
+beforeEach(function () {
+hooks_mock = jasmine.createSpyObj('hooksRunner mock', ['fire']);
+hooks_mock.fire.and.returnValue(Q());
+cfg_parser_mock.prototype = jasmine.createSpyObj('config parser 
mock', ['write', 'removeEngine', 'addEngine', 'getHookScripts']);
+cfg_parser_revert_mock = 
platform_addHelper.__set__('ConfigParser', cfg_parser_mock);
+fetch_mock = jasmine.createSpy('fetch mock').and.returnValue(Q());
+fetch_revert_mock = platform_addHelper.__set__('fetch', 
fetch_mock);
+prepare_mock = jasmine.createSpy('prepare 
mock').and.returnValue(Q());
+prepare_mock.preparePlatforms = 
jasmine.createSpy('preparePlatforms mock').and.returnValue(Q());
+prepare_revert_mock = platform_addHelper.__set__('prepare', 
prepare_mock);
+spyOn(shell, 'mkdir');
+spyOn(fs, 'existsSync').and.returnValue(false);
+spyOn(fs, 'writeFileSync');
+spyOn(cordova_util, 
'projectConfig').and.returnValue(path.join(projectRoot, 'config.xml'));
+spyOn(cordova_util, 'isDirectory').and.returnValue(false);
+spyOn(cordova_util, 'fixRelativePath').and.callFake(function 
(input) { return input; });
+spyOn(cordova_util, 'isUrl').and.returnValue(false);
+spyOn(cordova_util, 'hostSupports').and.returnValue(true);
+spyOn(cordova_util, 'removePlatformPluginsJson');
+spyOn(cordova_config, 'read').and.returnValue({});
+// Fake platform details we will use for our mocks, returned by 
either
+// getPlatfromDetailsFromDir (in the local-directory case), or
+// downloadPlatform (in every other case)
+spyOn(platform_module, 
'getPlatformDetailsFromDir').and.returnValue(Q(fake_platform));
+spyOn(platform_addHelper, 
'downloadPlatform').and.returnValue(Q(fake_platform));
+spyOn(platform_addHelper, 
'getVersionFromConfigFile').and.returnValue(false);
+spyOn(platform_addHelper, 
'installPluginsForNewPlatform').and.returnValue(Q());
+platform_api_mock = jasmine.createSpyObj('platform api mock', 
['createPlatform', 'updatePlatform']);
+platform_api_mock.createPlatform.and.returnValue(Q());
+platform_api_mock.updatePlatform.and.returnValue(Q());
+spyOn(cordova_util, 
'getPlatformApiFunction').and.returnValue(platform_api_mock);
+spyOn(platform_metadata, 'save');
+});
+afterEach(function () {
+   

[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-06-29 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16068846#comment-16068846
 ] 

ASF GitHub Bot commented on CB-12361:
-

Github user stevengill commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/573#discussion_r124878766
  
--- Diff: spec/cordova/platform/addHelper.spec.js ---
@@ -16,34 +16,459 @@
 */
 /* eslint-env jasmine */
 
+var path = require('path');
+var fs = require('fs');
+var Q = require('q');
+var shell = require('shelljs');
+var events = require('cordova-common').events;
+var rewire = require('rewire');
+var platform_addHelper = rewire('../../../src/cordova/platform/addHelper');
+var platform_module = require('../../../src/cordova/platform');
+var platform_metadata = require('../../../src/cordova/platform_metadata');
+var cordova_util = require('../../../src/cordova/util');
+var cordova_config = require('../../../src/cordova/config');
+var plugman = require('../../../src/plugman/plugman');
+var fetch_metadata = require('../../../src/plugman/util/metadata');
+var lazy_load = require('../../../src/cordova/lazy_load');
+// require module here
+// spy on it and return 
+var cordova = require('../../../src/cordova/cordova');
+var prepare = require('../../../src/cordova/prepare');
+var gitclone = require('../../../src/gitclone');
+var fail;
+
 describe('cordova/platform/addHelper', function () {
+var projectRoot = '/some/path';
+// These _mock and _revert_mock objects use rewire as the modules 
these mocks replace
+// during testing all return functions, which we cannot spy on using 
jasmine.
+// Thus, we replace these modules inside the scope of addHelper.js 
using rewire, and shim
+// in these _mock test dummies. The test dummies themselves are 
constructed using
+// jasmine.createSpy inside the first beforeEach.
+var cfg_parser_mock = function () {};
+var cfg_parser_revert_mock;
+var hooks_mock;
+var platform_api_mock;
+var fetch_mock;
+var fetch_revert_mock;
+var prepare_mock;
+var prepare_revert_mock;
+var fake_platform = {
+'platform': 'atari'
+};
+beforeEach(function () {
+hooks_mock = jasmine.createSpyObj('hooksRunner mock', ['fire']);
+hooks_mock.fire.and.returnValue(Q());
+cfg_parser_mock.prototype = jasmine.createSpyObj('config parser 
mock', ['write', 'removeEngine', 'addEngine', 'getHookScripts']);
+cfg_parser_revert_mock = 
platform_addHelper.__set__('ConfigParser', cfg_parser_mock);
+fetch_mock = jasmine.createSpy('fetch mock').and.returnValue(Q());
+fetch_revert_mock = platform_addHelper.__set__('fetch', 
fetch_mock);
+prepare_mock = jasmine.createSpy('prepare 
mock').and.returnValue(Q());
+prepare_mock.preparePlatforms = 
jasmine.createSpy('preparePlatforms mock').and.returnValue(Q());
+prepare_revert_mock = platform_addHelper.__set__('prepare', 
prepare_mock);
+spyOn(shell, 'mkdir');
+spyOn(fs, 'existsSync').and.returnValue(false);
+spyOn(fs, 'writeFileSync');
+spyOn(cordova_util, 
'projectConfig').and.returnValue(path.join(projectRoot, 'config.xml'));
+spyOn(cordova_util, 'isDirectory').and.returnValue(false);
+spyOn(cordova_util, 'fixRelativePath').and.callFake(function 
(input) { return input; });
+spyOn(cordova_util, 'isUrl').and.returnValue(false);
+spyOn(cordova_util, 'hostSupports').and.returnValue(true);
+spyOn(cordova_util, 'removePlatformPluginsJson');
+spyOn(cordova_config, 'read').and.returnValue({});
+// Fake platform details we will use for our mocks, returned by 
either
+// getPlatfromDetailsFromDir (in the local-directory case), or
+// downloadPlatform (in every other case)
+spyOn(platform_module, 
'getPlatformDetailsFromDir').and.returnValue(Q(fake_platform));
+spyOn(platform_addHelper, 
'downloadPlatform').and.returnValue(Q(fake_platform));
+spyOn(platform_addHelper, 
'getVersionFromConfigFile').and.returnValue(false);
+spyOn(platform_addHelper, 
'installPluginsForNewPlatform').and.returnValue(Q());
+platform_api_mock = jasmine.createSpyObj('platform api mock', 
['createPlatform', 'updatePlatform']);
+platform_api_mock.createPlatform.and.returnValue(Q());
+platform_api_mock.updatePlatform.and.returnValue(Q());
+spyOn(cordova_util, 
'getPlatformApiFunction').and.returnValue(platform_api_mock);
+spyOn(platform_metadata, 'save');
+});
+afterEach(function () {
+   

[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-06-29 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16068854#comment-16068854
 ] 

ASF GitHub Bot commented on CB-12361:
-

Github user stevengill commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/573#discussion_r124879975
  
--- Diff: spec/cordova/platform/addHelper.spec.js ---
@@ -16,34 +16,459 @@
 */
 /* eslint-env jasmine */
 
+var path = require('path');
+var fs = require('fs');
+var Q = require('q');
+var shell = require('shelljs');
+var events = require('cordova-common').events;
+var rewire = require('rewire');
+var platform_addHelper = rewire('../../../src/cordova/platform/addHelper');
+var platform_module = require('../../../src/cordova/platform');
+var platform_metadata = require('../../../src/cordova/platform_metadata');
+var cordova_util = require('../../../src/cordova/util');
+var cordova_config = require('../../../src/cordova/config');
+var plugman = require('../../../src/plugman/plugman');
+var fetch_metadata = require('../../../src/plugman/util/metadata');
+var lazy_load = require('../../../src/cordova/lazy_load');
+// require module here
+// spy on it and return 
+var cordova = require('../../../src/cordova/cordova');
+var prepare = require('../../../src/cordova/prepare');
+var gitclone = require('../../../src/gitclone');
+var fail;
+
 describe('cordova/platform/addHelper', function () {
+var projectRoot = '/some/path';
+// These _mock and _revert_mock objects use rewire as the modules 
these mocks replace
+// during testing all return functions, which we cannot spy on using 
jasmine.
+// Thus, we replace these modules inside the scope of addHelper.js 
using rewire, and shim
+// in these _mock test dummies. The test dummies themselves are 
constructed using
+// jasmine.createSpy inside the first beforeEach.
+var cfg_parser_mock = function () {};
+var cfg_parser_revert_mock;
+var hooks_mock;
+var platform_api_mock;
+var fetch_mock;
+var fetch_revert_mock;
+var prepare_mock;
+var prepare_revert_mock;
+var fake_platform = {
+'platform': 'atari'
+};
+beforeEach(function () {
+hooks_mock = jasmine.createSpyObj('hooksRunner mock', ['fire']);
+hooks_mock.fire.and.returnValue(Q());
+cfg_parser_mock.prototype = jasmine.createSpyObj('config parser 
mock', ['write', 'removeEngine', 'addEngine', 'getHookScripts']);
+cfg_parser_revert_mock = 
platform_addHelper.__set__('ConfigParser', cfg_parser_mock);
+fetch_mock = jasmine.createSpy('fetch mock').and.returnValue(Q());
+fetch_revert_mock = platform_addHelper.__set__('fetch', 
fetch_mock);
+prepare_mock = jasmine.createSpy('prepare 
mock').and.returnValue(Q());
+prepare_mock.preparePlatforms = 
jasmine.createSpy('preparePlatforms mock').and.returnValue(Q());
+prepare_revert_mock = platform_addHelper.__set__('prepare', 
prepare_mock);
+spyOn(shell, 'mkdir');
+spyOn(fs, 'existsSync').and.returnValue(false);
+spyOn(fs, 'writeFileSync');
+spyOn(cordova_util, 
'projectConfig').and.returnValue(path.join(projectRoot, 'config.xml'));
+spyOn(cordova_util, 'isDirectory').and.returnValue(false);
+spyOn(cordova_util, 'fixRelativePath').and.callFake(function 
(input) { return input; });
+spyOn(cordova_util, 'isUrl').and.returnValue(false);
+spyOn(cordova_util, 'hostSupports').and.returnValue(true);
+spyOn(cordova_util, 'removePlatformPluginsJson');
+spyOn(cordova_config, 'read').and.returnValue({});
+// Fake platform details we will use for our mocks, returned by 
either
+// getPlatfromDetailsFromDir (in the local-directory case), or
+// downloadPlatform (in every other case)
+spyOn(platform_module, 
'getPlatformDetailsFromDir').and.returnValue(Q(fake_platform));
+spyOn(platform_addHelper, 
'downloadPlatform').and.returnValue(Q(fake_platform));
+spyOn(platform_addHelper, 
'getVersionFromConfigFile').and.returnValue(false);
+spyOn(platform_addHelper, 
'installPluginsForNewPlatform').and.returnValue(Q());
+platform_api_mock = jasmine.createSpyObj('platform api mock', 
['createPlatform', 'updatePlatform']);
+platform_api_mock.createPlatform.and.returnValue(Q());
+platform_api_mock.updatePlatform.and.returnValue(Q());
+spyOn(cordova_util, 
'getPlatformApiFunction').and.returnValue(platform_api_mock);
+spyOn(platform_metadata, 'save');
+});
+afterEach(function () {
+   

[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-06-29 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16068851#comment-16068851
 ] 

ASF GitHub Bot commented on CB-12361:
-

Github user stevengill commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/573#discussion_r124878233
  
--- Diff: spec/cordova/platform/addHelper.spec.js ---
@@ -16,34 +16,459 @@
 */
 /* eslint-env jasmine */
 
+var path = require('path');
+var fs = require('fs');
+var Q = require('q');
+var shell = require('shelljs');
+var events = require('cordova-common').events;
+var rewire = require('rewire');
+var platform_addHelper = rewire('../../../src/cordova/platform/addHelper');
+var platform_module = require('../../../src/cordova/platform');
+var platform_metadata = require('../../../src/cordova/platform_metadata');
+var cordova_util = require('../../../src/cordova/util');
+var cordova_config = require('../../../src/cordova/config');
+var plugman = require('../../../src/plugman/plugman');
+var fetch_metadata = require('../../../src/plugman/util/metadata');
+var lazy_load = require('../../../src/cordova/lazy_load');
+// require module here
+// spy on it and return 
+var cordova = require('../../../src/cordova/cordova');
+var prepare = require('../../../src/cordova/prepare');
+var gitclone = require('../../../src/gitclone');
+var fail;
+
 describe('cordova/platform/addHelper', function () {
+var projectRoot = '/some/path';
+// These _mock and _revert_mock objects use rewire as the modules 
these mocks replace
+// during testing all return functions, which we cannot spy on using 
jasmine.
+// Thus, we replace these modules inside the scope of addHelper.js 
using rewire, and shim
+// in these _mock test dummies. The test dummies themselves are 
constructed using
+// jasmine.createSpy inside the first beforeEach.
+var cfg_parser_mock = function () {};
+var cfg_parser_revert_mock;
+var hooks_mock;
+var platform_api_mock;
+var fetch_mock;
+var fetch_revert_mock;
+var prepare_mock;
+var prepare_revert_mock;
+var fake_platform = {
+'platform': 'atari'
+};
+beforeEach(function () {
+hooks_mock = jasmine.createSpyObj('hooksRunner mock', ['fire']);
+hooks_mock.fire.and.returnValue(Q());
+cfg_parser_mock.prototype = jasmine.createSpyObj('config parser 
mock', ['write', 'removeEngine', 'addEngine', 'getHookScripts']);
+cfg_parser_revert_mock = 
platform_addHelper.__set__('ConfigParser', cfg_parser_mock);
+fetch_mock = jasmine.createSpy('fetch mock').and.returnValue(Q());
+fetch_revert_mock = platform_addHelper.__set__('fetch', 
fetch_mock);
+prepare_mock = jasmine.createSpy('prepare 
mock').and.returnValue(Q());
+prepare_mock.preparePlatforms = 
jasmine.createSpy('preparePlatforms mock').and.returnValue(Q());
+prepare_revert_mock = platform_addHelper.__set__('prepare', 
prepare_mock);
+spyOn(shell, 'mkdir');
+spyOn(fs, 'existsSync').and.returnValue(false);
+spyOn(fs, 'writeFileSync');
+spyOn(cordova_util, 
'projectConfig').and.returnValue(path.join(projectRoot, 'config.xml'));
+spyOn(cordova_util, 'isDirectory').and.returnValue(false);
+spyOn(cordova_util, 'fixRelativePath').and.callFake(function 
(input) { return input; });
+spyOn(cordova_util, 'isUrl').and.returnValue(false);
+spyOn(cordova_util, 'hostSupports').and.returnValue(true);
+spyOn(cordova_util, 'removePlatformPluginsJson');
+spyOn(cordova_config, 'read').and.returnValue({});
+// Fake platform details we will use for our mocks, returned by 
either
+// getPlatfromDetailsFromDir (in the local-directory case), or
+// downloadPlatform (in every other case)
+spyOn(platform_module, 
'getPlatformDetailsFromDir').and.returnValue(Q(fake_platform));
+spyOn(platform_addHelper, 
'downloadPlatform').and.returnValue(Q(fake_platform));
+spyOn(platform_addHelper, 
'getVersionFromConfigFile').and.returnValue(false);
+spyOn(platform_addHelper, 
'installPluginsForNewPlatform').and.returnValue(Q());
+platform_api_mock = jasmine.createSpyObj('platform api mock', 
['createPlatform', 'updatePlatform']);
+platform_api_mock.createPlatform.and.returnValue(Q());
+platform_api_mock.updatePlatform.and.returnValue(Q());
+spyOn(cordova_util, 
'getPlatformApiFunction').and.returnValue(platform_api_mock);
+spyOn(platform_metadata, 'save');
+});
+afterEach(function () {
+   

[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-06-29 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16068853#comment-16068853
 ] 

ASF GitHub Bot commented on CB-12361:
-

Github user stevengill commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/573#discussion_r124880319
  
--- Diff: spec/cordova/platform/addHelper.spec.js ---
@@ -16,34 +16,459 @@
 */
 /* eslint-env jasmine */
 
+var path = require('path');
+var fs = require('fs');
+var Q = require('q');
+var shell = require('shelljs');
+var events = require('cordova-common').events;
+var rewire = require('rewire');
+var platform_addHelper = rewire('../../../src/cordova/platform/addHelper');
+var platform_module = require('../../../src/cordova/platform');
+var platform_metadata = require('../../../src/cordova/platform_metadata');
+var cordova_util = require('../../../src/cordova/util');
+var cordova_config = require('../../../src/cordova/config');
+var plugman = require('../../../src/plugman/plugman');
+var fetch_metadata = require('../../../src/plugman/util/metadata');
+var lazy_load = require('../../../src/cordova/lazy_load');
+// require module here
+// spy on it and return 
+var cordova = require('../../../src/cordova/cordova');
+var prepare = require('../../../src/cordova/prepare');
+var gitclone = require('../../../src/gitclone');
+var fail;
+
 describe('cordova/platform/addHelper', function () {
+var projectRoot = '/some/path';
+// These _mock and _revert_mock objects use rewire as the modules 
these mocks replace
+// during testing all return functions, which we cannot spy on using 
jasmine.
+// Thus, we replace these modules inside the scope of addHelper.js 
using rewire, and shim
+// in these _mock test dummies. The test dummies themselves are 
constructed using
+// jasmine.createSpy inside the first beforeEach.
+var cfg_parser_mock = function () {};
+var cfg_parser_revert_mock;
+var hooks_mock;
+var platform_api_mock;
+var fetch_mock;
+var fetch_revert_mock;
+var prepare_mock;
+var prepare_revert_mock;
+var fake_platform = {
+'platform': 'atari'
+};
+beforeEach(function () {
+hooks_mock = jasmine.createSpyObj('hooksRunner mock', ['fire']);
+hooks_mock.fire.and.returnValue(Q());
+cfg_parser_mock.prototype = jasmine.createSpyObj('config parser 
mock', ['write', 'removeEngine', 'addEngine', 'getHookScripts']);
+cfg_parser_revert_mock = 
platform_addHelper.__set__('ConfigParser', cfg_parser_mock);
+fetch_mock = jasmine.createSpy('fetch mock').and.returnValue(Q());
+fetch_revert_mock = platform_addHelper.__set__('fetch', 
fetch_mock);
+prepare_mock = jasmine.createSpy('prepare 
mock').and.returnValue(Q());
+prepare_mock.preparePlatforms = 
jasmine.createSpy('preparePlatforms mock').and.returnValue(Q());
+prepare_revert_mock = platform_addHelper.__set__('prepare', 
prepare_mock);
+spyOn(shell, 'mkdir');
+spyOn(fs, 'existsSync').and.returnValue(false);
+spyOn(fs, 'writeFileSync');
+spyOn(cordova_util, 
'projectConfig').and.returnValue(path.join(projectRoot, 'config.xml'));
+spyOn(cordova_util, 'isDirectory').and.returnValue(false);
+spyOn(cordova_util, 'fixRelativePath').and.callFake(function 
(input) { return input; });
+spyOn(cordova_util, 'isUrl').and.returnValue(false);
+spyOn(cordova_util, 'hostSupports').and.returnValue(true);
+spyOn(cordova_util, 'removePlatformPluginsJson');
+spyOn(cordova_config, 'read').and.returnValue({});
+// Fake platform details we will use for our mocks, returned by 
either
+// getPlatfromDetailsFromDir (in the local-directory case), or
+// downloadPlatform (in every other case)
+spyOn(platform_module, 
'getPlatformDetailsFromDir').and.returnValue(Q(fake_platform));
+spyOn(platform_addHelper, 
'downloadPlatform').and.returnValue(Q(fake_platform));
+spyOn(platform_addHelper, 
'getVersionFromConfigFile').and.returnValue(false);
+spyOn(platform_addHelper, 
'installPluginsForNewPlatform').and.returnValue(Q());
+platform_api_mock = jasmine.createSpyObj('platform api mock', 
['createPlatform', 'updatePlatform']);
+platform_api_mock.createPlatform.and.returnValue(Q());
+platform_api_mock.updatePlatform.and.returnValue(Q());
+spyOn(cordova_util, 
'getPlatformApiFunction').and.returnValue(platform_api_mock);
+spyOn(platform_metadata, 'save');
+});
+afterEach(function () {
+   

[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-06-29 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16068857#comment-16068857
 ] 

ASF GitHub Bot commented on CB-12361:
-

Github user stevengill commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/573#discussion_r124893969
  
--- Diff: spec/cordova/platform/addHelper.spec.js ---
@@ -16,34 +16,459 @@
 */
 /* eslint-env jasmine */
 
+var path = require('path');
+var fs = require('fs');
+var Q = require('q');
+var shell = require('shelljs');
+var events = require('cordova-common').events;
+var rewire = require('rewire');
+var platform_addHelper = rewire('../../../src/cordova/platform/addHelper');
+var platform_module = require('../../../src/cordova/platform');
+var platform_metadata = require('../../../src/cordova/platform_metadata');
+var cordova_util = require('../../../src/cordova/util');
+var cordova_config = require('../../../src/cordova/config');
+var plugman = require('../../../src/plugman/plugman');
+var fetch_metadata = require('../../../src/plugman/util/metadata');
+var lazy_load = require('../../../src/cordova/lazy_load');
+// require module here
+// spy on it and return 
+var cordova = require('../../../src/cordova/cordova');
+var prepare = require('../../../src/cordova/prepare');
+var gitclone = require('../../../src/gitclone');
+var fail;
+
 describe('cordova/platform/addHelper', function () {
+var projectRoot = '/some/path';
+// These _mock and _revert_mock objects use rewire as the modules 
these mocks replace
+// during testing all return functions, which we cannot spy on using 
jasmine.
+// Thus, we replace these modules inside the scope of addHelper.js 
using rewire, and shim
+// in these _mock test dummies. The test dummies themselves are 
constructed using
+// jasmine.createSpy inside the first beforeEach.
+var cfg_parser_mock = function () {};
+var cfg_parser_revert_mock;
+var hooks_mock;
+var platform_api_mock;
+var fetch_mock;
+var fetch_revert_mock;
+var prepare_mock;
+var prepare_revert_mock;
+var fake_platform = {
+'platform': 'atari'
+};
+beforeEach(function () {
+hooks_mock = jasmine.createSpyObj('hooksRunner mock', ['fire']);
+hooks_mock.fire.and.returnValue(Q());
+cfg_parser_mock.prototype = jasmine.createSpyObj('config parser 
mock', ['write', 'removeEngine', 'addEngine', 'getHookScripts']);
+cfg_parser_revert_mock = 
platform_addHelper.__set__('ConfigParser', cfg_parser_mock);
+fetch_mock = jasmine.createSpy('fetch mock').and.returnValue(Q());
+fetch_revert_mock = platform_addHelper.__set__('fetch', 
fetch_mock);
+prepare_mock = jasmine.createSpy('prepare 
mock').and.returnValue(Q());
+prepare_mock.preparePlatforms = 
jasmine.createSpy('preparePlatforms mock').and.returnValue(Q());
+prepare_revert_mock = platform_addHelper.__set__('prepare', 
prepare_mock);
+spyOn(shell, 'mkdir');
+spyOn(fs, 'existsSync').and.returnValue(false);
+spyOn(fs, 'writeFileSync');
+spyOn(cordova_util, 
'projectConfig').and.returnValue(path.join(projectRoot, 'config.xml'));
+spyOn(cordova_util, 'isDirectory').and.returnValue(false);
+spyOn(cordova_util, 'fixRelativePath').and.callFake(function 
(input) { return input; });
+spyOn(cordova_util, 'isUrl').and.returnValue(false);
+spyOn(cordova_util, 'hostSupports').and.returnValue(true);
+spyOn(cordova_util, 'removePlatformPluginsJson');
+spyOn(cordova_config, 'read').and.returnValue({});
+// Fake platform details we will use for our mocks, returned by 
either
+// getPlatfromDetailsFromDir (in the local-directory case), or
+// downloadPlatform (in every other case)
+spyOn(platform_module, 
'getPlatformDetailsFromDir').and.returnValue(Q(fake_platform));
+spyOn(platform_addHelper, 
'downloadPlatform').and.returnValue(Q(fake_platform));
+spyOn(platform_addHelper, 
'getVersionFromConfigFile').and.returnValue(false);
+spyOn(platform_addHelper, 
'installPluginsForNewPlatform').and.returnValue(Q());
+platform_api_mock = jasmine.createSpyObj('platform api mock', 
['createPlatform', 'updatePlatform']);
+platform_api_mock.createPlatform.and.returnValue(Q());
+platform_api_mock.updatePlatform.and.returnValue(Q());
+spyOn(cordova_util, 
'getPlatformApiFunction').and.returnValue(platform_api_mock);
+spyOn(platform_metadata, 'save');
+});
+afterEach(function () {
+   

[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-06-29 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16068847#comment-16068847
 ] 

ASF GitHub Bot commented on CB-12361:
-

Github user stevengill commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/573#discussion_r124873252
  
--- Diff: spec/cordova/platform/addHelper.spec.js ---
@@ -16,34 +16,459 @@
 */
 /* eslint-env jasmine */
 
+var path = require('path');
+var fs = require('fs');
+var Q = require('q');
+var shell = require('shelljs');
+var events = require('cordova-common').events;
+var rewire = require('rewire');
+var platform_addHelper = rewire('../../../src/cordova/platform/addHelper');
+var platform_module = require('../../../src/cordova/platform');
+var platform_metadata = require('../../../src/cordova/platform_metadata');
+var cordova_util = require('../../../src/cordova/util');
+var cordova_config = require('../../../src/cordova/config');
+var plugman = require('../../../src/plugman/plugman');
+var fetch_metadata = require('../../../src/plugman/util/metadata');
+var lazy_load = require('../../../src/cordova/lazy_load');
+// require module here
+// spy on it and return 
+var cordova = require('../../../src/cordova/cordova');
+var prepare = require('../../../src/cordova/prepare');
+var gitclone = require('../../../src/gitclone');
+var fail;
+
 describe('cordova/platform/addHelper', function () {
+var projectRoot = '/some/path';
+// These _mock and _revert_mock objects use rewire as the modules 
these mocks replace
+// during testing all return functions, which we cannot spy on using 
jasmine.
+// Thus, we replace these modules inside the scope of addHelper.js 
using rewire, and shim
+// in these _mock test dummies. The test dummies themselves are 
constructed using
+// jasmine.createSpy inside the first beforeEach.
+var cfg_parser_mock = function () {};
+var cfg_parser_revert_mock;
+var hooks_mock;
+var platform_api_mock;
+var fetch_mock;
+var fetch_revert_mock;
+var prepare_mock;
+var prepare_revert_mock;
+var fake_platform = {
+'platform': 'atari'
+};
+beforeEach(function () {
+hooks_mock = jasmine.createSpyObj('hooksRunner mock', ['fire']);
+hooks_mock.fire.and.returnValue(Q());
+cfg_parser_mock.prototype = jasmine.createSpyObj('config parser 
mock', ['write', 'removeEngine', 'addEngine', 'getHookScripts']);
+cfg_parser_revert_mock = 
platform_addHelper.__set__('ConfigParser', cfg_parser_mock);
+fetch_mock = jasmine.createSpy('fetch mock').and.returnValue(Q());
+fetch_revert_mock = platform_addHelper.__set__('fetch', 
fetch_mock);
+prepare_mock = jasmine.createSpy('prepare 
mock').and.returnValue(Q());
+prepare_mock.preparePlatforms = 
jasmine.createSpy('preparePlatforms mock').and.returnValue(Q());
+prepare_revert_mock = platform_addHelper.__set__('prepare', 
prepare_mock);
+spyOn(shell, 'mkdir');
+spyOn(fs, 'existsSync').and.returnValue(false);
+spyOn(fs, 'writeFileSync');
+spyOn(cordova_util, 
'projectConfig').and.returnValue(path.join(projectRoot, 'config.xml'));
+spyOn(cordova_util, 'isDirectory').and.returnValue(false);
+spyOn(cordova_util, 'fixRelativePath').and.callFake(function 
(input) { return input; });
+spyOn(cordova_util, 'isUrl').and.returnValue(false);
+spyOn(cordova_util, 'hostSupports').and.returnValue(true);
+spyOn(cordova_util, 'removePlatformPluginsJson');
+spyOn(cordova_config, 'read').and.returnValue({});
+// Fake platform details we will use for our mocks, returned by 
either
+// getPlatfromDetailsFromDir (in the local-directory case), or
+// downloadPlatform (in every other case)
+spyOn(platform_module, 
'getPlatformDetailsFromDir').and.returnValue(Q(fake_platform));
+spyOn(platform_addHelper, 
'downloadPlatform').and.returnValue(Q(fake_platform));
+spyOn(platform_addHelper, 
'getVersionFromConfigFile').and.returnValue(false);
+spyOn(platform_addHelper, 
'installPluginsForNewPlatform').and.returnValue(Q());
+platform_api_mock = jasmine.createSpyObj('platform api mock', 
['createPlatform', 'updatePlatform']);
+platform_api_mock.createPlatform.and.returnValue(Q());
+platform_api_mock.updatePlatform.and.returnValue(Q());
+spyOn(cordova_util, 
'getPlatformApiFunction').and.returnValue(platform_api_mock);
+spyOn(platform_metadata, 'save');
+});
+afterEach(function () {
+   

[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-06-29 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16068843#comment-16068843
 ] 

ASF GitHub Bot commented on CB-12361:
-

Github user stevengill commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/573#discussion_r124868182
  
--- Diff: spec/cordova/platform/addHelper.spec.js ---
@@ -16,34 +16,459 @@
 */
 /* eslint-env jasmine */
 
+var path = require('path');
+var fs = require('fs');
+var Q = require('q');
+var shell = require('shelljs');
+var events = require('cordova-common').events;
+var rewire = require('rewire');
+var platform_addHelper = rewire('../../../src/cordova/platform/addHelper');
+var platform_module = require('../../../src/cordova/platform');
+var platform_metadata = require('../../../src/cordova/platform_metadata');
+var cordova_util = require('../../../src/cordova/util');
+var cordova_config = require('../../../src/cordova/config');
+var plugman = require('../../../src/plugman/plugman');
+var fetch_metadata = require('../../../src/plugman/util/metadata');
+var lazy_load = require('../../../src/cordova/lazy_load');
+// require module here
+// spy on it and return 
+var cordova = require('../../../src/cordova/cordova');
+var prepare = require('../../../src/cordova/prepare');
+var gitclone = require('../../../src/gitclone');
+var fail;
+
 describe('cordova/platform/addHelper', function () {
+var projectRoot = '/some/path';
+// These _mock and _revert_mock objects use rewire as the modules 
these mocks replace
+// during testing all return functions, which we cannot spy on using 
jasmine.
+// Thus, we replace these modules inside the scope of addHelper.js 
using rewire, and shim
+// in these _mock test dummies. The test dummies themselves are 
constructed using
+// jasmine.createSpy inside the first beforeEach.
+var cfg_parser_mock = function () {};
+var cfg_parser_revert_mock;
+var hooks_mock;
+var platform_api_mock;
+var fetch_mock;
+var fetch_revert_mock;
+var prepare_mock;
+var prepare_revert_mock;
+var fake_platform = {
+'platform': 'atari'
+};
+beforeEach(function () {
+hooks_mock = jasmine.createSpyObj('hooksRunner mock', ['fire']);
+hooks_mock.fire.and.returnValue(Q());
+cfg_parser_mock.prototype = jasmine.createSpyObj('config parser 
mock', ['write', 'removeEngine', 'addEngine', 'getHookScripts']);
+cfg_parser_revert_mock = 
platform_addHelper.__set__('ConfigParser', cfg_parser_mock);
+fetch_mock = jasmine.createSpy('fetch mock').and.returnValue(Q());
+fetch_revert_mock = platform_addHelper.__set__('fetch', 
fetch_mock);
+prepare_mock = jasmine.createSpy('prepare 
mock').and.returnValue(Q());
+prepare_mock.preparePlatforms = 
jasmine.createSpy('preparePlatforms mock').and.returnValue(Q());
+prepare_revert_mock = platform_addHelper.__set__('prepare', 
prepare_mock);
+spyOn(shell, 'mkdir');
+spyOn(fs, 'existsSync').and.returnValue(false);
+spyOn(fs, 'writeFileSync');
+spyOn(cordova_util, 
'projectConfig').and.returnValue(path.join(projectRoot, 'config.xml'));
+spyOn(cordova_util, 'isDirectory').and.returnValue(false);
+spyOn(cordova_util, 'fixRelativePath').and.callFake(function 
(input) { return input; });
+spyOn(cordova_util, 'isUrl').and.returnValue(false);
+spyOn(cordova_util, 'hostSupports').and.returnValue(true);
+spyOn(cordova_util, 'removePlatformPluginsJson');
+spyOn(cordova_config, 'read').and.returnValue({});
+// Fake platform details we will use for our mocks, returned by 
either
+// getPlatfromDetailsFromDir (in the local-directory case), or
+// downloadPlatform (in every other case)
+spyOn(platform_module, 
'getPlatformDetailsFromDir').and.returnValue(Q(fake_platform));
+spyOn(platform_addHelper, 
'downloadPlatform').and.returnValue(Q(fake_platform));
+spyOn(platform_addHelper, 
'getVersionFromConfigFile').and.returnValue(false);
+spyOn(platform_addHelper, 
'installPluginsForNewPlatform').and.returnValue(Q());
+platform_api_mock = jasmine.createSpyObj('platform api mock', 
['createPlatform', 'updatePlatform']);
+platform_api_mock.createPlatform.and.returnValue(Q());
+platform_api_mock.updatePlatform.and.returnValue(Q());
+spyOn(cordova_util, 
'getPlatformApiFunction').and.returnValue(platform_api_mock);
+spyOn(platform_metadata, 'save');
+});
+afterEach(function () {
+   

[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-06-29 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16068844#comment-16068844
 ] 

ASF GitHub Bot commented on CB-12361:
-

Github user stevengill commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/573#discussion_r124871034
  
--- Diff: spec/cordova/platform/addHelper.spec.js ---
@@ -16,34 +16,459 @@
 */
 /* eslint-env jasmine */
 
+var path = require('path');
+var fs = require('fs');
+var Q = require('q');
+var shell = require('shelljs');
+var events = require('cordova-common').events;
+var rewire = require('rewire');
+var platform_addHelper = rewire('../../../src/cordova/platform/addHelper');
+var platform_module = require('../../../src/cordova/platform');
+var platform_metadata = require('../../../src/cordova/platform_metadata');
+var cordova_util = require('../../../src/cordova/util');
+var cordova_config = require('../../../src/cordova/config');
+var plugman = require('../../../src/plugman/plugman');
+var fetch_metadata = require('../../../src/plugman/util/metadata');
+var lazy_load = require('../../../src/cordova/lazy_load');
+// require module here
+// spy on it and return 
+var cordova = require('../../../src/cordova/cordova');
+var prepare = require('../../../src/cordova/prepare');
+var gitclone = require('../../../src/gitclone');
+var fail;
+
 describe('cordova/platform/addHelper', function () {
+var projectRoot = '/some/path';
+// These _mock and _revert_mock objects use rewire as the modules 
these mocks replace
+// during testing all return functions, which we cannot spy on using 
jasmine.
+// Thus, we replace these modules inside the scope of addHelper.js 
using rewire, and shim
+// in these _mock test dummies. The test dummies themselves are 
constructed using
+// jasmine.createSpy inside the first beforeEach.
+var cfg_parser_mock = function () {};
+var cfg_parser_revert_mock;
+var hooks_mock;
+var platform_api_mock;
+var fetch_mock;
+var fetch_revert_mock;
+var prepare_mock;
+var prepare_revert_mock;
+var fake_platform = {
+'platform': 'atari'
+};
+beforeEach(function () {
+hooks_mock = jasmine.createSpyObj('hooksRunner mock', ['fire']);
+hooks_mock.fire.and.returnValue(Q());
+cfg_parser_mock.prototype = jasmine.createSpyObj('config parser 
mock', ['write', 'removeEngine', 'addEngine', 'getHookScripts']);
+cfg_parser_revert_mock = 
platform_addHelper.__set__('ConfigParser', cfg_parser_mock);
+fetch_mock = jasmine.createSpy('fetch mock').and.returnValue(Q());
+fetch_revert_mock = platform_addHelper.__set__('fetch', 
fetch_mock);
+prepare_mock = jasmine.createSpy('prepare 
mock').and.returnValue(Q());
+prepare_mock.preparePlatforms = 
jasmine.createSpy('preparePlatforms mock').and.returnValue(Q());
+prepare_revert_mock = platform_addHelper.__set__('prepare', 
prepare_mock);
+spyOn(shell, 'mkdir');
+spyOn(fs, 'existsSync').and.returnValue(false);
+spyOn(fs, 'writeFileSync');
+spyOn(cordova_util, 
'projectConfig').and.returnValue(path.join(projectRoot, 'config.xml'));
+spyOn(cordova_util, 'isDirectory').and.returnValue(false);
+spyOn(cordova_util, 'fixRelativePath').and.callFake(function 
(input) { return input; });
+spyOn(cordova_util, 'isUrl').and.returnValue(false);
+spyOn(cordova_util, 'hostSupports').and.returnValue(true);
+spyOn(cordova_util, 'removePlatformPluginsJson');
+spyOn(cordova_config, 'read').and.returnValue({});
+// Fake platform details we will use for our mocks, returned by 
either
+// getPlatfromDetailsFromDir (in the local-directory case), or
+// downloadPlatform (in every other case)
+spyOn(platform_module, 
'getPlatformDetailsFromDir').and.returnValue(Q(fake_platform));
+spyOn(platform_addHelper, 
'downloadPlatform').and.returnValue(Q(fake_platform));
+spyOn(platform_addHelper, 
'getVersionFromConfigFile').and.returnValue(false);
+spyOn(platform_addHelper, 
'installPluginsForNewPlatform').and.returnValue(Q());
+platform_api_mock = jasmine.createSpyObj('platform api mock', 
['createPlatform', 'updatePlatform']);
+platform_api_mock.createPlatform.and.returnValue(Q());
+platform_api_mock.updatePlatform.and.returnValue(Q());
+spyOn(cordova_util, 
'getPlatformApiFunction').and.returnValue(platform_api_mock);
+spyOn(platform_metadata, 'save');
+});
+afterEach(function () {
+   

[jira] [Commented] (CB-12361) Speed up cordova-lib tests

2017-06-29 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16068850#comment-16068850
 ] 

ASF GitHub Bot commented on CB-12361:
-

Github user stevengill commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/573#discussion_r124892113
  
--- Diff: spec/cordova/platform/addHelper.spec.js ---
@@ -16,34 +16,459 @@
 */
 /* eslint-env jasmine */
 
+var path = require('path');
+var fs = require('fs');
+var Q = require('q');
+var shell = require('shelljs');
+var events = require('cordova-common').events;
+var rewire = require('rewire');
+var platform_addHelper = rewire('../../../src/cordova/platform/addHelper');
+var platform_module = require('../../../src/cordova/platform');
+var platform_metadata = require('../../../src/cordova/platform_metadata');
+var cordova_util = require('../../../src/cordova/util');
+var cordova_config = require('../../../src/cordova/config');
+var plugman = require('../../../src/plugman/plugman');
+var fetch_metadata = require('../../../src/plugman/util/metadata');
+var lazy_load = require('../../../src/cordova/lazy_load');
+// require module here
+// spy on it and return 
+var cordova = require('../../../src/cordova/cordova');
+var prepare = require('../../../src/cordova/prepare');
+var gitclone = require('../../../src/gitclone');
+var fail;
+
 describe('cordova/platform/addHelper', function () {
+var projectRoot = '/some/path';
+// These _mock and _revert_mock objects use rewire as the modules 
these mocks replace
+// during testing all return functions, which we cannot spy on using 
jasmine.
+// Thus, we replace these modules inside the scope of addHelper.js 
using rewire, and shim
+// in these _mock test dummies. The test dummies themselves are 
constructed using
+// jasmine.createSpy inside the first beforeEach.
+var cfg_parser_mock = function () {};
+var cfg_parser_revert_mock;
+var hooks_mock;
+var platform_api_mock;
+var fetch_mock;
+var fetch_revert_mock;
+var prepare_mock;
+var prepare_revert_mock;
+var fake_platform = {
+'platform': 'atari'
+};
+beforeEach(function () {
+hooks_mock = jasmine.createSpyObj('hooksRunner mock', ['fire']);
+hooks_mock.fire.and.returnValue(Q());
+cfg_parser_mock.prototype = jasmine.createSpyObj('config parser 
mock', ['write', 'removeEngine', 'addEngine', 'getHookScripts']);
+cfg_parser_revert_mock = 
platform_addHelper.__set__('ConfigParser', cfg_parser_mock);
+fetch_mock = jasmine.createSpy('fetch mock').and.returnValue(Q());
+fetch_revert_mock = platform_addHelper.__set__('fetch', 
fetch_mock);
+prepare_mock = jasmine.createSpy('prepare 
mock').and.returnValue(Q());
+prepare_mock.preparePlatforms = 
jasmine.createSpy('preparePlatforms mock').and.returnValue(Q());
+prepare_revert_mock = platform_addHelper.__set__('prepare', 
prepare_mock);
+spyOn(shell, 'mkdir');
+spyOn(fs, 'existsSync').and.returnValue(false);
+spyOn(fs, 'writeFileSync');
+spyOn(cordova_util, 
'projectConfig').and.returnValue(path.join(projectRoot, 'config.xml'));
+spyOn(cordova_util, 'isDirectory').and.returnValue(false);
+spyOn(cordova_util, 'fixRelativePath').and.callFake(function 
(input) { return input; });
+spyOn(cordova_util, 'isUrl').and.returnValue(false);
+spyOn(cordova_util, 'hostSupports').and.returnValue(true);
+spyOn(cordova_util, 'removePlatformPluginsJson');
+spyOn(cordova_config, 'read').and.returnValue({});
+// Fake platform details we will use for our mocks, returned by 
either
+// getPlatfromDetailsFromDir (in the local-directory case), or
+// downloadPlatform (in every other case)
+spyOn(platform_module, 
'getPlatformDetailsFromDir').and.returnValue(Q(fake_platform));
+spyOn(platform_addHelper, 
'downloadPlatform').and.returnValue(Q(fake_platform));
+spyOn(platform_addHelper, 
'getVersionFromConfigFile').and.returnValue(false);
+spyOn(platform_addHelper, 
'installPluginsForNewPlatform').and.returnValue(Q());
+platform_api_mock = jasmine.createSpyObj('platform api mock', 
['createPlatform', 'updatePlatform']);
+platform_api_mock.createPlatform.and.returnValue(Q());
+platform_api_mock.updatePlatform.and.returnValue(Q());
+spyOn(cordova_util, 
'getPlatformApiFunction').and.returnValue(platform_api_mock);
+spyOn(platform_metadata, 'save');
+});
+afterEach(function () {
+   

  1   2   >