testing: bump distro and make document polyfill work again
This commit is contained in:
parent
c67ac5d083
commit
1d951484ed
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "code-oss-dev",
|
"name": "code-oss-dev",
|
||||||
"version": "1.56.0",
|
"version": "1.56.0",
|
||||||
"distro": "900923200327a1b5ecf3ad8dc533af4de84bafd1",
|
"distro": "2751b4612f181f4eda7f028a00618bec192eef66",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Microsoft Corporation"
|
"name": "Microsoft Corporation"
|
||||||
},
|
},
|
||||||
|
|
|
@ -623,6 +623,7 @@ export class TestItemFilteredWrapper extends TestItemImpl {
|
||||||
this.description = actual.description;
|
this.description = actual.description;
|
||||||
this.error = actual.error;
|
this.error = actual.error;
|
||||||
this.status = actual.status;
|
this.status = actual.status;
|
||||||
|
this.resolveHandler = actual.resolveHandler;
|
||||||
|
|
||||||
const wrapperApi = getPrivateApiFor(this);
|
const wrapperApi = getPrivateApiFor(this);
|
||||||
const actualApi = getPrivateApiFor(actual);
|
const actualApi = getPrivateApiFor(actual);
|
||||||
|
@ -654,10 +655,10 @@ export class TestItemFilteredWrapper extends TestItemImpl {
|
||||||
// filter. Synchronize them.
|
// filter. Synchronize them.
|
||||||
for (const rawChild of this.actual.children.values()) {
|
for (const rawChild of this.actual.children.values()) {
|
||||||
const wrapper = TestItemFilteredWrapper.getWrapperForTestItem(rawChild, this.filterDocument, this);
|
const wrapper = TestItemFilteredWrapper.getWrapperForTestItem(rawChild, this.filterDocument, this);
|
||||||
if (wrapper.hasNodeMatchingFilter) {
|
if (!wrapper.hasNodeMatchingFilter) {
|
||||||
this.addChild(wrapper);
|
|
||||||
} else {
|
|
||||||
wrapper.dispose();
|
wrapper.dispose();
|
||||||
|
} else if (!this.children.has(wrapper.id)) {
|
||||||
|
this.addChild(wrapper);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -670,6 +671,14 @@ export class TestItemFilteredWrapper extends TestItemImpl {
|
||||||
|
|
||||||
return this._cachedMatchesFilter;
|
return this._cachedMatchesFilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override dispose() {
|
||||||
|
if (this.actualParent) {
|
||||||
|
getPrivateApiFor(this.actualParent).children.delete(this.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
getPrivateApiFor(this).bus.fire([ExtHostTestItemEventType.Disposed]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -10,8 +10,8 @@ import { TestItemImpl, TestItemStatus, TestResultState } from 'vs/workbench/api/
|
||||||
export { TestItemImpl, TestResultState } from 'vs/workbench/api/common/extHostTypes';
|
export { TestItemImpl, TestResultState } from 'vs/workbench/api/common/extHostTypes';
|
||||||
export * as Convert from 'vs/workbench/api/common/extHostTypeConverters';
|
export * as Convert from 'vs/workbench/api/common/extHostTypeConverters';
|
||||||
|
|
||||||
export const stubTest = (label: string, idPrefix = 'id-', children: TestItemImpl[] = []): TestItemImpl => {
|
export const stubTest = (label: string, idPrefix = 'id-', children: TestItemImpl[] = [], uri = URI.file('/')): TestItemImpl => {
|
||||||
const item = new TestItemImpl(idPrefix + label, label, URI.file('/'), undefined);
|
const item = new TestItemImpl(idPrefix + label, label, uri, undefined);
|
||||||
if (children.length) {
|
if (children.length) {
|
||||||
item.status = TestItemStatus.Pending;
|
item.status = TestItemStatus.Pending;
|
||||||
item.resolveHandler = () => {
|
item.resolveHandler = () => {
|
||||||
|
|
|
@ -4,11 +4,14 @@
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
import * as assert from 'assert';
|
import * as assert from 'assert';
|
||||||
|
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||||
|
import { URI } from 'vs/base/common/uri';
|
||||||
|
import { createDefaultDocumentTestRoot, TestItemFilteredWrapper } from 'vs/workbench/api/common/extHostTesting';
|
||||||
import * as convert from 'vs/workbench/api/common/extHostTypeConverters';
|
import * as convert from 'vs/workbench/api/common/extHostTypeConverters';
|
||||||
import { TestDiffOpType, TestItemExpandState } from 'vs/workbench/contrib/testing/common/testCollection';
|
import { TestDiffOpType, TestItemExpandState } from 'vs/workbench/contrib/testing/common/testCollection';
|
||||||
import { stubTest, testStubs } from 'vs/workbench/contrib/testing/common/testStubs';
|
import { stubTest, TestItemImpl, testStubs } from 'vs/workbench/contrib/testing/common/testStubs';
|
||||||
import { TestOwnedTestCollection, TestSingleUseCollection } from 'vs/workbench/contrib/testing/test/common/ownedTestCollection';
|
import { TestOwnedTestCollection, TestSingleUseCollection } from 'vs/workbench/contrib/testing/test/common/ownedTestCollection';
|
||||||
import { TestItem } from 'vscode';
|
import { TestItem, TextDocument } from 'vscode';
|
||||||
|
|
||||||
const simplify = (item: TestItem<unknown>) => ({
|
const simplify = (item: TestItem<unknown>) => ({
|
||||||
id: item.id,
|
id: item.id,
|
||||||
|
@ -164,284 +167,256 @@ suite('ExtHost Testing', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// todo@connor4312: re-renable when we figure out what observing looks like we async children
|
suite('MirroredTestCollection', () => {
|
||||||
// suite('MirroredTestCollection', () => {
|
// todo@connor4312: re-renable when we figure out what observing looks like we async children
|
||||||
// let m: TestMirroredCollection;
|
// let m: TestMirroredCollection;
|
||||||
// setup(() => m = new TestMirroredCollection());
|
// setup(() => m = new TestMirroredCollection());
|
||||||
|
|
||||||
// test('mirrors creation of the root', () => {
|
// test('mirrors creation of the root', () => {
|
||||||
// const tests = testStubs.nested();
|
// const tests = testStubs.nested();
|
||||||
// single.addRoot(tests, 'pid');
|
// single.addRoot(tests, 'pid');
|
||||||
// single.expand('id-root', Infinity);
|
// single.expand('id-root', Infinity);
|
||||||
// m.apply(single.collectDiff());
|
// m.apply(single.collectDiff());
|
||||||
// assertTreesEqual(m.rootTestItems[0], owned.getTestById('id-root')![1].actual);
|
// assertTreesEqual(m.rootTestItems[0], owned.getTestById('id-root')![1].actual);
|
||||||
// assert.strictEqual(m.length, single.itemToInternal.size);
|
// assert.strictEqual(m.length, single.itemToInternal.size);
|
||||||
// });
|
// });
|
||||||
|
|
||||||
// test('mirrors node deletion', () => {
|
// test('mirrors node deletion', () => {
|
||||||
// const tests = testStubs.nested();
|
// const tests = testStubs.nested();
|
||||||
// single.addRoot(tests, 'pid');
|
// single.addRoot(tests, 'pid');
|
||||||
// m.apply(single.collectDiff());
|
// m.apply(single.collectDiff());
|
||||||
// single.expand('id-root', Infinity);
|
// single.expand('id-root', Infinity);
|
||||||
// tests.children!.splice(0, 1);
|
// tests.children!.splice(0, 1);
|
||||||
// single.onItemChange(tests, 'pid');
|
// single.onItemChange(tests, 'pid');
|
||||||
// single.expand('id-root', Infinity);
|
// single.expand('id-root', Infinity);
|
||||||
// m.apply(single.collectDiff());
|
// m.apply(single.collectDiff());
|
||||||
|
|
||||||
// assertTreesEqual(m.rootTestItems[0], owned.getTestById('id-root')![1].actual);
|
// assertTreesEqual(m.rootTestItems[0], owned.getTestById('id-root')![1].actual);
|
||||||
// assert.strictEqual(m.length, single.itemToInternal.size);
|
// assert.strictEqual(m.length, single.itemToInternal.size);
|
||||||
// });
|
// });
|
||||||
|
|
||||||
// test('mirrors node addition', () => {
|
// test('mirrors node addition', () => {
|
||||||
// const tests = testStubs.nested();
|
// const tests = testStubs.nested();
|
||||||
// single.addRoot(tests, 'pid');
|
// single.addRoot(tests, 'pid');
|
||||||
// m.apply(single.collectDiff());
|
// m.apply(single.collectDiff());
|
||||||
// tests.children![0].children!.push(stubTest('ac'));
|
// tests.children![0].children!.push(stubTest('ac'));
|
||||||
// single.onItemChange(tests, 'pid');
|
// single.onItemChange(tests, 'pid');
|
||||||
// m.apply(single.collectDiff());
|
// m.apply(single.collectDiff());
|
||||||
|
|
||||||
// assertTreesEqual(m.rootTestItems[0], owned.getTestById('id-root')![1].actual);
|
// assertTreesEqual(m.rootTestItems[0], owned.getTestById('id-root')![1].actual);
|
||||||
// assert.strictEqual(m.length, single.itemToInternal.size);
|
// assert.strictEqual(m.length, single.itemToInternal.size);
|
||||||
// });
|
// });
|
||||||
|
|
||||||
// test('mirrors node update', () => {
|
// test('mirrors node update', () => {
|
||||||
// const tests = testStubs.nested();
|
// const tests = testStubs.nested();
|
||||||
// single.addRoot(tests, 'pid');
|
// single.addRoot(tests, 'pid');
|
||||||
// m.apply(single.collectDiff());
|
// m.apply(single.collectDiff());
|
||||||
// tests.children![0].description = 'Hello world'; /* item a */
|
// tests.children![0].description = 'Hello world'; /* item a */
|
||||||
// single.onItemChange(tests, 'pid');
|
// single.onItemChange(tests, 'pid');
|
||||||
// m.apply(single.collectDiff());
|
// m.apply(single.collectDiff());
|
||||||
|
|
||||||
// assertTreesEqual(m.rootTestItems[0], owned.getTestById('id-root')![1].actual);
|
// assertTreesEqual(m.rootTestItems[0], owned.getTestById('id-root')![1].actual);
|
||||||
// });
|
// });
|
||||||
|
|
||||||
// suite('MirroredChangeCollector', () => {
|
// suite('MirroredChangeCollector', () => {
|
||||||
// let tests = testStubs.nested();
|
// let tests = testStubs.nested();
|
||||||
// setup(() => {
|
// setup(() => {
|
||||||
// tests = testStubs.nested();
|
// tests = testStubs.nested();
|
||||||
// single.addRoot(tests, 'pid');
|
// single.addRoot(tests, 'pid');
|
||||||
// m.apply(single.collectDiff());
|
// m.apply(single.collectDiff());
|
||||||
// });
|
// });
|
||||||
|
|
||||||
// test('creates change for root', () => {
|
// test('creates change for root', () => {
|
||||||
// assertTreeListEqual(m.changeEvent.added, [
|
// assertTreeListEqual(m.changeEvent.added, [
|
||||||
// tests,
|
// tests,
|
||||||
// tests.children[0],
|
// tests.children[0],
|
||||||
// tests.children![0].children![0],
|
// tests.children![0].children![0],
|
||||||
// tests.children![0].children![1],
|
// tests.children![0].children![1],
|
||||||
// tests.children[1],
|
// tests.children[1],
|
||||||
// ]);
|
// ]);
|
||||||
// assertTreeListEqual(m.changeEvent.removed, []);
|
// assertTreeListEqual(m.changeEvent.removed, []);
|
||||||
// assertTreeListEqual(m.changeEvent.updated, []);
|
// assertTreeListEqual(m.changeEvent.updated, []);
|
||||||
// });
|
// });
|
||||||
|
|
||||||
// test('creates change for delete', () => {
|
// test('creates change for delete', () => {
|
||||||
// const rm = tests.children.shift()!;
|
// const rm = tests.children.shift()!;
|
||||||
// single.onItemChange(tests, 'pid');
|
// single.onItemChange(tests, 'pid');
|
||||||
// m.apply(single.collectDiff());
|
// m.apply(single.collectDiff());
|
||||||
|
|
||||||
// assertTreeListEqual(m.changeEvent.added, []);
|
// assertTreeListEqual(m.changeEvent.added, []);
|
||||||
// assertTreeListEqual(m.changeEvent.removed, [
|
// assertTreeListEqual(m.changeEvent.removed, [
|
||||||
// { ...rm },
|
// { ...rm },
|
||||||
// { ...rm.children![0] },
|
// { ...rm.children![0] },
|
||||||
// { ...rm.children![1] },
|
// { ...rm.children![1] },
|
||||||
// ]);
|
// ]);
|
||||||
// assertTreeListEqual(m.changeEvent.updated, []);
|
// assertTreeListEqual(m.changeEvent.updated, []);
|
||||||
// });
|
// });
|
||||||
|
|
||||||
// test('creates change for update', () => {
|
// test('creates change for update', () => {
|
||||||
// tests.children[0].label = 'updated!';
|
// tests.children[0].label = 'updated!';
|
||||||
// single.onItemChange(tests, 'pid');
|
// single.onItemChange(tests, 'pid');
|
||||||
// m.apply(single.collectDiff());
|
// m.apply(single.collectDiff());
|
||||||
|
|
||||||
// assertTreeListEqual(m.changeEvent.added, []);
|
// assertTreeListEqual(m.changeEvent.added, []);
|
||||||
// assertTreeListEqual(m.changeEvent.removed, []);
|
// assertTreeListEqual(m.changeEvent.removed, []);
|
||||||
// assertTreeListEqual(m.changeEvent.updated, [tests.children[0]]);
|
// assertTreeListEqual(m.changeEvent.updated, [tests.children[0]]);
|
||||||
// });
|
// });
|
||||||
|
|
||||||
// test('is a no-op if a node is added and removed', () => {
|
// test('is a no-op if a node is added and removed', () => {
|
||||||
// const nested = testStubs.nested('id2-');
|
// const nested = testStubs.nested('id2-');
|
||||||
// tests.children.push(nested);
|
// tests.children.push(nested);
|
||||||
// single.onItemChange(tests, 'pid');
|
// single.onItemChange(tests, 'pid');
|
||||||
// tests.children.pop();
|
// tests.children.pop();
|
||||||
// single.onItemChange(tests, 'pid');
|
// single.onItemChange(tests, 'pid');
|
||||||
// const previousEvent = m.changeEvent;
|
// const previousEvent = m.changeEvent;
|
||||||
// m.apply(single.collectDiff());
|
// m.apply(single.collectDiff());
|
||||||
// assert.strictEqual(m.changeEvent, previousEvent);
|
// assert.strictEqual(m.changeEvent, previousEvent);
|
||||||
// });
|
// });
|
||||||
|
|
||||||
// test('is a single-op if a node is added and changed', () => {
|
// test('is a single-op if a node is added and changed', () => {
|
||||||
// const child = stubTest('c');
|
// const child = stubTest('c');
|
||||||
// tests.children.push(child);
|
// tests.children.push(child);
|
||||||
// single.onItemChange(tests, 'pid');
|
// single.onItemChange(tests, 'pid');
|
||||||
// child.label = 'd';
|
// child.label = 'd';
|
||||||
// single.onItemChange(tests, 'pid');
|
// single.onItemChange(tests, 'pid');
|
||||||
// m.apply(single.collectDiff());
|
// m.apply(single.collectDiff());
|
||||||
|
|
||||||
// assertTreeListEqual(m.changeEvent.added, [child]);
|
// assertTreeListEqual(m.changeEvent.added, [child]);
|
||||||
// assertTreeListEqual(m.changeEvent.removed, []);
|
// assertTreeListEqual(m.changeEvent.removed, []);
|
||||||
// assertTreeListEqual(m.changeEvent.updated, []);
|
// assertTreeListEqual(m.changeEvent.updated, []);
|
||||||
// });
|
// });
|
||||||
|
|
||||||
// test('gets the common ancestor (1)', () => {
|
// test('gets the common ancestor (1)', () => {
|
||||||
// tests.children![0].children![0].label = 'za';
|
// tests.children![0].children![0].label = 'za';
|
||||||
// tests.children![0].children![1].label = 'zb';
|
// tests.children![0].children![1].label = 'zb';
|
||||||
// single.onItemChange(tests, 'pid');
|
// single.onItemChange(tests, 'pid');
|
||||||
// m.apply(single.collectDiff());
|
// m.apply(single.collectDiff());
|
||||||
|
|
||||||
// });
|
// });
|
||||||
|
|
||||||
// test('gets the common ancestor (2)', () => {
|
// test('gets the common ancestor (2)', () => {
|
||||||
// tests.children![0].children![0].label = 'za';
|
// tests.children![0].children![0].label = 'za';
|
||||||
// tests.children![1].label = 'ab';
|
// tests.children![1].label = 'ab';
|
||||||
// single.onItemChange(tests, 'pid');
|
// single.onItemChange(tests, 'pid');
|
||||||
// m.apply(single.collectDiff());
|
// m.apply(single.collectDiff());
|
||||||
// });
|
// });
|
||||||
// });
|
// });
|
||||||
|
|
||||||
// suite('TestItemFilteredWrapper', () => {
|
suite('TestItemFilteredWrapper', () => {
|
||||||
// const stubTestWithLocation = (label: string, location: Location, children: StubTestItem[] = []) => {
|
const textDocumentFilter = {
|
||||||
// const t = stubTest(label, undefined, children);
|
uri: URI.parse('file:///foo.ts'),
|
||||||
// t.location = location as any;
|
} as TextDocument;
|
||||||
// return t;
|
|
||||||
// };
|
|
||||||
|
|
||||||
// const location1: Location = {
|
let testsWithLocation: TestItemImpl;
|
||||||
// range: new Range(0, 0, 0, 0),
|
setup(async () => {
|
||||||
// uri: URI.parse('file:///foo.ts')
|
testsWithLocation =
|
||||||
// };
|
stubTest('root', undefined, [
|
||||||
|
stubTest('a', undefined, [
|
||||||
|
stubTest('aa', undefined, undefined, URI.parse('file:///foo.ts')),
|
||||||
|
stubTest('ab', undefined, undefined, URI.parse('file:///foo.ts'))
|
||||||
|
], URI.parse('file:///foo.ts')),
|
||||||
|
stubTest('b', undefined, [
|
||||||
|
stubTest('ba', undefined, undefined, URI.parse('file:///bar.ts')),
|
||||||
|
stubTest('bb', undefined, undefined, URI.parse('file:///bar.ts'))
|
||||||
|
], URI.parse('file:///bar.ts')),
|
||||||
|
stubTest('c', undefined, undefined, URI.parse('file:///baz.ts')),
|
||||||
|
]);
|
||||||
|
|
||||||
// const location2: Location = {
|
// todo: this is not used, don't think it's needed anymore
|
||||||
// range: new Range(0, 0, 0, 0),
|
await createDefaultDocumentTestRoot<void>(
|
||||||
// uri: URI.parse('file:///bar.ts')
|
{
|
||||||
// };
|
createWorkspaceTestRoot: () => testsWithLocation as TestItem<void>,
|
||||||
|
runTests() {
|
||||||
|
throw new Error('no implemented');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
textDocumentFilter,
|
||||||
|
undefined,
|
||||||
|
CancellationToken.None
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
// const location3: Location = {
|
teardown(() => {
|
||||||
// range: new Range(0, 0, 0, 0),
|
TestItemFilteredWrapper.removeFilter(textDocumentFilter);
|
||||||
// uri: URI.parse('file:///baz.ts')
|
});
|
||||||
// };
|
|
||||||
|
|
||||||
// const textDocumentFilter = {
|
test('gets all actual properties', () => {
|
||||||
// uri: location1.uri
|
const testItem = stubTest('test1');
|
||||||
// } as TextDocument;
|
const wrapper = TestItemFilteredWrapper.getWrapperForTestItem(testItem, textDocumentFilter);
|
||||||
|
|
||||||
// let testsWithLocation: StubTestItem;
|
assert.strictEqual(testItem.debuggable, wrapper.debuggable);
|
||||||
// let hierarchy: TestHierarchy<TestItemFilteredWrapper>;
|
assert.strictEqual(testItem.description, wrapper.description);
|
||||||
// setup(async () => {
|
assert.strictEqual(testItem.label, wrapper.label);
|
||||||
// testsWithLocation =
|
assert.strictEqual(testItem.uri, wrapper.uri);
|
||||||
// stubTest('root', undefined, [
|
assert.strictEqual(testItem.runnable, wrapper.runnable);
|
||||||
// stubTestWithLocation('a', location1, [stubTestWithLocation('aa', location1), stubTestWithLocation('ab', location1)]),
|
});
|
||||||
// stubTestWithLocation('b', location2, [stubTestWithLocation('ba', location2), stubTestWithLocation('bb', location2)]),
|
|
||||||
// stubTestWithLocation('b', location3),
|
|
||||||
// ]);
|
|
||||||
|
|
||||||
// hierarchy = (await createDefaultDocumentTestHierarchy<StubTestItem>(
|
test('gets no children if nothing matches Uri filter', () => {
|
||||||
// {
|
const tests = testStubs.nested();
|
||||||
// provideWorkspaceTestHierarchy: () => ({
|
const wrapper = TestItemFilteredWrapper.getWrapperForTestItem(tests, textDocumentFilter);
|
||||||
// getChildren.getChildren,
|
wrapper.resolveHandler?.(CancellationToken.None);
|
||||||
// getParent.getParent,
|
assert.strictEqual(wrapper.children.size, 0);
|
||||||
// onDidChangeTest: new Emitter<StubTestItem>().event,
|
});
|
||||||
// root: testsWithLocation
|
|
||||||
// }),
|
|
||||||
// runTests() {
|
|
||||||
// throw new Error('no implemented');
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// textDocumentFilter,
|
|
||||||
// undefined,
|
|
||||||
// CancellationToken.None
|
|
||||||
// ))!;
|
|
||||||
// });
|
|
||||||
|
|
||||||
// teardown(() => {
|
test('filter is applied to children', () => {
|
||||||
// TestItemFilteredWrapper.removeFilter(textDocumentFilter);
|
const wrapper = TestItemFilteredWrapper.getWrapperForTestItem(testsWithLocation, textDocumentFilter);
|
||||||
// });
|
assert.strictEqual(wrapper.label, 'root');
|
||||||
|
wrapper.resolveHandler?.(CancellationToken.None);
|
||||||
|
|
||||||
// test('gets all actual properties', () => {
|
const children = [...wrapper.children.values()];
|
||||||
// const testItem: TestItem = stubTest('test1');
|
assert.strictEqual(children.length, 1);
|
||||||
// const wrapper: TestItemFilteredWrapper = TestItemFilteredWrapper.getWrapperForTestItem(testItem, textDocumentFilter);
|
assert.strictEqual(children[0] instanceof TestItemFilteredWrapper, true);
|
||||||
|
assert.strictEqual(children[0].label, 'a');
|
||||||
|
});
|
||||||
|
|
||||||
// assert.strictEqual(testItem.debuggable, wrapper.debuggable);
|
test('can get if node has matching filter', () => {
|
||||||
// assert.strictEqual(testItem.description, wrapper.description);
|
const rootWrapper = TestItemFilteredWrapper.getWrapperForTestItem(testsWithLocation, textDocumentFilter);
|
||||||
// assert.strictEqual(testItem.label, wrapper.label);
|
rootWrapper.resolveHandler?.(CancellationToken.None);
|
||||||
// assert.strictEqual(testItem.location, wrapper.location);
|
|
||||||
// assert.strictEqual(testItem.runnable, wrapper.runnable);
|
|
||||||
// });
|
|
||||||
|
|
||||||
// test('gets no children if nothing matches Uri filter', () => {
|
const invisible = testsWithLocation.children.get('id-b')!;
|
||||||
// let tests: TestItem = testStubs.nested();
|
const invisibleWrapper = TestItemFilteredWrapper.getWrapperForTestItem(invisible, textDocumentFilter);
|
||||||
// const wrapper = TestItemFilteredWrapper.getWrapperForTestItem(tests, textDocumentFilter);
|
const visible = testsWithLocation.children.get('id-a')!;
|
||||||
// const children = hierarchy.getChildren(wrapper, CancellationToken.None) as TestItemFilteredWrapper[];
|
const visibleWrapper = TestItemFilteredWrapper.getWrapperForTestItem(visible, textDocumentFilter);
|
||||||
// assert.strictEqual(children.length, 0);
|
|
||||||
// });
|
|
||||||
|
|
||||||
// test('filter is applied to children', () => {
|
// The root is always visible
|
||||||
// const wrapper = TestItemFilteredWrapper.getWrapperForTestItem(testsWithLocation, textDocumentFilter);
|
assert.strictEqual(rootWrapper.hasNodeMatchingFilter, true);
|
||||||
// assert.strictEqual(wrapper.label, 'root');
|
assert.strictEqual(invisibleWrapper.hasNodeMatchingFilter, false);
|
||||||
// const children = hierarchy.getChildren(wrapper, CancellationToken.None) as TestItemFilteredWrapper[];
|
assert.strictEqual(visibleWrapper.hasNodeMatchingFilter, true);
|
||||||
// assert.strictEqual(children.length, 1);
|
});
|
||||||
// assert.strictEqual(children[0] instanceof TestItemFilteredWrapper, true);
|
|
||||||
// assert.strictEqual(children[0].label, 'a');
|
|
||||||
// });
|
|
||||||
|
|
||||||
// test('can get if node has matching filter', () => {
|
test('can reset cached value of hasNodeMatchingFilter', () => {
|
||||||
// const rootWrapper = TestItemFilteredWrapper.getWrapperForTestItem(testsWithLocation, textDocumentFilter);
|
const wrapper = TestItemFilteredWrapper.getWrapperForTestItem(testsWithLocation, textDocumentFilter);
|
||||||
|
wrapper.resolveHandler?.(CancellationToken.None);
|
||||||
|
|
||||||
// const invisible = testsWithLocation.children![1];
|
const invisible = testsWithLocation.children.get('id-b')!;
|
||||||
// const invisibleWrapper = TestItemFilteredWrapper.getWrapperForTestItem(invisible, textDocumentFilter);
|
const invisibleWrapper = TestItemFilteredWrapper.getWrapperForTestItem(invisible, textDocumentFilter);
|
||||||
// const visible = testsWithLocation.children![0];
|
|
||||||
// const visibleWrapper = TestItemFilteredWrapper.getWrapperForTestItem(visible, textDocumentFilter);
|
|
||||||
|
|
||||||
// // The root is always visible
|
assert.strictEqual(wrapper.children.get('id-b'), undefined);
|
||||||
// assert.strictEqual(rootWrapper.hasNodeMatchingFilter, true);
|
assert.strictEqual(invisibleWrapper.hasNodeMatchingFilter, false);
|
||||||
// assert.strictEqual(invisibleWrapper.hasNodeMatchingFilter, false);
|
|
||||||
// assert.strictEqual(visibleWrapper.hasNodeMatchingFilter, true);
|
|
||||||
// });
|
|
||||||
|
|
||||||
// test('can get visible parent', () => {
|
invisible.addChild(stubTest('bc', undefined, undefined, URI.parse('file:///foo.ts')));
|
||||||
// const rootWrapper = TestItemFilteredWrapper.getWrapperForTestItem(testsWithLocation, textDocumentFilter);
|
assert.strictEqual(invisibleWrapper.hasNodeMatchingFilter, true);
|
||||||
|
assert.strictEqual(invisibleWrapper.children.size, 1);
|
||||||
|
assert.strictEqual(wrapper.children.get('id-b'), invisibleWrapper);
|
||||||
|
});
|
||||||
|
|
||||||
// const invisible = testsWithLocation.children![1];
|
// test('can reset cached value of hasNodeMatchingFilter of parents up to visible parent', () => {
|
||||||
// const invisibleWrapper = TestItemFilteredWrapper.getWrapperForTestItem(invisible, textDocumentFilter);
|
// const rootWrapper = TestItemFilteredWrapper.getWrapperForTestItem(testsWithLocation, textDocumentFilter);
|
||||||
// const visible = testsWithLocation.children![0];
|
|
||||||
// const visibleWrapper = TestItemFilteredWrapper.getWrapperForTestItem(visible, textDocumentFilter);
|
|
||||||
|
|
||||||
// // The root is always visible
|
// const invisibleParent = testsWithLocation.children.get('id-b')!;
|
||||||
// assert.strictEqual(rootWrapper.visibleParent, rootWrapper);
|
// const invisibleParentWrapper = TestItemFilteredWrapper.getWrapperForTestItem(invisibleParent, textDocumentFilter);
|
||||||
// assert.strictEqual(invisibleWrapper.visibleParent, rootWrapper);
|
// const invisible = invisibleParent.children.get('id-bb')!;
|
||||||
// assert.strictEqual(visibleWrapper.visibleParent, visibleWrapper);
|
// const invisibleWrapper = TestItemFilteredWrapper.getWrapperForTestItem(invisible, textDocumentFilter);
|
||||||
// });
|
|
||||||
|
|
||||||
// test('can reset cached value of hasNodeMatchingFilter', () => {
|
// assert.strictEqual(invisibleParentWrapper.hasNodeMatchingFilter, false);
|
||||||
// TestItemFilteredWrapper.getWrapperForTestItem(testsWithLocation, textDocumentFilter);
|
// invisible.location = location1 as any;
|
||||||
|
// assert.strictEqual(invisibleParentWrapper.hasNodeMatchingFilter, false);
|
||||||
|
// invisibleWrapper.reset();
|
||||||
|
// assert.strictEqual(invisibleParentWrapper.hasNodeMatchingFilter, true);
|
||||||
|
|
||||||
// const invisible = testsWithLocation.children![1];
|
// // the root should be undefined due to the reset.
|
||||||
// const invisibleWrapper = TestItemFilteredWrapper.getWrapperForTestItem(invisible, textDocumentFilter);
|
// assert.strictEqual((rootWrapper as any).matchesFilter, undefined);
|
||||||
|
// });
|
||||||
// assert.strictEqual(invisibleWrapper.hasNodeMatchingFilter, false);
|
});
|
||||||
// invisible.location = location1 as any;
|
});
|
||||||
// assert.strictEqual(invisibleWrapper.hasNodeMatchingFilter, false);
|
|
||||||
// invisibleWrapper.reset();
|
|
||||||
// assert.strictEqual(invisibleWrapper.hasNodeMatchingFilter, true);
|
|
||||||
// });
|
|
||||||
|
|
||||||
// test('can reset cached value of hasNodeMatchingFilter of parents up to visible parent', () => {
|
|
||||||
// const rootWrapper = TestItemFilteredWrapper.getWrapperForTestItem(testsWithLocation, textDocumentFilter);
|
|
||||||
|
|
||||||
// const invisibleParent = testsWithLocation.children![1];
|
|
||||||
// const invisibleParentWrapper = TestItemFilteredWrapper.getWrapperForTestItem(invisibleParent, textDocumentFilter);
|
|
||||||
// const invisible = invisibleParent.children![1];
|
|
||||||
// const invisibleWrapper = TestItemFilteredWrapper.getWrapperForTestItem(invisible, textDocumentFilter);
|
|
||||||
|
|
||||||
// assert.strictEqual(invisibleParentWrapper.hasNodeMatchingFilter, false);
|
|
||||||
// invisible.location = location1 as any;
|
|
||||||
// assert.strictEqual(invisibleParentWrapper.hasNodeMatchingFilter, false);
|
|
||||||
// invisibleWrapper.reset();
|
|
||||||
// assert.strictEqual(invisibleParentWrapper.hasNodeMatchingFilter, true);
|
|
||||||
|
|
||||||
// // the root should be undefined due to the reset.
|
|
||||||
// assert.strictEqual((rootWrapper as any).matchesFilter, undefined);
|
|
||||||
// });
|
|
||||||
// });
|
|
||||||
// });
|
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue