diff --git a/README.md b/README.md index 769e10f..56cb0c0 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,8 @@ ## Visual Studio Code Extension Development for Deno -https://deno.land/x/vscode +- https://deno.land/x/vscode +- https://jsr.io/@narumincho/vscode modified for Deno from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/vscode/index.d.ts @@ -10,10 +11,7 @@ https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/vscode/inde esbuild or something similar should be used. ( https://deno.land/x/esbuild ) ```ts -import { - ExtensionContext, - importVsCodeApi, -} from "https://deno.land/x/vscode@1.87.0/mod.ts"; +import { ExtensionContext, importVsCodeApi } from "jsr:@narumincho/vscode"; export function activate(context: ExtensionContext) { const vscode = importVsCodeApi(); diff --git a/deno.json b/deno.json index 9b1291b..e1fb55e 100644 --- a/deno.json +++ b/deno.json @@ -1,5 +1,5 @@ { "name": "@narumincho/vscode", - "version": "1.87.0", + "version": "1.88.0", "exports": "./mod.ts" } diff --git a/gen/Cargo.lock b/gen/Cargo.lock index 9a9e916..a44be03 100644 --- a/gen/Cargo.lock +++ b/gen/Cargo.lock @@ -38,9 +38,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.80" +version = "1.0.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ad32ce52e4161730f7098c077cd2ed6229b5804ccf99e5366be1ab72a98b4e1" +checksum = "0952808a6c2afd1aa8947271f3a60f1a6763c7b912d210184c5149b5cf147247" [[package]] name = "ast_node" @@ -179,9 +179,9 @@ dependencies = [ [[package]] name = "errno" -version = "0.3.2" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b30f669a7961ef1631673d2766cc92f52d64f7ef354d4fe0ddfd30ed52f0f4f" +checksum = "add4f07d43996f76ef320709726a556a9d4f965d9410d8d0271132d2f8293480" dependencies = [ "errno-dragonfly", "libc", @@ -200,9 +200,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764" +checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" [[package]] name = "fnv" @@ -495,9 +495,9 @@ checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" [[package]] name = "linux-raw-sys" -version = "0.4.5" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57bcfdad1b858c2db7c38303a6d2ad4dfaf5eb53dfeb0910128b2c26d6158503" +checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" [[package]] name = "lock_api" @@ -661,9 +661,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.90" +version = "0.9.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "374533b0e45f3a7ced10fcaeccca020e66656bc03dac384f852e4e5a7a8104a6" +checksum = "db4d56a4c0478783083cfafcc42493dd4a981d41669da64b4572a2a089b51b1d" dependencies = [ "cc", "libc", @@ -857,9 +857,9 @@ checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2" [[package]] name = "reqwest" -version = "0.11.24" +version = "0.11.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6920094eb85afde5e4a138be3f2de8bbdf28000f0029e72c45025a56b042251" +checksum = "dd67538700a17451e7cba03ac727fb961abb7607553461627b97de0b89cf4a62" dependencies = [ "base64", "bytes", @@ -918,9 +918,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.6" +version = "0.38.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ee020b1716f0a80e2ace9b03441a749e402e86712f15f16fe8a8f75afac732f" +checksum = "f25469e9ae0f3d0047ca8b93fc56843f38e6774f0914a107ff8b41be8be8e0b7" dependencies = [ "bitflags 2.4.1", "errno", @@ -1374,9 +1374,9 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.7.0" +version = "3.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5486094ee78b2e5038a6382ed7645bc084dc2ec433426ca4c3cb61e2007b8998" +checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef" dependencies = [ "cfg-if", "fastrand", @@ -1387,18 +1387,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.57" +version = "1.0.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e45bcbe8ed29775f228095caf2cd67af7a4ccf756ebff23a306bf3e8b47b24b" +checksum = "03468839009160513471e86a034bb2c5c0e4baae3b43f79ffc55c4a5427b3297" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.57" +version = "1.0.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81" +checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7" dependencies = [ "proc-macro2", "quote", @@ -1422,9 +1422,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.36.0" +version = "1.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931" +checksum = "1adbebffeca75fcfd058afa480fb6c0b81e165a0323f9c9d39c9697e37c46787" dependencies = [ "backtrace", "bytes", diff --git a/gen/Cargo.toml b/gen/Cargo.toml index 9f485cb..52a343a 100644 --- a/gen/Cargo.toml +++ b/gen/Cargo.toml @@ -6,10 +6,10 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -tokio = { version = "1.36.0", features = ["macros", "rt-multi-thread"] } -anyhow = "1.0.80" -reqwest = "0.11.24" -thiserror = "1.0.57" +tokio = { version = "1.37.0", features = ["macros", "rt-multi-thread"] } +anyhow = "1.0.81" +reqwest = "0.11.27" +thiserror = "1.0.58" swc_atoms = "0.5.9" swc_common = "0.31.22" swc_ecma_parser = "0.137.16" diff --git a/gen/out.ts b/gen/out.ts index 1fd7558..cecea65 100644 --- a/gen/out.ts +++ b/gen/out.ts @@ -3132,17 +3132,12 @@ Returns VSCodeApi only within the vscode extension. * for file changes recursively. * * Additional paths can be added for file watching by providing a {@link RelativePattern} with - * a `base` path to watch. If the `pattern` is complex (e.g. contains `**` or path segments), - * the path will be watched recursively and otherwise will be watched non-recursively (i.e. only - * changes to the first level of the path will be reported). - * - * *Note* that requests for recursive file watchers for a `base` path that is inside the opened - * workspace are ignored given all opened {@link workspace.workspaceFolders workspace folders} are - * watched for file changes recursively by default. Non-recursive file watchers however are always - * supported, even inside the opened workspace because they allow to bypass the configured settings - * for excludes (`files.watcherExclude`). If you need to watch in a location that is typically - * excluded (for example `node_modules` or `.git` folder), then you can use a non-recursive watcher - * in the workspace for this purpose. + * a `base` path to watch. If the path is a folder and the `pattern` is complex (e.g. contains + * `**` or path segments), it will be watched recursively and otherwise will be watched + * non-recursively (i.e. only changes to the first level of the path will be reported). + * + * *Note* that paths must exist in the file system to be watched. File watching may stop when + * the watched path is renamed or deleted. * * If possible, keep the use of recursive watchers to a minimum because recursive file watching * is quite resource intense. @@ -4752,6 +4747,66 @@ Returns VSCodeApi only within the vscode extension. * @param message The message to show to the user. */ new(message: string | MarkdownString): TestMessage; }; + /** + * A class that contains information about a covered resource. A count can + * be give for lines, branches, and declarations in a file. + */ readonly TestCoverageCount: { + /** + * @param covered Value for {@link TestCoverageCount.covered} + * @param total Value for {@link TestCoverageCount.total} + */ new(covered: number, total: number): TestCoverageCount; + }; + /** + * Contains coverage metadata for a file. + */ readonly FileCoverage: { + /** + * Creates a {@link FileCoverage} instance with counts filled in from + * the coverage details. + * @param uri Covered file URI + * @param detailed Detailed coverage information + */ fromDetails(uri: Uri, details: readonly FileCoverageDetail[]): FileCoverage; + /** + * @param uri Covered file URI + * @param statementCoverage Statement coverage information. If the reporter + * does not provide statement coverage information, this can instead be + * used to represent line coverage. + * @param branchCoverage Branch coverage information + * @param declarationCoverage Declaration coverage information + */ new(uri: Uri, statementCoverage: TestCoverageCount, branchCoverage?: TestCoverageCount, declarationCoverage?: TestCoverageCount): FileCoverage; + }; + /** + * Contains coverage information for a single statement or line. + */ readonly StatementCoverage: { + /** + * @param location The statement position. + * @param executed The number of times this statement was executed, or a + * boolean indicating whether it was executed if the exact count is + * unknown. If zero or false, the statement will be marked as un-covered. + * @param branches Coverage from branches of this line. If it's not a + * conditional, this should be omitted. + */ new(executed: number | boolean, location: Position | Range, branches?: BranchCoverage[]): StatementCoverage; + }; + /** + * Contains coverage information for a branch of a {@link StatementCoverage}. + */ readonly BranchCoverage: { + /** + * @param executed The number of times this branch was executed, or a + * boolean indicating whether it was executed if the exact count is + * unknown. If zero or false, the branch will be marked as un-covered. + * @param location The branch position. + */ new(executed: number | boolean, location?: Position | Range, label?: string): BranchCoverage; + }; + /** + * Contains coverage information for a declaration. Depending on the reporter + * and language, this may be types such as functions, methods, or namespaces. + */ readonly DeclarationCoverage: { + /** + * @param executed The number of times this declaration was executed, or a + * boolean indicating whether it was executed if the exact count is + * unknown. If zero or false, the declaration will be marked as un-covered. + * @param location The declaration position. + */ new(name: string, executed: number | boolean, location: Position | Range): DeclarationCoverage; + }; /** * The tab represents a single text based resource. */ readonly TabInputText: { @@ -5660,14 +5715,14 @@ type ValueOf = T[keyof T]; */ export interface TextEditorEdit { /** * Replace a certain text region with a new value. - * You can use \r\n or \n in `value` and they will be normalized to the current {@link TextDocument document}. + * You can use `\r\n` or `\n` in `value` and they will be normalized to the current {@link TextDocument document}. * * @param location The range this operation should remove. * @param value The new text this operation should insert after removing `location`. */ replace(location: Position | Range | Selection, value: string): void; /** * Insert text at a location. - * You can use \r\n or \n in `value` and they will be normalized to the current {@link TextDocument document}. + * You can use `\r\n` or `\n` in `value` and they will be normalized to the current {@link TextDocument document}. * Although the equivalent text edit can be made with {@link TextEditorEdit.replace replace}, `insert` will produce a different resulting selection (it will get moved). * * @param location The position where the new text should be inserted. @@ -5721,7 +5776,7 @@ type ValueOf = T[keyof T]; * ```ts * const u = URI.parse('file://server/c$/folder/file.txt') * u.authority === 'server' - * u.path === '/shares/c$/file.txt' + * u.path === '/c$/folder/file.txt' * u.fsPath === '\\server\c$\folder\file.txt' * ``` */ readonly fsPath: string; @@ -9232,7 +9287,7 @@ type ValueOf = T[keyof T]; * * @param text The text to send. * @param shouldExecute Indicates that the text being sent should be executed rather than just inserted in the terminal. - * The character(s) added are \n or \r\n, depending on the platform. This defaults to `true`. + * The character(s) added are `\n` or `\r\n`, depending on the platform. This defaults to `true`. */ sendText(text: string, shouldExecute?: boolean): void; /** * Show the terminal panel and reveal this terminal in the UI. @@ -11483,7 +11538,7 @@ type ValueOf = T[keyof T]; * until `Terminal.show` is called. The typical usage for this is when you need to run * something that may need interactivity but only want to tell the user about it when * interaction is needed. Note that the terminals will still be exposed to all extensions - * as normal and they will remain hidden when the workspace is reloaded. + * as normal. The hidden terminals will not be restored when the workspace is next opened. */ hideFromUser?: boolean; /** * A message to write to the terminal on first launch, note that this is not sent to the @@ -13966,6 +14021,15 @@ type ValueOf = T[keyof T]; * instances associated with the request will be * automatically cancelled as well. */ runHandler: (request: TestRunRequest, token: CancellationToken) => Thenable | void; + /** + * An extension-provided function that provides detailed statement and + * function-level coverage for a file. The editor will call this when more + * detail is needed for a file, such as when it's opened in an editor or + * expanded in the **Test Coverage** view. + * + * The {@link FileCoverage} object passed to this function is the same instance + * emitted on {@link TestRun.addCoverage} calls associated with this profile. + */ loadDetailedCoverage?: (testRun: TestRun, fileCoverage: FileCoverage, token: CancellationToken) => Thenable; /** * Deletes the run profile. */ dispose(): void; @@ -14184,10 +14248,17 @@ type ValueOf = T[keyof T]; * location. * @param test Test item to associate the output with. */ appendOutput(output: string, location?: Location, test?: TestItem): void; + /** + * Adds coverage for a file in the run. + */ addCoverage(fileCoverage: FileCoverage): void; /** * Signals the end of the test run. Any tests included in the run whose * states have not been updated will have their state reset. */ end(): void; + /** + * An event fired when the editor is no longer interested in data + * associated with the test run. + */ onDidDispose: Event; } /** * Collection of test items, found in {@link TestItem.children} and @@ -14333,6 +14404,86 @@ type ValueOf = T[keyof T]; * - `message`: the {@link TestMessage} instance. */ contextValue?: string; }; +/** + * A class that contains information about a covered resource. A count can + * be give for lines, branches, and declarations in a file. + */ export type TestCoverageCount = { + /** + * Number of items covered in the file. + */ covered: number; + /** + * Total number of covered items in the file. + */ total: number; +}; +/** + * Contains coverage metadata for a file. + */ export type FileCoverage = { + /** + * File URI. + */ readonly uri: Uri; + /** + * Statement coverage information. If the reporter does not provide statement + * coverage information, this can instead be used to represent line coverage. + */ statementCoverage: TestCoverageCount; + /** + * Branch coverage information. + */ branchCoverage?: TestCoverageCount; + /** + * Declaration coverage information. Depending on the reporter and + * language, this may be types such as functions, methods, or namespaces. + */ declarationCoverage?: TestCoverageCount; +}; +/** + * Contains coverage information for a single statement or line. + */ export type StatementCoverage = { + /** + * The number of times this statement was executed, or a boolean indicating + * whether it was executed if the exact count is unknown. If zero or false, + * the statement will be marked as un-covered. + */ executed: number | boolean; + /** + * Statement location. + */ location: Position | Range; + /** + * Coverage from branches of this line or statement. If it's not a + * conditional, this will be empty. + */ branches: BranchCoverage[]; +}; +/** + * Contains coverage information for a branch of a {@link StatementCoverage}. + */ export type BranchCoverage = { + /** + * The number of times this branch was executed, or a boolean indicating + * whether it was executed if the exact count is unknown. If zero or false, + * the branch will be marked as un-covered. + */ executed: number | boolean; + /** + * Branch location. + */ location?: Position | Range; + /** + * Label for the branch, used in the context of "the ${label} branch was + * not taken," for example. + */ label?: string; +}; +/** + * Contains coverage information for a declaration. Depending on the reporter + * and language, this may be types such as functions, methods, or namespaces. + */ export type DeclarationCoverage = { + /** + * Name of the declaration. + */ name: string; + /** + * The number of times this declaration was executed, or a boolean + * indicating whether it was executed if the exact count is unknown. If + * zero or false, the declaration will be marked as un-covered. + */ executed: number | boolean; + /** + * Declaration location. + */ location: Position | Range; +}; +/** + * Coverage details returned from {@link TestRunProfile.loadDetailedCoverage}. + */ export type FileCoverageDetail = StatementCoverage | DeclarationCoverage; /** * The tab represents a single text based resource. */ export type TabInputText = { diff --git a/mod.ts b/mod.ts index 3bd506f..dd55905 100644 --- a/mod.ts +++ b/mod.ts @@ -3466,17 +3466,12 @@ Returns VSCodeApi only within the vscode extension. * for file changes recursively. * * Additional paths can be added for file watching by providing a {@link RelativePattern} with - * a `base` path to watch. If the `pattern` is complex (e.g. contains `**` or path segments), - * the path will be watched recursively and otherwise will be watched non-recursively (i.e. only - * changes to the first level of the path will be reported). - * - * *Note* that requests for recursive file watchers for a `base` path that is inside the opened - * workspace are ignored given all opened {@link workspace.workspaceFolders workspace folders} are - * watched for file changes recursively by default. Non-recursive file watchers however are always - * supported, even inside the opened workspace because they allow to bypass the configured settings - * for excludes (`files.watcherExclude`). If you need to watch in a location that is typically - * excluded (for example `node_modules` or `.git` folder), then you can use a non-recursive watcher - * in the workspace for this purpose. + * a `base` path to watch. If the path is a folder and the `pattern` is complex (e.g. contains + * `**` or path segments), it will be watched recursively and otherwise will be watched + * non-recursively (i.e. only changes to the first level of the path will be reported). + * + * *Note* that paths must exist in the file system to be watched. File watching may stop when + * the watched path is renamed or deleted. * * If possible, keep the use of recursive watchers to a minimum because recursive file watching * is quite resource intense. @@ -5321,6 +5316,86 @@ Returns VSCodeApi only within the vscode extension. * @param message The message to show to the user. */ new (message: string | MarkdownString): TestMessage; }; + /** + * A class that contains information about a covered resource. A count can + * be give for lines, branches, and declarations in a file. + */ readonly TestCoverageCount: { + /** + * @param covered Value for {@link TestCoverageCount.covered} + * @param total Value for {@link TestCoverageCount.total} + */ new (covered: number, total: number): TestCoverageCount; + }; + /** + * Contains coverage metadata for a file. + */ readonly FileCoverage: { + /** + * Creates a {@link FileCoverage} instance with counts filled in from + * the coverage details. + * @param uri Covered file URI + * @param detailed Detailed coverage information + */ fromDetails( + uri: Uri, + details: readonly FileCoverageDetail[], + ): FileCoverage; + /** + * @param uri Covered file URI + * @param statementCoverage Statement coverage information. If the reporter + * does not provide statement coverage information, this can instead be + * used to represent line coverage. + * @param branchCoverage Branch coverage information + * @param declarationCoverage Declaration coverage information + */ new ( + uri: Uri, + statementCoverage: TestCoverageCount, + branchCoverage?: TestCoverageCount, + declarationCoverage?: TestCoverageCount, + ): FileCoverage; + }; + /** + * Contains coverage information for a single statement or line. + */ readonly StatementCoverage: { + /** + * @param location The statement position. + * @param executed The number of times this statement was executed, or a + * boolean indicating whether it was executed if the exact count is + * unknown. If zero or false, the statement will be marked as un-covered. + * @param branches Coverage from branches of this line. If it's not a + * conditional, this should be omitted. + */ new ( + executed: number | boolean, + location: Position | Range, + branches?: BranchCoverage[], + ): StatementCoverage; + }; + /** + * Contains coverage information for a branch of a {@link StatementCoverage}. + */ readonly BranchCoverage: { + /** + * @param executed The number of times this branch was executed, or a + * boolean indicating whether it was executed if the exact count is + * unknown. If zero or false, the branch will be marked as un-covered. + * @param location The branch position. + */ new ( + executed: number | boolean, + location?: Position | Range, + label?: string, + ): BranchCoverage; + }; + /** + * Contains coverage information for a declaration. Depending on the reporter + * and language, this may be types such as functions, methods, or namespaces. + */ readonly DeclarationCoverage: { + /** + * @param executed The number of times this declaration was executed, or a + * boolean indicating whether it was executed if the exact count is + * unknown. If zero or false, the declaration will be marked as un-covered. + * @param location The declaration position. + */ new ( + name: string, + executed: number | boolean, + location: Position | Range, + ): DeclarationCoverage; + }; /** * The tab represents a single text based resource. */ readonly TabInputText: { @@ -6257,14 +6332,14 @@ type ValueOf = T[keyof T]; */ export interface TextEditorEdit { /** * Replace a certain text region with a new value. - * You can use \r\n or \n in `value` and they will be normalized to the current {@link TextDocument document}. + * You can use `\r\n` or `\n` in `value` and they will be normalized to the current {@link TextDocument document}. * * @param location The range this operation should remove. * @param value The new text this operation should insert after removing `location`. */ replace(location: Position | Range | Selection, value: string): void; /** * Insert text at a location. - * You can use \r\n or \n in `value` and they will be normalized to the current {@link TextDocument document}. + * You can use `\r\n` or `\n` in `value` and they will be normalized to the current {@link TextDocument document}. * Although the equivalent text edit can be made with {@link TextEditorEdit.replace replace}, `insert` will produce a different resulting selection (it will get moved). * * @param location The position where the new text should be inserted. @@ -6318,7 +6393,7 @@ type ValueOf = T[keyof T]; * ```ts * const u = URI.parse('file://server/c$/folder/file.txt') * u.authority === 'server' - * u.path === '/shares/c$/file.txt' + * u.path === '/c$/folder/file.txt' * u.fsPath === '\\server\c$\folder\file.txt' * ``` */ readonly fsPath: string; @@ -10102,7 +10177,7 @@ type ValueOf = T[keyof T]; * * @param text The text to send. * @param shouldExecute Indicates that the text being sent should be executed rather than just inserted in the terminal. - * The character(s) added are \n or \r\n, depending on the platform. This defaults to `true`. + * The character(s) added are `\n` or `\r\n`, depending on the platform. This defaults to `true`. */ sendText(text: string, shouldExecute?: boolean): void; /** * Show the terminal panel and reveal this terminal in the UI. @@ -12437,7 +12512,7 @@ type ValueOf = T[keyof T]; * until `Terminal.show` is called. The typical usage for this is when you need to run * something that may need interactivity but only want to tell the user about it when * interaction is needed. Note that the terminals will still be exposed to all extensions - * as normal and they will remain hidden when the workspace is reloaded. + * as normal. The hidden terminals will not be restored when the workspace is next opened. */ hideFromUser?: boolean; /** * A message to write to the terminal on first launch, note that this is not sent to the @@ -15041,6 +15116,19 @@ type ValueOf = T[keyof T]; request: TestRunRequest, token: CancellationToken, ) => Thenable | void; + /** + * An extension-provided function that provides detailed statement and + * function-level coverage for a file. The editor will call this when more + * detail is needed for a file, such as when it's opened in an editor or + * expanded in the **Test Coverage** view. + * + * The {@link FileCoverage} object passed to this function is the same instance + * emitted on {@link TestRun.addCoverage} calls associated with this profile. + */ loadDetailedCoverage?: ( + testRun: TestRun, + fileCoverage: FileCoverage, + token: CancellationToken, + ) => Thenable; /** * Deletes the run profile. */ dispose(): void; @@ -15283,10 +15371,17 @@ type ValueOf = T[keyof T]; * location. * @param test Test item to associate the output with. */ appendOutput(output: string, location?: Location, test?: TestItem): void; + /** + * Adds coverage for a file in the run. + */ addCoverage(fileCoverage: FileCoverage): void; /** * Signals the end of the test run. Any tests included in the run whose * states have not been updated will have their state reset. */ end(): void; + /** + * An event fired when the editor is no longer interested in data + * associated with the test run. + */ onDidDispose: Event; } /** * Collection of test items, found in {@link TestItem.children} and @@ -15436,6 +15531,86 @@ type ValueOf = T[keyof T]; * - `message`: the {@link TestMessage} instance. */ contextValue?: string; }; +/** + * A class that contains information about a covered resource. A count can + * be give for lines, branches, and declarations in a file. + */ export type TestCoverageCount = { + /** + * Number of items covered in the file. + */ covered: number; + /** + * Total number of covered items in the file. + */ total: number; +}; +/** + * Contains coverage metadata for a file. + */ export type FileCoverage = { + /** + * File URI. + */ readonly uri: Uri; + /** + * Statement coverage information. If the reporter does not provide statement + * coverage information, this can instead be used to represent line coverage. + */ statementCoverage: TestCoverageCount; + /** + * Branch coverage information. + */ branchCoverage?: TestCoverageCount; + /** + * Declaration coverage information. Depending on the reporter and + * language, this may be types such as functions, methods, or namespaces. + */ declarationCoverage?: TestCoverageCount; +}; +/** + * Contains coverage information for a single statement or line. + */ export type StatementCoverage = { + /** + * The number of times this statement was executed, or a boolean indicating + * whether it was executed if the exact count is unknown. If zero or false, + * the statement will be marked as un-covered. + */ executed: number | boolean; + /** + * Statement location. + */ location: Position | Range; + /** + * Coverage from branches of this line or statement. If it's not a + * conditional, this will be empty. + */ branches: BranchCoverage[]; +}; +/** + * Contains coverage information for a branch of a {@link StatementCoverage}. + */ export type BranchCoverage = { + /** + * The number of times this branch was executed, or a boolean indicating + * whether it was executed if the exact count is unknown. If zero or false, + * the branch will be marked as un-covered. + */ executed: number | boolean; + /** + * Branch location. + */ location?: Position | Range; + /** + * Label for the branch, used in the context of "the ${label} branch was + * not taken," for example. + */ label?: string; +}; +/** + * Contains coverage information for a declaration. Depending on the reporter + * and language, this may be types such as functions, methods, or namespaces. + */ export type DeclarationCoverage = { + /** + * Name of the declaration. + */ name: string; + /** + * The number of times this declaration was executed, or a boolean + * indicating whether it was executed if the exact count is unknown. If + * zero or false, the declaration will be marked as un-covered. + */ executed: number | boolean; + /** + * Declaration location. + */ location: Position | Range; +}; +/** + * Coverage details returned from {@link TestRunProfile.loadDetailedCoverage}. + */ export type FileCoverageDetail = StatementCoverage | DeclarationCoverage; /** * The tab represents a single text based resource. */ export type TabInputText = {