testing: remove data from TestItems

Data was viral and spread generics all over the place. It was also
hard to type correctly and consistently, which ended up in the type
being `any` unless great care was taken.

This removes the `data`. Instead, consumers can use a `WeakMap<TestItem, T>`
to keep data associated with the test item. This is a similar pattern
to what is used to store data about documents and debug sessions, for
example. Here's an example of a migration:

8fdf822985 (diff-2fe3ad6ad19447c57c5db14c5a6ccb5544944494db6b909540d70ea499784b49R9)
This commit is contained in:
Connor Peet
2021-06-24 11:54:07 -07:00
parent 44445888fa
commit 6a76c62232
6 changed files with 87 additions and 86 deletions

View File

@@ -18,7 +18,7 @@ export type ExtHostTestItemEvent =
| [evt: ExtHostTestItemEventType.NewChild, item: TestItemImpl]
| [evt: ExtHostTestItemEventType.Disposed]
| [evt: ExtHostTestItemEventType.Invalidated]
| [evt: ExtHostTestItemEventType.SetProp, key: keyof vscode.TestItem<never>, value: any];
| [evt: ExtHostTestItemEventType.SetProp, key: keyof vscode.TestItem, value: any];
export interface IExtHostTestItemApi {
children: Map<string, TestItemImpl>;