@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,166 +1,166 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2022 STMicroelectronics and others.
3
- //
4
- // This program and the accompanying materials are made available under the
5
- // terms of the Eclipse Public License v. 2.0 which is available at
6
- // http://www.eclipse.org/legal/epl-2.0.
7
- //
8
- // This Source Code may also be made available under the following Secondary
9
- // Licenses when the conditions for such availability set forth in the Eclipse
10
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- // with the GNU Classpath Exception which is available at
12
- // https://www.gnu.org/software/classpath/license.html.
13
- //
14
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
-
16
- import { DeltaKind, TreeDelta, TreeDeltaBuilderImpl } from './tree-delta';
17
- import * as chai from 'chai';
18
-
19
- const expect = chai.expect;
20
-
21
- interface TestType {
22
- id: string;
23
- prop: number;
24
- }
25
-
26
- describe('TreeDeltaBuilder tests', () => {
27
-
28
- it('should split paths', () => {
29
- const builder = new TreeDeltaBuilderImpl<string, TestType>();
30
-
31
- builder.reportAdded(['a', 'b', 'c'], {
32
- id: 'c',
33
- prop: 17
34
- });
35
-
36
- builder.reportRemoved(['a', 'b', 'd', 'e']);
37
-
38
- const expected: TreeDelta<string, TestType> = {
39
- path: ['a', 'b'],
40
- type: DeltaKind.NONE,
41
- childDeltas: [
42
- {
43
- path: ['d', 'e'],
44
- type: DeltaKind.REMOVED,
45
- },
46
- {
47
- type: DeltaKind.ADDED,
48
- path: ['c'],
49
- value: { id: 'c', prop: 17 },
50
- },
51
- ]
52
- };
53
-
54
- expect(builder.currentDelta).deep.equal([
55
- expected
56
- ]);
57
- });
58
-
59
- it('should merge add/remove child', () => {
60
- const builder = new TreeDeltaBuilderImpl<string, TestType>();
61
-
62
- builder.reportAdded(['a', 'b', 'c'], {
63
- id: 'c',
64
- prop: 17
65
- });
66
-
67
- builder.reportRemoved(['a', 'b', 'c', 'd']);
68
-
69
- expect(builder.currentDelta).deep.equal([{
70
- path: ['a', 'b', 'c'],
71
- type: DeltaKind.ADDED,
72
- value: { id: 'c', prop: 17 },
73
- }]);
74
- });
75
-
76
- it('should merge change', () => {
77
- const builder = new TreeDeltaBuilderImpl<string, TestType>();
78
-
79
- builder.reportChanged(['a', 'b', 'c'], { id: 'c', prop: 17 });
80
- builder.reportChanged(['a', 'b', 'c'], { prop: 18 });
81
- builder.reportChanged(['a', 'b', 'c'], { prop: 19 });
82
-
83
- expect(builder.currentDelta).deep.equal([
84
- {
85
- type: DeltaKind.CHANGED,
86
- path: ['a', 'b', 'c'],
87
- value: { id: 'c', prop: 19 },
88
- }
89
- ]);
90
- });
91
-
92
- it('should merge add/change', () => {
93
- const builder = new TreeDeltaBuilderImpl<string, TestType>();
94
-
95
- const obj = {
96
- id: 'c',
97
- prop: 17
98
- };
99
-
100
- builder.reportAdded(['a', 'b', 'c'], obj);
101
-
102
- obj.prop = 18;
103
-
104
- builder.reportChanged(['a', 'b', 'c'], { prop: 18 });
105
-
106
- expect(builder.currentDelta).deep.equal([
107
- {
108
- type: DeltaKind.ADDED,
109
- path: ['a', 'b', 'c'],
110
- value: { id: 'c', prop: 18 },
111
- }
112
- ]);
113
- });
114
-
115
- it('should handle adds/delete', () => {
116
- const builder = new TreeDeltaBuilderImpl<string, TestType>();
117
- builder.reportAdded(['a', 'b'], { id: 'c', prop: 14 });
118
- builder.reportRemoved(['a', 'b']);
119
- expect(builder.currentDelta).deep.equal([]);
120
- builder.reportAdded(['a', 'b'], { id: 'c', prop: 20 });
121
- expect(builder.currentDelta).deep.equal([{
122
- path: ['a', 'b'],
123
- type: DeltaKind.ADDED,
124
- value: { id: 'c', prop: 20 }
125
- }]);
126
- });
127
-
128
- it('should handle delete/add', () => {
129
- const builder = new TreeDeltaBuilderImpl<string, TestType>();
130
- builder.reportRemoved(['a', 'b']);
131
- builder.reportAdded(['a', 'b'], { id: 'c', prop: 14 });
132
- expect(builder.currentDelta).deep.equal([{
133
- path: ['a', 'b'],
134
- type: DeltaKind.CHANGED,
135
- value: { id: 'c', prop: 14 }
136
- }]);
137
- builder.reportRemoved(['a', 'b']);
138
- expect(builder.currentDelta).deep.equal([{
139
- path: ['a', 'b'],
140
- type: DeltaKind.REMOVED,
141
- }]);
142
- });
143
-
144
- it('should handle changed below changed', () => {
145
- const builder = new TreeDeltaBuilderImpl<string, TestType>();
146
- builder.reportChanged(['a', 'b', 'c', 'e'], { id: 'e', prop: 14 });
147
- builder.reportChanged(['a', 'b', 'c', 'd'], { id: 'd', prop: 23 });
148
- builder.reportChanged(['a', 'b', 'c'], { id: 'c', prop: 27 });
149
- expect(builder.currentDelta).deep.equal([{
150
- path: ['a', 'b', 'c'],
151
- type: DeltaKind.CHANGED,
152
- value: { id: 'c', prop: 27 },
153
- childDeltas: [
154
- {
155
- path: ['d'],
156
- type: DeltaKind.CHANGED,
157
- value: { id: 'd', prop: 23 }
158
- }, {
159
- path: ['e'],
160
- type: DeltaKind.CHANGED,
161
- value: { id: 'e', prop: 14 }
162
- }]
163
- }]);
164
- });
165
-
166
- });
1
+ // *****************************************************************************
2
+ // Copyright (C) 2022 STMicroelectronics and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
+
16
+ import { DeltaKind, TreeDelta, TreeDeltaBuilderImpl } from './tree-delta';
17
+ import * as chai from 'chai';
18
+
19
+ const expect = chai.expect;
20
+
21
+ interface TestType {
22
+ id: string;
23
+ prop: number;
24
+ }
25
+
26
+ describe('TreeDeltaBuilder tests', () => {
27
+
28
+ it('should split paths', () => {
29
+ const builder = new TreeDeltaBuilderImpl<string, TestType>();
30
+
31
+ builder.reportAdded(['a', 'b', 'c'], {
32
+ id: 'c',
33
+ prop: 17
34
+ });
35
+
36
+ builder.reportRemoved(['a', 'b', 'd', 'e']);
37
+
38
+ const expected: TreeDelta<string, TestType> = {
39
+ path: ['a', 'b'],
40
+ type: DeltaKind.NONE,
41
+ childDeltas: [
42
+ {
43
+ path: ['d', 'e'],
44
+ type: DeltaKind.REMOVED,
45
+ },
46
+ {
47
+ type: DeltaKind.ADDED,
48
+ path: ['c'],
49
+ value: { id: 'c', prop: 17 },
50
+ },
51
+ ]
52
+ };
53
+
54
+ expect(builder.currentDelta).deep.equal([
55
+ expected
56
+ ]);
57
+ });
58
+
59
+ it('should merge add/remove child', () => {
60
+ const builder = new TreeDeltaBuilderImpl<string, TestType>();
61
+
62
+ builder.reportAdded(['a', 'b', 'c'], {
63
+ id: 'c',
64
+ prop: 17
65
+ });
66
+
67
+ builder.reportRemoved(['a', 'b', 'c', 'd']);
68
+
69
+ expect(builder.currentDelta).deep.equal([{
70
+ path: ['a', 'b', 'c'],
71
+ type: DeltaKind.ADDED,
72
+ value: { id: 'c', prop: 17 },
73
+ }]);
74
+ });
75
+
76
+ it('should merge change', () => {
77
+ const builder = new TreeDeltaBuilderImpl<string, TestType>();
78
+
79
+ builder.reportChanged(['a', 'b', 'c'], { id: 'c', prop: 17 });
80
+ builder.reportChanged(['a', 'b', 'c'], { prop: 18 });
81
+ builder.reportChanged(['a', 'b', 'c'], { prop: 19 });
82
+
83
+ expect(builder.currentDelta).deep.equal([
84
+ {
85
+ type: DeltaKind.CHANGED,
86
+ path: ['a', 'b', 'c'],
87
+ value: { id: 'c', prop: 19 },
88
+ }
89
+ ]);
90
+ });
91
+
92
+ it('should merge add/change', () => {
93
+ const builder = new TreeDeltaBuilderImpl<string, TestType>();
94
+
95
+ const obj = {
96
+ id: 'c',
97
+ prop: 17
98
+ };
99
+
100
+ builder.reportAdded(['a', 'b', 'c'], obj);
101
+
102
+ obj.prop = 18;
103
+
104
+ builder.reportChanged(['a', 'b', 'c'], { prop: 18 });
105
+
106
+ expect(builder.currentDelta).deep.equal([
107
+ {
108
+ type: DeltaKind.ADDED,
109
+ path: ['a', 'b', 'c'],
110
+ value: { id: 'c', prop: 18 },
111
+ }
112
+ ]);
113
+ });
114
+
115
+ it('should handle adds/delete', () => {
116
+ const builder = new TreeDeltaBuilderImpl<string, TestType>();
117
+ builder.reportAdded(['a', 'b'], { id: 'c', prop: 14 });
118
+ builder.reportRemoved(['a', 'b']);
119
+ expect(builder.currentDelta).deep.equal([]);
120
+ builder.reportAdded(['a', 'b'], { id: 'c', prop: 20 });
121
+ expect(builder.currentDelta).deep.equal([{
122
+ path: ['a', 'b'],
123
+ type: DeltaKind.ADDED,
124
+ value: { id: 'c', prop: 20 }
125
+ }]);
126
+ });
127
+
128
+ it('should handle delete/add', () => {
129
+ const builder = new TreeDeltaBuilderImpl<string, TestType>();
130
+ builder.reportRemoved(['a', 'b']);
131
+ builder.reportAdded(['a', 'b'], { id: 'c', prop: 14 });
132
+ expect(builder.currentDelta).deep.equal([{
133
+ path: ['a', 'b'],
134
+ type: DeltaKind.CHANGED,
135
+ value: { id: 'c', prop: 14 }
136
+ }]);
137
+ builder.reportRemoved(['a', 'b']);
138
+ expect(builder.currentDelta).deep.equal([{
139
+ path: ['a', 'b'],
140
+ type: DeltaKind.REMOVED,
141
+ }]);
142
+ });
143
+
144
+ it('should handle changed below changed', () => {
145
+ const builder = new TreeDeltaBuilderImpl<string, TestType>();
146
+ builder.reportChanged(['a', 'b', 'c', 'e'], { id: 'e', prop: 14 });
147
+ builder.reportChanged(['a', 'b', 'c', 'd'], { id: 'd', prop: 23 });
148
+ builder.reportChanged(['a', 'b', 'c'], { id: 'c', prop: 27 });
149
+ expect(builder.currentDelta).deep.equal([{
150
+ path: ['a', 'b', 'c'],
151
+ type: DeltaKind.CHANGED,
152
+ value: { id: 'c', prop: 27 },
153
+ childDeltas: [
154
+ {
155
+ path: ['d'],
156
+ type: DeltaKind.CHANGED,
157
+ value: { id: 'd', prop: 23 }
158
+ }, {
159
+ path: ['e'],
160
+ type: DeltaKind.CHANGED,
161
+ value: { id: 'e', prop: 14 }
162
+ }]
163
+ }]);
164
+ });
165
+
166
+ });