[
https://issues.apache.org/jira/browse/CB-14251?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16568642#comment-16568642
]
ASF GitHub Bot commented on CB-14251:
-------------------------------------
brodybits closed pull request #30: CB-14251 patch release updates WIP
URL: https://github.com/apache/cordova-fetch/pull/30
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/package.json b/package.json
index 1082595..87acc3a 100644
--- a/package.json
+++ b/package.json
@@ -40,7 +40,7 @@
},
"scripts": {
"test": "npm run eslint && npm run jasmine",
- "eslint": "eslint index.js spec/fetch.spec.js",
+ "eslint": "eslint .",
"jasmine": "jasmine spec/fetch.spec.js spec/fetch-unit.spec.js"
},
"engines": {
diff --git a/spec/fetch-unit.spec.js b/spec/fetch-unit.spec.js
index c13f75a..81ec9d1 100644
--- a/spec/fetch-unit.spec.js
+++ b/spec/fetch-unit.spec.js
@@ -19,68 +19,47 @@
var fetch = require('../index.js');
var shell = require('shelljs');
var fs = require('fs');
-var Q = require('q');
var superspawn = require('cordova-common').superspawn;
describe('unit tests for index.js', function () {
beforeEach(function () {
spyOn(superspawn, 'spawn').and.returnValue(true);
spyOn(shell, 'mkdir').and.returnValue(true);
- spyOn(shell, 'which').and.returnValue(Q());
- spyOn(fetch, 'isNpmInstalled').and.returnValue(Q());
+ spyOn(shell, 'which').and.returnValue(Promise.resolve());
+ spyOn(fetch, 'isNpmInstalled').and.returnValue(Promise.resolve());
spyOn(fetch, 'getPath').and.returnValue('some/path');
spyOn(fs, 'existsSync').and.returnValue(false);
});
- it('npm install should be called with production flag (default)', function
(done) {
- var opts = { cwd: 'some/path', production: true, save: true};
- fetch('platform', 'tmpDir', opts)
+ it('npm install should be called with production flag (default)', function
() {
+ var opts = { cwd: 'some/path', production: true, save: true };
+ return fetch('platform', 'tmpDir', opts)
.then(function (result) {
expect(superspawn.spawn).toHaveBeenCalledWith('npm',
jasmine.stringMatching(/production/), jasmine.any(Object));
- })
- .fail(function (err) {
- console.error(err);
- expect(err).toBeUndefined();
- })
- .fin(done);
+ });
});
- it('save-exact should be true if passed in', function (done) {
+ it('save-exact should be true if passed in', function () {
var opts = { cwd: 'some/path', save_exact: true };
- fetch('platform', 'tmpDir', opts)
+ return fetch('platform', 'tmpDir', opts)
.then(function (result) {
expect(superspawn.spawn).toHaveBeenCalledWith('npm',
jasmine.stringMatching(/save-exact/), jasmine.any(Object));
- })
- .fail(function (err) {
- console.error(err);
- expect(err).toBeUndefined();
- })
- .fin(done);
+ });
});
- it('noprod should turn production off', function (done) {
- var opts = { cwd: 'some/path', production: false};
- fetch('platform', 'tmpDir', opts)
+ it('noprod should turn production off', function () {
+ var opts = { cwd: 'some/path', production: false };
+ return fetch('platform', 'tmpDir', opts)
.then(function (result) {
expect(superspawn.spawn).not.toHaveBeenCalledWith('npm',
jasmine.stringMatching(/production/), jasmine.any(Object));
- })
- .fail(function (err) {
- console.error(err);
- expect(err).toBeUndefined();
- })
- .fin(done);
+ });
});
- it('when save is false, no-save flag should be passed through', function
(done) {
- var opts = { cwd: 'some/path', production: true, save: false};
- fetch('platform', 'tmpDir', opts)
+ it('when save is false, no-save flag should be passed through', function
() {
+ var opts = { cwd: 'some/path', production: true, save: false };
+ return fetch('platform', 'tmpDir', opts)
.then(function (result) {
expect(superspawn.spawn).toHaveBeenCalledWith('npm',
jasmine.stringMatching(/--no-save/), jasmine.any(Object));
- })
- .fail(function (err) {
- console.error(err);
- expect(err).toBeUndefined();
- })
- .fin(done);
+ });
});
});
diff --git a/spec/fetch.spec.js b/spec/fetch.spec.js
index 4d9369c..3cd6857 100644
--- a/spec/fetch.spec.js
+++ b/spec/fetch.spec.js
@@ -37,49 +37,53 @@ describe('platform fetch/uninstall tests via npm & git',
function () {
shell.rm('-rf', tmpDir);
});
- it('should fetch and uninstall a cordova platform via npm & git', function
(done) {
+ it('should fetch and uninstall a cordova platform via npm & git', function
() {
- fetch('cordova-android', tmpDir, opts)
+ // cordova-wp8 which is now deprecated should never
+ // drop support for deprecated Node.js 4 version.
+ return fetch('cordova-wp8', tmpDir, opts)
.then(function (result) {
var pkgJSON = require(path.join(result, 'package.json'));
expect(result).toBeDefined();
expect(fs.existsSync(result)).toBe(true);
- expect(pkgJSON.name).toBe('cordova-android');
+ expect(pkgJSON.name).toBe('cordova-wp8');
- return uninstall('cordova-android', tmpDir, opts);
+ return uninstall('cordova-wp8', tmpDir, opts);
})
.then(function () {
- expect(fs.existsSync(path.join(tmpDir, 'node_modules',
'cordova-android'))).toBe(false);
+ expect(fs.existsSync(path.join(tmpDir, 'node_modules',
'cordova-wp8'))).toBe(false);
- return fetch('https://github.com/apache/cordova-ios.git',
tmpDir, opts);
+ // https://github.com/apache/cordova-blackberry.git which is
now deprecated
+ // should never drop suport for deprecated Node.js 4 version.
+ return fetch('https://github.com/apache/cordova-ubuntu.git',
tmpDir, opts);
})
.then(function (result) {
var pkgJSON = require(path.join(result, 'package.json'));
expect(result).toBeDefined();
expect(fs.existsSync(result)).toBe(true);
- expect(pkgJSON.name).toBe('cordova-ios');
+ expect(pkgJSON.name).toBe('cordova-ubuntu');
- return uninstall('cordova-ios', tmpDir, opts);
+ return uninstall('cordova-ubuntu', tmpDir, opts);
})
.then(function () {
- expect(fs.existsSync(path.join(tmpDir, 'node_modules',
'cordova-ios'))).toBe(false);
+ expect(fs.existsSync(path.join(tmpDir, 'node_modules',
'cordova-blackberry'))).toBe(false);
+ expect(fs.existsSync(path.join(tmpDir, 'node_modules',
'cordova-blackberry10'))).toBe(false);
+ // FUTURE TBD:
// return
fetch('git+ssh://[email protected]/apache/cordova-browser.git#487d91d1ded96b8e2029f2ee90f12a8b20499f54',
tmpDir, opts);
// can't test ssh right now as it is requiring ssh password
- return fetch('https://github.com/apache/cordova-browser.git',
tmpDir, opts);
+
+ // https://github.com/apache/cordova-blackberry.git which is
now deprecated
+ // drop support for deprecated Node.js 4 version.
+ return
fetch('https://github.com/apache/cordova-blackberry.git', tmpDir, opts);
})
.then(function (result) {
var pkgJSON = require(path.join(result, 'package.json'));
expect(result).toBeDefined();
expect(fs.existsSync(result)).toBe(true);
- expect(pkgJSON.name).toBe('cordova-browser');
- })
- .fail(function (err) {
- console.error(err);
- expect(err).toBeUndefined();
- })
- .fin(done);
- }, 60000);
+ expect(pkgJSON.name).toBe('cordova-blackberry10');
+ });
+ }, 120000);
});
describe('platform fetch/uninstall test via npm & git tags with --save',
function () {
@@ -98,8 +102,8 @@ describe('platform fetch/uninstall test via npm & git tags
with --save', functio
shell.rm('-rf', tmpDir);
});
- it('should fetch and uninstall a cordova platform via npm & git
tags/branches', function (done) {
- fetch('[email protected]', tmpDir, opts)
+ it('should fetch and uninstall a cordova platform via npm & git
tags/branches', function () {
+ return fetch('[email protected]', tmpDir, opts)
.then(function (result) {
var pkgJSON = require(path.join(result, 'package.json'));
expect(result).toBeDefined();
@@ -149,12 +153,7 @@ describe('platform fetch/uninstall test via npm & git tags
with --save', functio
expect(rootPJ.dependencies['cordova-android']).toBe('git+https://github.com/apache/cordova-android.git#4.1.x');
return uninstall('cordova-android', tmpDir, opts);
- })
- .fail(function (err) {
- console.error(err);
- expect(err).toBeUndefined();
- })
- .fin(done);
+ });
}, 150000);
});
@@ -174,8 +173,8 @@ describe('plugin fetch/uninstall test with --save',
function () {
shell.rm('-rf', tmpDir);
});
- it('should fetch and uninstall a cordova plugin via git commit sha',
function (done) {
-
fetch('https://github.com/apache/cordova-plugin-contacts.git#7db612115755c2be73a98dda76ff4c5fd9d8a575',
tmpDir, opts)
+ it('should fetch and uninstall a cordova plugin via git commit sha',
function () {
+ return
fetch('https://github.com/apache/cordova-plugin-contacts.git#7db612115755c2be73a98dda76ff4c5fd9d8a575',
tmpDir, opts)
.then(function (result) {
var pkgJSON = require(path.join(result, 'package.json'));
expect(result).toBeDefined();
@@ -192,12 +191,7 @@ describe('plugin fetch/uninstall test with --save',
function () {
var rootPJ = JSON.parse(fs.readFileSync(path.join(tmpDir,
'package.json'), 'utf8'));
expect(Object.keys(rootPJ.dependencies).length).toBe(0);
expect(fs.existsSync(path.join(tmpDir, 'node_modules',
'cordova-plugin-contacts'))).toBe(false);
- })
- .fail(function (err) {
- console.error(err);
- expect(err).toBeUndefined();
- })
- .fin(done);
+ });
}, 30000);
});
@@ -216,8 +210,8 @@ describe('test trimID method for npm and git', function () {
shell.rm('-rf', tmpDir);
});
- it('should fetch the same cordova plugin twice in a row', function (done) {
- fetch('cordova-plugin-device', tmpDir, opts)
+ it('should fetch the same cordova plugin twice in a row', function () {
+ return fetch('cordova-plugin-device', tmpDir, opts)
.then(function (result) {
var pkgJSON = require(path.join(result, 'package.json'));
expect(result).toBeDefined();
@@ -256,16 +250,11 @@ describe('test trimID method for npm and git', function
() {
expect(result).toBeDefined();
expect(fs.existsSync(result)).toBe(true);
expect(result).toMatch('cordova-plugin-media');
- })
- .fail(function (err) {
- console.error(err);
- expect(err).toBeUndefined();
- })
- .fin(done);
+ });
}, 40000);
- it('should fetch same plugin twice in a row if git repo name differ from
plugin id', function (done) {
-
fetch('https://github.com/AzureAD/azure-activedirectory-library-for-cordova.git',
tmpDir, opts)
+ it('should fetch same plugin twice in a row if git repo name differ from
plugin id', function () {
+ return
fetch('https://github.com/AzureAD/azure-activedirectory-library-for-cordova.git',
tmpDir, opts)
.then(function (result) {
expect(result).toBeDefined();
expect(fs.existsSync(result)).toBe(true);
@@ -276,12 +265,7 @@ describe('test trimID method for npm and git', function ()
{
expect(result).toBeDefined();
expect(fs.existsSync(result)).toBe(true);
expect(result).toMatch('cordova-plugin-ms-adal');
- })
- .fail(function (err) {
- console.error(err);
- expect(err).toBeUndefined();
- })
- .fin(done);
+ });
}, 30000);
});
@@ -299,16 +283,14 @@ describe('fetch failure with unknown module', function ()
{
shell.rm('-rf', tmpDir);
});
- it('should fail fetching a module that does not exist on npm', function
(done) {
- fetch('NOTAMODULE', tmpDir, opts)
+ it('should fail fetching a module that does not exist on npm', function ()
{
+ return fetch('NOTAMODULE', tmpDir, opts)
.then(function (result) {
- console.log('This should fail and it should not be seen');
- })
- .fail(function (err) {
+ fail('Expected promise to be rejected');
+ }, function (err) {
expect(err.message.code).toBe(1);
expect(err).toBeDefined();
- })
- .fin(done);
+ });
}, 30000);
});
@@ -326,16 +308,14 @@ describe('fetch failure with git subdirectory', function
() {
shell.rm('-rf', tmpDir);
});
- it('should fail fetching a giturl which contains a subdirectory', function
(done) {
- fetch('https://github.com/apache/cordova-plugins.git#:keyboard',
tmpDir, opts)
+ it('should fail fetching a giturl which contains a subdirectory', function
() {
+ return
fetch('https://github.com/apache/cordova-plugins.git#:keyboard', tmpDir, opts)
.then(function (result) {
- console.log('This should fail and it should not be seen');
- })
- .fail(function (err) {
+ fail('Expected promise to be rejected');
+ }, function (err) {
expect(err.message.code).toBe(1);
expect(err).toBeDefined();
- })
- .fin(done);
+ });
}, 30000);
});
@@ -353,18 +333,13 @@ describe('scoped plugin fetch/uninstall tests via npm',
function () {
shell.rm('-rf', tmpDir);
});
- it('should fetch a scoped plugin from npm', function (done) {
- fetch('@stevegill/cordova-plugin-device', tmpDir, opts)
+ it('should fetch a scoped plugin from npm', function () {
+ return fetch('@stevegill/cordova-plugin-device', tmpDir, opts)
.then(function (result) {
var pkgJSON = require(path.join(result, 'package.json'));
expect(result).toBeDefined();
expect(fs.existsSync(result)).toBe(true);
expect(pkgJSON.name).toBe('@stevegill/cordova-plugin-device');
- })
- .fail(function (err) {
- console.error(err);
- expect(err).toBeUndefined();
- })
- .fin(done);
+ });
}, 30000);
});
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> cordova-fetch patch release August 2018
> ---------------------------------------
>
> Key: CB-14251
> URL: https://issues.apache.org/jira/browse/CB-14251
> Project: Apache Cordova
> Issue Type: Task
> Components: cordova-fetch
> Reporter: Chris Brody
> Assignee: Chris Brody
> Priority: Major
>
> Patch release wanted with the following updates:
> * repo URL fix from [https://github.com/apache/cordova-fetch/pull/20]
> * explicit requirement for [email protected] (or cordova-common@^2.2.5)
> in dependencies, which would be an in-range update (not wanted in master
> branch, see note below)
> Following steps at
> https://github.com/apache/cordova-coho/blob/master/docs/tools-release-process.md
> (with some minor adjustments)
> Note: cordova-common@^2.2.5 dependency update is not wanted in master branch.
> The master branch of this and other Cordova repos should now target the next
> major release as discussed in [this [email protected]
> thread|https://lists.apache.org/thread.html/083ffe568bad2a8adc5533cbe5aca481bdd921e22a6aad9602aaded2@%3Cdev.cordova.apache.org%3E].
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]