@@ -16035,6 +16035,18 @@ export module '@theia/plugin' {
1603516035 */
1603616036 runHandler: (request: TestRunRequest, token: CancellationToken) => Thenable<void> | void;
1603716037
16038+ /**
16039+ * An extension-provided function that provides detailed statement and
16040+ * function-level coverage for a file. The editor will call this when more
16041+ * detail is needed for a file, such as when it's opened in an editor or
16042+ * expanded in the **Test Coverage** view.
16043+ *
16044+ * The {@link FileCoverage} object passed to this function is the same instance
16045+ * emitted on {@link TestRun.addCoverage} calls associated with this profile.
16046+ * @stubbed
16047+ */
16048+ loadDetailedCoverage?: (testRun: TestRun, fileCoverage: FileCoverage, token: CancellationToken) => Thenable<FileCoverageDetail[]>;
16049+
1603816050 /**
1603916051 * Deletes the run profile.
1604016052 */
@@ -16314,11 +16326,23 @@ export module '@theia/plugin' {
1631416326 */
1631516327 appendOutput(output: string, location?: Location, test?: TestItem): void;
1631616328
16329+ /**
16330+ * Adds coverage for a file in the run.
16331+ * @stubbed
16332+ */
16333+ addCoverage(fileCoverage: FileCoverage): void;
16334+
1631716335 /**
1631816336 * Signals the end of the test run. Any tests included in the run whose
1631916337 * states have not been updated will have their state reset.
1632016338 */
1632116339 end(): void;
16340+
16341+ /**
16342+ * An event fired when the editor is no longer interested in data
16343+ * associated with the test run.
16344+ */
16345+ onDidDispose: Event<void>;
1632216346 }
1632316347
1632416348 /**
@@ -16527,6 +16551,178 @@ export module '@theia/plugin' {
1652716551 */
1652816552 constructor(message: string | MarkdownString);
1652916553 }
16554+
16555+ /**
16556+ * A class that contains information about a covered resource. A count can
16557+ * be give for lines, branches, and declarations in a file.
16558+ */
16559+ export class TestCoverageCount {
16560+ /**
16561+ * Number of items covered in the file.
16562+ */
16563+ covered: number;
16564+ /**
16565+ * Total number of covered items in the file.
16566+ */
16567+ total: number;
16568+
16569+ /**
16570+ * @param covered Value for {@link TestCoverageCount.covered}
16571+ * @param total Value for {@link TestCoverageCount.total}
16572+ */
16573+ constructor(covered: number, total: number);
16574+ }
16575+
16576+ /**
16577+ * Contains coverage metadata for a file.
16578+ */
16579+ export class FileCoverage {
16580+ /**
16581+ * File URI.
16582+ */
16583+ readonly uri: Uri;
16584+
16585+ /**
16586+ * Statement coverage information. If the reporter does not provide statement
16587+ * coverage information, this can instead be used to represent line coverage.
16588+ */
16589+ statementCoverage: TestCoverageCount;
16590+
16591+ /**
16592+ * Branch coverage information.
16593+ */
16594+ branchCoverage?: TestCoverageCount;
16595+
16596+ /**
16597+ * Declaration coverage information. Depending on the reporter and
16598+ * language, this may be types such as functions, methods, or namespaces.
16599+ */
16600+ declarationCoverage?: TestCoverageCount;
16601+
16602+ /**
16603+ * Creates a {@link FileCoverage} instance with counts filled in from
16604+ * the coverage details.
16605+ * @param uri Covered file URI
16606+ * @param detailed Detailed coverage information
16607+ */
16608+ static fromDetails(uri: Uri, details: readonly FileCoverageDetail[]): FileCoverage;
16609+
16610+ /**
16611+ * @param uri Covered file URI
16612+ * @param statementCoverage Statement coverage information. If the reporter
16613+ * does not provide statement coverage information, this can instead be
16614+ * used to represent line coverage.
16615+ * @param branchCoverage Branch coverage information
16616+ * @param declarationCoverage Declaration coverage information
16617+ */
16618+ constructor(
16619+ uri: Uri,
16620+ statementCoverage: TestCoverageCount,
16621+ branchCoverage?: TestCoverageCount,
16622+ declarationCoverage?: TestCoverageCount,
16623+ );
16624+ }
16625+
16626+ /**
16627+ * Contains coverage information for a single statement or line.
16628+ */
16629+ export class StatementCoverage {
16630+ /**
16631+ * The number of times this statement was executed, or a boolean indicating
16632+ * whether it was executed if the exact count is unknown. If zero or false,
16633+ * the statement will be marked as un-covered.
16634+ */
16635+ executed: number | boolean;
16636+
16637+ /**
16638+ * Statement location.
16639+ */
16640+ location: Position | Range;
16641+
16642+ /**
16643+ * Coverage from branches of this line or statement. If it's not a
16644+ * conditional, this will be empty.
16645+ */
16646+ branches: BranchCoverage[];
16647+
16648+ /**
16649+ * @param location The statement position.
16650+ * @param executed The number of times this statement was executed, or a
16651+ * boolean indicating whether it was executed if the exact count is
16652+ * unknown. If zero or false, the statement will be marked as un-covered.
16653+ * @param branches Coverage from branches of this line. If it's not a
16654+ * conditional, this should be omitted.
16655+ */
16656+ constructor(executed: number | boolean, location: Position | Range, branches?: BranchCoverage[]);
16657+ }
16658+
16659+ /**
16660+ * Contains coverage information for a branch of a {@link StatementCoverage}.
16661+ */
16662+ export class BranchCoverage {
16663+ /**
16664+ * The number of times this branch was executed, or a boolean indicating
16665+ * whether it was executed if the exact count is unknown. If zero or false,
16666+ * the branch will be marked as un-covered.
16667+ */
16668+ executed: number | boolean;
16669+
16670+ /**
16671+ * Branch location.
16672+ */
16673+ location?: Position | Range;
16674+
16675+ /**
16676+ * Label for the branch, used in the context of "the ${label} branch was
16677+ * not taken," for example.
16678+ */
16679+ label?: string;
16680+
16681+ /**
16682+ * @param executed The number of times this branch was executed, or a
16683+ * boolean indicating whether it was executed if the exact count is
16684+ * unknown. If zero or false, the branch will be marked as un-covered.
16685+ * @param location The branch position.
16686+ */
16687+ constructor(executed: number | boolean, location?: Position | Range, label?: string);
16688+ }
16689+
16690+ /**
16691+ * Contains coverage information for a declaration. Depending on the reporter
16692+ * and language, this may be types such as functions, methods, or namespaces.
16693+ */
16694+ export class DeclarationCoverage {
16695+ /**
16696+ * Name of the declaration.
16697+ */
16698+ name: string;
16699+
16700+ /**
16701+ * The number of times this declaration was executed, or a boolean
16702+ * indicating whether it was executed if the exact count is unknown. If
16703+ * zero or false, the declaration will be marked as un-covered.
16704+ */
16705+ executed: number | boolean;
16706+
16707+ /**
16708+ * Declaration location.
16709+ */
16710+ location: Position | Range;
16711+
16712+ /**
16713+ * @param executed The number of times this declaration was executed, or a
16714+ * boolean indicating whether it was executed if the exact count is
16715+ * unknown. If zero or false, the declaration will be marked as un-covered.
16716+ * @param location The declaration position.
16717+ */
16718+ constructor(name: string, executed: number | boolean, location: Position | Range);
16719+ }
16720+
16721+ /**
16722+ * Coverage details returned from {@link TestRunProfile.loadDetailedCoverage}.
16723+ */
16724+ export type FileCoverageDetail = StatementCoverage | DeclarationCoverage;
16725+
1653016726 /**
1653116727 * Thenable is a common denominator between ES6 promises, Q, jquery.Deferred, WinJS.Promise,
1653216728 * and others. This API makes no assumption about what promise library is being used which
0 commit comments