appium-support
Advanced tools
Comparing version 2.0.0-beta2 to 2.0.0-beta3
@@ -5,2 +5,4 @@ 'use strict'; | ||
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default']; | ||
Object.defineProperty(exports, '__esModule', { | ||
@@ -22,12 +24,14 @@ value: true | ||
var _libFs = require('./lib/fs'); | ||
var _libFs2 = _interopRequireDefault(_libFs); | ||
var _libRimraf = require('./lib/rimraf'); | ||
var _libRimraf2 = _interopRequireDefault(_libRimraf); | ||
// can't add to other exports `as default` | ||
// until JSHint figures out how to parse that pattern | ||
exports['default'] = { | ||
tempDir: tempDir, | ||
system: system, | ||
util: util | ||
}; | ||
exports.tempDir = tempDir; | ||
exports.system = system; | ||
exports.util = util; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7OzBCQUV5QixlQUFlOztJQUE1QixPQUFPOzt5QkFDSyxjQUFjOztJQUExQixNQUFNOzt1QkFDSSxZQUFZOztJQUF0QixJQUFJOzs7O3FCQUlEO0FBQ2IsU0FBTyxFQUFQLE9BQU87QUFDUCxRQUFNLEVBQU4sTUFBTTtBQUNOLE1BQUksRUFBSixJQUFJO0NBQ0w7UUFFUSxPQUFPLEdBQVAsT0FBTztRQUFFLE1BQU0sR0FBTixNQUFNO1FBQUUsSUFBSSxHQUFKLElBQUkiLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VzQ29udGVudCI6WyJcblxuaW1wb3J0ICogYXMgdGVtcERpciBmcm9tICcuL2xpYi90ZW1wZGlyJztcbmltcG9ydCAqIGFzIHN5c3RlbSBmcm9tICcuL2xpYi9zeXN0ZW0nO1xuaW1wb3J0ICogYXMgdXRpbCBmcm9tICcuL2xpYi91dGlsJztcblxuLy8gY2FuJ3QgYWRkIHRvIG90aGVyIGV4cG9ydHMgYGFzIGRlZmF1bHRgXG4vLyB1bnRpbCBKU0hpbnQgZmlndXJlcyBvdXQgaG93IHRvIHBhcnNlIHRoYXQgcGF0dGVyblxuZXhwb3J0IGRlZmF1bHQge1xuICB0ZW1wRGlyLFxuICBzeXN0ZW0sXG4gIHV0aWxcbn07XG5cbmV4cG9ydCB7IHRlbXBEaXIsIHN5c3RlbSwgdXRpbCB9O1xuIl19 | ||
exports['default'] = { tempDir: tempDir, system: system, util: util, fs: _libFs2['default'], rimraf: _libRimraf2['default'], cancellableDelay: _libUtil.cancellableDelay }; | ||
module.exports = exports['default']; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7MEJBQXlCLGVBQWU7O0lBQTVCLE9BQU87O3lCQUNLLGNBQWM7O0lBQTFCLE1BQU07O3VCQUNJLFlBQVk7O0lBQXRCLElBQUk7O3FCQUVELFVBQVU7Ozs7eUJBQ04sY0FBYzs7Ozs7O3FCQUlsQixFQUFFLE9BQU8sRUFBUCxPQUFPLEVBQUUsTUFBTSxFQUFOLE1BQU0sRUFBRSxJQUFJLEVBQUosSUFBSSxFQUFFLEVBQUUsb0JBQUEsRUFBRSxNQUFNLHdCQUFBLEVBQUUsZ0JBQWdCLFdBTjNELGdCQUFnQixBQU0yQyxFQUFFIiwiZmlsZSI6ImluZGV4LmpzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0ICogYXMgdGVtcERpciBmcm9tICcuL2xpYi90ZW1wZGlyJztcbmltcG9ydCAqIGFzIHN5c3RlbSBmcm9tICcuL2xpYi9zeXN0ZW0nO1xuaW1wb3J0ICogYXMgdXRpbCBmcm9tICcuL2xpYi91dGlsJztcbmltcG9ydCB7IGNhbmNlbGxhYmxlRGVsYXkgfSBmcm9tICcuL2xpYi91dGlsJztcbmltcG9ydCBmcyBmcm9tICcuL2xpYi9mcyc7XG5pbXBvcnQgcmltcmFmIGZyb20gJy4vbGliL3JpbXJhZic7XG5cbi8vIGNhbid0IGFkZCB0byBvdGhlciBleHBvcnRzIGBhcyBkZWZhdWx0YFxuLy8gdW50aWwgSlNIaW50IGZpZ3VyZXMgb3V0IGhvdyB0byBwYXJzZSB0aGF0IHBhdHRlcm5cbmV4cG9ydCBkZWZhdWx0IHsgdGVtcERpciwgc3lzdGVtLCB1dGlsLCBmcywgcmltcmFmLCBjYW5jZWxsYWJsZURlbGF5IH07XG4iXX0= |
@@ -12,2 +12,6 @@ 'use strict'; | ||
var _bluebird = require('bluebird'); | ||
var _bluebird2 = _interopRequireDefault(_bluebird); | ||
var _lodash = require('lodash'); | ||
@@ -17,6 +21,2 @@ | ||
var _fs2 = require('fs'); | ||
var _fs3 = _interopRequireDefault(_fs2); | ||
var _os = require('os'); | ||
@@ -26,15 +26,10 @@ | ||
var _bluebird = require('bluebird'); | ||
var _appiumLogger = require('appium-logger'); | ||
var _bluebird2 = _interopRequireDefault(_bluebird); | ||
var _fs = require('./fs'); | ||
var _appiumLogger = require('appium-logger'); | ||
var _fs2 = _interopRequireDefault(_fs); | ||
var logger = (0, _appiumLogger.getLogger)('Appium-Support'); | ||
var fs = { | ||
mkdir: _bluebird2['default'].promisify(_fs3['default'].mkdir), | ||
access: _bluebird2['default'].promisify(_fs3['default'].access) | ||
}; | ||
function hasContent(val) { | ||
@@ -68,23 +63,9 @@ return _lodash2['default'].isString(val) && val !== ''; | ||
case 0: | ||
context$1$0.prev = 0; | ||
context$1$0.next = 3; | ||
return _regeneratorRuntime.awrap(fs.access(path, fs.F_OK | fs.R_OK)); | ||
return context$1$0.abrupt('return', _fs2['default'].hasAccess(path)); | ||
case 3: | ||
context$1$0.next = 8; | ||
break; | ||
case 5: | ||
context$1$0.prev = 5; | ||
context$1$0.t0 = context$1$0['catch'](0); | ||
return context$1$0.abrupt('return', false); | ||
case 8: | ||
return context$1$0.abrupt('return', true); | ||
case 9: | ||
case 1: | ||
case 'end': | ||
return context$1$0.stop(); | ||
} | ||
}, null, this, [[0, 5]]); | ||
}, null, this); | ||
} | ||
@@ -98,3 +79,3 @@ | ||
context$1$0.next = 3; | ||
return _regeneratorRuntime.awrap(fs.mkdir(dirName)); | ||
return _regeneratorRuntime.awrap(_fs2['default'].mkdir(dirName)); | ||
@@ -127,2 +108,18 @@ case 3: | ||
/* | ||
* Creates a promise that is cancellable, and will timeout | ||
* after `ms` delay | ||
*/ | ||
function cancellableDelay(ms) { | ||
var timer = undefined; | ||
return new _bluebird2['default'].Promise(function (resolve) { | ||
timer = setTimeout(function () { | ||
resolve(); | ||
}, ms); | ||
}).cancellable()['catch'](_bluebird2['default'].CancellationError, function (err) { | ||
clearTimeout(timer); | ||
throw err; | ||
}); | ||
} | ||
exports.hasValue = hasValue; | ||
@@ -133,2 +130,5 @@ exports.escapeSpace = escapeSpace; | ||
exports.localIp = localIp; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImxpYi91dGlsLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7OztRQWVnQixVQUFVLEdBQVYsVUFBVTs7c0JBZFosUUFBUTs7OzttQkFDTixJQUFJOzs7O2tCQUNMLElBQUk7Ozs7d0JBQ0wsVUFBVTs7Ozs0QkFDRSxlQUFlOztBQUV6QyxJQUFJLE1BQU0sR0FBRyxrQkFGSixTQUFTLEVBRUssZ0JBQWdCLENBQUMsQ0FBQzs7QUFFekMsSUFBSSxFQUFFLEdBQUc7QUFDUCxPQUFLLEVBQUUsc0JBQUUsU0FBUyxDQUFDLGdCQUFJLEtBQUssQ0FBQztBQUM3QixRQUFNLEVBQUUsc0JBQUUsU0FBUyxDQUFDLGdCQUFJLE1BQU0sQ0FBQztDQUNoQyxDQUFDOztBQUdLLFNBQVMsVUFBVSxDQUFFLEdBQUcsRUFBRTtBQUMvQixTQUFPLG9CQUFFLFFBQVEsQ0FBQyxHQUFHLENBQUMsSUFBSSxHQUFHLEtBQUssRUFB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oZXJyICYmIGVyci5jb2RlICE9PSBcIkVFWElTVFwiKSB7XG4gICAgICBsb2dnZXIuZXJyb3JBbmRUaHJvdyhlcnIpO1xuICAgIH0gXG4gIH1cbn1cblxuZnVuY3Rpb24gbG9jYWxJcCAoKSB7XG4gIGxldCBpcCA9IF8uY2hhaW4ob3MubmV0d29ya0ludGVyZmFjZXMoKSlcbiAgICAudmFsdWVzKClcbiAgICAuZmxhdHRlbigpXG4gICAgLmZpbHRlcihmdW5jdGlvbiAodmFsKSB7XG4gICAgICByZXR1cm4gKHZhbC5mYW1pbHkgPT09ICdJUHY0JyAmJiB2YWwuaW50ZXJuYWwgPT09IGZhbHNlKTtcbiAgICB9KVxuICAgIC5wbHVjaygnYWRkcmVzcycpXG4gICAgLmZpcnN0KClcbiAgICAudmFsdWUoKTtcbiAgcmV0dXJuIGlwO1xufVxuXG5leHBvcnQgeyBoYXNWYWx1ZSwgZXNjYXBlU3BhY2UsIGhhc0FjY2VzcywgbWtkaXIsIGxvY2FsSXAgfTsiXX0= | ||
exports.cancellableDelay = cancellableDelay; | ||
// TODO: deprecate, use fs.hasAccess instead | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImxpYi91dGlsLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7OztRQVFnQixVQUFVLEdBQVYsVUFBVTs7d0JBUlosVUFBVTs7OztzQkFDVixRQUFROzs7O2tCQUNQLElBQUk7Ozs7NEJBQ08sZUFBZTs7a0JBQzFCLE1BQU07Ozs7QUFFckIsSUFBSSxNQUFNLEdBQUcsa0JBSEosU0FBUyxFQUdLLGdCQUFnQixDQUFDLENBQUM7O0FBRWxDLFNBQVMsVUFBVSxDQUFFLEdBQUcsRUFBRTtBQUMvQixTQUFPLG9CQUFFLFFBQVEsQ0FBQyxHQUFHLENBQUMsSUFBSSxHQUFHLEtBQUssRUFBRSxDQUFDO0NBQ3RDOzs7QUFHRCxTQ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biAgICB0aHJvdyBlcnI7XG4gIH0pO1xufVxuXG5leHBvcnQgeyBoYXNWYWx1ZSwgZXNjYXBlU3BhY2UsIGhhc0FjY2VzcywgbWtkaXIsIGxvY2FsSXAsIGNhbmNlbGxhYmxlRGVsYXkgfTtcbiJdfQ== |
@@ -21,2 +21,6 @@ 'use strict'; | ||
var _chaiAsPromised = require('chai-as-promised'); | ||
var _chaiAsPromised2 = _interopRequireDefault(_chaiAsPromised); | ||
var _bluebird = require('bluebird'); | ||
@@ -32,2 +36,3 @@ | ||
var should = _chai2['default'].should(); | ||
_chai2['default'].use(_chaiAsPromised2['default']); | ||
@@ -258,3 +263,38 @@ describe('util', function () { | ||
}); | ||
describe('cancellableDelay', function () { | ||
it('should delay', function callee$2$0() { | ||
return _regeneratorRuntime.async(function callee$2$0$(context$3$0) { | ||
while (1) switch (context$3$0.prev = context$3$0.next) { | ||
case 0: | ||
context$3$0.next = 2; | ||
return _regeneratorRuntime.awrap(_.util.cancellableDelay('10')); | ||
case 2: | ||
case 'end': | ||
return context$3$0.stop(); | ||
} | ||
}, null, this); | ||
}); | ||
it('cancel should work', function callee$2$0() { | ||
var delay; | ||
return _regeneratorRuntime.async(function callee$2$0$(context$3$0) { | ||
while (1) switch (context$3$0.prev = context$3$0.next) { | ||
case 0: | ||
delay = _.util.cancellableDelay('1000'); | ||
_bluebird2['default'].delay(10).then(function () { | ||
delay.cancel(); | ||
}).done(); | ||
context$3$0.next = 4; | ||
return _regeneratorRuntime.awrap(delay.should.be.rejectedWith(/cancellation error/)); | ||
case 4: | ||
case 'end': | ||
return context$3$0.stop(); | ||
} | ||
}, null, this); | ||
}); | ||
}); | ||
}); | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QvdXRpbC1zcGVjcy5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxZQUFZLENBQUM7Ozs7OztnQkFFUSxPQUFPOzt1QkFDUixRQ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l0IHV0aWwuaGFzQWNjZXNzKGRpck5hbWUpO1xuICAgICAgICBleGlzdHMuc2hvdWxkLmJlLnRydWU7XG4gICAgICAgIGF3YWl0IHV0aWwubWtkaXIoZGlyTmFtZSk7XG4gICAgfSk7XG5cbiAgICBpdChcInNob3VsZCBzdGlsbCB0aHJvdyBhbiBlcnJvciBpZiBzb21ldGhpbmcgZWxzZSBnb2VzIHdyb25nXCIsIGFzeW5jIGZ1bmN0aW9uICgpIHtcbiAgICAgIGF3YWl0IHV0aWwubWtkaXIoXCIvYmluL2Zvb1wiKS5zaG91bGQuYmUucmVqZWN0ZWQ7XG4gICAgfSk7XG4gIH0pO1xuXG4gIGRlc2NyaWJlKFwiY2FuY2VsbGFibGVEZWxheVwiLCBmdW5jdGlvbiAoKSB7XG4gICAgaXQoXCJzaG91bGQgZGVsYXlcIiwgYXN5bmMgZnVuY3Rpb24gKCkge1xuICAgICAgYXdhaXQgdXRpbC5jYW5jZWxsYWJsZURlbGF5KCcxMCcpO1xuICAgIH0pO1xuICAgIGl0KFwiY2FuY2VsIHNob3VsZCB3b3JrXCIsIGFzeW5jIGZ1bmN0aW9uICgpIHtcbiAgICAgIGxldCBkZWxheSA9IHV0aWwuY2FuY2VsbGFibGVEZWxheSgnMTAwMCcpO1xuICAgICAgQi5kZWxheSgxMCkudGhlbihmdW5jdGlvbigpIHsgZGVsYXkuY2FuY2VsKCk7IH0pLmRvbmUoKTtcbiAgICAgIGF3YWl0IGRlbGF5LnNob3VsZC5iZS5yZWplY3RlZFdpdGgoL2NhbmNlbGxhdGlvbiBlcnJvci8pO1xuICAgIH0pO1xuICB9KTtcbn0pO1xuXG4iXX0= |
13
index.js
@@ -1,15 +0,10 @@ | ||
import * as tempDir from './lib/tempdir'; | ||
import * as system from './lib/system'; | ||
import * as util from './lib/util'; | ||
import { cancellableDelay } from './lib/util'; | ||
import fs from './lib/fs'; | ||
import rimraf from './lib/rimraf'; | ||
// can't add to other exports `as default` | ||
// until JSHint figures out how to parse that pattern | ||
export default { | ||
tempDir, | ||
system, | ||
util | ||
}; | ||
export { tempDir, system, util }; | ||
export default { tempDir, system, util, fs, rimraf, cancellableDelay }; |
@@ -1,16 +0,9 @@ | ||
import B from 'bluebird'; | ||
import _ from 'lodash'; | ||
import _fs from 'fs'; | ||
import os from 'os'; | ||
import B from 'bluebird'; | ||
import { getLogger } from 'appium-logger'; | ||
import fs from './fs'; | ||
let logger = getLogger('Appium-Support'); | ||
let fs = { | ||
mkdir: B.promisify(_fs.mkdir), | ||
access: B.promisify(_fs.access) | ||
}; | ||
export function hasContent (val) { | ||
@@ -41,8 +34,4 @@ return _.isString(val) && val !== ""; | ||
async function hasAccess (path) { | ||
try { | ||
await fs.access(path, fs.F_OK | fs.R_OK); | ||
} catch (err) { | ||
return false; | ||
} | ||
return true; | ||
// TODO: deprecate, use fs.hasAccess instead | ||
return fs.hasAccess(path); | ||
} | ||
@@ -73,2 +62,20 @@ | ||
export { hasValue, escapeSpace, hasAccess, mkdir, localIp }; | ||
/* | ||
* Creates a promise that is cancellable, and will timeout | ||
* after `ms` delay | ||
*/ | ||
function cancellableDelay (ms) { | ||
let timer; | ||
return new B.Promise((resolve) => { | ||
timer = setTimeout(function() { | ||
resolve(); | ||
}, ms); | ||
}) | ||
.cancellable() | ||
.catch(B.CancellationError, (err) => { | ||
clearTimeout(timer); | ||
throw err; | ||
}); | ||
} | ||
export { hasValue, escapeSpace, hasAccess, mkdir, localIp, cancellableDelay }; |
@@ -7,3 +7,3 @@ { | ||
], | ||
"version": "2.0.0-beta2", | ||
"version": "2.0.0-beta3", | ||
"author": "appium", | ||
@@ -10,0 +10,0 @@ "license": "Apache-2.0", |
@@ -7,2 +7,3 @@ "use strict"; | ||
import chai from 'chai'; | ||
import chaiAsPromised from 'chai-as-promised'; | ||
import B from 'bluebird'; | ||
@@ -13,4 +14,4 @@ import sinon from 'sinon'; | ||
let should = chai.should(); | ||
chai.use(chaiAsPromised); | ||
describe('util', function () { | ||
@@ -164,3 +165,14 @@ | ||
}); | ||
describe("cancellableDelay", function () { | ||
it("should delay", async function () { | ||
await util.cancellableDelay('10'); | ||
}); | ||
it("cancel should work", async function () { | ||
let delay = util.cancellableDelay('1000'); | ||
B.delay(10).then(function() { delay.cancel(); }).done(); | ||
await delay.should.be.rejectedWith(/cancellation error/); | ||
}); | ||
}); | ||
}); | ||
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 2 instances in 1 package
1470
0
104788