mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-26 11:38:51 +01:00
testing: make test ids locally unique, instead of globally unique
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { TestIdPathParts } from 'vs/workbench/contrib/testing/common/testId';
|
||||
import * as vscode from 'vscode';
|
||||
|
||||
export const enum ExtHostTestItemEventOp {
|
||||
@@ -242,6 +243,9 @@ export class TestItemImpl implements vscode.TestItem {
|
||||
*/
|
||||
constructor(id: string, label: string, uri: vscode.Uri | undefined) {
|
||||
const api = getPrivateApiFor(this);
|
||||
if (id.includes(TestIdPathParts.Delimiter)) {
|
||||
throw new Error(`Test IDs may not include the ${JSON.stringify(id)} symbol`);
|
||||
}
|
||||
|
||||
Object.defineProperties(this, {
|
||||
id: {
|
||||
@@ -256,7 +260,9 @@ export class TestItemImpl implements vscode.TestItem {
|
||||
},
|
||||
parent: {
|
||||
enumerable: false,
|
||||
get() { return api.parent; },
|
||||
get() {
|
||||
return api.parent instanceof TestItemRootImpl ? undefined : api.parent;
|
||||
},
|
||||
},
|
||||
children: {
|
||||
value: createTestItemCollection(this),
|
||||
@@ -272,3 +278,9 @@ export class TestItemImpl implements vscode.TestItem {
|
||||
getPrivateApiFor(this).listener?.({ op: ExtHostTestItemEventOp.Invalidated });
|
||||
}
|
||||
}
|
||||
|
||||
export class TestItemRootImpl extends TestItemImpl {
|
||||
constructor(controllerId: string, label: string) {
|
||||
super(controllerId, label, undefined);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user