Skip to content

Commit a16713c

Browse files
Fix cocoapods check and add unit tests for doctor service
When cocoapods are not installed on Mac machine, doctor is failing. Fix this by skipping match check in case pods are not installed. Add basic unit tests for doctor service. Add unit test for the failing cocoapods check.
1 parent c4e6318 commit a16713c

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

lib/services/android-project-service.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
8080

8181
// this call will fail in case `android` is not set correctly.
8282
this.$androidToolsInfo.getPathToAndroidExecutable().wait();
83-
this.$androidToolsInfo.validateJavacVersion(this.$sysInfo.getSysInfo().wait().javacVersion, {showWarningsAsErrors: true}).wait();
83+
this.$androidToolsInfo.validateJavacVersion(this.$sysInfo.getSysInfo(path.join(__dirname, "..", "..", "package.json")).wait().javacVersion, {showWarningsAsErrors: true}).wait();
8484
}).future<void>()();
8585
}
8686

lib/services/doctor-service.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"use strict";
33
import {EOL} from "os";
44
import * as semver from "semver";
5+
import * as path from "path";
56

67
class DoctorService implements IDoctorService {
78
private static MIN_SUPPORTED_POD_VERSION = "0.38.2";
@@ -13,7 +14,7 @@ class DoctorService implements IDoctorService {
1314

1415
public printWarnings(): boolean {
1516
let result = false;
16-
let sysInfo = this.$sysInfo.getSysInfo().wait();
17+
let sysInfo = this.$sysInfo.getSysInfo(path.join(__dirname, "..", "..", "package.json")).wait();
1718

1819
if (!sysInfo.adbVer) {
1920
this.$logger.warn("WARNING: adb from the Android SDK is not installed or is not configured properly.");

lib/sys-info.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,25 @@
22
"use strict";
33

44
import {SysInfoBase} from "./common/sys-info-base";
5+
import * as path from "path";
56

67
export class SysInfo extends SysInfoBase {
78
constructor(protected $childProcess: IChildProcess,
89
protected $hostInfo: IHostInfo,
910
protected $iTunesValidator: Mobile.IiTunesValidator,
1011
protected $logger: ILogger,
12+
protected $winreg: IWinReg,
1113
private $androidToolsInfo: IAndroidToolsInfo) {
12-
super($childProcess, $hostInfo, $iTunesValidator, $logger);
14+
super($childProcess, $hostInfo, $iTunesValidator, $logger, $winreg);
1315
}
1416

15-
public getSysInfo(androidToolsInfo?: {pathToAdb: string, pathToAndroid: string}): IFuture<ISysInfoData> {
17+
public getSysInfo(pathToPackageJson: string, androidToolsInfo?: {pathToAdb: string, pathToAndroid: string}): IFuture<ISysInfoData> {
1618
return ((): ISysInfoData => {
1719
let defaultAndroidToolsInfo = {
1820
pathToAdb: this.$androidToolsInfo.getPathToAdbFromAndroidHome().wait(),
1921
pathToAndroid: this.$androidToolsInfo.getPathToAndroidExecutable().wait()
2022
};
21-
return super.getSysInfo(androidToolsInfo || defaultAndroidToolsInfo).wait();
23+
return super.getSysInfo(pathToPackageJson || path.join(__dirname, "..", "package.json"), androidToolsInfo || defaultAndroidToolsInfo).wait();
2224
}).future<ISysInfoData>()();
2325
}
2426
}

0 commit comments

Comments
 (0)