Skip to content

Commit b171b9b

Browse files
committed
Use native VSCode coverage APIs, cover swift-testing
Move to the new VSCode coverage APIs that were introduced in VSCode version 1.88. This allows us to remove the coverage renderer and coverage report files. This functionality is now built in to the test explorer and VSCode's document rendering. This patch also adds support for producing test coverage from swift-testing tests. XCTests and swift-testing tests are each run in their respective binaries and then the coverage data is merged into a profdata file before being exported to LCOV format. Finally we transform the LCOV JSON into the coverage structures for VSCode and associate this data with the test run.
1 parent 585cb59 commit b171b9b

File tree

11 files changed

+449
-847
lines changed

11 files changed

+449
-847
lines changed

package-lock.json

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"url": "https://github.com/swift-server/vscode-swift"
1111
},
1212
"engines": {
13-
"vscode": "^1.71.0"
13+
"vscode": "^1.88.0"
1414
},
1515
"categories": [
1616
"Programming Languages",
@@ -429,47 +429,6 @@
429429
}
430430
}
431431
},
432-
{
433-
"title": "Test Coverage",
434-
"properties": {
435-
"swift.coverage.displayReportAfterRun": {
436-
"type": "boolean",
437-
"default": true,
438-
"description": "Should test coverage report be shown after running tests",
439-
"order": 1
440-
},
441-
"swift.coverage.alwaysShowStatusItem": {
442-
"type": "boolean",
443-
"default": true,
444-
"description": "Always show the test coverage status item. If this is set to true the status item can be clicked on to toggle test coverage display on and off.",
445-
"order": 2
446-
},
447-
"swift.coverage.colors.lightMode.hit": {
448-
"type": "string",
449-
"default": "#c0ffc0",
450-
"description": "Light mode theme background color for line of code hit during test coverage.",
451-
"order": 3
452-
},
453-
"swift.coverage.colors.lightMode.miss": {
454-
"type": "string",
455-
"default": "#ffc0c0",
456-
"description": "Light mode theme background color for line of code missed during test coverage.",
457-
"order": 4
458-
},
459-
"swift.coverage.colors.darkMode.hit": {
460-
"type": "string",
461-
"default": "#003000",
462-
"description": "Dark mode theme background color for line of code hit during test coverage.",
463-
"order": 5
464-
},
465-
"swift.coverage.colors.darkMode.miss": {
466-
"type": "string",
467-
"default": "#400000",
468-
"description": "Dark mode theme background color for line of code missed during test coverage.",
469-
"order": 6
470-
}
471-
}
472-
},
473432
{
474433
"title": "Debugger",
475434
"properties": {
@@ -1142,7 +1101,7 @@
11421101
"@types/mocha": "^10.0.1",
11431102
"@types/node": "^18.19.33",
11441103
"@types/plist": "^3.0.5",
1145-
"@types/vscode": "^1.71.0",
1104+
"@types/vscode": "^1.88.0",
11461105
"@typescript-eslint/eslint-plugin": "^7.8.0",
11471106
"@typescript-eslint/parser": "^7.8.0",
11481107
"@vscode/test-electron": "^2.3.8",

src/TaskQueue.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ export class TaskOperation implements SwiftOperation {
7171
workspaceContext: WorkspaceContext,
7272
token?: vscode.CancellationToken
7373
): Promise<number | undefined> {
74+
workspaceContext.outputChannel.log(`Exec Task: ${this.task.detail}`);
7475
return workspaceContext.tasks.executeTaskAndWait(this.task, token);
7576
}
7677
}

0 commit comments

Comments
 (0)