Skip to content

Commit

Permalink
Update appium-gulp-plugins (appium#11461)
Browse files Browse the repository at this point in the history
  • Loading branch information
imurchie authored Oct 3, 2018
1 parent c639190 commit 7f3f136
Show file tree
Hide file tree
Showing 19 changed files with 89 additions and 119 deletions.
23 changes: 0 additions & 23 deletions .npmignore

This file was deleted.

6 changes: 0 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,6 @@ jobs:
- sudo: false
script: npm run test && npm run e2e-test
node_js: "8"
- stage:
os:
- linux
- sudo: false
script: npm run test && npm run e2e-test
node_js: "6"
- stage:
os:
- linux
Expand Down
2 changes: 1 addition & 1 deletion commands-yml/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ Handlebars.registerHelper('versions', (object, name, driverName) => {
return `${min} to ${max}`;
});

Handlebars.registerHelper('hyphenate', (str) => str.replace('_', '-'));
Handlebars.registerHelper('hyphenate', (str) => str.replace('_', '-'));
Handlebars.registerHelper('uppercase', (str) => str.toUpperCase());

Handlebars.registerHelper('capitalize', function (driverName) {
Expand Down
12 changes: 5 additions & 7 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@

// turn all logging on since we have tests that rely on npmlog logs actually
// getting sent to the handler
process.env._FORCE_LOGS="1";
process.env._FORCE_LOGS = "1";

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) {
Expand All @@ -20,16 +21,13 @@ gulp.task('fixShrinkwrap', function (done) {
} catch (err) {
console.error('Could not find shrinkwrap; skipping fixing shrinkwrap. ' +
'(Original error: ' + err.message + ')');
return;
return done();
}
delete shrinkwrap.dependencies.fsevents;
const shrinkwrapString = JSON.stringify(shrinkwrap, null, ' ') + '\n';
fs.writeFile('./npm-shrinkwrap.json', shrinkwrapString, done);
});




boilerplate({
build: 'appium',
test: {
Expand All @@ -40,7 +38,7 @@ boilerplate({
});

// generates server arguments readme
gulp.task('docs', ['transpile'], function () {
gulp.task('docs', gulp.series(['transpile']), function () {
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");
Expand Down Expand Up @@ -77,7 +75,7 @@ gulp.task('docs', ['transpile'], function () {
md += "|" + ((typeof argOpts.example === "undefined") ? "" : "`" + exampleArg + " " + argOpts.example + "`");
md += "|\n";
});
// console.log(md);

fs.writeFile(docFile, md, function (err) {
if (err) {
console.log(err.stack);
Expand Down
4 changes: 2 additions & 2 deletions lib/appium.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,9 @@ class AppiumDriver extends BaseDriver {
log.warn(`Unable to get version of driver '${driver.name}'`);
}

async getStatus () {
async getStatus () { // eslint-disable-line require-await
return {
build: _.clone(await getBuildInfo()),
build: _.clone(getBuildInfo()),
};
}

Expand Down
13 changes: 7 additions & 6 deletions lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ async function getGitTimestamp (commitSha, useGitHubFallback = false) {
* and git commit hash asynchronously as soon as `updateBuildInfo` is called
* and succeeds.
*/
async function getBuildInfo () {
function getBuildInfo () {
return BUILD_INFO;
}

Expand All @@ -139,7 +139,7 @@ function warnNodeDeprecations () {

async function showConfig () {
await updateBuildInfo();
console.log(JSON.stringify(await getBuildInfo())); // eslint-disable-line no-console
console.log(JSON.stringify(getBuildInfo())); // eslint-disable-line no-console
}

function getNonDefaultArgs (parser, args) {
Expand Down Expand Up @@ -228,7 +228,8 @@ async function validateTmpDir (tmpDir) {
}
}

export { getBuildInfo, validateServerArgs, checkNodeOk, showConfig,
warnNodeDeprecations, validateTmpDir, getNonDefaultArgs,
getDeprecatedArgs, getGitRev, checkValidPort, APPIUM_VER,
updateBuildInfo };
export {
getBuildInfo, validateServerArgs, checkNodeOk, showConfig,
warnNodeDeprecations, validateTmpDir, getNonDefaultArgs, getDeprecatedArgs,
getGitRev, checkValidPort, APPIUM_VER, updateBuildInfo,
};
8 changes: 4 additions & 4 deletions lib/grid-register.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ async function registerNode (configFile, addr, port) {
logger.error('No data found in the node configuration file to send to the grid');
return;
}
await postRequest(data, addr, port);
postRequest(data, addr, port);
}

async function registerToGrid (options_post, jsonObject) {
Expand All @@ -37,7 +37,7 @@ async function registerToGrid (options_post, jsonObject) {
}
}

async function postRequest (data, addr, port) {
function postRequest (data, addr, port) {
// parse json to get hub host and port
let jsonObject;
try {
Expand Down Expand Up @@ -121,8 +121,8 @@ async function isAlreadyRegistered (jsonObject) {
try {
let response = await request({
uri: `${hubUri(jsonObject.configuration)}/grid/api/proxy?id=${id}`,
method : 'GET',
timeout : 10000,
method: 'GET',
timeout: 10000,
resolveWithFullResponse: true // return the full response, not just the body
});
if (response === undefined || response.statusCode !== 200) {
Expand Down
6 changes: 3 additions & 3 deletions lib/logsink.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import npmlog from 'npmlog';
import winston from 'winston';
import winston from 'winston';
import { fs, logger } from 'appium-support';
import dateformat from 'dateformat';
import _ from 'lodash';
Expand Down Expand Up @@ -52,7 +52,7 @@ function timestamp () {
function applyStripColorPatch (transport) {
let _log = transport.log.bind(transport);
transport.log = function (level, msg, meta, callback) { // eslint-disable-line promise/prefer-await-to-callbacks
let code = /\u001b\[(\d+(;\d+)*)?m/g;
const code = /\u001b\[(\d+(;\d+)*)?m/g; // eslint-disable-line no-control-regex
msg = ('' + msg).replace(code, '');
_log(level, msg, meta, callback);
};
Expand Down Expand Up @@ -130,7 +130,7 @@ async function _createTransports (args) {
if (args.loglevel && args.loglevel.match(":")) {
// --log-level arg can optionally provide diff logging levels for console and file, separated by a colon
let lvlPair = args.loglevel.split(':');
consoleLogLevel = lvlPair[0] || consoleLogLevel;
consoleLogLevel = lvlPair[0] || consoleLogLevel;
fileLogLevel = lvlPair[1] || fileLogLevel;
} else {
consoleLogLevel = fileLogLevel = args.loglevel;
Expand Down
8 changes: 4 additions & 4 deletions lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ async function logStartupInfo (parser, args) {
logDefaultCapabilitiesWarning(args.defaultCapabilities);
}
// TODO: bring back loglevel reporting below once logger is flushed out
//logger.info('Console LogLevel: ' + logger.transports.console.level);
//if (logger.transports.file) {
//logger.info('File LogLevel: ' + logger.transports.file.level);
//}
// logger.info('Console LogLevel: ' + logger.transports.console.level);
// if (logger.transports.file) {
// logger.info('File LogLevel: ' + logger.transports.file.level);
// }
}

function logServerPort (address, port) {
Expand Down
10 changes: 6 additions & 4 deletions lib/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,12 @@ const args = [
}],

[['--log-level'], {
choices: ['info', 'info:debug', 'info:info', 'info:warn', 'info:error',
'warn', 'warn:debug', 'warn:info', 'warn:warn', 'warn:error',
'error', 'error:debug', 'error:info', 'error:warn', 'error:error',
'debug', 'debug:debug', 'debug:info', 'debug:warn', 'debug:error'],
choices: [
'info', 'info:debug', 'info:info', 'info:warn', 'info:error',
'warn', 'warn:debug', 'warn:info', 'warn:warn', 'warn:error',
'error', 'error:debug', 'error:info', 'error:warn', 'error:error',
'debug', 'debug:debug', 'debug:info', 'debug:warn', 'debug:error',
],
defaultValue: 'debug',
dest: 'loglevel',
required: false,
Expand Down
6 changes: 4 additions & 2 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,5 +253,7 @@ function getPackageVersion (pkgName) {

const rootDir = findRoot(__dirname);

export { inspectObject, parseCapsForInnerDriver, insertAppiumPrefixes, rootDir,
getPackageVersion };
export {
inspectObject, parseCapsForInnerDriver, insertAppiumPrefixes, rootDir,
getPackageVersion,
};
40 changes: 18 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
"url": "https://github.com/appium/appium/issues"
},
"engines": {
"node": ">=6",
"npm": ">=3"
"node": ">=8",
"npm": ">=6"
},
"main": "./build/lib/main.js",
"bin": {
Expand All @@ -33,7 +33,13 @@
"lib": "./lib",
"doc": "./docs"
},
"files": [
"bin",
"lib",
"build/lib"
],
"dependencies": {
"@babel/runtime": "^7.0.0",
"appium-android-driver": "^4.0.0",
"appium-base-driver": "3.x",
"appium-espresso-driver": ">=1.0.0-beta.13",
Expand All @@ -50,7 +56,6 @@
"argparse": "^1.0.10",
"async-lock": "^1.0.0",
"asyncbox": "2.x",
"babel-runtime": "=5.8.24",
"bluebird": "3.x",
"continuation-local-storage": "3.x",
"dateformat": "^3.0.3",
Expand All @@ -66,7 +71,7 @@
"winston": "2.x"
},
"scripts": {
"prepublish": "gulp prepublish",
"prepare": "gulp prepublish",
"publish": "gulp prepublish",
"test": "gulp once",
"e2e-test": "gulp e2e-test",
Expand All @@ -90,20 +95,20 @@
"precommit-test"
],
"devDependencies": {
"appium-gulp-plugins": "^2.4.0",
"ajv": "^6.5.3",
"appium-gulp-plugins": "^3.1.0",
"babel-cli": "^6.26.0",
"babel-eslint": "^7.x",
"babel-eslint": "^10.0.0",
"babel-preset-env": "^1.7.0",
"chai": "4.x",
"chai-as-promised": "7.x",
"eslint": "^3.x",
"eslint-config-appium": "2.x",
"eslint-plugin-babel": "3.x",
"eslint-plugin-import": "2.x",
"eslint-plugin-mocha": "4.x",
"eslint-plugin-promise": "3.x",
"eslint": "^5.2.0",
"eslint-config-appium": "3.x",
"eslint-plugin-import": "^2.2.0",
"eslint-plugin-mocha": "^5.0.0",
"eslint-plugin-promise": "^4.0.0",
"fancy-log": "^1.3.2",
"gulp": "^3.9.1",
"gulp": "^4.0.0",
"handlebars": "^4.0.10",
"mocha": "5.x",
"pre-commit": "1.x",
Expand All @@ -120,15 +125,6 @@
},
"greenkeeper": {
"ignore": [
"babel-eslint",
"babel-preset-env",
"eslint",
"eslint-plugin-babel",
"eslint-plugin-import",
"eslint-plugin-mocha",
"eslint-plugin-promise",
"gulp",
"babel-runtime",
"winston"
]
}
Expand Down
16 changes: 8 additions & 8 deletions test/config-specs.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe('Config', function () {
describe('Appium config', function () {
describe('getBuildInfo', function () {
async function verifyBuildInfoUpdate (useLocalGit) {
const buildInfo = await getBuildInfo();
const buildInfo = getBuildInfo();
mockFs.expects('exists').atLeast(1).returns(useLocalGit);
buildInfo['git-sha'] = undefined;
buildInfo.built = undefined;
Expand Down Expand Up @@ -118,9 +118,9 @@ describe('Config', function () {
sinon.spy(console, "log");
});
it('should log the config to console', async function () {
const config = await getBuildInfo();
const config = getBuildInfo();
await showConfig();
console.log.calledOnce.should.be.true; // eslint-disable-line no-console
console.log.calledOnce.should.be.true; // eslint-disable-line no-console
console.log.getCall(0).args[0].should.contain(JSON.stringify(config)); // eslint-disable-line no-console
});
});
Expand All @@ -136,10 +136,10 @@ describe('Config', function () {
for (let [prop, value] of _.toPairs(process)) {
tempProcess[prop] = value;
}
process = tempProcess;
process = tempProcess; // eslint-disable-line no-global-assign
});
after(function () {
process = _process;
process = _process; // eslint-disable-line no-global-assign
});
describe('checkNodeOk', function () {
it('should fail if node is below 6', function () {
Expand Down Expand Up @@ -259,13 +259,13 @@ describe('Config', function () {
});

describe('validateTmpDir', function () {
it('should fail to use a tmp dir with incorrect permissions', async function () {
it('should fail to use a tmp dir with incorrect permissions', function () {
validateTmpDir('/private/if_you_run_with_sudo_this_wont_fail').should.be.rejectedWith(/could not ensure/);
});
it('should fail to use an undefined tmp dir', async function () {
it('should fail to use an undefined tmp dir', function () {
validateTmpDir().should.be.rejectedWith(/could not ensure/);
});
it('should be able to use a tmp dir with correct permissions', async function () {
it('should be able to use a tmp dir with correct permissions', function () {
validateTmpDir('/tmp/test_tmp_dir/with/any/number/of/levels').should.not.be.rejected;
});
});
Expand Down
Loading

0 comments on commit 7f3f136

Please sign in to comment.