зеркало из https://github.com/xamarin/appium.old.git
Update linting (#9123)
* Update linting * Move minimum node version to 5 * Remove coverage for now * Fix docs for node version * Fail for node 4 and below
This commit is contained in:
Родитель
bf3eeb54d7
Коммит
94635edeac
|
@ -1 +1,2 @@
|
|||
sample-code
|
||||
coverage
|
||||
|
|
|
@ -31,3 +31,4 @@ build/
|
|||
__pycache__
|
||||
old
|
||||
.tern-project
|
||||
coverage
|
||||
|
|
11
.jscsrc
11
.jscsrc
|
@ -1,11 +0,0 @@
|
|||
{
|
||||
"excludeFiles": ["node_modules/**"],
|
||||
"requireCurlyBraces": ["for", "while", "do", "try", "catch"],
|
||||
"requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch",
|
||||
"return", "try", "catch", "function"],
|
||||
"disallowMixedSpacesAndTabs": true,
|
||||
"disallowTrailingWhitespace": true,
|
||||
"requireSpacesInFunctionExpression": {
|
||||
"beforeOpeningCurlyBrace": true
|
||||
}
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
submodules
|
||||
node_modules
|
||||
lib/server/static
|
||||
lib/devices/firefoxos/atoms
|
||||
/Users/baba/Work/appium/ci/standalone-tools/node_modules
|
11
.jshintrc
11
.jshintrc
|
@ -1,11 +0,0 @@
|
|||
{
|
||||
"laxcomma": true,
|
||||
"undef": true,
|
||||
"unused": true,
|
||||
"node": true,
|
||||
"eqeqeq": true,
|
||||
"trailing": true,
|
||||
"indent": 2,
|
||||
"esnext": true,
|
||||
"experimental": ["asyncawait"]
|
||||
}
|
|
@ -12,5 +12,5 @@ _vimrc_local.vim
|
|||
*.trace
|
||||
*.sublime-
|
||||
*.prefs
|
||||
.jshintrc
|
||||
./.npmignore
|
||||
coverage
|
||||
|
|
|
@ -3,7 +3,6 @@ sudo: false
|
|||
node_js:
|
||||
- "7"
|
||||
- "6"
|
||||
- "4"
|
||||
env:
|
||||
- CXX=g++-4.8
|
||||
addons:
|
||||
|
@ -13,7 +12,4 @@ addons:
|
|||
packages:
|
||||
- g++-4.8
|
||||
script:
|
||||
- npm run lint
|
||||
- npm run test
|
||||
after_success:
|
||||
- gulp coveralls
|
||||
|
|
|
@ -20,25 +20,25 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
var spawn = require('child_process').spawn,
|
||||
_ = require('lodash');
|
||||
const spawn = require('child_process').spawn;
|
||||
const _ = require('lodash');
|
||||
|
||||
var args = process.argv.slice(2);
|
||||
const args = process.argv.slice(2);
|
||||
|
||||
var RESTART_ON_MESSAGES = [
|
||||
const RESTART_ON_MESSAGES = [
|
||||
'Invalid message _rpc_applicationUpdated',
|
||||
'Invalid message _rpc_applicationSentListing'];
|
||||
|
||||
var PROXY_CMD = 'ios_webkit_debug_proxy';
|
||||
var proxy;
|
||||
const PROXY_CMD = 'ios_webkit_debug_proxy';
|
||||
let proxy;
|
||||
|
||||
var handleKillProcess = function (exitCode) {
|
||||
const handleKillProcess = function (exitCode) {
|
||||
console.log('\nKilling proxy process!');
|
||||
proxy.kill('SIGTERM');
|
||||
process.exit((exitCode || 0));
|
||||
};
|
||||
|
||||
var startProxy = function () {
|
||||
const startProxy = function () {
|
||||
console.log('RUNNING:', PROXY_CMD, args.join(' '));
|
||||
|
||||
proxy = spawn(PROXY_CMD, args);
|
||||
|
@ -49,7 +49,7 @@ var startProxy = function () {
|
|||
|
||||
proxy.stderr.on('data', function (data) {
|
||||
console.log('stderr: ' + data);
|
||||
var restartMessage = _(RESTART_ON_MESSAGES).find(function (message) {
|
||||
const restartMessage = _(RESTART_ON_MESSAGES).find(function (message) {
|
||||
return ('' + data).indexOf(message) >= 0;
|
||||
});
|
||||
if (restartMessage) {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
## appium
|
||||
- runs basic checks
|
||||
- node version (>= 4)
|
||||
- node version (>= 5)
|
||||
- CLI arguments checks
|
||||
- contains all available and supported CLI arguments
|
||||
- check for deprecation and mutual exclusion
|
||||
|
@ -228,7 +228,7 @@
|
|||
- contains task for
|
||||
- e2e and unit tests (with coverage reporting)
|
||||
- transpiling ES2016 into ES5
|
||||
- static code analysis (jshint)
|
||||
- static code analysis (eslint)
|
||||
- watch task for dev
|
||||
|
||||
## appium-remote-debugger
|
||||
|
|
30
gulpfile.js
30
gulpfile.js
|
@ -6,15 +6,15 @@
|
|||
// getting sent to the handler
|
||||
process.env._FORCE_LOGS="1";
|
||||
|
||||
var gulp = require('gulp'),
|
||||
boilerplate = require('appium-gulp-plugins').boilerplate.use(gulp),
|
||||
path = require('path'),
|
||||
fs = require('fs');
|
||||
const gulp = require('gulp');
|
||||
const boilerplate = require('appium-gulp-plugins').boilerplate.use(gulp);
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
|
||||
// remove 'fsevents' from shrinkwrap, since it causes errors on non-Mac hosts
|
||||
// see https://github.com/npm/npm/issues/2679
|
||||
gulp.task('fixShrinkwrap', function (done) {
|
||||
var shrinkwrap;
|
||||
let shrinkwrap;
|
||||
try {
|
||||
shrinkwrap = require('./npm-shrinkwrap.json');
|
||||
} catch (err) {
|
||||
|
@ -23,7 +23,7 @@ gulp.task('fixShrinkwrap', function (done) {
|
|||
return;
|
||||
}
|
||||
delete shrinkwrap.dependencies.fsevents;
|
||||
var shrinkwrapString = JSON.stringify(shrinkwrap, null, ' ') + '\n';
|
||||
const shrinkwrapString = JSON.stringify(shrinkwrap, null, ' ') + '\n';
|
||||
fs.writeFile('./npm-shrinkwrap.json', shrinkwrapString, done);
|
||||
});
|
||||
|
||||
|
@ -32,8 +32,6 @@ gulp.task('fixShrinkwrap', function (done) {
|
|||
|
||||
boilerplate({
|
||||
build: 'appium',
|
||||
jscs: false,
|
||||
jshint: false,
|
||||
test: {
|
||||
files: ['${testDir}/**/*-specs.js']
|
||||
},
|
||||
|
@ -43,10 +41,10 @@ boilerplate({
|
|||
|
||||
// generates server arguments readme
|
||||
gulp.task('docs', ['transpile'], function () {
|
||||
var parser = require('./build/lib/parser.js');
|
||||
var appiumArguments = parser.getParser().rawArgs;
|
||||
var docFile = path.resolve(__dirname, "docs/en/writing-running-appium/server-args.md");
|
||||
var md = "# Appium server arguments\n\n";
|
||||
const parser = require('./build/lib/parser.js');
|
||||
const appiumArguments = parser.getParser().rawArgs;
|
||||
const docFile = path.resolve(__dirname, "docs/en/writing-running-appium/server-args.md");
|
||||
let md = "# Appium server arguments\n\n";
|
||||
md += "Many Appium 1.5 server arguments have been deprecated in favor of the ";
|
||||
md += "[--default-capabilities flag](/docs/en/writing-running-appium/default-capabilities-arg.md).";
|
||||
md += "\n\nUsage: `node . [flags]`\n\n";
|
||||
|
@ -57,14 +55,14 @@ gulp.task('docs', ['transpile'], function () {
|
|||
md += "|Flag|Default|Description|Example|\n";
|
||||
md += "|----|-------|-----------|-------|\n";
|
||||
appiumArguments.forEach(function (arg) {
|
||||
var argNames = arg[0];
|
||||
var exampleArg = typeof arg[0][1] === "undefined" ? arg[0][0] : arg[0][1];
|
||||
var argOpts = arg[1];
|
||||
const argNames = arg[0];
|
||||
const exampleArg = typeof arg[0][1] === "undefined" ? arg[0][0] : arg[0][1];
|
||||
const argOpts = arg[1];
|
||||
|
||||
// --keystore-path defaultValue contains a user-specific path,
|
||||
// let's replace it with <user>/...
|
||||
if (arg[0][0] === '--keystore-path') {
|
||||
var userPath = process.env.HOME || process.env.USERPROFILE;
|
||||
const userPath = process.env.HOME || process.env.USERPROFILE;
|
||||
argOpts.defaultValue = argOpts.defaultValue.replace(userPath, '<user>');
|
||||
}
|
||||
|
||||
|
|
|
@ -38,8 +38,8 @@ async function getAppiumConfig () {
|
|||
|
||||
function checkNodeOk () {
|
||||
let [major, minor] = getNodeVersion();
|
||||
if (major < 4) {
|
||||
let msg = `Node version must be >= 4. Currently ${major}.${minor}`;
|
||||
if (major < 5) {
|
||||
let msg = `Node version must be >= 5. Currently ${major}.${minor}`;
|
||||
logger.errorAndThrow(msg);
|
||||
}
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ function getDeprecatedArgs (parser, args) {
|
|||
}
|
||||
|
||||
function checkValidPort (port, portName) {
|
||||
if (port > 0 && port < 65536) return true;
|
||||
if (port > 0 && port < 65536) return true; // eslint-disable-line curly
|
||||
logger.error(`Port '${portName}' must be greater than 0 and less than 65536. Currently ${port}`);
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ async function postRequest (data, addr, port) {
|
|||
// Move Selenium 3 configuration properties to configuration object
|
||||
if (!jsonObject.hasOwnProperty('configuration')) {
|
||||
let configuration = {};
|
||||
for (var property in jsonObject) {
|
||||
for (let property in jsonObject) {
|
||||
if (jsonObject.hasOwnProperty(property) && property !== 'capabilities') {
|
||||
configuration[property] = jsonObject[property];
|
||||
delete jsonObject[property];
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
25
package.json
25
package.json
|
@ -22,7 +22,7 @@
|
|||
"url": "https://github.com/appium/appium/issues"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4",
|
||||
"node": ">=5",
|
||||
"npm": ">=3"
|
||||
},
|
||||
"main": "./build/lib/main.js",
|
||||
|
@ -64,25 +64,28 @@
|
|||
"scripts": {
|
||||
"prepublish": "gulp prepublish",
|
||||
"test": "gulp once",
|
||||
"watch": "gulp",
|
||||
"watch": "gulp watch",
|
||||
"build": "gulp transpile",
|
||||
"mocha": "mocha",
|
||||
"precommit-msg": "echo 'Pre-commit checks...' && exit 0",
|
||||
"lint": "gulp eslint"
|
||||
"precommit-test": "REPORTER=dot gulp once",
|
||||
"lint": "gulp eslint",
|
||||
"coverage": "gulp coveralls"
|
||||
},
|
||||
"pre-commit": [
|
||||
"precommit-msg",
|
||||
"lint",
|
||||
"test"
|
||||
"precommit-test"
|
||||
],
|
||||
"devDependencies": {
|
||||
"appium-gulp-plugins": "1.x",
|
||||
"babel-eslint": "6.x",
|
||||
"appium-gulp-plugins": "2.x",
|
||||
"babel-eslint": "7.x",
|
||||
"chai": "3.x",
|
||||
"chai-as-promised": "5.x",
|
||||
"eslint": "2.x",
|
||||
"eslint-config-appium": "0.x",
|
||||
"eslint": "3.x",
|
||||
"eslint-config-appium": "2.x",
|
||||
"eslint-plugin-babel": "3.x",
|
||||
"eslint-plugin-import": "1.x",
|
||||
"eslint-plugin-mocha": "3.x",
|
||||
"eslint-plugin-import": "2.x",
|
||||
"eslint-plugin-mocha": "4.x",
|
||||
"eslint-plugin-promise": "3.x",
|
||||
"gulp": "3.x",
|
||||
"mocha": "2.x",
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
{
|
||||
"laxcomma": true,
|
||||
"undef": true,
|
||||
"unused": true,
|
||||
"trailing": true,
|
||||
"node": true,
|
||||
"eqeqeq": true,
|
||||
"expr": true,
|
||||
"white": true,
|
||||
"indent": 2,
|
||||
"esnext": true,
|
||||
"experimental": ["asyncawait"],
|
||||
"globals": {
|
||||
"describe": true,
|
||||
"it": true,
|
||||
"before": true,
|
||||
"after": true,
|
||||
"beforeEach": true,
|
||||
"afterEach": true
|
||||
}
|
||||
}
|
|
@ -65,6 +65,8 @@ describe('Config', () => {
|
|||
});
|
||||
describe('checkNodeOk', () => {
|
||||
it('should fail if node is below 4', () => {
|
||||
process.version = 'v4.4.7';
|
||||
checkNodeOk.should.throw();
|
||||
process.version = 'v0.9.12';
|
||||
checkNodeOk.should.throw();
|
||||
process.version = 'v0.1';
|
||||
|
@ -74,10 +76,6 @@ describe('Config', () => {
|
|||
process.version = 'v0.12.14';
|
||||
checkNodeOk.should.throw();
|
||||
});
|
||||
it('should succeed if node is 4+', () => {
|
||||
process.version = 'v4.4.7';
|
||||
checkNodeOk.should.not.throw();
|
||||
});
|
||||
it('should succeed if node is 5+', () => {
|
||||
process.version = 'v5.7.0';
|
||||
checkNodeOk.should.not.throw();
|
||||
|
@ -86,6 +84,14 @@ describe('Config', () => {
|
|||
process.version = 'v6.3.1';
|
||||
checkNodeOk.should.not.throw();
|
||||
});
|
||||
it('should succeed if node is 7+', () => {
|
||||
process.version = 'v7.1.1';
|
||||
checkNodeOk.should.not.throw();
|
||||
});
|
||||
it('should succeed if node is 8+', () => {
|
||||
process.version = 'v8.1.2';
|
||||
checkNodeOk.should.not.throw();
|
||||
});
|
||||
});
|
||||
|
||||
describe('warnNodeDeprecations', () => {
|
||||
|
|
|
@ -4,8 +4,9 @@ import _ from 'lodash';
|
|||
import chai from 'chai';
|
||||
import chaiAsPromised from 'chai-as-promised';
|
||||
|
||||
|
||||
chai.use(chaiAsPromised);
|
||||
var expect = chai.expect;
|
||||
const expect = chai.expect;
|
||||
|
||||
describe.skip('shrinkwrap checks', () => {
|
||||
it('shrinkwrap file should exist', async () => {
|
||||
|
@ -18,7 +19,7 @@ describe.skip('shrinkwrap checks', () => {
|
|||
let shrinkwrap = require('../../npm-shrinkwrap.json');
|
||||
expect(shrinkwrap.dependencies, 'no shrinkwrap file found. run `npm shrinkwrap`').to.exist;
|
||||
_.values(shrinkwrap.dependencies).length.should.be.above(10);
|
||||
var message = "'fsevents' entry found in shrinkwrap. It causes problems " +
|
||||
let message = "'fsevents' entry found in shrinkwrap. It causes problems " +
|
||||
"on non-Mac systems. run `gulp fixShrinkwrap` and try again";
|
||||
expect(shrinkwrap.dependencies.fsevents, message).to.not.exist;
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче