-
Notifications
You must be signed in to change notification settings - Fork 454
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
129 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 6 additions & 1 deletion
7
test/end-to-end-tests/single-root-UI/project-folder/.vscode/settings.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
{ | ||
"cmake.buildDirectory": "${workspaceFolder}/build", | ||
"cmake.useCMakePresets": "never", | ||
"cmake.configureOnOpen": false | ||
"cmake.configureOnOpen": false, | ||
"cmake.preRunCoverageTarget": "init-coverage", | ||
"cmake.postRunCoverageTarget": "capture-coverage", | ||
"cmake.coverageInfoFiles": [ | ||
"${workspaceFolder}/build/lcov.info" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
test/end-to-end-tests/single-root-UI/test/coverage.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import { DefaultEnvironment, expect } from '@test/util'; | ||
import * as vscode from 'vscode'; | ||
|
||
// From vscode: src/vs/workbench/contrib/testing/common/testTypes.ts | ||
const enum TestResultState { | ||
Unset = 0, | ||
Queued = 1, | ||
Running = 2, | ||
Passed = 3, | ||
Failed = 4, | ||
Skipped = 5, | ||
Errored = 6 | ||
}; | ||
|
||
suite('Coverage integration', () => { | ||
let testEnv: DefaultEnvironment; | ||
|
||
suiteSetup(async function (this: Mocha.Context) { | ||
this.timeout(100000); | ||
|
||
const build_loc = 'build'; | ||
const exe_res = 'output.txt'; | ||
|
||
testEnv = new DefaultEnvironment('test/end-to-end-tests/single-root-UI/project-folder', build_loc, exe_res); | ||
|
||
await vscode.workspace.getConfiguration('cmake', vscode.workspace.workspaceFolders![0].uri).update('useCMakePresets', 'always'); | ||
await vscode.commands.executeCommand('cmake.getSettingsChangePromise'); | ||
|
||
testEnv.projectFolder.buildDirectory.clear(); | ||
await vscode.commands.executeCommand('cmake.setConfigurePreset', 'LinuxUser2'); | ||
expect(await vscode.commands.executeCommand('cmake.configure')).to.be.eq(0); | ||
expect(await vscode.commands.executeCommand('cmake.build')).to.be.eq(0); | ||
}); | ||
|
||
suiteTeardown(async function (this: Mocha.Context) { | ||
this.timeout(30000); | ||
testEnv.teardown(); | ||
}); | ||
|
||
test('Bad Run test with coverage', async () => { | ||
await vscode.workspace.getConfiguration('cmake', vscode.workspace.workspaceFolders![0].uri).update('preRunCoverageTarget', 'non-existing-target'); | ||
|
||
let testResult: any = await vscode.commands.executeCommand('testing.coverage.uri', vscode.Uri.file(testEnv.projectFolder.location)); | ||
expect(testResult['tasks'][0].hasCoverage).to.be.eq(false); | ||
expect(testResult['items'][2].computedState).to.be.eq(TestResultState.Unset); | ||
|
||
await vscode.workspace.getConfiguration('cmake', vscode.workspace.workspaceFolders![0].uri).update('preRunCoverageTarget', 'init-target'); | ||
await vscode.workspace.getConfiguration('cmake', vscode.workspace.workspaceFolders![0].uri).update('postRunCoverageTarget', 'non-existing-target'); | ||
|
||
testResult = await vscode.commands.executeCommand('testing.coverage.uri', vscode.Uri.file(testEnv.projectFolder.location)); | ||
expect(testResult['tasks'][0].hasCoverage).to.be.eq(false); | ||
expect(testResult['items'][2].computedState).to.be.eq(TestResultState.Unset); | ||
}).timeout(60000); | ||
|
||
test('Good Run test with coverage', async () => { | ||
await vscode.workspace.getConfiguration('cmake', vscode.workspace.workspaceFolders![0].uri).update('preRunCoverageTarget', 'init-coverage'); | ||
await vscode.workspace.getConfiguration('cmake', vscode.workspace.workspaceFolders![0].uri).update('postRunCoverageTarget', 'capture-coverage'); | ||
|
||
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); | ||
}).timeout(60000); | ||
}); |