Skip to content

Commit 535e296

Browse files
committed
fix: fix the unit tests execution with istanbul
1 parent 204f398 commit 535e296

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

lib/services/android/gradle-command-service.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,18 @@ export class GradleCommandService implements IGradleCommandService {
77
) { }
88

99
public async executeCommand(gradleArgs: string[], options: IGradleCommandOptions): Promise<ISpawnResult> {
10-
const { message, cwd, stdio = "inherit", spawnOptions } = options;
10+
const { message, cwd, stdio, spawnOptions } = options;
1111
this.$logger.info(message);
1212

13-
const childProcessOptions = { cwd, stdio };
13+
const childProcessOptions = { cwd, stdio: stdio || "inherit" };
1414
const gradleExecutable = this.$hostInfo.isWindows ? "gradlew.bat" : "./gradlew";
1515

1616
const result = await this.executeCommandSafe(gradleExecutable, gradleArgs, childProcessOptions, spawnOptions);
1717

1818
return result;
1919
}
2020

21-
private async executeCommandSafe(gradleExecutable: string, gradleArgs: string[], childProcessOptions: { cwd: string, stdio: string }, spawnOptions: ISpawnFromEventOptions) {
21+
private async executeCommandSafe(gradleExecutable: string, gradleArgs: string[], childProcessOptions: { cwd: string, stdio: string }, spawnOptions: ISpawnFromEventOptions): Promise<ISpawnResult> {
2222
try {
2323
const result = await this.$childProcess.spawnFromEvent(gradleExecutable, gradleArgs, "close", childProcessOptions, spawnOptions);
2424

test/services/android/gradle-build-args-service.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ function createTestInjector(): IInjector {
77
injector.register("androidToolsInfo", {
88
getToolsInfo: () => ({
99
compileSdkVersion: 28,
10+
targetSdkVersion: 26,
1011
buildToolsVersion: "my-build-tools-version",
1112
generateTypings: true
1213
})
@@ -36,13 +37,13 @@ function executeTests(testCases: any[], testFunction: (gradleBuildArgsService: I
3637

3738
const expectedInfoLoggingArgs = ["--quiet"];
3839
const expectedTraceLoggingArgs = ["--stacktrace", "--debug"];
39-
const expectedDebugBuildArgs = ["-PcompileSdk=android-28", "-PbuildToolsVersion=my-build-tools-version", "-PgenerateTypings=true"];
40-
const expectedReleaseBuildArgs = expectedDebugBuildArgs.concat(["-Prelease", "-PksPath=/Users/havaluova/Work/nativescript-cli/keyStorePath",
40+
const expectedDebugBuildArgs = ["-PcompileSdk=android-28", "-PtargetSdk=26", "-PbuildToolsVersion=my-build-tools-version", "-PgenerateTypings=true"];
41+
const expectedReleaseBuildArgs = expectedDebugBuildArgs.concat(["-Prelease", "-PksPath=/my/key/store/path",
4142
"-Palias=keyStoreAlias", "-Ppassword=keyStoreAliasPassword", "-PksPassword=keyStorePassword"]);
4243

4344
const releaseBuildConfig = {
4445
release: true,
45-
keyStorePath: "keyStorePath",
46+
keyStorePath: "/my/key/store/path",
4647
keyStoreAlias: "keyStoreAlias",
4748
keyStoreAliasPassword: "keyStoreAliasPassword",
4849
keyStorePassword: "keyStorePassword"

0 commit comments

Comments
 (0)