Skip to content
This repository was archived by the owner on Feb 2, 2021. It is now read-only.

Commit 5a2d82e

Browse files
Fatme HavaluovaFatme Havaluova
Fatme Havaluova
authored and
Fatme Havaluova
committed
Fix "ANDROID_HOME environment variable is not set correctly" error
Fixes NativeScript/nativescript-cli#1242
1 parent 774c5fe commit 5a2d82e

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

helpers.ts

+4
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ function cmdQuote(s: string): string {
2525
}
2626

2727
export function quoteString(s: string): string {
28+
if (!s) {
29+
return s;
30+
}
31+
2832
return (platform() === "win32") ? cmdQuote(s) : bashQuote(s);
2933
}
3034

test/unit-tests/sys-info-base.ts

+16
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,22 @@ describe("sysInfoBase", () => {
227227
};
228228
});
229229

230+
describe("when android info is incorrect", () => {
231+
it("pathToAdb and pathToAndroid are null", () => {
232+
childProcessResult.adbVersion = {
233+
result: null
234+
};
235+
childProcessResult.androidInstalled = {
236+
result: false
237+
};
238+
testInjector = createTestInjector(childProcessResult, {isWindows: false, isDarwin: false, dotNetVersion: "4.5.1"}, null);
239+
sysInfoBase = testInjector.resolve("sysInfoBase");
240+
let result = sysInfoBase.getSysInfo(toolsPackageJson, {pathToAdb: null, pathToAndroid: null}).wait();
241+
assert.deepEqual(result.adbVer, null);
242+
assert.deepEqual(result.androidInstalled, false);
243+
});
244+
});
245+
230246
describe("when all of calls throw", () => {
231247
let assertAllValuesAreNull = () => {
232248
sysInfoBase = testInjector.resolve("sysInfoBase");

0 commit comments

Comments
 (0)