diff --git a/src/controller/testController.ts b/src/controller/testController.ts index bae0f2e5..05e1feea 100644 --- a/src/controller/testController.ts +++ b/src/controller/testController.ts @@ -167,7 +167,7 @@ export const runTests: (request: TestRunRequest, option: IRunOption) => any = in } const run: TestRun = testController!.createTestRun(request); - const coverageProvider = new JavaTestCoverageProvider(); + const coverageProvider: JavaTestCoverageProvider = new JavaTestCoverageProvider(); try { await new Promise(async (resolve: () => void): Promise => { const token: CancellationToken = option.token ?? run.token; diff --git a/src/provider/JavaTestCoverageProvider.ts b/src/provider/JavaTestCoverageProvider.ts index 300bad68..bcfb7ef1 100644 --- a/src/provider/JavaTestCoverageProvider.ts +++ b/src/provider/JavaTestCoverageProvider.ts @@ -28,18 +28,20 @@ export class JavaTestCoverageProvider implements TestCoverageProvider { } for (const sourceFileCoverage of sourceFileCoverages) { - const uri = Uri.file(Uri.parse(sourceFileCoverage.uriString).fsPath); + const uri: Uri = Uri.file(Uri.parse(sourceFileCoverage.uriString).fsPath); const detailedCoverage: DetailedCoverage[] = []; for (const lineCoverage of sourceFileCoverage.lineCoverages) { const branchCoverages: BranchCoverage[] = []; for (const branchCoverage of lineCoverage.branchCoverages) { branchCoverages.push(new BranchCoverage(branchCoverage.hit, new Position(lineCoverage.lineNumber - 1, 0))); } - const statementCoverage = new StatementCoverage(lineCoverage.hit, new Position(lineCoverage.lineNumber - 1, 0), branchCoverages); + const statementCoverage: StatementCoverage = new StatementCoverage(lineCoverage.hit, + new Position(lineCoverage.lineNumber - 1, 0), branchCoverages); detailedCoverage.push(statementCoverage); } for (const methodCoverage of sourceFileCoverage.methodCoverages) { - const functionCoverage = new FunctionCoverage(methodCoverage.name, methodCoverage.hit, new Position(methodCoverage.lineNumber - 1, 0)); + const functionCoverage: FunctionCoverage = new FunctionCoverage(methodCoverage.name, methodCoverage.hit, + new Position(methodCoverage.lineNumber - 1, 0)); detailedCoverage.push(functionCoverage); } fileCoverages.push(FileCoverage.fromDetails(uri, detailedCoverage)); diff --git a/src/types.ts b/src/types.ts index a986470e..f453411d 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,7 +1,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. -import { Range, TestItem, TestRun, TestRunProfile, WorkspaceFolder } from 'vscode'; +import { Range, TestItem, TestRun, TestRunProfile } from 'vscode'; +import * as vscode from 'vscode'; export interface IJavaTestItem { children: IJavaTestItem[]; @@ -54,7 +55,7 @@ export interface IRunTestContext { projectName: string; testItems: TestItem[]; testRun: TestRun; - workspaceFolder: WorkspaceFolder; + workspaceFolder: vscode.WorkspaceFolder; profile?: TestRunProfile; } diff --git a/src/utils/launchUtils.ts b/src/utils/launchUtils.ts index 32f8d519..9b8a0f19 100644 --- a/src/utils/launchUtils.ts +++ b/src/utils/launchUtils.ts @@ -83,7 +83,7 @@ export async function resolveLaunchConfigurationForRunner(runner: BaseRunner, te } if (testContext.profile?.label.includes('Coverage')) { - let agentArg = `-javaagent:${getJacocoAgentPath()}=destfile=${getJacocoDataFilePath(launchArguments.projectName)}`; + let agentArg: string = `-javaagent:${getJacocoAgentPath()}=destfile=${getJacocoDataFilePath(launchArguments.projectName)}`; if (config?.coverage?.appendResult === false) { agentArg += ',append=false'; }