@codingame/monaco-vscode-testing-service-override 3.2.3 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/package.json +8 -8
  2. package/testing.js +5 -4
  3. package/external/rollup-plugin-styles/dist/runtime/inject-css.js +0 -3
  4. package/external/tslib/tslib.es6.js +0 -11
  5. package/vscode/src/vs/workbench/contrib/testing/browser/codeCoverageDecorations.js +0 -567
  6. package/vscode/src/vs/workbench/contrib/testing/browser/explorerProjections/display.js +0 -3
  7. package/vscode/src/vs/workbench/contrib/testing/browser/explorerProjections/index.js +0 -83
  8. package/vscode/src/vs/workbench/contrib/testing/browser/explorerProjections/listProjection.js +0 -186
  9. package/vscode/src/vs/workbench/contrib/testing/browser/explorerProjections/testItemContextOverlay.js +0 -18
  10. package/vscode/src/vs/workbench/contrib/testing/browser/explorerProjections/testingObjectTree.js +0 -46
  11. package/vscode/src/vs/workbench/contrib/testing/browser/explorerProjections/testingViewState.js +0 -17
  12. package/vscode/src/vs/workbench/contrib/testing/browser/explorerProjections/treeProjection.js +0 -225
  13. package/vscode/src/vs/workbench/contrib/testing/browser/icons.js +0 -174
  14. package/vscode/src/vs/workbench/contrib/testing/browser/media/testing.css.js +0 -6
  15. package/vscode/src/vs/workbench/contrib/testing/browser/testCoverageBars.js +0 -227
  16. package/vscode/src/vs/workbench/contrib/testing/browser/testCoverageView.js +0 -545
  17. package/vscode/src/vs/workbench/contrib/testing/browser/testExplorerActions.js +0 -1662
  18. package/vscode/src/vs/workbench/contrib/testing/browser/testing.contribution.js +0 -219
  19. package/vscode/src/vs/workbench/contrib/testing/browser/testingDecorations.js +0 -970
  20. package/vscode/src/vs/workbench/contrib/testing/browser/testingExplorerFilter.js +0 -236
  21. package/vscode/src/vs/workbench/contrib/testing/browser/testingExplorerView.js +0 -1227
  22. package/vscode/src/vs/workbench/contrib/testing/browser/testingOutputPeek.css.js +0 -6
  23. package/vscode/src/vs/workbench/contrib/testing/browser/testingOutputPeek.js +0 -2091
  24. package/vscode/src/vs/workbench/contrib/testing/browser/testingProgressUiService.js +0 -142
  25. package/vscode/src/vs/workbench/contrib/testing/browser/testingViewPaneContainer.js +0 -47
  26. package/vscode/src/vs/workbench/contrib/testing/browser/theme.js +0 -259
  27. package/vscode/src/vs/workbench/contrib/testing/common/configuration.js +0 -273
  28. package/vscode/src/vs/workbench/contrib/testing/common/constants.js +0 -59
  29. package/vscode/src/vs/workbench/contrib/testing/common/mainThreadTestCollection.js +0 -129
  30. package/vscode/src/vs/workbench/contrib/testing/common/testExclusions.js +0 -48
  31. package/vscode/src/vs/workbench/contrib/testing/common/testServiceImpl.js +0 -296
  32. package/vscode/src/vs/workbench/contrib/testing/common/testingContentProvider.js +0 -125
  33. package/vscode/src/vs/workbench/contrib/testing/common/testingUri.js +0 -67
@@ -1,83 +0,0 @@
1
- import { ObjectTreeElementCollapseState } from 'vscode/vscode/vs/base/browser/ui/tree/tree';
2
- import { Emitter } from 'vscode/vscode/vs/base/common/event';
3
- import { Iterable } from 'vscode/vscode/vs/base/common/iterator';
4
- import { isCollapsedInSerializedTestTree } from './testingViewState.js';
5
- import { InternalTestItem } from 'vscode/vscode/vs/workbench/contrib/testing/common/testTypes';
6
-
7
- let idCounter = 0;
8
- const getId = () => String(idCounter++);
9
- class TestItemTreeElement {
10
- constructor(test,
11
- parent = null) {
12
- this.test = test;
13
- this.parent = parent;
14
- this.changeEmitter = ( new Emitter());
15
- this.onChange = this.changeEmitter.event;
16
- this.children = ( new Set());
17
- this.treeId = getId();
18
- this.depth = this.parent ? this.parent.depth + 1 : 0;
19
- this.retired = false;
20
- this.state = 0 ;
21
- }
22
- toJSON() {
23
- if (this.depth === 0) {
24
- return { controllerId: this.test.controllerId };
25
- }
26
- const context = {
27
- $mid: 16 ,
28
- tests: [InternalTestItem.serialize(this.test)],
29
- };
30
- for (let p = this.parent; p && p.depth > 0; p = p.parent) {
31
- context.tests.unshift(InternalTestItem.serialize(p.test));
32
- }
33
- return context;
34
- }
35
- }
36
- class TestTreeErrorMessage {
37
- get description() {
38
- return typeof this.message === 'string' ? this.message : this.message.value;
39
- }
40
- constructor(message, parent) {
41
- this.message = message;
42
- this.parent = parent;
43
- this.treeId = getId();
44
- this.children = ( new Set());
45
- }
46
- }
47
- const testIdentityProvider = {
48
- getId(element) {
49
- const expandComponent = element instanceof TestTreeErrorMessage
50
- ? 'error'
51
- : element.test.expand === 0
52
- ? !!element.children.size
53
- : element.test.expand;
54
- return element.treeId + '\0' + expandComponent;
55
- }
56
- };
57
- const getChildrenForParent = (serialized, rootsWithChildren, node) => {
58
- let it;
59
- if (node === null) {
60
- const rootsWithChildrenArr = [...rootsWithChildren];
61
- if (rootsWithChildrenArr.length === 1) {
62
- return getChildrenForParent(serialized, rootsWithChildrenArr, rootsWithChildrenArr[0]);
63
- }
64
- it = rootsWithChildrenArr;
65
- }
66
- else {
67
- it = node.children;
68
- }
69
- return ( Iterable.map(it, element => (element instanceof TestTreeErrorMessage
70
- ? { element }
71
- : {
72
- element,
73
- collapsible: element.test.expand !== 0 ,
74
- collapsed: element.test.item.error
75
- ? ObjectTreeElementCollapseState.PreserveOrExpanded
76
- : (isCollapsedInSerializedTestTree(serialized, element.test.item.extId) ?? element.depth > 0
77
- ? ObjectTreeElementCollapseState.PreserveOrCollapsed
78
- : ObjectTreeElementCollapseState.PreserveOrExpanded),
79
- children: getChildrenForParent(serialized, rootsWithChildren, element),
80
- })));
81
- };
82
-
83
- export { TestItemTreeElement, TestTreeErrorMessage, getChildrenForParent, testIdentityProvider };
@@ -1,186 +0,0 @@
1
- import { __decorate, __param } from '../../../../../../../../external/tslib/tslib.es6.js';
2
- import { Emitter } from 'vscode/vscode/vs/base/common/event';
3
- import { Iterable } from 'vscode/vscode/vs/base/common/iterator';
4
- import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
5
- import { flatTestItemDelimiter } from './display.js';
6
- import { getChildrenForParent, testIdentityProvider, TestItemTreeElement, TestTreeErrorMessage } from './index.js';
7
- import { isCollapsedInSerializedTestTree } from './testingViewState.js';
8
- import { TestId } from 'vscode/vscode/vs/workbench/contrib/testing/common/testId';
9
- import { ITestResultService } from 'vscode/vscode/vs/workbench/contrib/testing/common/testResultService';
10
- import { ITestService } from 'vscode/vscode/vs/workbench/contrib/testing/common/testService';
11
- import { applyTestItemUpdate } from 'vscode/vscode/vs/workbench/contrib/testing/common/testTypes';
12
-
13
- class ListTestItemElement extends TestItemTreeElement {
14
- get description() {
15
- return ( this.chain.map(c => c.item.label)).join(flatTestItemDelimiter);
16
- }
17
- constructor(test, parent, chain) {
18
- super({ ...test, item: { ...test.item } }, parent);
19
- this.chain = chain;
20
- this.descriptionParts = [];
21
- this.updateErrorVisibility();
22
- }
23
- update(patch) {
24
- applyTestItemUpdate(this.test, patch);
25
- this.updateErrorVisibility(patch);
26
- this.fireChange();
27
- }
28
- fireChange() {
29
- this.changeEmitter.fire();
30
- }
31
- updateErrorVisibility(patch) {
32
- if (this.errorChild && (!this.test.item.error || patch?.item?.error)) {
33
- this.children.delete(this.errorChild);
34
- this.errorChild = undefined;
35
- }
36
- if (this.test.item.error && !this.errorChild) {
37
- this.errorChild = ( new TestTreeErrorMessage(this.test.item.error, this));
38
- this.children.add(this.errorChild);
39
- }
40
- }
41
- }
42
- let ListProjection = class ListProjection extends Disposable {
43
- get rootsWithChildren() {
44
- const rootsIt = ( Iterable.map(this.testService.collection.rootItems, r => this.items.get(r.item.extId)));
45
- return Iterable.filter(rootsIt, (r) => !!r?.children.size);
46
- }
47
- constructor(lastState, testService, results) {
48
- super();
49
- this.lastState = lastState;
50
- this.testService = testService;
51
- this.results = results;
52
- this.updateEmitter = ( new Emitter());
53
- this.items = ( new Map());
54
- this.onUpdate = this.updateEmitter.event;
55
- this._register(testService.onDidProcessDiff((diff) => this.applyDiff(diff)));
56
- this._register(results.onResultsChanged((evt) => {
57
- if (!('removed' in evt)) {
58
- return;
59
- }
60
- for (const inTree of ( this.items.values())) {
61
- const lookup = this.results.getStateById(inTree.test.item.extId)?.[1];
62
- inTree.duration = lookup?.ownDuration;
63
- inTree.state = lookup?.ownComputedState || 0 ;
64
- inTree.fireChange();
65
- }
66
- }));
67
- this._register(results.onTestChanged(ev => {
68
- if (ev.reason === 2 ) {
69
- return;
70
- }
71
- let result = ev.item;
72
- if (result.ownComputedState === 0 || ev.result !== results.results[0]) {
73
- const fallback = results.getStateById(result.item.extId);
74
- if (fallback) {
75
- result = fallback[1];
76
- }
77
- }
78
- const item = this.items.get(result.item.extId);
79
- if (!item) {
80
- return;
81
- }
82
- item.retired = !!result.retired;
83
- item.state = result.computedState;
84
- item.duration = result.ownDuration;
85
- item.fireChange();
86
- }));
87
- for (const test of testService.collection.all) {
88
- this.storeItem(test);
89
- }
90
- }
91
- getElementByTestId(testId) {
92
- return this.items.get(testId);
93
- }
94
- applyDiff(diff) {
95
- for (const op of diff) {
96
- switch (op.op) {
97
- case 0 : {
98
- this.storeItem(op.item);
99
- break;
100
- }
101
- case 1 : {
102
- this.items.get(op.item.extId)?.update(op.item);
103
- break;
104
- }
105
- case 3 : {
106
- for (const [id, item] of this.items) {
107
- if (id === op.itemId || TestId.isChild(op.itemId, id)) {
108
- this.unstoreItem(item);
109
- }
110
- }
111
- break;
112
- }
113
- }
114
- }
115
- if (diff.length !== 0) {
116
- this.updateEmitter.fire();
117
- }
118
- }
119
- applyTo(tree) {
120
- tree.setChildren(null, getChildrenForParent(this.lastState, this.rootsWithChildren, null), {
121
- diffIdentityProvider: testIdentityProvider,
122
- diffDepth: Infinity
123
- });
124
- }
125
- expandElement(element, depth) {
126
- if (!(element instanceof ListTestItemElement)) {
127
- return;
128
- }
129
- if (element.test.expand === 0 ) {
130
- return;
131
- }
132
- this.testService.collection.expand(element.test.item.extId, depth);
133
- }
134
- unstoreItem(treeElement) {
135
- this.items.delete(treeElement.test.item.extId);
136
- treeElement.parent?.children.delete(treeElement);
137
- const parentId = TestId.fromString(treeElement.test.item.extId).parentId;
138
- if (!parentId) {
139
- return;
140
- }
141
- for (const id of parentId.idsToRoot()) {
142
- const parentTest = this.testService.collection.getNodeById(( id.toString()));
143
- if (parentTest) {
144
- if (parentTest.children.size === 0 && !( this.items.has(( id.toString())))) {
145
- this._storeItem(parentId, parentTest);
146
- }
147
- break;
148
- }
149
- }
150
- }
151
- _storeItem(testId, item) {
152
- const displayedParent = testId.isRoot ? null : this.items.get(item.controllerId);
153
- const chain = ( [...testId.idsFromRoot()].slice(1, -1).map(id => this.testService.collection.getNodeById(( id.toString()))));
154
- const treeElement = ( new ListTestItemElement(item, displayedParent, chain));
155
- displayedParent?.children.add(treeElement);
156
- this.items.set(treeElement.test.item.extId, treeElement);
157
- if (treeElement.depth === 0 || isCollapsedInSerializedTestTree(this.lastState, treeElement.test.item.extId) === false) {
158
- this.expandElement(treeElement, Infinity);
159
- }
160
- const prevState = this.results.getStateById(treeElement.test.item.extId)?.[1];
161
- if (prevState) {
162
- treeElement.retired = !!prevState.retired;
163
- treeElement.state = prevState.computedState;
164
- treeElement.duration = prevState.ownDuration;
165
- }
166
- }
167
- storeItem(item) {
168
- const testId = TestId.fromString(item.item.extId);
169
- for (const parentId of testId.idsToRoot()) {
170
- if (!parentId.isRoot) {
171
- const prevParent = this.items.get(( parentId.toString()));
172
- if (prevParent) {
173
- this.unstoreItem(prevParent);
174
- break;
175
- }
176
- }
177
- }
178
- this._storeItem(testId, item);
179
- }
180
- };
181
- ListProjection = ( __decorate([
182
- ( __param(1, ITestService)),
183
- ( __param(2, ITestResultService))
184
- ], ListProjection));
185
-
186
- export { ListProjection };
@@ -1,18 +0,0 @@
1
- import { capabilityContextKeys } from 'vscode/vscode/vs/workbench/contrib/testing/common/testProfileService';
2
- import { TestId } from 'vscode/vscode/vs/workbench/contrib/testing/common/testId';
3
- import { TestingContextKeys } from 'vscode/vscode/vs/workbench/contrib/testing/common/testingContextKeys';
4
-
5
- const getTestItemContextOverlay = (test, capabilities) => {
6
- if (!test) {
7
- return [];
8
- }
9
- const testId = TestId.fromString(test.item.extId);
10
- return [
11
- [TestingContextKeys.testItemExtId.key, testId.localId],
12
- [TestingContextKeys.controllerId.key, test.controllerId],
13
- [TestingContextKeys.testItemHasUri.key, !!test.item.uri],
14
- ...capabilityContextKeys(capabilities),
15
- ];
16
- };
17
-
18
- export { getTestItemContextOverlay };
@@ -1,46 +0,0 @@
1
- import { WorkbenchObjectTree } from 'vscode/vscode/vs/platform/list/browser/listService';
2
- import { TestItemTreeElement } from './index.js';
3
- import { TestId } from 'vscode/vscode/vs/workbench/contrib/testing/common/testId';
4
-
5
- class TestingObjectTree extends WorkbenchObjectTree {
6
- getOptimizedViewState(updatePreviousState) {
7
- const root = updatePreviousState || {};
8
- const build = (node, parent) => {
9
- if (!(node.element instanceof TestItemTreeElement)) {
10
- return false;
11
- }
12
- const localId = TestId.localId(node.element.test.item.extId);
13
- const inTree = parent.children?.[localId] || {};
14
- inTree.collapsed = node.depth === 0 || !node.collapsed ? node.collapsed : undefined;
15
- let hasAnyNonDefaultValue = inTree.collapsed !== undefined;
16
- if (node.children.length) {
17
- for (const child of node.children) {
18
- hasAnyNonDefaultValue = build(child, inTree) || hasAnyNonDefaultValue;
19
- }
20
- }
21
- if (hasAnyNonDefaultValue) {
22
- parent.children ??= {};
23
- parent.children[localId] = inTree;
24
- }
25
- else if (parent.children?.hasOwnProperty(localId)) {
26
- delete parent.children[localId];
27
- }
28
- return hasAnyNonDefaultValue;
29
- };
30
- root.children ??= {};
31
- for (const node of this.getNode().children) {
32
- if (node.element instanceof TestItemTreeElement) {
33
- if (node.element.test.controllerId === node.element.test.item.extId) {
34
- build(node, root);
35
- }
36
- else {
37
- const ctrlNode = root.children[node.element.test.controllerId] ??= { children: {} };
38
- build(node, ctrlNode);
39
- }
40
- }
41
- }
42
- return root;
43
- }
44
- }
45
-
46
- export { TestingObjectTree };
@@ -1,17 +0,0 @@
1
- import { TestId } from 'vscode/vscode/vs/workbench/contrib/testing/common/testId';
2
-
3
- function isCollapsedInSerializedTestTree(serialized, id) {
4
- if (!(id instanceof TestId)) {
5
- id = TestId.fromString(id);
6
- }
7
- let node = serialized;
8
- for (const part of id.path) {
9
- if (!node.children?.hasOwnProperty(part)) {
10
- return undefined;
11
- }
12
- node = node.children[part];
13
- }
14
- return node.collapsed;
15
- }
16
-
17
- export { isCollapsedInSerializedTestTree };
@@ -1,225 +0,0 @@
1
- import { __decorate, __param } from '../../../../../../../../external/tslib/tslib.es6.js';
2
- import { Emitter } from 'vscode/vscode/vs/base/common/event';
3
- import { Iterable } from 'vscode/vscode/vs/base/common/iterator';
4
- import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
5
- import { getChildrenForParent, testIdentityProvider, TestItemTreeElement, TestTreeErrorMessage } from './index.js';
6
- import { isCollapsedInSerializedTestTree } from './testingViewState.js';
7
- import { refreshComputedState } from 'vscode/vscode/vs/workbench/contrib/testing/common/getComputedState';
8
- import { TestId } from 'vscode/vscode/vs/workbench/contrib/testing/common/testId';
9
- import { ITestResultService } from 'vscode/vscode/vs/workbench/contrib/testing/common/testResultService';
10
- import { ITestService } from 'vscode/vscode/vs/workbench/contrib/testing/common/testService';
11
- import { applyTestItemUpdate } from 'vscode/vscode/vs/workbench/contrib/testing/common/testTypes';
12
-
13
- const computedStateAccessor = {
14
- getOwnState: i => i instanceof TestItemTreeElement ? i.ownState : 0 ,
15
- getCurrentComputedState: i => i.state,
16
- setComputedState: (i, s) => i.state = s,
17
- getCurrentComputedDuration: i => i.duration,
18
- getOwnDuration: i => i instanceof TestItemTreeElement ? i.ownDuration : undefined,
19
- setComputedDuration: (i, d) => i.duration = d,
20
- getChildren: i => Iterable.filter(( i.children.values()), (t) => t instanceof TreeTestItemElement),
21
- *getParents(i) {
22
- for (let parent = i.parent; parent; parent = parent.parent) {
23
- yield parent;
24
- }
25
- },
26
- };
27
- class TreeTestItemElement extends TestItemTreeElement {
28
- get description() {
29
- return this.test.item.description;
30
- }
31
- constructor(test, parent, addedOrRemoved) {
32
- super({ ...test, item: { ...test.item } }, parent);
33
- this.addedOrRemoved = addedOrRemoved;
34
- this.ownState = 0 ;
35
- this.updateErrorVisibility();
36
- }
37
- update(patch) {
38
- applyTestItemUpdate(this.test, patch);
39
- this.updateErrorVisibility(patch);
40
- this.fireChange();
41
- }
42
- fireChange() {
43
- this.changeEmitter.fire();
44
- }
45
- updateErrorVisibility(patch) {
46
- if (this.errorChild && (!this.test.item.error || patch?.item?.error)) {
47
- this.addedOrRemoved(this);
48
- this.children.delete(this.errorChild);
49
- this.errorChild = undefined;
50
- }
51
- if (this.test.item.error && !this.errorChild) {
52
- this.errorChild = ( new TestTreeErrorMessage(this.test.item.error, this));
53
- this.children.add(this.errorChild);
54
- this.addedOrRemoved(this);
55
- }
56
- }
57
- }
58
- let TreeProjection = class TreeProjection extends Disposable {
59
- get rootsWithChildren() {
60
- const rootsIt = ( Iterable.map(this.testService.collection.rootItems, r => this.items.get(r.item.extId)));
61
- return Iterable.filter(rootsIt, (r) => !!r?.children.size);
62
- }
63
- constructor(lastState, testService, results) {
64
- super();
65
- this.lastState = lastState;
66
- this.testService = testService;
67
- this.results = results;
68
- this.updateEmitter = ( new Emitter());
69
- this.changedParents = ( new Set());
70
- this.resortedParents = ( new Set());
71
- this.items = ( new Map());
72
- this.onUpdate = this.updateEmitter.event;
73
- this._register(testService.onDidProcessDiff((diff) => this.applyDiff(diff)));
74
- this._register(results.onResultsChanged((evt) => {
75
- if (!('removed' in evt)) {
76
- return;
77
- }
78
- for (const inTree of [...( this.items.values())].sort((a, b) => b.depth - a.depth)) {
79
- const lookup = this.results.getStateById(inTree.test.item.extId)?.[1];
80
- inTree.ownDuration = lookup?.ownDuration;
81
- refreshComputedState(computedStateAccessor, inTree, lookup?.ownComputedState ?? 0 ).forEach(i => i.fireChange());
82
- }
83
- }));
84
- this._register(results.onTestChanged(ev => {
85
- if (ev.reason === 2 ) {
86
- return;
87
- }
88
- let result = ev.item;
89
- if (result.ownComputedState === 0 || ev.result !== results.results[0]) {
90
- const fallback = results.getStateById(result.item.extId);
91
- if (fallback) {
92
- result = fallback[1];
93
- }
94
- }
95
- const item = this.items.get(result.item.extId);
96
- if (!item) {
97
- return;
98
- }
99
- const refreshDuration = ev.reason === 1 && ev.previousOwnDuration !== result.ownDuration;
100
- const explicitComputed = item.children.size ? undefined : result.computedState;
101
- item.retired = !!result.retired;
102
- item.ownState = result.ownComputedState;
103
- item.ownDuration = result.ownDuration;
104
- item.fireChange();
105
- refreshComputedState(computedStateAccessor, item, explicitComputed, refreshDuration).forEach(i => i.fireChange());
106
- }));
107
- for (const test of testService.collection.all) {
108
- this.storeItem(this.createItem(test));
109
- }
110
- }
111
- getElementByTestId(testId) {
112
- return this.items.get(testId);
113
- }
114
- applyDiff(diff) {
115
- for (const op of diff) {
116
- switch (op.op) {
117
- case 0 : {
118
- const item = this.createItem(op.item);
119
- this.storeItem(item);
120
- break;
121
- }
122
- case 1 : {
123
- const patch = op.item;
124
- const existing = this.items.get(patch.extId);
125
- if (!existing) {
126
- break;
127
- }
128
- const needsParentUpdate = existing.test.expand === 0 && patch.expand;
129
- existing.update(patch);
130
- if (needsParentUpdate) {
131
- this.changedParents.add(existing.parent);
132
- }
133
- else {
134
- this.resortedParents.add(existing.parent);
135
- }
136
- break;
137
- }
138
- case 3 : {
139
- const toRemove = this.items.get(op.itemId);
140
- if (!toRemove) {
141
- break;
142
- }
143
- const parent = toRemove.parent;
144
- const affectsRootElement = toRemove.depth === 1 && parent?.children.size === 1;
145
- this.changedParents.add(affectsRootElement ? null : parent);
146
- const queue = [[toRemove]];
147
- while (queue.length) {
148
- for (const item of queue.pop()) {
149
- if (item instanceof TreeTestItemElement) {
150
- queue.push(this.unstoreItem(item));
151
- }
152
- }
153
- }
154
- if (parent instanceof TreeTestItemElement) {
155
- refreshComputedState(computedStateAccessor, parent, undefined, !!parent.duration).forEach(i => i.fireChange());
156
- }
157
- }
158
- }
159
- }
160
- if (diff.length !== 0) {
161
- this.updateEmitter.fire();
162
- }
163
- }
164
- applyTo(tree) {
165
- for (const s of [this.changedParents, this.resortedParents]) {
166
- for (const element of s) {
167
- if (element && !tree.hasElement(element)) {
168
- s.delete(element);
169
- }
170
- }
171
- }
172
- for (const parent of this.changedParents) {
173
- tree.setChildren(parent, getChildrenForParent(this.lastState, this.rootsWithChildren, parent), { diffIdentityProvider: testIdentityProvider });
174
- }
175
- for (const parent of this.resortedParents) {
176
- tree.resort(parent, false);
177
- }
178
- }
179
- expandElement(element, depth) {
180
- if (!(element instanceof TreeTestItemElement)) {
181
- return;
182
- }
183
- if (element.test.expand === 0 ) {
184
- return;
185
- }
186
- this.testService.collection.expand(element.test.item.extId, depth);
187
- }
188
- createItem(item) {
189
- const parentId = TestId.parentId(item.item.extId);
190
- const parent = parentId ? this.items.get(parentId) : null;
191
- return ( new TreeTestItemElement(item, parent, n => this.changedParents.add(n)));
192
- }
193
- unstoreItem(treeElement) {
194
- const parent = treeElement.parent;
195
- parent?.children.delete(treeElement);
196
- this.items.delete(treeElement.test.item.extId);
197
- return treeElement.children;
198
- }
199
- storeItem(treeElement) {
200
- treeElement.parent?.children.add(treeElement);
201
- this.items.set(treeElement.test.item.extId, treeElement);
202
- const affectsParent = treeElement.parent?.children.size === 1;
203
- const affectedParent = affectsParent ? treeElement.parent.parent : treeElement.parent;
204
- this.changedParents.add(affectedParent);
205
- if (affectedParent?.depth === 0) {
206
- this.changedParents.add(null);
207
- }
208
- if (treeElement.depth === 0 || isCollapsedInSerializedTestTree(this.lastState, treeElement.test.item.extId) === false) {
209
- this.expandElement(treeElement, 0);
210
- }
211
- const prevState = this.results.getStateById(treeElement.test.item.extId)?.[1];
212
- if (prevState) {
213
- treeElement.retired = !!prevState.retired;
214
- treeElement.ownState = prevState.computedState;
215
- treeElement.ownDuration = prevState.ownDuration;
216
- refreshComputedState(computedStateAccessor, treeElement, undefined, !!treeElement.ownDuration).forEach(i => i.fireChange());
217
- }
218
- }
219
- };
220
- TreeProjection = ( __decorate([
221
- ( __param(1, ITestService)),
222
- ( __param(2, ITestResultService))
223
- ], TreeProjection));
224
-
225
- export { TreeProjection };