You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by au...@apache.org on 2017/07/28 18:26:49 UTC
[18/18] cordova-lib git commit: CB-12895 : updated integration tests
with eslint format and rebased
CB-12895 : updated integration tests with eslint format and rebased
Project: http://git-wip-us.apache.org/repos/asf/cordova-lib/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-lib/commit/d19951b3
Tree: http://git-wip-us.apache.org/repos/asf/cordova-lib/tree/d19951b3
Diff: http://git-wip-us.apache.org/repos/asf/cordova-lib/diff/d19951b3
Branch: refs/heads/master
Commit: d19951b3e37239f699c4f304c0fee8407d89d9c2
Parents: 17438d2
Author: Audrey So <au...@apache.org>
Authored: Tue Jul 25 10:59:31 2017 -0700
Committer: Audrey So <au...@apache.org>
Committed: Fri Jul 28 11:00:50 2017 -0700
----------------------------------------------------------------------
integration-tests/HooksRunner.spec.js | 40 +-
integration-tests/fetch.spec.js | 188 +-
integration-tests/pkgJson-restore.spec.js | 2228 +++++++++---------
integration-tests/pkgJson.spec.js | 640 ++---
integration-tests/platform.spec.js | 346 ++-
integration-tests/plugin.spec.js | 232 +-
integration-tests/plugin_fetch.spec.js | 46 +-
integration-tests/plugman_fetch.spec.js | 133 +-
integration-tests/plugman_uninstall.spec.js | 321 +--
.../platform/getPlatformDetailsFromDir.spec.js | 20 +-
spec/cordova/platform/remove.spec.js | 118 +-
src/hooks/HooksRunner.js | 11 +-
src/plugman/init-defaults.js | 6 +-
13 files changed, 2175 insertions(+), 2154 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d19951b3/integration-tests/HooksRunner.spec.js
----------------------------------------------------------------------
diff --git a/integration-tests/HooksRunner.spec.js b/integration-tests/HooksRunner.spec.js
index 3a4c69c..eebbb63 100644
--- a/integration-tests/HooksRunner.spec.js
+++ b/integration-tests/HooksRunner.spec.js
@@ -17,20 +17,18 @@
under the License.
**/
-/* jshint boss:true */
-
-var cordova = require('../src/cordova/cordova'),
- HooksRunner = require('../src/hooks/HooksRunner'),
- shell = require('shelljs'),
- path = require('path'),
- fs = require('fs'),
- os = require('os'),
- Q = require('q'),
- child_process = require('child_process'),
- helpers = require('../spec/helpers'),
- PluginInfo = require('cordova-common').PluginInfo,
- superspawn = require('cordova-common').superspawn,
- config = require('../src/cordova/config');
+var cordova = require('../src/cordova/cordova');
+var HooksRunner = require('../src/hooks/HooksRunner');
+var shell = require('shelljs');
+var path = require('path');
+var fs = require('fs');
+var os = require('os');
+var Q = require('q');
+var child_process = require('child_process');
+var helpers = require('../spec/helpers');
+var PluginInfo = require('cordova-common').PluginInfo;
+var superspawn = require('cordova-common').superspawn;
+var config = require('../src/cordova/config');
var platform = os.platform();
var tmpDir = helpers.tmpDir('hooks_test');
@@ -85,18 +83,18 @@ describe('HooksRunner', function () {
});
afterEach(function () {
- process.chdir(path.join(__dirname, '..')); // Non e2e tests assume CWD is repo root.
+ process.chdir(path.join(__dirname, '..')); // Non e2e tests assume CWD is repo root.
});
it('Test 001 : should throw if provided directory is not a cordova project', function () {
expect(function () {
- new HooksRunner(tmpDir);
+ new HooksRunner(tmpDir); // eslint-disable-line no-new
}).toThrow();
});
it('Test 002 : should not throw if provided directory is a cordova project', function () {
expect(function () {
- new HooksRunner(project);
+ new HooksRunner(project); // eslint-disable-line no-new
}).not.toThrow();
});
@@ -179,9 +177,11 @@ describe('HooksRunner', function () {
var orderArrOriginal = order.split(' ').slice(0);
function splitNumbers (mixedString) {
- var re = /\w+/g, match, params = [];
+ var re = /\w+/g;
+ var match;
+ var params = [];
- while (match = re.exec(mixedString)) {
+ while (match = re.exec(mixedString)) { // eslint-disable-line no-cond-assign
params.push(match[0]);
}
return params;
@@ -664,7 +664,7 @@ describe('HooksRunner', function () {
// Cleanup. Must be the last spec. Is there a better place for final cleanup in Jasmine?
it('Test 025 : should not fail during cleanup', function () {
- process.chdir(path.join(__dirname, '..')); // Non e2e tests assume CWD is repo root.
+ process.chdir(path.join(__dirname, '..')); // Non e2e tests assume CWD is repo root.
if (ext == 'sh') {
shell.rm('-rf', tmpDir);
} else { // Windows:
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d19951b3/integration-tests/fetch.spec.js
----------------------------------------------------------------------
diff --git a/integration-tests/fetch.spec.js b/integration-tests/fetch.spec.js
index b3fe45c..d3de921 100644
--- a/integration-tests/fetch.spec.js
+++ b/integration-tests/fetch.spec.js
@@ -17,13 +17,13 @@
under the License.
*/
-var path = require('path'),
- shell = require('shelljs'),
- helpers = require('../spec/helpers'),
- cordova = require('../src/cordova/cordova');
+var path = require('path');
+var shell = require('shelljs');
+var helpers = require('../spec/helpers');
+var cordova = require('../src/cordova/cordova');
-var TIMEOUT = 90000,
- plugins_dir = path.join(__dirname, '..', 'spec', 'plugman', 'plugins');
+var TIMEOUT = 90000;
+var plugins_dir = path.join(__dirname, '..', 'spec', 'plugman', 'plugins');
var plugins = {
'Test1': path.join(plugins_dir, 'dependencies', 'Test1'),
@@ -43,119 +43,119 @@ describe('end-to-end plugin dependency tests', function () {
});
afterEach(function () {
- process.chdir(path.join(__dirname, '..')); // Needed to rm the dir on Windows.
+ process.chdir(path.join(__dirname, '..')); // Needed to rm the dir on Windows.
shell.rm('-rf', tmpDir);
});
it('Test 029 : should fail if dependency already installed is wrong version', function (done) {
cordova.create('hello3')
- .then(function () {
- process.chdir(project);
- return cordova.platform('add', 'android', {'fetch': true});
- }).then(function () {
- return cordova.plugin('add', 'cordova-plugin-file', {'fetch': true});
- }).then(function () {
- expect(path.join(pluginsDir, 'cordova-plugin-file')).toExist();
- return cordova.plugin('add', plugins['Test1'], {'fetch': true});
- }).fail(function (err) {
- expect(err.message).toContain('does not satisfy dependency plugin requirement');
- })
- .fin(done);
+ .then(function () {
+ process.chdir(project);
+ return cordova.platform('add', 'android', {'fetch': true});
+ }).then(function () {
+ return cordova.plugin('add', 'cordova-plugin-file', {'fetch': true});
+ }).then(function () {
+ expect(path.join(pluginsDir, 'cordova-plugin-file')).toExist();
+ return cordova.plugin('add', plugins['Test1'], {'fetch': true});
+ }).fail(function (err) {
+ expect(err.message).toContain('does not satisfy dependency plugin requirement');
+ })
+ .fin(done);
}, TIMEOUT);
it('Test 030 : should pass if dependency already installed is wrong version with --force', function (done) {
cordova.create('hello3')
- .then(function () {
- process.chdir(project);
- return cordova.platform('add', 'android', {'fetch': true});
- })
- .then(function () {
- return cordova.plugin('add', 'cordova-plugin-file', {'fetch': true});
- })
- .then(function () {
- expect(path.join(pluginsDir, 'cordova-plugin-file')).toExist();
- return cordova.plugin('add', plugins['Test1'], {'fetch': true, 'force': true});
- })
- .then(function () {
- expect(path.join(pluginsDir, 'Test1')).toExist();
- })
- .fail(function (err) {
- expect(err).toBeUndefined();
- })
- .fin(done);
+ .then(function () {
+ process.chdir(project);
+ return cordova.platform('add', 'android', {'fetch': true});
+ })
+ .then(function () {
+ return cordova.plugin('add', 'cordova-plugin-file', {'fetch': true});
+ })
+ .then(function () {
+ expect(path.join(pluginsDir, 'cordova-plugin-file')).toExist();
+ return cordova.plugin('add', plugins['Test1'], {'fetch': true, 'force': true});
+ })
+ .then(function () {
+ expect(path.join(pluginsDir, 'Test1')).toExist();
+ })
+ .fail(function (err) {
+ expect(err).toBeUndefined();
+ })
+ .fin(done);
}, TIMEOUT);
it('Test 031 : should pass if dependency already installed is same major version (if specific version is specified)', function (done) {
// Test1 requires cordova-plugin-file version 2.0.0 (which should automatically turn into ^2.0.0); we'll install version 2.1.0
cordova.create('hello3')
- .then(function () {
- process.chdir(project);
- return cordova.platform('add', 'android', {'fetch': true});
- })
- .then(function () {
- return cordova.plugin('add', 'cordova-plugin-file@2.1.0', {'fetch': true});
- })
- .then(function () {
- expect(path.join(pluginsDir, 'cordova-plugin-file')).toExist();
- return cordova.plugin('add', plugins['Test1'], {'fetch': true});
- })
- .then(function () {
- expect(path.join(pluginsDir, 'Test1')).toExist();
- })
- .fail(function (err) {
- // console.error(err);
- expect(err).toBeUndefined();
- })
- .fin(done);
+ .then(function () {
+ process.chdir(project);
+ return cordova.platform('add', 'android', {'fetch': true});
+ })
+ .then(function () {
+ return cordova.plugin('add', 'cordova-plugin-file@2.1.0', {'fetch': true});
+ })
+ .then(function () {
+ expect(path.join(pluginsDir, 'cordova-plugin-file')).toExist();
+ return cordova.plugin('add', plugins['Test1'], {'fetch': true});
+ })
+ .then(function () {
+ expect(path.join(pluginsDir, 'Test1')).toExist();
+ })
+ .fail(function (err) {
+ // console.error(err);
+ expect(err).toBeUndefined();
+ })
+ .fin(done);
}, TIMEOUT);
it('Test 032 : should handle two plugins with same dependent plugin', function (done) {
// Test1 and Test2 have compatible dependencies on cordova-plugin-file
// Test1 and Test3 have incompatible dependencies on cordova-plugin-file
cordova.create('hello3')
- .then(function () {
- process.chdir(project);
- return cordova.platform('add', 'android', {'fetch': true});
- })
- .then(function () {
- return cordova.plugin('add', plugins['Test1'], {'fetch': true});
- })
- .then(function () {
- expect(path.join(pluginsDir, 'cordova-plugin-file')).toExist();
- expect(path.join(pluginsDir, 'Test1')).toExist();
- return cordova.plugin('add', plugins['Test2'], {'fetch': true});
- })
- .then(function () {
- return cordova.plugin('add', plugins['Test3'], {'fetch': true});
- })
- .fail(function (err) {
- expect(path.join(pluginsDir, 'Test2')).toExist();
- expect(path.join(pluginsDir, 'Test3')).not.toExist();
- expect(err.message).toContain('does not satisfy dependency plugin requirement');
- }, TIMEOUT)
- .fin(done);
+ .then(function () {
+ process.chdir(project);
+ return cordova.platform('add', 'android', {'fetch': true});
+ })
+ .then(function () {
+ return cordova.plugin('add', plugins['Test1'], {'fetch': true});
+ })
+ .then(function () {
+ expect(path.join(pluginsDir, 'cordova-plugin-file')).toExist();
+ expect(path.join(pluginsDir, 'Test1')).toExist();
+ return cordova.plugin('add', plugins['Test2'], {'fetch': true});
+ })
+ .then(function () {
+ return cordova.plugin('add', plugins['Test3'], {'fetch': true});
+ })
+ .fail(function (err) {
+ expect(path.join(pluginsDir, 'Test2')).toExist();
+ expect(path.join(pluginsDir, 'Test3')).not.toExist();
+ expect(err.message).toContain('does not satisfy dependency plugin requirement');
+ }, TIMEOUT)
+ .fin(done);
}, TIMEOUT);
it('Test 033 : should use a dev version of a dependent plugin if it is already installed', function (done) {
// Test4 has this dependency in its plugin.xml:
// <dependency id="cordova-plugin-file" url="https://github.com/apache/cordova-plugin-file" />
cordova.create('hello3')
- .then(function () {
- process.chdir(project);
- return cordova.platform('add', 'android', {'fetch': true});
- })
- .then(function () {
- return cordova.plugin('add', 'https://github.com/apache/cordova-plugin-file');
- })
- .then(function () {
- return cordova.plugin('add', plugins['Test4'], {'fetch': true});
- })
- .then(function () {
- expect(path.join(pluginsDir, 'cordova-plugin-file')).toExist();
- expect(path.join(pluginsDir, 'Test4')).toExist();
- }, function (error) {
- fail(error);
- })
- .fin(done);
+ .then(function () {
+ process.chdir(project);
+ return cordova.platform('add', 'android', {'fetch': true});
+ })
+ .then(function () {
+ return cordova.plugin('add', 'https://github.com/apache/cordova-plugin-file');
+ })
+ .then(function () {
+ return cordova.plugin('add', plugins['Test4'], {'fetch': true});
+ })
+ .then(function () {
+ expect(path.join(pluginsDir, 'cordova-plugin-file')).toExist();
+ expect(path.join(pluginsDir, 'Test4')).toExist();
+ }, function (error) {
+ fail(error);
+ })
+ .fin(done);
}, TIMEOUT);
});
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org