CB-12895 : fixed eslint errors

This commit is contained in:
Audrey So
2017-06-13 11:42:20 -07:00
parent e36158a0da
commit d83d49d83b
40 changed files with 3176 additions and 3325 deletions
+9 -9
View File
@@ -16,12 +16,13 @@
specific language governing permissions and limitations
under the License.
*/
/* eslint-env jasmine */
var actions = require('./helpers/projectActions.js');
var CREATE_TIMEOUT = 180000;
function createAndBuild(projectname, projectid, done) {
function createAndBuild (projectname, projectid, done) {
actions.createProject(projectname, projectid, function (error) {
expect(error).toBe(null);
actions.buildProject(projectid, function (error) {
@@ -32,45 +33,44 @@ function createAndBuild(projectname, projectid, done) {
});
}
describe('create', function () {
describe('create', function() {
it('Test#001 : create project with ascii name, no spaces', function(done) {
it('Test#001 : create project with ascii name, no spaces', function (done) {
var projectname = 'testcreate';
var projectid = 'com.test.create.app1';
createAndBuild(projectname, projectid, done);
}, CREATE_TIMEOUT);
it('Test#002 : create project with ascii name, and spaces', function(done) {
it('Test#002 : create project with ascii name, and spaces', function (done) {
var projectname = 'test create';
var projectid = 'com.test.create.app2';
createAndBuild(projectname, projectid, done);
}, CREATE_TIMEOUT);
it('Test#003 : create project with unicode name, no spaces', function(done) {
it('Test#003 : create project with unicode name, no spaces', function (done) {
var projectname = '応応応応用用用用';
var projectid = 'com.test.create.app3';
createAndBuild(projectname, projectid, done);
}, CREATE_TIMEOUT);
it('Test#004 : create project with unicode name, and spaces', function(done) {
it('Test#004 : create project with unicode name, and spaces', function (done) {
var projectname = '応応応応 用用用用';
var projectid = 'com.test.create.app4';
createAndBuild(projectname, projectid, done);
}, CREATE_TIMEOUT);
it('Test#005 : create project with ascii+unicode name, no spaces', function(done) {
it('Test#005 : create project with ascii+unicode name, no spaces', function (done) {
var projectname = '応応応応hello用用用用';
var projectid = 'com.test.create.app5';
createAndBuild(projectname, projectid, done);
}, CREATE_TIMEOUT);
it('Test#006 : create project with ascii+unicode name, and spaces', function(done) {
it('Test#006 : create project with ascii+unicode name, and spaces', function (done) {
var projectname = '応応応応 hello 用用用用';
var projectid = 'com.test.create.app6';
+11 -11
View File
@@ -17,11 +17,11 @@
under the License.
*/
var PluginInfoProvider = require('cordova-common').PluginInfoProvider,
shell = require('shelljs'),
cp = require('child_process'),
path = require('path'),
util = require('util');
var PluginInfoProvider = require('cordova-common').PluginInfoProvider;
var shell = require('shelljs');
var cp = require('child_process');
var path = require('path');
var util = require('util');
var cordova_bin = path.join(__dirname, '../../../bin');
@@ -70,7 +70,7 @@ module.exports.updateProject = function (projectid, platformpath, callback) {
var projectDirName = getDirName(projectid);
var updateScriptPath = platformpath ? path.join(platformpath, 'bin/update') : path.join(cordova_bin, 'update');
var command = util.format('%s %s', updateScriptPath, projectDirName);
cp.exec(command, function (error, stdout, stderr) {
if (error) {
console.log(stdout);
@@ -78,7 +78,7 @@ module.exports.updateProject = function (projectid, platformpath, callback) {
}
callback(error);
});
};
/**
@@ -115,7 +115,7 @@ module.exports.removeProject = function (projectid) {
* @param {function} callback - function which is called (without arguments) when the plugin is added or (with error object) when error occurs
*/
module.exports.addPlugin = function (projectid, plugindir, callback) {
var projectDirName = getDirName(projectid);
var projectDirName = getDirName(projectid);
var pip = new PluginInfoProvider();
var pluginInfo = pip.get(plugindir);
var Api = require(path.join(__dirname, '../../..', projectDirName, 'cordova', 'Api.js'));
@@ -126,7 +126,7 @@ module.exports.addPlugin = function (projectid, plugindir, callback) {
}, function (error) {
console.error(error);
callback(error);
});
});
};
/**
@@ -136,7 +136,7 @@ module.exports.addPlugin = function (projectid, plugindir, callback) {
*/
module.exports.getPlatformVersion = function (projectid, callback) {
var command = path.join(getDirName(projectid), 'cordova/version');
cp.exec(command, function (error, stdout, stderr) {
if (error) {
console.log(stdout);
@@ -146,6 +146,6 @@ module.exports.getPlatformVersion = function (projectid, callback) {
});
};
function getDirName(projectid) {
function getDirName (projectid) {
return 'test-' + projectid;
}
+5 -4
View File
@@ -16,15 +16,16 @@
specific language governing permissions and limitations
under the License.
*/
/* eslint-env jasmine */
var path = require('path'),
actions = require('./helpers/projectActions.js');
var path = require('path');
var actions = require('./helpers/projectActions.js');
var PLUGIN_ADD_TIMEOUT = 90000;
describe('plugin add', function() {
describe('plugin add', function () {
it('Test#001 : create project and add a plugin with framework', function(done) {
it('Test#001 : create project and add a plugin with framework', function (done) {
var projectname = 'testpluginframework';
var projectid = 'com.test.plugin.framework';
var fakePluginPath = path.join(__dirname, 'fixtures/cordova-plugin-fake');
+15 -14
View File
@@ -16,23 +16,24 @@
specific language governing permissions and limitations
under the License.
*/
/* eslint-env jasmine */
var actions = require('./helpers/projectActions.js'),
shell = require('shelljs'),
fs = require('fs'),
util = require('util'),
platformOld = { version: '4.0.0', path: 'cordova-android-old' },
platformEdge = { version: getCurrentVersion(), path: '.' };
var actions = require('./helpers/projectActions.js');
var shell = require('shelljs');
var fs = require('fs');
var util = require('util');
var platformOld = { version: '4.0.0', path: 'cordova-android-old' };
var platformEdge = { version: getCurrentVersion(), path: '.' };
var DOWNLOAD_TIMEOUT = 2 * 60 * 1000,
UPDATE_TIMEOUT = 90 * 1000,
PLATFORM_GIT_URL = 'https://github.com/apache/cordova-android';
var DOWNLOAD_TIMEOUT = 2 * 60 * 1000;
var UPDATE_TIMEOUT = 90 * 1000;
var PLATFORM_GIT_URL = 'https://github.com/apache/cordova-android';
function getCurrentVersion() {
function getCurrentVersion () {
return fs.readFileSync('VERSION').toString().trim();
}
function testUpdate(projectname, projectid, createfrom, updatefrom, doBuild, done) {
function testUpdate (projectname, projectid, createfrom, updatefrom, doBuild, done) {
actions.createProject(projectname, projectid, createfrom.path, function (error) {
expect(error).toBe(null);
actions.updateProject(projectid, updatefrom.path, function (error) {
@@ -68,9 +69,9 @@ describe('preparing fixtures', function () {
});
describe('update', function() {
describe('update', function () {
it('Test#002 : should update major version and build the project', function(done) {
it('Test#002 : should update major version and build the project', function (done) {
var projectname = 'testupdate';
var projectid = 'com.test.update.app1';
@@ -82,7 +83,7 @@ describe('update', function() {
describe('cleanup', function () {
it('Test#004 : remove cloned old platform', function() {
it('Test#004 : remove cloned old platform', function () {
shell.rm('-rf', platformOld.path);
});