Skip to content

Commit

Permalink
Stubs TestRunProfile loadDetailedCoverageForTest
Browse files Browse the repository at this point in the history
fixes eclipse-theia#14582

contributed on behalf of STMicroelectronics

Signed-off-by: Remi Schnekenburger <rschnekenburger@eclipsesource.com>
  • Loading branch information
rschnekenbu committed Dec 9, 2024
1 parent 8378858 commit 55f95a5
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/plugin-ext/src/plugin/types-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3417,6 +3417,7 @@ export class FileCoverage {
public statementCoverage: TestCoverageCount,
public branchCoverage?: TestCoverageCount,
public declarationCoverage?: TestCoverageCount,
public includesTests?: theia.TestItem[],
) { }
}

Expand Down
33 changes: 33 additions & 0 deletions packages/plugin/src/theia.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16547,6 +16547,30 @@ export module '@theia/plugin' {
*/
loadDetailedCoverage?: (testRun: TestRun, fileCoverage: FileCoverage, token: CancellationToken) => Thenable<FileCoverageDetail[]>;

/**
* An extension-provided function that provides detailed statement and
* function-level coverage for a single test in a file. This is the per-test
* sibling of {@link TestRunProfile.loadDetailedCoverage}, called only if
* a test item is provided in {@link FileCoverage.includesTests} and only
* for files where such data is reported.
*
* Often {@link TestRunProfile.loadDetailedCoverage} will be called first
* when a user opens a file, and then this method will be called if they
* drill down into specific per-test coverage information. This method
* should then return coverage data only for constructs the given test item
* executed during the test run.
*
* The {@link FileCoverage} object passed to this function is the same
* instance emitted on {@link TestRun.addCoverage} calls associated with this profile.
*
* @param testRun The test run that generated the coverage data.
* @param fileCoverage The file coverage object to load detailed coverage for.
* @param fromTestItem The test item to request coverage information for.
* @param token A cancellation token that indicates the operation should be cancelled.
* @stubbed
*/
loadDetailedCoverageForTest?: (testRun: TestRun, fileCoverage: FileCoverage, fromTestItem: TestItem, token: CancellationToken) => Thenable<FileCoverageDetail[]>;

/**
* Deletes the run profile.
*/
Expand Down Expand Up @@ -17141,6 +17165,13 @@ export module '@theia/plugin' {
*/
declarationCoverage?: TestCoverageCount;

/**
* A list of {@link TestItem test cases} that generated coverage in this
* file. If set, then {@link TestRunProfile.loadDetailedCoverageForTest}
* should also be defined in order to retrieve detailed coverage information.
*/
includesTests?: TestItem[];

/**
* Creates a {@link FileCoverage} instance with counts filled in from
* the coverage details.
Expand All @@ -17156,12 +17187,14 @@ export module '@theia/plugin' {
* used to represent line coverage.
* @param branchCoverage Branch coverage information
* @param declarationCoverage Declaration coverage information
* @param includesTests Test cases included in this coverage report, see {@link includesTests}
*/
constructor(
uri: Uri,
statementCoverage: TestCoverageCount,
branchCoverage?: TestCoverageCount,
declarationCoverage?: TestCoverageCount,
includesTests?: TestItem[],
);
}

Expand Down

0 comments on commit 55f95a5

Please sign in to comment.