You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by st...@apache.org on 2017/12/14 07:17:52 UTC
[cordova-lib] 02/03: CB-13057 : removed platformsJson from
integration tests
This is an automated email from the ASF dual-hosted git repository.
steven pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-lib.git
commit cb400949e28e9c4f00fd294451b729c135537b56
Author: Audrey So <au...@apache.org>
AuthorDate: Tue Aug 1 15:07:52 2017 -0700
CB-13057 : removed platformsJson from integration tests
---
integration-tests/pkgJson-restore.spec.js | 104 +++++++++++-------------------
integration-tests/pkgJson.spec.js | 10 +--
src/cordova/platform/index.js | 1 -
3 files changed, 44 insertions(+), 71 deletions(-)
diff --git a/integration-tests/pkgJson-restore.spec.js b/integration-tests/pkgJson-restore.spec.js
index bd9dc5b..746bf5a 100644
--- a/integration-tests/pkgJson-restore.spec.js
+++ b/integration-tests/pkgJson-restore.spec.js
@@ -140,8 +140,8 @@ describe('tests platform/spec restore with --save', function () {
var cwd = process.cwd();
var pkgJsonPath = path.join(cwd, 'package.json');
var pkgJson;
- var platformsFolderPath = path.join(cwd, 'platforms/platforms.json');
- var platformsJson;
+ //var platformsFolderPath = path.join(cwd, 'platforms/platforms.json');
+ //var platformsJson;
var configXmlPath = path.join(cwd, 'config.xml');
var bPlatform = 'browser';
var engines;
@@ -168,8 +168,8 @@ describe('tests platform/spec restore with --save', function () {
expect(pkgJson.cordova.platforms.indexOf('browser')).toBeDefined();
expect(pkgJson.dependencies['cordova-browser']).toEqual('git+https://github.com/apache/cordova-browser.git');
// Check that platform was added to platforms list successfully.
- platformsJson = cordova_util.requireNoCache(platformsFolderPath);
- expect(platformsJson[bPlatform]).toBeDefined();
+ //platformsJson = cordova_util.requireNoCache(platformsFolderPath);
+ //expect(platformsJson[bPlatform]).toBeDefined();
}).then(function () {
// Remove platform without --save.
return cordovaPlatform('rm', bPlatform, {'fetch': true});
@@ -179,8 +179,8 @@ describe('tests platform/spec restore with --save', function () {
expect(pkgJson.cordova.platforms.indexOf('browser')).toBeDefined();
expect(pkgJson.dependencies['cordova-browser']).toEqual('git+https://github.com/apache/cordova-browser.git');
// Platform in platforms.json should not be there.
- platformsJson = cordova_util.requireNoCache(platformsFolderPath);
- expect(platformsJson[bPlatform]).toBeUndefined();
+ //platformsJson = cordova_util.requireNoCache(platformsFolderPath);
+ //expect(platformsJson[bPlatform]).toBeUndefined();
}).then(function () {
// Run cordova prepare
return prepare({'fetch': true});
@@ -201,8 +201,8 @@ describe('tests platform/spec restore with --save', function () {
expect(pkgJson.cordova.platforms.indexOf('browser')).toBeDefined();
expect(pkgJson.dependencies['cordova-browser']).toEqual('git+https://github.com/apache/cordova-browser.git');
// Check that platform was restored to platform.json list successfully.
- platformsJson = cordova_util.requireNoCache(platformsFolderPath);
- expect(platformsJson[bPlatform]).toBeDefined();
+ //platformsJson = cordova_util.requireNoCache(platformsFolderPath);
+ //expect(platformsJson[bPlatform]).toBeDefined();
}).fail(function (err) {
expect(err).toBeUndefined();
}).fin(done);
@@ -327,9 +327,7 @@ describe('tests platform/spec restore with --save', function () {
var cwd = process.cwd();
var pkgJsonPath = path.join(cwd, 'package.json');
var pkgJson;
- var platformsFolderPath = path.join(cwd, 'platforms/platforms.json');
- var secondPlatformAdded = 'ios';
- var platformsJson;
+ var secondPlatformAdded = 'browser';
emptyPlatformList().then(function () {
// Add 'browser' platform to project without --save
@@ -340,14 +338,12 @@ describe('tests platform/spec restore with --save', function () {
}).then(function () {
// Delete any previous caches of require(package.json) and (platformsJson)
pkgJson = cordova_util.requireNoCache(pkgJsonPath);
- platformsJson = cordova_util.requireNoCache(platformsFolderPath);
+ //platformsJson = cordova_util.requireNoCache(platformsFolderPath);
// Check the platform add of only helpers.testPlatform was successful in package.json.
expect(pkgJson.cordova.platforms).toBeDefined();
expect(pkgJson.cordova.platforms.indexOf('browser')).toBeGreaterThan(-1);
expect(pkgJson.cordova.platforms.indexOf(secondPlatformAdded)).toEqual(-1);
// Expect both platforms to be installed platform list in platforms.json
- expect(platformsJson['browser']).toBeDefined();
- expect(platformsJson[secondPlatformAdded]).toBeDefined();
}).then(fullPlatformList) // Platforms should still be in platform ls.
.then(function () {
// Remove helpers.testPlatform without --save.
@@ -357,23 +353,13 @@ describe('tests platform/spec restore with --save', function () {
return cordovaPlatform('rm', secondPlatformAdded);
}).then(function () {
// Delete any previous caches of require(pkgJson) and (platformsJson)
- platformsJson = cordova_util.requireNoCache(platformsFolderPath);
+ //platformsJson = cordova_util.requireNoCache(platformsFolderPath);
pkgJson = cordova_util.requireNoCache(pkgJsonPath);
// Check that the platform that was added with --save is still in package.json.
expect(pkgJson.cordova.platforms.indexOf('browser')).toBeGreaterThan(-1);
- // Check that both platforms were removed from the platforms.json.
- expect(platformsJson[secondPlatformAdded]).toBeUndefined();
- expect(platformsJson['browser']).toBeUndefined();
}).then(function () {
// Run cordova prepare
return prepare({'fetch': true});
- }).then(function () {
- // Delete any previous caches of platformsJson
- platformsJson = cordova_util.requireNoCache(platformsFolderPath);
- // Expect "helpers.testPlatform" to be in the installed platforms list.
- expect(platformsJson['browser']).toBeDefined();
- // Expect that 'browser' will not be in platforms.json and has not been restored.
- expect(platformsJson[secondPlatformAdded]).toBeUndefined();
}).fail(function (err) {
expect(err).toBeUndefined();
}).fin(done);
@@ -1278,9 +1264,9 @@ describe('platforms and plugins should be restored with config.xml even without
});
var configEngArray = engNames.slice();
var configPlugins = cfg1.getPluginIdList();
- var platformsFolderPath1 = path.join(cwd, 'platforms/platforms.json');
+ //var platformsFolderPath1 = path.join(cwd, 'platforms/platforms.json');
var pluginsFolderPath16 = path.join(cwd, 'plugins');
- var platformsJson;
+ //var platformsJson;
var androidPlatform = 'android';
var browserPlatform = 'windows';
@@ -1304,11 +1290,11 @@ describe('platforms and plugins should be restored with config.xml even without
configEngArray = engNames.slice();
expect(configEngArray.length === 2);
// Delete previouc caches of (pkg.json).
- platformsJson = cordova_util.requireNoCache(platformsFolderPath1);
+ //platformsJson = cordova_util.requireNoCache(platformsFolderPath1);
// Browser should be installed
- expect(platformsJson).toBeDefined();
- expect(platformsJson[androidPlatform]).not.toBeDefined();
- expect(platformsJson[browserPlatform]).toBeDefined();
+ //expect(platformsJson).toBeDefined();
+ //expect(platformsJson[androidPlatform]).not.toBeDefined();
+ //expect(platformsJson[browserPlatform]).toBeDefined();
// Package.json should be auto-created.
expect(path.join(cwd, 'package.json')).toExist();
var pkgJsonPath = path.join(cwd, 'package.json');
@@ -1323,10 +1309,10 @@ describe('platforms and plugins should be restored with config.xml even without
return cordovaPlatform('rm', [browserPlatform]);
}).then(function () {
// Android should not be in the installed list (only browser).
- platformsJson = cordova_util.requireNoCache(platformsFolderPath1);
- expect(platformsJson).toBeDefined();
- expect(platformsJson[browserPlatform]).toBeUndefined();
- expect(platformsJson[androidPlatform]).not.toBeDefined();
+ //platformsJson = cordova_util.requireNoCache(platformsFolderPath1);
+ //expect(platformsJson).toBeDefined();
+ //expect(platformsJson[browserPlatform]).toBeUndefined();
+ //expect(platformsJson[androidPlatform]).not.toBeDefined();
}).then(function () {
// Run cordova prepare.
return prepare({'fetch': true});
@@ -1342,9 +1328,9 @@ describe('platforms and plugins should be restored with config.xml even without
expect(configEngArray.indexOf(browserPlatform)).toBeGreaterThan(-1);
expect(configEngArray.length === 2);
// Expect that android and browser were restored.
- platformsJson = cordova_util.requireNoCache(platformsFolderPath1);
- expect(platformsJson[androidPlatform]).toBeDefined();
- expect(platformsJson[browserPlatform]).toBeDefined();
+ // platformsJson = cordova_util.requireNoCache(platformsFolderPath1);
+ // expect(platformsJson[androidPlatform]).toBeDefined();
+ // expect(platformsJson[browserPlatform]).toBeDefined();
}).then(function () {
// Check plugins.
var cfg5 = new ConfigParser(configXmlPath);
@@ -1435,8 +1421,8 @@ describe('tests platform/spec restore with --save', function () {
var pkgJsonPath = path.join(cwd, 'package.json');
cordova_util.requireNoCache(pkgJsonPath);
var pkgJson;
- var platformsFolderPath = path.join(cwd, 'platforms/platforms.json');
- var platformsJson;
+ //var platformsFolderPath = path.join(cwd, 'platforms/platforms.json');
+ //var platformsJson;
emptyPlatformList().then(function () {
// Add the testing platform with --save.
@@ -1444,33 +1430,23 @@ describe('tests platform/spec restore with --save', function () {
}).then(function () {
pkgJson = cordova_util.requireNoCache(pkgJsonPath);
// Require platformsFolderPath
- platformsJson = cordova_util.requireNoCache(platformsFolderPath);
+ //platformsJson = cordova_util.requireNoCache(platformsFolderPath);
// Check the platform add was successful in package.json.
expect(pkgJson.cordova.platforms).toBeDefined();
expect(pkgJson.cordova.platforms.indexOf('browser')).toBeGreaterThan(-1);
- // Expect that "helpers.testPlatform" in the installed platform list in platforms.json
- expect(platformsJson).toBeDefined();
- expect(platformsJson['browser']).toBeDefined();
- }).then() // Platform should still be in platform ls.
.then(function () {
// And now remove helpers.testPlatform without --save.
return cordovaPlatform('rm', ['browser']);
}).then(function () {
// Delete any previous caches of require(package.json) and (platforms.json)
- platformsJson = cordova_util.requireNoCache(platformsFolderPath);
+ //platformsJson = cordova_util.requireNoCache(platformsFolderPath);
pkgJson = cordova_util.requireNoCache(pkgJsonPath);
// Check that the platform removed without --save is still in platforms key.
expect(pkgJson.cordova.platforms.indexOf('browser')).toBeGreaterThan(-1);
// Check that the platform was removed from the platforms.json
- expect(platformsJson['browser']).toBeUndefined();
}).then(function () {
// Run cordova prepare.
return prepare({'fetch': true});
- }).then(function () {
- // Delete any previous caches of platforms.json.
- platformsJson = cordova_util.requireNoCache(platformsFolderPath);
- // Expect "helpers.testPlatform" to be in the installed platforms list in platforms.json.
- expect(platformsJson['browser']).toBeDefined();
}).fail(function (err) {
expect(err).toBeUndefined();
}).fin(done);
@@ -1486,9 +1462,7 @@ describe('tests platform/spec restore with --save', function () {
var cwd = process.cwd();
var pkgJsonPath = path.join(cwd, 'package.json');
var pkgJson;
- var platformsFolderPath = path.join(cwd, 'platforms/platforms.json');
- var platformsJson;
- var secondPlatformAdded = 'windows';
+ var secondPlatformAdded = 'browser';
emptyPlatformList().then(function () {
// Add the testing platform with --save.
@@ -1499,15 +1473,15 @@ describe('tests platform/spec restore with --save', function () {
}).then(function () {
// Delete any previous caches of require(package.json) and (platforms.json).
pkgJson = cordova_util.requireNoCache(pkgJsonPath);
- platformsJson = cordova_util.requireNoCache(platformsFolderPath);
+ //platformsJson = cordova_util.requireNoCache(platformsFolderPath);
// Check the platform add of both platforms (to pkg.Json) was successful.
expect(pkgJson.cordova.platforms).toBeDefined();
expect(pkgJson.cordova.platforms.indexOf(helpers.testPlatform)).toEqual(0);
expect(pkgJson.cordova.platforms.indexOf(secondPlatformAdded)).toEqual(1);
// Expect that "helpers.testPlatform" in the installed platform list in platforms.json.
- expect(platformsJson).toBeDefined();
- expect(platformsJson[helpers.testPlatform]).toBeDefined();
- expect(platformsJson[secondPlatformAdded]).toBeDefined();
+ // expect(platformsJson).toBeDefined();
+ // expect(platformsJson[helpers.testPlatform]).toBeDefined();
+ // expect(platformsJson[secondPlatformAdded]).toBeDefined();
}).then(fullPlatformList) // Platform should still be in platform ls.
.then(function () {
// Remove helpers.testPlatform with --save.
@@ -1517,24 +1491,24 @@ describe('tests platform/spec restore with --save', function () {
return cordovaPlatform('rm', secondPlatformAdded);
}).then(function () {
// Delete any previous caches of require(package.json) and (platformsJson).
- platformsJson = cordova_util.requireNoCache(platformsFolderPath);
+ //platformsJson = cordova_util.requireNoCache(platformsFolderPath);
pkgJson = cordova_util.requireNoCache(pkgJsonPath);
// Check that ONLY the platform removed without --save is still in (pkg.json) platforms key.
expect(pkgJson.cordova.platforms.indexOf(secondPlatformAdded)).toEqual(0);
expect(pkgJson.cordova.platforms.indexOf(helpers.testPlatform)).toEqual(-1);
// Check that both platforms were removed from the platforms.json list.
- expect(platformsJson[helpers.testPlatform]).toBeUndefined();
- expect(platformsJson[secondPlatformAdded]).toBeUndefined();
+ //expect(platformsJson[helpers.testPlatform]).toBeUndefined();
+ //expect(platformsJson[secondPlatformAdded]).toBeUndefined();
}).then(function () {
// Run cordova prepare.
return prepare({'fetch': true});
}).then(function () {
// Delete any previous caches of platformsJson.
- platformsJson = cordova_util.requireNoCache(platformsFolderPath);
+ //platformsJson = cordova_util.requireNoCache(platformsFolderPath);
// Expect "helpers.testPlatform" to be in the installed platforms list in platforms.json
- expect(platformsJson[helpers.testPlatform]).toBeUndefined();
+ //expect(platformsJson[helpers.testPlatform]).toBeUndefined();
// Expect 'browser' not to be in platforms.json and has not been restored.
- expect(platformsJson[secondPlatformAdded]).toBeDefined();
+ //expect(platformsJson[secondPlatformAdded]).toBeDefined();
}).fail(function (err) {
expect(err).toBeUndefined();
}).fin(done);
diff --git a/integration-tests/pkgJson.spec.js b/integration-tests/pkgJson.spec.js
index 11ed7da..04ab40b 100644
--- a/integration-tests/pkgJson.spec.js
+++ b/integration-tests/pkgJson.spec.js
@@ -621,7 +621,7 @@ describe('During add, if pkg.json has a platform/plugin spec, use that one.', fu
var iosVersion;
var cwd = process.cwd();
var iosDirectory = path.join(cwd, 'platforms/ios/cordova/version');
- var platformsFolderPath = path.join(cwd, 'platforms/platforms.json');
+ //var platformsFolderPath = path.join(cwd, 'platforms/platforms.json');
var configXmlPath = path.join(cwd, 'config.xml');
var pkgJsonPath = path.join(cwd, 'package.json');
var pkgJson = cordova_util.requireNoCache(pkgJsonPath);
@@ -629,7 +629,7 @@ describe('During add, if pkg.json has a platform/plugin spec, use that one.', fu
var engines = cfg.getEngines();
var engNames;
var engSpec; // eslint-disable-line no-unused-vars
- var platformsJson;
+ //var platformsJson;
var configPlugins = cfg.getPluginIdList();
var pluginPkgJsonDir = path.join(cwd, 'plugins/cordova-plugin-splashscreen/package.json');
var pluginPkgJsonVersion;
@@ -646,7 +646,7 @@ describe('During add, if pkg.json has a platform/plugin spec, use that one.', fu
return cordova.platform('add', [iosPlatform], {'save': true, 'fetch': true});
}).then(function () {
// Require platformsFolderPath, ios and spec should be in there.
- platformsJson = cordova_util.requireNoCache(platformsFolderPath);
+ //platformsJson = cordova_util.requireNoCache(platformsFolderPath);
// Delete any previous caches of require(package.json).
// ios has been added.
pkgJson = cordova_util.requireNoCache(pkgJsonPath);
@@ -667,14 +667,14 @@ describe('During add, if pkg.json has a platform/plugin spec, use that one.', fu
iosVersion = cordova_util.requireNoCache(iosDirectory);
expect(semver.satisfies(iosVersion.version, elem.spec)).toEqual(true);
// Check that config and platforms.json "satisfy".
- expect(semver.satisfies(platformsJson[iosPlatform], elem.spec)).toEqual(true);
+ //expect(semver.satisfies(platformsJson[iosPlatform], elem.spec)).toEqual(true);
});
// Config.xml added ios platform.
expect(engNames).toEqual([ 'ios' ]);
// Check that pkg.json and ios/cordova/version versions "satisfy" each other.
expect(semver.satisfies(iosVersion.version, pkgJson.dependencies['cordova-ios'])).toEqual(true);
// Check that pkg.json and platforms.json "satisfy".
- expect(semver.satisfies(platformsJson[iosPlatform], pkgJson.dependencies['cordova-ios'])).toEqual(true);
+ //expect(semver.satisfies(platformsJson[iosPlatform], pkgJson.dependencies['cordova-ios'])).toEqual(true);
}).then(function () {
// Add splashscreen plugin with --save --fetch.
return cordova.plugin('add', 'cordova-plugin-splashscreen', {'save': true, 'fetch': true});
diff --git a/src/cordova/platform/index.js b/src/cordova/platform/index.js
index 65a94b9..233a8df 100644
--- a/src/cordova/platform/index.js
+++ b/src/cordova/platform/index.js
@@ -21,7 +21,6 @@ var HooksRunner = require('../../hooks/HooksRunner');
var CordovaError = require('cordova-common').CordovaError;
var platforms = require('../../platforms/platforms');
var addHelper = require('./addHelper');
-var events = require('cordova-common').events;
module.exports = platform;
--
To stop receiving notification emails like this one, please contact
"commits@cordova.apache.org" <co...@cordova.apache.org>.
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org