New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

androidctrl

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

androidctrl - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

.jscsrc

15

android.js

@@ -8,4 +8,4 @@ 'use strict';

var promiseRetry = require('promise-retry');
var noop = function() {
var returnUndefined = function() {
return undefined;
};

@@ -49,3 +49,3 @@

var self = this;
return this.getAVDs().then(function(avds) {
return this.listAVDs().then(function(avds) {
if (avds.length) {

@@ -62,3 +62,3 @@ return avds;

return self.createAVD(targetId, target.Name.replace(/[^\w]+/g, '')).then(function() {
return self.getAVDs();
return self.listAVDs();
}).catch(function(err) {

@@ -87,3 +87,3 @@ console.error(err);

waitForDevice: function(emulatorId) {
return this.adb(emulatorId, 'wait-for-device').then(noop);
return this.adb(emulatorId, 'wait-for-device').then(returnUndefined);
},

@@ -110,3 +110,4 @@ ensureReady: function(emulatorId) {

createAVD: function(targetId, name) {
return ezspawn('android create avd -t ' + targetId + ' -a -c 500M -d "Nexus 5" -n "' + name + '"');
return ezspawn('android create avd -t ' + targetId + ' -a -c 500M -d "Nexus 5" -n "' + name + '"')
.then(returnUndefined);
},

@@ -148,3 +149,3 @@ isInstalled: function() {

},
getAVDs: function() {
listAVDs: function() {
debug('get avds');

@@ -151,0 +152,0 @@ return ezspawn('android list avds').then(function(output) {

{
"name": "androidctrl",
"version": "1.0.0",
"version": "1.0.1",
"description": "Node module for managing and controlling the Android Emulator",

@@ -29,2 +29,4 @@ "main": "android.js",

"jasmine": "^2.3.2",
"jscs": "^2.1.1",
"jshint": "^2.8.0",
"proxyquire": "^1.7.2"

@@ -31,0 +33,0 @@ },

@@ -27,4 +27,4 @@ # androidctrl [![Build Status](https://travis-ci.org/leahciMic/androidctrl.svg?branch=master)](https://travis-ci.org/leahciMic/androidctrl)

Wait until the device specified with `deviceId` is ready (adb daemon is
running).
Return a promise that will be resolved when the device specified with `deviceId`
is ready (adb daemon is running).

@@ -48,1 +48,63 @@ ### ensureReady(deviceId)

```
## createAVD(targetId, name)
Create an AVD based upon `targetId` (from `listTargets`). Returns a promise
that will be resolved when the AVD has finished being created.
## listTargets
Resolves to an array of Android target objects that can be used with createAVD.
The array looks like:
```js
[
{
id: '1 or "android-22"',
Name: 'Android 5.1.1',
Type: 'Platform',
level: '22',
Revision: '2',
Skins: 'HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in'
},
{
id: '2 or "android-23"',
Name: 'Android 6.0.0',
Type: 'Platform',
level: '23',
Revision: '2',
Skins: 'HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in'
}
]
```
## listAVDs
Resolves to an array of Android AVD objects that can be used in conjunction
with `start(avd.Name)`.
The array looks like:
```js
[
{
Name: 'Android511',
Device: 'Nexus 5 (Google)',
Path: '/Users/michael/.android/avd/Android511.avd',
Target: 'Android 5.1.1 (API level 22)',
'Tag/ABI': 'default/x86',
Skin: '1080x1920',
Sdcard: '500M'
},
{
Name: 'Android600',
Device: 'Nexus 5 (Google)',
Path: '/Users/michael/.android/avd/Android600.avd',
Target: 'Android 6.0.0 (API level 23)',
'Tag/ABI': 'default/x86',
Skin: '1080x1920',
Sdcard: '500M'
}
]
```
## getDevices

@@ -0,24 +1,57 @@

'use strict';
var proxyquire = require('proxyquire');
var bluebird = require('bluebird');
var Android = require('../android.js');
var spawnWaitForMock;
var Android;
describe('Android', function() {
var fakeProcess;
beforeEach(function() {
spyOn(Android, 'adb').and.callFake(function() {
return bluebird.resolve('some fake data');
spawnWaitForMock = jasmine.createSpy('spwanWaitForMock');
spawnWaitForMock.and.callFake(function(cmd) {
var obj = {
process: fakeProcess = {},
matches: [
'emulator: control console listening on port (5554), ADB on port 5555',
'5554',
],
line: 'emulator: control console listening on port (5554), ADB on port 5555',
};
return bluebird.resolve(obj);
});
Android = proxyquire('../android.js', {
'spawn-wait-for': spawnWaitForMock,
});
});
describe('waitForDevice', function() {
it('should run the right command', function() {
Android.waitForDevice('5554');
expect(Android.adb).toHaveBeenCalledWith('5554', 'wait-for-device');
describe('start', function() {
it('should run the right command', function(done) {
Android.start('foobar').then(function(result) {
expect(spawnWaitForMock).toHaveBeenCalledWith(
'emulator -verbose -avd "foobar" -no-boot-anim -no-skin',
jasmine.any(RegExp)
);
done();
});
});
it('should resolve with nothing', function(done) {
Android.waitForDevice('5554').then(function(data) {
expect(data).toBeUndefined();
it('should get the correct emulator id', function(done) {
Android.start('foobar').then(function(result) {
expect(result.id).toEqual('5554');
done();
});
});
it('should get the process object back', function(done) {
Android.start('foobar').then(function(result) {
expect(result.process).toEqual(fakeProcess);
done();
});
});
});
});

@@ -1,55 +0,26 @@

var proxyquire = require('proxyquire');
'use strict';
var bluebird = require('bluebird');
var spawnWaitForMock;
var Android;
var Android = require('../android.js');
describe('Android', function() {
var fakeProcess;
beforeEach(function() {
spawnWaitForMock = jasmine.createSpy('spwanWaitForMock');
spawnWaitForMock.and.callFake(function(cmd) {
var obj = {
process: fakeProcess = {},
matches: [
'emulator: control console listening on port (5554), ADB on port 5555',
'5554'
],
line: 'emulator: control console listening on port (5554), ADB on port 5555'
};
return bluebird.resolve(obj);
spyOn(Android, 'adb').and.callFake(function() {
return bluebird.resolve('some fake data');
});
Android = proxyquire('../android.js', {
'spawn-wait-for': spawnWaitForMock
});
});
describe('start', function() {
it('should run the right command', function(done) {
Android.start('foobar').then(function(result) {
expect(spawnWaitForMock).toHaveBeenCalledWith(
'emulator -verbose -avd "foobar" -no-boot-anim -no-skin',
jasmine.any(RegExp)
);
done();
});
describe('waitForDevice', function() {
it('should run the right command', function() {
Android.waitForDevice('5554');
expect(Android.adb).toHaveBeenCalledWith('5554', 'wait-for-device');
});
it('should get the correct emulator id', function(done) {
Android.start('foobar').then(function(result) {
expect(result.id).toEqual('5554');
it('should resolve with nothing', function(done) {
Android.waitForDevice('5554').then(function(data) {
expect(data).toBeUndefined();
done();
});
});
it('should get the process object back', function(done) {
Android.start('foobar').then(function(result) {
expect(result.process).toEqual(fakeProcess);
done();
});
});
});
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc