mirror of
https://github.com/microsoft/vscode.git
synced 2026-07-14 16:04:09 +01:00
testing: fix test document filter not working with parent dirs on windows
For #128824
This commit is contained in:
@@ -737,8 +737,8 @@ const enum FilterResult {
|
||||
Include,
|
||||
}
|
||||
|
||||
const hasNodeInOrParentOfUri = (collection: IMainThreadTestCollection, testUri: URI | string, fromNode?: string) => {
|
||||
testUri = testUri.toString();
|
||||
const hasNodeInOrParentOfUri = (collection: IMainThreadTestCollection, testUri: URI, fromNode?: string) => {
|
||||
const fsPath = testUri.fsPath;
|
||||
|
||||
const queue: Iterable<string>[] = [fromNode ? [fromNode] : collection.rootIds];
|
||||
while (queue.length) {
|
||||
@@ -753,7 +753,7 @@ const hasNodeInOrParentOfUri = (collection: IMainThreadTestCollection, testUri:
|
||||
continue;
|
||||
}
|
||||
|
||||
if (extpath.isEqualOrParent(testUri, node.item.uri.toString())) {
|
||||
if (extpath.isEqualOrParent(fsPath, node.item.uri.fsPath)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -765,7 +765,7 @@ const hasNodeInOrParentOfUri = (collection: IMainThreadTestCollection, testUri:
|
||||
class TestsFilter implements ITreeFilter<TestExplorerTreeElement> {
|
||||
private lastText?: string;
|
||||
private filters: [include: boolean, value: string][] | undefined;
|
||||
private documentUri: string | undefined;
|
||||
private documentUri: URI | undefined;
|
||||
|
||||
constructor(
|
||||
private readonly collection: IMainThreadTestCollection,
|
||||
@@ -826,7 +826,7 @@ class TestsFilter implements ITreeFilter<TestExplorerTreeElement> {
|
||||
}
|
||||
|
||||
public filterToDocumentUri(uri: URI | undefined) {
|
||||
this.documentUri = uri?.toString();
|
||||
this.documentUri = uri;
|
||||
}
|
||||
|
||||
private testState(element: TestItemTreeElement): FilterResult {
|
||||
|
||||
@@ -161,18 +161,18 @@ export const getAllTestsInHierarchy = async (collection: IMainThreadTestCollecti
|
||||
* in strictly descending order.
|
||||
*/
|
||||
export const testsInFile = async function* (collection: IMainThreadTestCollection, uri: URI): AsyncIterable<IncrementalTestCollectionItem> {
|
||||
const demandUriStr = uri.toString();
|
||||
const demandFsPath = uri.fsPath;
|
||||
for (const test of collection.all) {
|
||||
if (!test.item.uri) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const itemUriStr = test.item.uri.toString();
|
||||
if (itemUriStr === demandUriStr) {
|
||||
const itemFsPath = test.item.uri.fsPath;
|
||||
if (itemFsPath === demandFsPath) {
|
||||
yield test;
|
||||
}
|
||||
|
||||
if (extpath.isEqualOrParent(demandUriStr, itemUriStr) && test.expand === TestItemExpandState.Expandable) {
|
||||
if (extpath.isEqualOrParent(demandFsPath, itemFsPath) && test.expand === TestItemExpandState.Expandable) {
|
||||
await collection.expand(test.item.extId, 1);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user