@theia/test 1.45.1 → 1.46.0-next.72

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 (53) hide show
  1. package/lib/browser/constants.d.ts +45 -45
  2. package/lib/browser/constants.js +17 -17
  3. package/lib/browser/test-service.d.ts +154 -154
  4. package/lib/browser/test-service.js +247 -247
  5. package/lib/browser/view/test-context-key-service.d.ts +7 -7
  6. package/lib/browser/view/test-context-key-service.js +51 -51
  7. package/lib/browser/view/test-execution-state-manager.d.ts +13 -13
  8. package/lib/browser/view/test-execution-state-manager.js +173 -173
  9. package/lib/browser/view/test-output-ui-model.d.ts +47 -47
  10. package/lib/browser/view/test-output-ui-model.js +151 -151
  11. package/lib/browser/view/test-output-view-contribution.d.ts +5 -5
  12. package/lib/browser/view/test-output-view-contribution.js +47 -47
  13. package/lib/browser/view/test-output-widget.d.ts +24 -24
  14. package/lib/browser/view/test-output-widget.js +158 -158
  15. package/lib/browser/view/test-result-view-contribution.d.ts +5 -5
  16. package/lib/browser/view/test-result-view-contribution.js +47 -47
  17. package/lib/browser/view/test-result-widget.d.ts +20 -20
  18. package/lib/browser/view/test-result-widget.js +108 -108
  19. package/lib/browser/view/test-run-view-contribution.d.ts +17 -17
  20. package/lib/browser/view/test-run-view-contribution.js +100 -100
  21. package/lib/browser/view/test-run-widget.d.ts +58 -58
  22. package/lib/browser/view/test-run-widget.js +310 -310
  23. package/lib/browser/view/test-tree-widget.d.ts +67 -67
  24. package/lib/browser/view/test-tree-widget.js +386 -386
  25. package/lib/browser/view/test-view-contribution.d.ts +45 -45
  26. package/lib/browser/view/test-view-contribution.js +288 -288
  27. package/lib/browser/view/test-view-frontend-module.d.ts +6 -6
  28. package/lib/browser/view/test-view-frontend-module.js +121 -121
  29. package/lib/common/collections.d.ts +46 -46
  30. package/lib/common/collections.js +210 -210
  31. package/lib/common/tree-delta.d.ts +51 -51
  32. package/lib/common/tree-delta.js +240 -240
  33. package/lib/common/tree-delta.spec.d.ts +1 -1
  34. package/lib/common/tree-delta.spec.js +139 -139
  35. package/package.json +8 -8
  36. package/src/browser/constants.ts +71 -71
  37. package/src/browser/style/index.css +41 -41
  38. package/src/browser/test-service.ts +355 -355
  39. package/src/browser/view/test-context-key-service.ts +36 -36
  40. package/src/browser/view/test-execution-state-manager.ts +147 -147
  41. package/src/browser/view/test-output-ui-model.ts +156 -156
  42. package/src/browser/view/test-output-view-contribution.ts +34 -34
  43. package/src/browser/view/test-output-widget.ts +148 -148
  44. package/src/browser/view/test-result-view-contribution.ts +34 -34
  45. package/src/browser/view/test-result-widget.ts +92 -92
  46. package/src/browser/view/test-run-view-contribution.ts +89 -89
  47. package/src/browser/view/test-run-widget.tsx +271 -271
  48. package/src/browser/view/test-tree-widget.tsx +360 -360
  49. package/src/browser/view/test-view-contribution.ts +300 -300
  50. package/src/browser/view/test-view-frontend-module.ts +134 -134
  51. package/src/common/collections.ts +223 -223
  52. package/src/common/tree-delta.spec.ts +166 -166
  53. package/src/common/tree-delta.ts +259 -259
