Skip to content

Commit

Permalink
Fix emulator throwing error when .env created for first time.
Browse files Browse the repository at this point in the history
  • Loading branch information
garg3133 committed Nov 2, 2022
1 parent 07656e9 commit 7a2dfa7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nightwatch/mobile-helper",
"version": "0.1.2",
"version": "0.1.3",
"description": "Easily setup all the requirements needed to get started with mobile-web testing using Nightwatch.",
"main": "dist/index.js",
"bin": "./index.js",
Expand Down
5 changes: 5 additions & 0 deletions src/commands/android/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ export class AndroidSetup {
const sdkRootEnv = this.getSdkRootFromEnv();
this.sdkRoot = sdkRootEnv || await this.getSdkRootFromUser();

const originalAndroidHome = process.env.ANDROID_HOME;
process.env.ANDROID_HOME = this.sdkRoot;

const setupConfigs: SetupConfigs = await this.getSetupConfigs(this.options);
Logger.log();

Expand Down Expand Up @@ -91,6 +94,8 @@ export class AndroidSetup {
Logger.log(`${colors.bold('Note:')} Please make sure you have required browsers installed on your real-device before running tests.\n`);
}

process.env.ANDROID_HOME = originalAndroidHome;

if (!sdkRootEnv) {
this.sdkRootEnvSetInstructions();
}
Expand Down

0 comments on commit 7a2dfa7

Please sign in to comment.