Skip to content

Commit

Permalink
chore: ci
Browse files Browse the repository at this point in the history
  • Loading branch information
wtto00 committed Sep 15, 2023
1 parent e78ea33 commit 0401063
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node: [14, 16, 18, 20]
node: [16, 18, 20]
env:
GITHUB_CI: true
steps:
- name: Checkout Code
uses: actions/checkout@v3
Expand Down
20 changes: 11 additions & 9 deletions spec/constructor.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import path from "path";
import Android from "../src/index.js";

const cmdLinePath = process.env.GITHUB_CI ? "cmdline-tools" : "cmdline-tools/latest";

describe("constructor", () => {
test("constructor", () => {
const androidHome = process.env.ANDROID_HOME || "";
Expand All @@ -20,35 +22,35 @@ describe("constructor", () => {
"adb",
"avdmanager",
"sdkmanager",
"emulator",
process.env.GITHUB_CI ? path.resolve(androidHome, "emulator/emulator111") : "emulator",
]);
});

test("constructor with custom path", () => {
const androidHome = process.env.ANDROID_HOME || "";
const android = new Android({
avdmanager: "cmdline-tools/latest/bin/avdmanager",
sdkmanager: "cmdline-tools/latest/bin/sdkmanager",
avdmanager: `${cmdLinePath}/bin/avdmanager`,
sdkmanager: `${cmdLinePath}/bin/sdkmanager`,
adb: "platform-tools/adb",
emulator: "emulator/emulator",
});
expect([android.adbBin, android.avdmanagerBin, android.sdkmanagerBin, android.emulatorBin]).toEqual([
path.resolve(androidHome, "platform-tools/adb"),
path.resolve(androidHome, "cmdline-tools/latest/bin/avdmanager"),
path.resolve(androidHome, "cmdline-tools/latest/bin/sdkmanager"),
path.resolve(androidHome, `${cmdLinePath}/bin/avdmanager`),
path.resolve(androidHome, `${cmdLinePath}/bin/sdkmanager`),
path.resolve(androidHome, "emulator/emulator"),
]);
});

test("constructor with custom executable file environment variable", () => {
const androidHome = process.env.ANDROID_HOME || "";
process.env.avdmanagerBin = path.resolve(androidHome, "cmdline-tools/latest/bin/avdmanager");
process.env.sdkmanagerBin = path.resolve(androidHome, "cmdline-tools/latest/bin/sdkmanager");
process.env.avdmanagerBin = path.resolve(androidHome, `${cmdLinePath}/bin/avdmanager`);
process.env.sdkmanagerBin = path.resolve(androidHome, `${cmdLinePath}/bin/sdkmanager`);
const android = new Android();
expect([android.adbBin, android.avdmanagerBin, android.sdkmanagerBin, android.emulatorBin]).toEqual([
path.resolve(androidHome, "platform-tools/adb"),
path.resolve(androidHome, "cmdline-tools/latest/bin/avdmanager"),
path.resolve(androidHome, "cmdline-tools/latest/bin/sdkmanager"),
path.resolve(androidHome, `${cmdLinePath}/bin/avdmanager`),
path.resolve(androidHome, `${cmdLinePath}/bin/sdkmanager`),
path.resolve(androidHome, "emulator/emulator"),
]);
});
Expand Down
1 change: 0 additions & 1 deletion src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ export function spawnExec(command: string, timeout = 60000) {
proc.on("close", (code) => {
clearTimeout(clock);
if (code) {
console.log('proc.killed',proc.killed);
reject(Error(error));
} else {
proc.output = output;
Expand Down

0 comments on commit 0401063

Please sign in to comment.