@@ -1,211 +1,211 @@
1
- "use strict";
2
- // *****************************************************************************
3
- // Copyright (C) 2022 STMicroelectronics and others.
4
- //
5
- // This program and the accompanying materials are made available under the
6
- // terms of the Eclipse Public License v. 2.0 which is available at
7
- // http://www.eclipse.org/legal/epl-2.0.
8
- //
9
- // This Source Code may also be made available under the following Secondary
10
- // Licenses when the conditions for such availability set forth in the Eclipse
11
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
- // with the GNU Classpath Exception which is available at
13
- // https://www.gnu.org/software/classpath/license.html.
14
- //
15
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
- // *****************************************************************************
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.groupBy = exports.TreeCollection = exports.SimpleObservableCollection = exports.ChangeBatcher = exports.observableProperty = void 0;
19
- const vscode_languageserver_protocol_1 = require("@theia/core/shared/vscode-languageserver-protocol");
20
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
21
- function observableProperty(observationFunction) {
22
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
23
- return (target, property) => {
24
- Reflect.defineProperty(target, property, {
25
- // @ts-ignore
26
- get() { return this['_' + property]; },
27
- set(v) {
28
- // @ts-ignore
29
- this[observationFunction](property, v);
30
- // @ts-ignore
31
- this['_' + property] = v;
32
- }
33
- });
34
- };
35
- }
36
- exports.observableProperty = observableProperty;
37
- class ChangeBatcher {
38
- constructor(emitBatch, timeoutMs) {
39
- this.emitBatch = emitBatch;
40
- this.timeoutMs = timeoutMs;
41
- }
42
- changeOccurred() {
43
- if (!this.startTime) {
44
- this.startTime = Date.now();
45
- this.handle = setTimeout(() => {
46
- this.flush();
47
- }, this.timeoutMs);
48
- }
49
- else {
50
- if (Date.now() - this.startTime > this.timeoutMs) {
51
- this.flush();
52
- }
53
- }
54
- }
55
- flush() {
56
- if (this.handle) {
57
- clearTimeout(this.handle);
58
- this.handle = undefined;
59
- }
60
- this.startTime = undefined;
61
- this.emitBatch();
62
- }
63
- }
64
- exports.ChangeBatcher = ChangeBatcher;
65
- class SimpleObservableCollection {
66
- constructor(equals = (left, right) => left === right) {
67
- this.equals = equals;
68
- this._values = [];
69
- this.onChangeEmitter = new vscode_languageserver_protocol_1.Emitter();
70
- this.onChanged = this.onChangeEmitter.event;
71
- }
72
- add(value) {
73
- if (!this._values.find(v => this.equals(v, value))) {
74
- this._values.push(value);
75
- this.onChangeEmitter.fire({ added: [value] });
76
- return true;
77
- }
78
- return false;
79
- }
80
- remove(value) {
81
- const index = this._values.findIndex(v => this.equals(v, value));
82
- if (index >= 0) {
83
- this._values.splice(index, 1);
84
- this.onChangeEmitter.fire({ removed: [value] });
85
- return true;
86
- }
87
- return false;
88
- }
89
- get values() {
90
- return this._values;
91
- }
92
- clear() {
93
- const copy = this._values;
94
- this._values = [];
95
- this.onChangeEmitter.fire({ removed: copy });
96
- }
97
- }
98
- exports.SimpleObservableCollection = SimpleObservableCollection;
99
- class AbstractIndexedCollection {
100
- constructor() {
101
- this.keys = new Map();
102
- }
103
- get values() {
104
- if (!this._values) {
105
- this._values = [...this.keys.values()];
106
- }
107
- return this._values;
108
- }
109
- get size() {
110
- return this.keys.size;
111
- }
112
- has(key) {
113
- return this.keys.has(key);
114
- }
115
- get(key) {
116
- return this.keys.get(key);
117
- }
118
- doAdd(key, value) {
119
- const previous = this.keys.get(key);
120
- if (previous !== undefined) {
121
- return previous;
122
- }
123
- else {
124
- this.keys.set(key, value);
125
- this._values = undefined;
126
- return undefined;
127
- }
128
- }
129
- remove(key) {
130
- const previous = this.keys.get(key);
131
- if (previous !== undefined) {
132
- this.keys.delete(key);
133
- this._values = undefined;
134
- return previous;
135
- }
136
- return undefined;
137
- }
138
- }
139
- class TreeCollection extends AbstractIndexedCollection {
140
- constructor(owner, pathOf, deltaBuilder) {
141
- super();
142
- this.owner = owner;
143
- this.pathOf = pathOf;
144
- this.deltaBuilder = deltaBuilder;
145
- }
146
- add(item) {
147
- const path = this.pathOf(item);
148
- const previous = this.doAdd(path[path.length - 1], item);
149
- const deltaBuilder = this.deltaBuilder(item);
150
- if (deltaBuilder) {
151
- if (previous) {
152
- deltaBuilder.reportChanged(path, item);
153
- }
154
- else {
155
- deltaBuilder.reportAdded(path, item);
156
- }
157
- }
158
- return previous;
159
- }
160
- remove(key) {
161
- const toRemove = this.get(key);
162
- if (toRemove) {
163
- const deltaBuilder = this.deltaBuilder(toRemove);
164
- const path = this.pathOf(toRemove);
165
- super.remove(key);
166
- if (deltaBuilder) {
167
- deltaBuilder.reportRemoved(path);
168
- }
169
- }
170
- return toRemove;
171
- }
172
- entries() {
173
- return this[Symbol.iterator]();
174
- }
175
- [Symbol.iterator]() {
176
- const iter = this.values.entries();
177
- const that = this;
178
- return {
179
- next(..._args) {
180
- const res = iter.next();
181
- if (res.done) {
182
- return { done: true, value: res.value };
183
- }
184
- else {
185
- const path = that.pathOf(res.value[1]);
186
- const result = [path[path.length - 1], res.value[1]];
187
- return {
188
- done: false,
189
- value: result
190
- };
191
- }
192
- }
193
- };
194
- }
195
- }
196
- exports.TreeCollection = TreeCollection;
197
- function groupBy(items, keyOf) {
198
- const result = new Map();
199
- for (const item of items) {
200
- const key = keyOf(item);
201
- let values = result.get(key);
202
- if (!values) {
203
- values = [];
204
- result.set(key, values);
205
- }
206
- values.push(item);
207
- }
208
- return result;
209
- }
210
- exports.groupBy = groupBy;
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2022 STMicroelectronics and others.
4
+ //
5
+ // This program and the accompanying materials are made available under the
6
+ // terms of the Eclipse Public License v. 2.0 which is available at
7
+ // http://www.eclipse.org/legal/epl-2.0.
8
+ //
9
+ // This Source Code may also be made available under the following Secondary
10
+ // Licenses when the conditions for such availability set forth in the Eclipse
11
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ // with the GNU Classpath Exception which is available at
13
+ // https://www.gnu.org/software/classpath/license.html.
14
+ //
15
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
+ // *****************************************************************************
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.groupBy = exports.TreeCollection = exports.SimpleObservableCollection = exports.ChangeBatcher = exports.observableProperty = void 0;
19
+ const vscode_languageserver_protocol_1 = require("@theia/core/shared/vscode-languageserver-protocol");
20
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
21
+ function observableProperty(observationFunction) {
22
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
23
+ return (target, property) => {
24
+ Reflect.defineProperty(target, property, {
25
+ // @ts-ignore
26
+ get() { return this['_' + property]; },
27
+ set(v) {
28
+ // @ts-ignore
29
+ this[observationFunction](property, v);
30
+ // @ts-ignore
31
+ this['_' + property] = v;
32
+ }
33
+ });
34
+ };
35
+ }
36
+ exports.observableProperty = observableProperty;
37
+ class ChangeBatcher {
38
+ constructor(emitBatch, timeoutMs) {
39
+ this.emitBatch = emitBatch;
40
+ this.timeoutMs = timeoutMs;
41
+ }
42
+ changeOccurred() {
43
+ if (!this.startTime) {
44
+ this.startTime = Date.now();
45
+ this.handle = setTimeout(() => {
46
+ this.flush();
47
+ }, this.timeoutMs);
48
+ }
49
+ else {
50
+ if (Date.now() - this.startTime > this.timeoutMs) {
51
+ this.flush();
52
+ }
53
+ }
54
+ }
55
+ flush() {
56
+ if (this.handle) {
57
+ clearTimeout(this.handle);
58
+ this.handle = undefined;
59
+ }
60
+ this.startTime = undefined;
61
+ this.emitBatch();
62
+ }
63
+ }
64
+ exports.ChangeBatcher = ChangeBatcher;
65
+ class SimpleObservableCollection {
66
+ constructor(equals = (left, right) => left === right) {
67
+ this.equals = equals;
68
+ this._values = [];
69
+ this.onChangeEmitter = new vscode_languageserver_protocol_1.Emitter();
70
+ this.onChanged = this.onChangeEmitter.event;
71
+ }
72
+ add(value) {
73
+ if (!this._values.find(v => this.equals(v, value))) {
74
+ this._values.push(value);
75
+ this.onChangeEmitter.fire({ added: [value] });
76
+ return true;
77
+ }
78
+ return false;
79
+ }
80
+ remove(value) {
81
+ const index = this._values.findIndex(v => this.equals(v, value));
82
+ if (index >= 0) {
83
+ this._values.splice(index, 1);
84
+ this.onChangeEmitter.fire({ removed: [value] });
85
+ return true;
86
+ }
87
+ return false;
88
+ }
89
+ get values() {
90
+ return this._values;
91
+ }
92
+ clear() {
93
+ const copy = this._values;
94
+ this._values = [];
95
+ this.onChangeEmitter.fire({ removed: copy });
96
+ }
97
+ }
98
+ exports.SimpleObservableCollection = SimpleObservableCollection;
99
+ class AbstractIndexedCollection {
100
+ constructor() {
101
+ this.keys = new Map();
102
+ }
103
+ get values() {
104
+ if (!this._values) {
105
+ this._values = [...this.keys.values()];
106
+ }
107
+ return this._values;
108
+ }
109
+ get size() {
110
+ return this.keys.size;
111
+ }
112
+ has(key) {
113
+ return this.keys.has(key);
114
+ }
115
+ get(key) {
116
+ return this.keys.get(key);
117
+ }
118
+ doAdd(key, value) {
119
+ const previous = this.keys.get(key);
120
+ if (previous !== undefined) {
121
+ return previous;
122
+ }
123
+ else {
124
+ this.keys.set(key, value);
125
+ this._values = undefined;
126
+ return undefined;
127
+ }
128
+ }
129
+ remove(key) {
130
+ const previous = this.keys.get(key);
131
+ if (previous !== undefined) {
132
+ this.keys.delete(key);
133
+ this._values = undefined;
134
+ return previous;
135
+ }
136
+ return undefined;
137
+ }
138
+ }
139
+ class TreeCollection extends AbstractIndexedCollection {
140
+ constructor(owner, pathOf, deltaBuilder) {
141
+ super();
142
+ this.owner = owner;
143
+ this.pathOf = pathOf;
144
+ this.deltaBuilder = deltaBuilder;
145
+ }
146
+ add(item) {
147
+ const path = this.pathOf(item);
148
+ const previous = this.doAdd(path[path.length - 1], item);
149
+ const deltaBuilder = this.deltaBuilder(item);
150
+ if (deltaBuilder) {
151
+ if (previous) {
152
+ deltaBuilder.reportChanged(path, item);
153
+ }
154
+ else {
155
+ deltaBuilder.reportAdded(path, item);
156
+ }
157
+ }
158
+ return previous;
159
+ }
160
+ remove(key) {
161
+ const toRemove = this.get(key);
162
+ if (toRemove) {
163
+ const deltaBuilder = this.deltaBuilder(toRemove);
164
+ const path = this.pathOf(toRemove);
165
+ super.remove(key);
166
+ if (deltaBuilder) {
167
+ deltaBuilder.reportRemoved(path);
168
+ }
169
+ }
170
+ return toRemove;
171
+ }
172
+ entries() {
173
+ return this[Symbol.iterator]();
174
+ }
175
+ [Symbol.iterator]() {
176
+ const iter = this.values.entries();
177
+ const that = this;
178
+ return {
179
+ next(..._args) {
180
+ const res = iter.next();
181
+ if (res.done) {
182
+ return { done: true, value: res.value };
183
+ }
184
+ else {
185
+ const path = that.pathOf(res.value[1]);
186
+ const result = [path[path.length - 1], res.value[1]];
187
+ return {
188
+ done: false,
189
+ value: result
190
+ };
191
+ }
192
+ }
193
+ };
194
+ }
195
+ }
196
+ exports.TreeCollection = TreeCollection;
197
+ function groupBy(items, keyOf) {
198
+ const result = new Map();
199
+ for (const item of items) {
200
+ const key = keyOf(item);
201
+ let values = result.get(key);
202
+ if (!values) {
203
+ values = [];
204
+ result.set(key, values);
205
+ }
206
+ values.push(item);
207
+ }
208
+ return result;
209
+ }
210
+ exports.groupBy = groupBy;
211
211
  //# sourceMappingURL=collections.js.map
