appium-instruments
Advanced tools
Comparing version 1.1.0-beta1 to 1.1.0-beta2
@@ -73,2 +73,4 @@ // Wrapper around Apple's Instruments app | ||
Instruments.prototype.start = function (cb, unexpectedExitCb) { | ||
cb = cb || function () {}; | ||
unexpectedExitCb = unexpectedExitCb || function () {}; | ||
if (this.didLaunch) { | ||
@@ -170,3 +172,6 @@ return cb(new Error("Called start() but we already launched")); | ||
Instruments.prototype.launchAndKill = function (msToLetLive, cb) { | ||
// launch Instruments and kill it when the function passed in as the 'condition' | ||
// param returns true. | ||
Instruments.prototype.launchAndKill = function (condition, cb) { | ||
var warnlevel = 10; // if we pass 10 attempts to kill but fail, log a warning | ||
logger.warn("Launching instruments briefly then killing it"); | ||
@@ -185,9 +190,23 @@ this.setInstrumentsPath(function (err) { | ||
}); | ||
setTimeout(function () { | ||
diedTooYoung.kill("SIGKILL"); | ||
if (!returned) { | ||
returned = true; | ||
cb(); | ||
var attempts = 0; | ||
var timelyCauseOfDeath = function () { | ||
attempts++; | ||
if (attempts > warnlevel && attempts < warnlevel + 3) { | ||
logger.warn("attempted to kill instruments " + attempts + " times. Could be stuck on the wait condition."); | ||
} | ||
}, msToLetLive); | ||
if (condition()) { | ||
diedTooYoung.kill("SIGKILL"); | ||
if (!returned) { | ||
returned = true; | ||
cb(); | ||
} | ||
} else { | ||
setTimeout(timelyCauseOfDeath, 700); | ||
} | ||
}; | ||
process.nextTick(timelyCauseOfDeath); | ||
}.bind(this)); | ||
@@ -194,0 +213,0 @@ }; |
@@ -5,3 +5,4 @@ 'use strict'; | ||
logger: require('./logger'), | ||
Instruments: require('./instruments') | ||
Instruments: require('./instruments'), | ||
utils: require('./utils') | ||
}; |
{ | ||
"name": "appium-instruments", | ||
"version": "1.1.0-beta1", | ||
"version": "1.1.0-beta2", | ||
"description": "IOS Instruments + instruments-without-delay launcher used by Appium", | ||
@@ -39,3 +39,3 @@ "main": "lib/main.js", | ||
"chai": "~1.9.1", | ||
"jscs": "~1.4.5", | ||
"jscs": "~1.5.3", | ||
"jshint": "~2.5.1", | ||
@@ -42,0 +42,0 @@ "mocha": "~1.20.0", |
@@ -5,7 +5,5 @@ 'use strict'; | ||
should = base.should, | ||
utils = require('../utils/instruments-utils'), | ||
path = require('path'), | ||
utils = require('../../lib/main').utils, | ||
exec = require('child_process').exec, | ||
Instruments = require('../../lib/main').Instruments, | ||
Q = require('q'); | ||
path = require('path'); | ||
@@ -15,10 +13,6 @@ describe('intruments tests', function () { | ||
var xcodeTraceTemplatePath, | ||
instruments; | ||
var instruments; | ||
beforeEach(function (done) { | ||
utils.killAllSimulators() | ||
.then(utils.getXcodeTraceTemplatePath) | ||
.then(function (_path) { xcodeTraceTemplatePath = _path; }) | ||
.nodeify(done); | ||
beforeEach(function () { | ||
return utils.killAllSimulators(); | ||
}); | ||
@@ -30,15 +24,8 @@ | ||
function newInstrument(timeout) { | ||
var instruments = new Instruments({ | ||
function newInstrument(launchTimeout) { | ||
return utils.quickInstrument({ | ||
app: path.resolve(__dirname, '../assets/TestApp.app'), | ||
bootstrap: utils.bootstrap, | ||
template: xcodeTraceTemplatePath, | ||
withoutDelay: true, | ||
xcodeVersion: '5.1', | ||
webSocket: null, | ||
launchTimeout: timeout, | ||
flakeyRetries: true, | ||
logNoColors: false, | ||
bootstrap: path.resolve(__dirname, '../assets/bootstrap.js'), | ||
launchTimeout: launchTimeout | ||
}); | ||
return new Q(instruments); | ||
} | ||
@@ -70,3 +57,3 @@ | ||
test('regular timeout', 60000); | ||
test('smart timeout', {global: 60000, afterSimLaunch: 10000}); | ||
//test('smart timeout', {global: 60000, afterSimLaunch: 10000}); | ||
@@ -73,0 +60,0 @@ describe("shutdown without startup", function () { |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
615552
682
2