Skip to content

Commit 92aa896

Browse files
chore: bump version (#189)
1 parent e1bb8cf commit 92aa896

File tree

4 files changed

+18
-8
lines changed

4 files changed

+18
-8
lines changed

lib/device-manager.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { logError, logInfo, logWarn } from "./utils";
1+
import { logError, logInfo, logWarn, shouldUserMobileDevicesController } from "./utils";
22
import { INsCapabilities } from "./interfaces/ns-capabilities";
33
import { IDeviceManager } from "./interfaces/device-manager";
44
import {
@@ -28,7 +28,7 @@ export class DeviceManager implements IDeviceManager {
2828
DeviceManager.cleanUnsetProperties(device);
2929
console.log("Default device: ", device);
3030

31-
if (!!process.env["USE_MOBILE_DEVICES_CONTROLLER_SERVER"]) {
31+
if (shouldUserMobileDevicesController(args)) {
3232
device = (await DeviceController.getDevices(device))[0];
3333
logInfo("Device: ", device);
3434
return device;

lib/utils.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ export declare const prepareDevice: (args: INsCapabilities, deviceManager: IDevi
4040
export declare const prepareApp: (args: INsCapabilities) => Promise<INsCapabilities>;
4141
export declare const sessionIds: (port: any) => Promise<any[]>;
4242
export declare function encodeImageToBase64(path: any): string;
43+
export declare const shouldUserMobileDevicesController: (args: INsCapabilities) => boolean;
4344
export declare function logInfo(info: any, obj?: any): void;
4445
export declare function logWarn(info: any, obj?: any): void;
4546
export declare function logError(info: any, obj?: any): void;

lib/utils.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,15 @@ const convertObjToString = obj => {
577577

578578
return "";
579579
}
580+
581+
export const shouldUserMobileDevicesController = (args: INsCapabilities)=>{
582+
const useDsCS = process.env["USE_DEVICES_CONTROLLER_SERVER"] || false;
583+
const useMDsCS = process.env["USE_MOBILE_DEVICES_CONTROLLER_SERVER"] || false;
584+
585+
return !args.isSauceLab && (new RegExp(`${useDsCS}`).test(`true`) || new RegExp(`${useMDsCS}`).test(`true`));
586+
}
587+
588+
580589
export function logInfo(info, obj = undefined) {
581590
info += " " + convertObjToString(obj);
582591
console.log(`${ConsoleColor.FgCyan}%s${ConsoleColor.Reset}`, info);

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
{
2323
"name": "SvetoslavTsenov",
2424
"email": "[email protected]"
25-
}
25+
}
2626
],
2727
"bin": {
2828
"nativescript-dev-appium": "./bin/nativescript-dev-appium",
@@ -37,18 +37,18 @@
3737
"frame-comparer": "^2.0.1",
3838
"glob": "^7.1.0",
3939
"inquirer": "^6.2.0",
40-
"mobile-devices-controller": "~3.1.5-2",
40+
"mobile-devices-controller": "~4.0.0-1",
4141
"wd": "~1.11.1",
4242
"webdriverio": "~4.14.0",
4343
"yargs": "~12.0.5"
4444
},
4545
"devDependencies": {
46+
"@types/chai": "^4.1.7",
47+
"@types/mocha": "^5.2.5",
4648
"@types/node": "~10.12.18",
47-
"typescript": "~3.1.6",
48-
"mocha": "^5.2.0",
4949
"chai": "^4.2.0",
50-
"@types/mocha": "^5.2.5",
51-
"@types/chai": "^4.1.7"
50+
"mocha": "^5.2.0",
51+
"typescript": "~3.1.6"
5252
},
5353
"scripts": {
5454
"postinstall": "node ./postinstall.js",

0 commit comments

Comments
 (0)