diff --git a/src/vs/vscode.d.ts b/src/vs/vscode.d.ts index 4ef65fa146e42bfe2269b601755d9d11d6f9520b..edd273928b202c242131417092ce20c8b1c6101b 100644 --- a/src/vs/vscode.d.ts +++ b/src/vs/vscode.d.ts @@ -14102,7 +14102,7 @@ declare module 'vscode' { * Associated tag for the profile. If this is set, only {@link TestItem} * instances with the same tag will be eligible to execute in this profile. */ - tag?: TestTag; + tag: TestTag | undefined; /** * If this method is present, a configuration gear will be present in the @@ -14110,7 +14110,7 @@ declare module 'vscode' { * you can take other editor actions, such as showing a quick pick or * opening a configuration file. */ - configureHandler?: () => void; + configureHandler: (() => void) | undefined; /** * Handler called to start a test run. When invoked, the function should call @@ -14259,7 +14259,7 @@ declare module 'vscode' { * The process of running tests should resolve the children of any test * items who have not yet been resolved. */ - readonly include?: TestItem[]; + readonly include: TestItem[] | undefined; /** * An array of tests the user has marked as excluded from the test included @@ -14268,14 +14268,14 @@ declare module 'vscode' { * May be omitted if no exclusions were requested. Test controllers should * not run excluded tests or any children of excluded tests. */ - readonly exclude?: TestItem[]; + readonly exclude: TestItem[] | undefined; /** * The profile used for this request. This will always be defined * for requests issued from the editor UI, though extensions may * programmatically create requests not associated with any profile. */ - readonly profile?: TestRunProfile; + readonly profile: TestRunProfile | undefined; /** * @param tests Array of specific tests to run, or undefined to run all tests @@ -14294,7 +14294,7 @@ declare module 'vscode' { * disambiguate multiple sets of results in a test run. It is useful if * tests are run across multiple platforms, for example. */ - readonly name?: string; + readonly name: string | undefined; /** * A cancellation token which will be triggered when the test run is @@ -14434,7 +14434,7 @@ declare module 'vscode' { /** * URI this `TestItem` is associated with. May be a file or directory. */ - readonly uri?: Uri; + readonly uri: Uri | undefined; /** * The children of this test item. For a test suite, this may contain the @@ -14447,7 +14447,7 @@ declare module 'vscode' { * top-level items in the {@link TestController.items} and for items that * aren't yet included in another item's {@link children}. */ - readonly parent?: TestItem; + readonly parent: TestItem | undefined; /** * Tags associated with this test item. May be used in combination with @@ -14489,7 +14489,7 @@ declare module 'vscode' { * * This is only meaningful if the `uri` points to a file. */ - range?: Range; + range: Range | undefined; /** * Optional error encountered while loading the test. @@ -14497,7 +14497,7 @@ declare module 'vscode' { * Note that this is not a test result and should only be used to represent errors in * test discovery, such as syntax errors. */ - error?: string | MarkdownString; + error: string | MarkdownString | undefined; } /** diff --git a/src/vs/workbench/api/common/extHostTypeConverters.ts b/src/vs/workbench/api/common/extHostTypeConverters.ts index 1b32b078f3208f6ce6df371fae9258dfb1da631a..8e366e8de4bf1dc54f817cee04cca3b4b623fa07 100644 --- a/src/vs/workbench/api/common/extHostTypeConverters.ts +++ b/src/vs/workbench/api/common/extHostTypeConverters.ts @@ -1728,6 +1728,8 @@ export namespace TestItem { export function toPlain(item: ITestItem): Omit { return { + parent: undefined, + error: undefined, id: TestId.fromString(item.extId).localId, label: item.label, uri: URI.revive(item.uri), diff --git a/src/vs/workbench/api/common/extHostTypes.ts b/src/vs/workbench/api/common/extHostTypes.ts index c81922e38ea3a3eef38ef64cef3de81a7b53c600..fc80501f22cb770a73d5f5c2f6129229976f4b5d 100644 --- a/src/vs/workbench/api/common/extHostTypes.ts +++ b/src/vs/workbench/api/common/extHostTypes.ts @@ -3328,9 +3328,9 @@ export enum TestRunProfileKind { @es5ClassCompat export class TestRunRequest implements vscode.TestRunRequest { constructor( - public readonly include?: vscode.TestItem[], - public readonly exclude?: vscode.TestItem[] | undefined, - public readonly profile?: vscode.TestRunProfile, + public readonly include: vscode.TestItem[] | undefined = undefined, + public readonly exclude: vscode.TestItem[] | undefined = undefined, + public readonly profile: vscode.TestRunProfile | undefined = undefined, ) { } } diff --git a/src/vs/workbench/test/browser/api/extHostTesting.test.ts b/src/vs/workbench/test/browser/api/extHostTesting.test.ts index 486c2537128a0087ac9a6a04f51e76ee8788fc1c..7a5398a7eefb6daa4fce51e54fcb2728ac0c9486 100644 --- a/src/vs/workbench/test/browser/api/extHostTesting.test.ts +++ b/src/vs/workbench/test/browser/api/extHostTesting.test.ts @@ -7,16 +7,16 @@ import * as assert from 'assert'; import { VSBuffer } from 'vs/base/common/buffer'; import { CancellationTokenSource } from 'vs/base/common/cancellation'; import { Iterable } from 'vs/base/common/iterator'; +import { URI } from 'vs/base/common/uri'; import { mockObject, MockObject } from 'vs/base/test/common/mock'; import { MainThreadTestingShape } from 'vs/workbench/api/common/extHost.protocol'; import { TestRunCoordinator, TestRunDto, TestRunProfileImpl } from 'vs/workbench/api/common/extHostTesting'; import * as convert from 'vs/workbench/api/common/extHostTypeConverters'; -import { TestMessage, TestResultState, TestRunProfileKind, TestTag, Location, Position, Range } from 'vs/workbench/api/common/extHostTypes'; +import { Location, Position, Range, TestMessage, TestResultState, TestRunProfileKind, TestRunRequest as TestRunRequestImpl, TestTag } from 'vs/workbench/api/common/extHostTypes'; import { TestDiffOpType, TestItemExpandState, TestMessageType } from 'vs/workbench/contrib/testing/common/testCollection'; import { TestId } from 'vs/workbench/contrib/testing/common/testId'; import { TestItemImpl, testStubs } from 'vs/workbench/contrib/testing/common/testStubs'; import { TestSingleUseCollection } from 'vs/workbench/contrib/testing/test/common/ownedTestCollection'; -import { URI } from 'vs/base/common/uri'; import type { TestItem, TestRunRequest } from 'vscode'; const simplify = (item: TestItem) => ({ @@ -654,7 +654,7 @@ suite('ExtHost Testing', () => { const childB = new TestItemImpl('ctrlId', 'id-child', 'child', undefined); testB!.children.replace([childB]); - const task1 = c.createTestRun('ctrl', single, {}, 'hello world', false); + const task1 = c.createTestRun('ctrl', single, new TestRunRequestImpl(), 'hello world', false); const tracker = Iterable.first(c.trackers)!; task1.passed(childA);