@@ -1,52 +1,52 @@
1
- import { Event } from '@theia/core';
2
- export interface CollectionDelta<K, T> {
3
- added?: T[];
4
- removed?: K[];
5
- }
6
- export declare enum DeltaKind {
7
- NONE = 0,
8
- ADDED = 1,
9
- REMOVED = 2,
10
- CHANGED = 3
11
- }
12
- export interface TreeDelta<K, T> {
13
- path: K[];
14
- type: DeltaKind;
15
- value?: Partial<T>;
16
- childDeltas?: TreeDelta<K, T>[];
17
- }
18
- export interface TreeDeltaBuilder<K, T> {
19
- reportAdded(path: K[], added: T): void;
20
- reportRemoved(path: K[]): void;
21
- reportChanged(path: K[], change: Partial<T>): void;
22
- }
23
- export declare class MappingTreeDeltaBuilder<K, T, V> implements TreeDeltaBuilder<K, V> {
24
- private readonly wrapped;
25
- private readonly map;
26
- private readonly mapPartial;
27
- constructor(wrapped: TreeDeltaBuilder<K, T>, map: (value: V) => T, mapPartial: (value: Partial<V>) => Partial<T>);
28
- reportAdded(path: K[], added: V): void;
29
- reportRemoved(path: K[]): void;
30
- reportChanged(path: K[], change: Partial<V>): void;
31
- }
32
- export declare class TreeDeltaBuilderImpl<K, T> {
33
- protected _currentDelta: TreeDelta<K, T>[];
34
- get currentDelta(): TreeDelta<K, T>[];
35
- reportAdded(path: K[], added: T): void;
36
- reportRemoved(path: K[]): void;
37
- reportChanged(path: K[], change: Partial<T>): void;
38
- private insert;
39
- private findNode;
40
- }
41
- export declare class AccumulatingTreeDeltaEmitter<K, T> extends TreeDeltaBuilderImpl<K, T> {
42
- private batcher;
43
- private onDidFlushEmitter;
44
- onDidFlush: Event<TreeDelta<K, T>[]>;
45
- constructor(timeoutMillis: number);
46
- flush(): void;
47
- doEmitDelta(): void;
48
- reportAdded(path: K[], added: T): void;
49
- reportChanged(path: K[], change: Partial<T>): void;
50
- reportRemoved(path: K[]): void;
51
- }
1
+ import { Event } from '@theia/core';
2
+ export interface CollectionDelta<K, T> {
3
+ added?: T[];
4
+ removed?: K[];
5
+ }
6
+ export declare enum DeltaKind {
7
+ NONE = 0,
8
+ ADDED = 1,
9
+ REMOVED = 2,
10
+ CHANGED = 3
11
+ }
12
+ export interface TreeDelta<K, T> {
13
+ path: K[];
14
+ type: DeltaKind;
15
+ value?: Partial<T>;
16
+ childDeltas?: TreeDelta<K, T>[];
17
+ }
18
+ export interface TreeDeltaBuilder<K, T> {
19
+ reportAdded(path: K[], added: T): void;
20
+ reportRemoved(path: K[]): void;
21
+ reportChanged(path: K[], change: Partial<T>): void;
22
+ }
23
+ export declare class MappingTreeDeltaBuilder<K, T, V> implements TreeDeltaBuilder<K, V> {
24
+ private readonly wrapped;
25
+ private readonly map;
26
+ private readonly mapPartial;
27
+ constructor(wrapped: TreeDeltaBuilder<K, T>, map: (value: V) => T, mapPartial: (value: Partial<V>) => Partial<T>);
28
+ reportAdded(path: K[], added: V): void;
29
+ reportRemoved(path: K[]): void;
30
+ reportChanged(path: K[], change: Partial<V>): void;
31
+ }
32
+ export declare class TreeDeltaBuilderImpl<K, T> {
33
+ protected _currentDelta: TreeDelta<K, T>[];
34
+ get currentDelta(): TreeDelta<K, T>[];
35
+ reportAdded(path: K[], added: T): void;
36
+ reportRemoved(path: K[]): void;
37
+ reportChanged(path: K[], change: Partial<T>): void;
38
+ private insert;
39
+ private findNode;
40
+ }
41
+ export declare class AccumulatingTreeDeltaEmitter<K, T> extends TreeDeltaBuilderImpl<K, T> {
42
+ private batcher;
43
+ private onDidFlushEmitter;
44
+ onDidFlush: Event<TreeDelta<K, T>[]>;
45
+ constructor(timeoutMillis: number);
46
+ flush(): void;
47
+ doEmitDelta(): void;
48
+ reportAdded(path: K[], added: T): void;
49
+ reportChanged(path: K[], change: Partial<T>): void;
50
+ reportRemoved(path: K[]): void;
51
+ }
52
52
  //# sourceMappingURL=tree-delta.d.ts.map