From 864215dd1089f50f496e2cee1c412b92e097b464 Mon Sep 17 00:00:00 2001 From: Tofik Sonono Date: Tue, 5 Nov 2024 09:30:54 +0100 Subject: [PATCH] Test additions and fixes --- test/end-to-end-tests/single-root-UI/test/coverage.test.ts | 3 +++ test/unit-tests/coverage.test.ts | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/test/end-to-end-tests/single-root-UI/test/coverage.test.ts b/test/end-to-end-tests/single-root-UI/test/coverage.test.ts index 94e280d1d..c836c28c4 100644 --- a/test/end-to-end-tests/single-root-UI/test/coverage.test.ts +++ b/test/end-to-end-tests/single-root-UI/test/coverage.test.ts @@ -1,5 +1,7 @@ import { DefaultEnvironment, expect } from '@test/util'; import * as vscode from 'vscode'; +import * as fs from 'fs'; +import * as path from 'path'; // From vscode: src/vs/workbench/contrib/testing/common/testTypes.ts const enum TestResultState { @@ -59,5 +61,6 @@ suite('Coverage integration', () => { const testResult: any = await vscode.commands.executeCommand('testing.coverage.uri', vscode.Uri.file(testEnv.projectFolder.location)); expect(testResult['tasks'][0].hasCoverage).to.be.eq(true); expect(testResult['items'][2].computedState).to.be.eq(TestResultState.Passed); + expect(fs.existsSync(path.join(testEnv.projectFolder.location, testEnv.buildLocation, 'lcov.info'))).to.be.true; }).timeout(60000); }); diff --git a/test/unit-tests/coverage.test.ts b/test/unit-tests/coverage.test.ts index 00936e6f1..c7f766a7c 100644 --- a/test/unit-tests/coverage.test.ts +++ b/test/unit-tests/coverage.test.ts @@ -1,6 +1,7 @@ import { handleCoverageInfoFiles } from "@cmt/coverage"; import * as vscode from "vscode"; import { expect, getTestResourceFilePath } from "@test/util"; +import * as path from "path"; suite('Coverage Handling', () => { @@ -27,7 +28,7 @@ suite('Coverage Handling', () => { const coverageData = new WeakMap(); await handleCoverageInfoFiles(testRun, [getTestResourceFilePath('lcov.info')], coverageData); expect(filesCoverages.length).to.eq(1); - expect(filesCoverages[0].uri.fsPath).to.eq('/tmp/lcov/main.cpp'); + expect(filesCoverages[0].uri.fsPath).to.eq(path.join(path.sep, 'tmp', 'lcov', 'main.cpp')); const coverageDetail = coverageData.get(filesCoverages[0]); expect(coverageDetail).to.not.be.undefined;