Change:
/** Gets the markdown description for the given detail */ public describe(detail: CoverageDetailsWithBranch, model: ITextModel): IMarkdownString | undefined { if (detail.type === DetailType.Declaration) { <del> return new MarkdownString().appendMarkdown(localize('coverage.declExecutedCount', '`{0}` was executed {1} time(s).', detail.name, detail.count)); </del> <ins> return namedDetailLabel(detail.name, detail); </ins> } else if (detail.type === DetailType.Statement) { const text = wrapName(model.getValueInRange(tidyLocation(detail.location)).trim() || `<empty statement>`); <del> const str = new MarkdownString(); </del> if (detail.branches?.length) { const covered = detail.branches.filter(b => !!b.count).length; <del> str.appendMarkdown(localize('coverage.branches', '{0} of {1} of branches in {2} were covered.', covered, detail.branches.length, text)); </del> <ins> return new MarkdownString().appendMarkdown(localize('coverage.branches', '{0} of {1} of branches in {2} were covered.', covered, detail.branches.length, text)); </ins> } else { <del> str.appendMarkdown(localize('coverage.codeExecutedCount', '{0} was executed {1} time(s).', text, detail.count)); </del> <ins> return namedDetailLabel(text, detail); </ins> } <del> return str; </del> } else if (detail.type === DetailType.Branch) { const text = wrapName(model.getValueInRange(tidyLocation(detail.detail.location)).trim() || `<empty statement>`); const { count, label } = detail.detail.branches![detail.branch]; const label2 = label ? wrapInBackticks(label) : `#${detail.branch + 1}`; <del> if (count === 0) { </del> <ins> if (!count) { </ins> return new MarkdownString().appendMarkdown(localize('coverage.branchNotCovered', 'Branch {0} in {1} was not covered.', label2, text)); <ins> } else if (count === true) { return new MarkdownString().appendMarkdown(localize('coverage.branchCoveredYes', 'Branch {0} in {1} was executed.', label2, text)); </ins> } else { return new MarkdownString().appendMarkdown(localize('coverage.branchCovered', 'Branch {0} in {1} was executed {2} time(s).', label2, text, count)); } } <del> return undefined; </del> <ins> assertNever(detail); </ins> } } <ins> function namedDetailLabel(name: string, detail: IStatementCoverage | IDeclarationCoverage) { return new MarkdownString().appendMarkdown( !detail.count // 0 or false ? localize('coverage.declExecutedNo', '`{0}` was not executed.', name) : typeof detail.count === 'number' ? localize('coverage.declExecutedCount', '`{0}` was executed {1} time(s).', name, detail.count) : localize('coverage.declExecutedYes', '`{0}` was executed.', name) ); } </ins> // 'tidies' the range by normalizing it into a range and removing leading // and trailing whitespace. function tidyLocation(location: Range | Position): Range {

Discussion:
Refs: [x] anyOS [x] anyOS Complexity: 4 We have at long last finalized the test coverage API. Implementing an extension that produces data for the API from scratch is challenging, and requires domain-specific knowledge, so you might find playing with the selfhost test provider to be the most effective way to test it The new types in the API include: - - - Please: Do some testing that the API and UI functions as you would expect Read through the API and verify that its documentation makes sense to you See that UI interactions work nicely as you would expect (you can use any extension that produces coverage to test this part)