diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d7ec86fcf408..52a80ad7394df 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ ## v1.42.0 - [core] fixed logger level propagation when log config file changes at runtime [#12566](https://github.com/eclipse-theia/theia/pull/12566) - Contributed on behalf of STMicroelectronics +- [vscode] stub TestController invalidateTestResults [#12944](https://github.com/eclipse-theia/theia/pull/12944) - Contributed by STMicroelectronics - [vsx-registry] added a hint to extension fetching ENOTFOUND errors [#12858](https://github.com/eclipse-theia/theia/pull/12858) - Contributed by STMicroelectronics ## v1.41.0 - 08/31/2023 diff --git a/packages/plugin-ext/src/plugin/plugin-context.ts b/packages/plugin-ext/src/plugin/plugin-context.ts index 0e73c0d34f9df..0f44efee200fa 100644 --- a/packages/plugin-ext/src/plugin/plugin-context.ts +++ b/packages/plugin-ext/src/plugin/plugin-context.ts @@ -232,7 +232,8 @@ import { createRunProfile, createTestRun, testItemCollection, - createTestItem + createTestItem, + invalidateTestResults } from './stubs/tests-api'; import { TimelineExtImpl } from './timeline'; import { ThemingExtImpl } from './theming'; @@ -1010,6 +1011,7 @@ export function createAPIFactory( createRunProfile, createTestRun, createTestItem, + invalidateTestResults, dispose: () => undefined, }; }, diff --git a/packages/plugin-ext/src/plugin/stubs/tests-api.ts b/packages/plugin-ext/src/plugin/stubs/tests-api.ts index 79a896de20562..16b06b2ec5597 100644 --- a/packages/plugin-ext/src/plugin/stubs/tests-api.ts +++ b/packages/plugin-ext/src/plugin/stubs/tests-api.ts @@ -96,3 +96,7 @@ export const createTestItem = ( range: undefined, error: undefined, }); + +export const invalidateTestResults = ( + items?: theia.TestItem | readonly theia.TestItem[] +): void => undefined; diff --git a/packages/plugin/src/theia.d.ts b/packages/plugin/src/theia.d.ts index 59c8d7374cdc4..0a2e5130eb1a2 100644 --- a/packages/plugin/src/theia.d.ts +++ b/packages/plugin/src/theia.d.ts @@ -15980,6 +15980,25 @@ export module '@theia/plugin' { */ createTestItem(id: string, label: string, uri?: Uri): TestItem; + /** + * Marks an item's results as being outdated. This is commonly called when + * code or configuration changes and previous results should no longer + * be considered relevant. The same logic used to mark results as outdated + * may be used to drive {@link TestRunRequest.continuous continuous test runs}. + * + * If an item is passed to this method, test results for the item and all of + * its children will be marked as outdated. If no item is passed, then all + * test owned by the TestController will be marked as outdated. + * + * Any test runs started before the moment this method is called, including + * runs which may still be ongoing, will be marked as outdated and deprioritized + * in the editor's UI. + * + * @param item Item to mark as outdated. If undefined, all the controller's items are marked outdated. + * @stubbed + */ + invalidateTestResults(items?: TestItem | readonly TestItem[]): void; + /** * Unregisters the test controller, disposing of its associated tests * and unpersisted results.