@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,289 +1,289 @@
1
- "use strict";
2
- // *****************************************************************************
3
- // Copyright (C) 2023 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
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
18
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
21
- return c > 3 && r && Object.defineProperty(target, key, r), r;
22
- };
23
- var __metadata = (this && this.__metadata) || function (k, v) {
24
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
25
- };
26
- Object.defineProperty(exports, "__esModule", { value: true });
27
- exports.TestViewContribution = exports.TEST_VIEW_CONTAINER_TITLE_OPTIONS = exports.TEST_VIEW_CONTAINER_ID = exports.TEST_VIEW_INLINE_MENU = exports.TEST_VIEW_CONTEXT_MENU = exports.TestViewCommands = void 0;
28
- const browser_1 = require("@theia/core/lib/browser");
29
- const core_1 = require("@theia/core");
30
- const inversify_1 = require("@theia/core/shared/inversify");
31
- const test_service_1 = require("../test-service");
32
- const context_key_service_1 = require("@theia/core/lib/browser/context-key-service");
33
- const test_tree_widget_1 = require("./test-tree-widget");
34
- const navigation_location_service_1 = require("@theia/editor/lib/browser/navigation/navigation-location-service");
35
- const navigation_location_1 = require("@theia/editor/lib/browser/navigation/navigation-location");
36
- const file_service_1 = require("@theia/filesystem/lib/browser/file-service");
37
- const file_navigator_commands_1 = require("@theia/navigator/lib/browser/file-navigator-commands");
38
- var TestViewCommands;
39
- (function (TestViewCommands) {
40
- /**
41
- * Command which refreshes all test.
42
- */
43
- TestViewCommands.REFRESH = core_1.Command.toDefaultLocalizedCommand({
44
- id: "testing.refreshTests" /* RefreshTestsAction */,
45
- label: 'Refresh Tests',
46
- category: 'Test',
47
- iconClass: (0, browser_1.codicon)('refresh')
48
- });
49
- /**
50
- * Command which cancels the refresh
51
- */
52
- TestViewCommands.CANCEL_REFRESH = core_1.Command.toDefaultLocalizedCommand({
53
- id: "testing.cancelTestRefresh" /* CancelTestRefreshAction */,
54
- label: 'Cancel Test Refresh',
55
- category: 'Test',
56
- iconClass: (0, browser_1.codicon)('stop')
57
- });
58
- TestViewCommands.RUN_ALL_TESTS = core_1.Command.toDefaultLocalizedCommand({
59
- id: "testing.runAll" /* RunAllAction */,
60
- label: 'Run All Tests',
61
- category: 'Test',
62
- iconClass: (0, browser_1.codicon)('run-all')
63
- });
64
- TestViewCommands.DEBUG_ALL_TESTS = core_1.Command.toDefaultLocalizedCommand({
65
- id: "testing.debugAll" /* DebugAllAction */,
66
- label: 'Debug Tests',
67
- category: 'Test',
68
- iconClass: (0, browser_1.codicon)('debug-all')
69
- });
70
- TestViewCommands.RUN_TEST = core_1.Command.toDefaultLocalizedCommand({
71
- id: "testing.run" /* RunAction */,
72
- label: 'Run Test',
73
- category: 'Test',
74
- iconClass: (0, browser_1.codicon)('run')
75
- });
76
- TestViewCommands.RUN_TEST_WITH_PROFILE = core_1.Command.toDefaultLocalizedCommand({
77
- id: "testing.runUsing" /* RunUsingProfileAction */,
78
- category: 'Test',
79
- label: 'Execute using Profile...'
80
- });
81
- TestViewCommands.DEBUG_TEST = core_1.Command.toDefaultLocalizedCommand({
82
- id: "testing.debug" /* DebugAction */,
83
- label: 'Debug Test',
84
- category: 'Test',
85
- iconClass: (0, browser_1.codicon)('debug-alt')
86
- });
87
- TestViewCommands.CANCEL_ALL_RUNS = core_1.Command.toLocalizedCommand({
88
- id: 'testing.cancelAllRuns',
89
- label: 'Cancel All Test Runs',
90
- category: 'Test',
91
- iconClass: (0, browser_1.codicon)('debug-stop')
92
- }, 'theia/test/cancelAllTestRuns', core_1.nls.getDefaultKey('Test'));
93
- TestViewCommands.CANCEL_RUN = core_1.Command.toDefaultLocalizedCommand({
94
- id: "testing.cancelRun" /* CancelTestRunAction */,
95
- label: 'Cancel Test Run',
96
- category: 'Test',
97
- iconClass: (0, browser_1.codicon)('debug-stop')
98
- });
99
- TestViewCommands.GOTO_TEST = core_1.Command.toDefaultLocalizedCommand({
100
- id: "testing.editFocusedTest" /* GoToTest */,
101
- label: 'Go to Test',
102
- category: 'Test',
103
- iconClass: (0, browser_1.codicon)('go-to-file')
104
- });
105
- TestViewCommands.CONFIGURE_PROFILES = core_1.Command.toDefaultLocalizedCommand({
106
- id: "testing.configureProfile" /* ConfigureTestProfilesAction */,
107
- label: 'Configure Test Profiles',
108
- category: 'Test'
109
- });
110
- TestViewCommands.CLEAR_ALL_RESULTS = core_1.Command.toDefaultLocalizedCommand({
111
- id: "testing.clearTestResults" /* ClearTestResultsAction */,
112
- label: 'Clear All Results',
113
- category: 'Test',
114
- iconClass: (0, browser_1.codicon)('trash')
115
- });
116
- })(TestViewCommands = exports.TestViewCommands || (exports.TestViewCommands = {}));
117
- exports.TEST_VIEW_CONTEXT_MENU = ['test-view-context-menu'];
118
- exports.TEST_VIEW_INLINE_MENU = [...exports.TEST_VIEW_CONTEXT_MENU, 'inline'];
119
- exports.TEST_VIEW_CONTAINER_ID = 'test-view-container';
120
- exports.TEST_VIEW_CONTAINER_TITLE_OPTIONS = {
121
- label: core_1.nls.localizeByDefault('Testing'),
122
- iconClass: (0, browser_1.codicon)('beaker'),
123
- closeable: true
124
- };
125
- let TestViewContribution = class TestViewContribution extends browser_1.AbstractViewContribution {
126
- constructor() {
127
- super({
128
- viewContainerId: exports.TEST_VIEW_CONTAINER_ID,
129
- widgetId: test_tree_widget_1.TestTreeWidget.ID,
130
- widgetName: core_1.nls.localizeByDefault('Test Explorer'),
131
- defaultWidgetOptions: {
132
- area: 'left',
133
- rank: 600,
134
- }
135
- });
136
- }
137
- async initializeLayout() {
138
- await this.openView({ activate: false });
139
- }
140
- registerCommands(commands) {
141
- super.registerCommands(commands);
142
- commands.registerCommand(TestViewCommands.REFRESH, {
143
- isEnabled: w => this.withWidget(w, () => !this.testService.isRefreshing),
144
- isVisible: w => this.withWidget(w, () => !this.testService.isRefreshing),
145
- execute: () => this.testService.refresh()
146
- });
147
- commands.registerCommand(TestViewCommands.CANCEL_REFRESH, {
148
- isEnabled: w => this.withWidget(w, () => this.testService.isRefreshing),
149
- isVisible: w => this.withWidget(w, () => this.testService.isRefreshing),
150
- execute: () => this.testService.cancelRefresh()
151
- });
152
- commands.registerCommand(TestViewCommands.RUN_ALL_TESTS, {
153
- isEnabled: w => this.withWidget(w, () => true),
154
- isVisible: w => this.withWidget(w, () => true),
155
- execute: () => this.testService.runAllTests(test_service_1.TestRunProfileKind.Run)
156
- });
157
- commands.registerCommand(TestViewCommands.DEBUG_ALL_TESTS, {
158
- isEnabled: w => this.withWidget(w, () => true),
159
- isVisible: w => this.withWidget(w, () => true),
160
- execute: () => this.testService.runAllTests(test_service_1.TestRunProfileKind.Debug)
161
- });
162
- commands.registerCommand(TestViewCommands.RUN_TEST, {
163
- isEnabled: t => test_service_1.TestItem.is(t),
164
- isVisible: t => test_service_1.TestItem.is(t),
165
- execute: t => {
166
- this.testService.runTests(test_service_1.TestRunProfileKind.Run, [t]);
167
- }
168
- });
169
- commands.registerCommand(TestViewCommands.DEBUG_TEST, {
170
- isEnabled: t => test_service_1.TestItem.is(t),
171
- isVisible: t => test_service_1.TestItem.is(t),
172
- execute: t => {
173
- this.testService.runTests(test_service_1.TestRunProfileKind.Debug, [t]);
174
- }
175
- });
176
- commands.registerCommand(TestViewCommands.RUN_TEST_WITH_PROFILE, {
177
- isEnabled: t => test_service_1.TestItem.is(t),
178
- isVisible: t => test_service_1.TestItem.is(t),
179
- execute: t => {
180
- this.testService.runTestsWithProfile([t]);
181
- }
182
- });
183
- commands.registerCommand(TestViewCommands.CANCEL_ALL_RUNS, {
184
- isEnabled: w => this.withWidget(w, () => true),
185
- isVisible: w => this.withWidget(w, () => true),
186
- execute: () => this.cancelAllRuns()
187
- });
188
- commands.registerCommand(TestViewCommands.GOTO_TEST, {
189
- isEnabled: t => test_service_1.TestItem.is(t) && !!t.uri,
190
- isVisible: t => test_service_1.TestItem.is(t) && !!t.uri,
191
- execute: t => {
192
- if (test_service_1.TestItem.is(t)) {
193
- this.fileSystem.resolve(t.uri).then(stat => {
194
- if (stat.isFile) {
195
- this.navigationService.reveal(navigation_location_1.NavigationLocation.create(t.uri, t.range ? t.range.start : { line: 0, character: 0 }));
196
- }
197
- else {
198
- commands.executeCommand(file_navigator_commands_1.FileNavigatorCommands.REVEAL_IN_NAVIGATOR.id, t.uri);
199
- }
200
- });
201
- }
202
- }
203
- });
204
- commands.registerCommand(TestViewCommands.CONFIGURE_PROFILES, {
205
- execute: () => {
206
- this.testService.configureProfile();
207
- }
208
- });
209
- }
210
- cancelAllRuns() {
211
- this.testService.getControllers().forEach(controller => controller.testRuns.forEach(run => run.cancel()));
212
- }
213
- registerMenus(menus) {
214
- super.registerMenus(menus);
215
- menus.registerMenuAction(exports.TEST_VIEW_INLINE_MENU, {
216
- commandId: TestViewCommands.RUN_TEST.id,
217
- order: 'a'
218
- });
219
- menus.registerMenuAction(exports.TEST_VIEW_INLINE_MENU, {
220
- commandId: TestViewCommands.DEBUG_TEST.id,
221
- order: 'aa'
222
- });
223
- menus.registerMenuAction(exports.TEST_VIEW_INLINE_MENU, {
224
- commandId: TestViewCommands.GOTO_TEST.id,
225
- order: 'aaa'
226
- });
227
- menus.registerMenuAction(exports.TEST_VIEW_CONTEXT_MENU, {
228
- commandId: TestViewCommands.RUN_TEST_WITH_PROFILE.id,
229
- order: 'aaaa'
230
- });
231
- }
232
- registerToolbarItems(toolbar) {
233
- toolbar.registerItem({
234
- id: TestViewCommands.REFRESH.id,
235
- command: TestViewCommands.REFRESH.id,
236
- priority: 0,
237
- onDidChange: this.testService.onDidChangeIsRefreshing
238
- });
239
- toolbar.registerItem({
240
- id: TestViewCommands.CANCEL_REFRESH.id,
241
- command: TestViewCommands.CANCEL_REFRESH.id,
242
- priority: 0,
243
- onDidChange: this.testService.onDidChangeIsRefreshing
244
- });
245
- toolbar.registerItem({
246
- id: TestViewCommands.RUN_ALL_TESTS.id,
247
- command: TestViewCommands.RUN_ALL_TESTS.id,
248
- priority: 1
249
- });
250
- toolbar.registerItem({
251
- id: TestViewCommands.DEBUG_ALL_TESTS.id,
252
- command: TestViewCommands.DEBUG_ALL_TESTS.id,
253
- priority: 2
254
- });
255
- toolbar.registerItem({
256
- id: TestViewCommands.CANCEL_ALL_RUNS.id,
257
- command: TestViewCommands.CANCEL_ALL_RUNS.id,
258
- priority: 3
259
- });
260
- }
261
- withWidget(widget = this.tryGetWidget(), cb) {
262
- if (widget instanceof test_tree_widget_1.TestTreeWidget && widget.id === test_tree_widget_1.TestTreeWidget.ID) {
263
- return cb(widget);
264
- }
265
- return false;
266
- }
267
- };
268
- __decorate([
269
- (0, inversify_1.inject)(test_service_1.TestService),
270
- __metadata("design:type", Object)
271
- ], TestViewContribution.prototype, "testService", void 0);
272
- __decorate([
273
- (0, inversify_1.inject)(context_key_service_1.ContextKeyService),
274
- __metadata("design:type", Object)
275
- ], TestViewContribution.prototype, "contextKeys", void 0);
276
- __decorate([
277
- (0, inversify_1.inject)(navigation_location_service_1.NavigationLocationService),
278
- __metadata("design:type", navigation_location_service_1.NavigationLocationService)
279
- ], TestViewContribution.prototype, "navigationService", void 0);
280
- __decorate([
281
- (0, inversify_1.inject)(file_service_1.FileService),
282
- __metadata("design:type", file_service_1.FileService)
283
- ], TestViewContribution.prototype, "fileSystem", void 0);
284
- TestViewContribution = __decorate([
285
- (0, inversify_1.injectable)(),
286
- __metadata("design:paramtypes", [])
287
- ], TestViewContribution);
288
- exports.TestViewContribution = TestViewContribution;
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2023 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
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
18
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
21
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
22
+ };
23
+ var __metadata = (this && this.__metadata) || function (k, v) {
24
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
25
+ };
26
+ Object.defineProperty(exports, "__esModule", { value: true });
27
+ exports.TestViewContribution = exports.TEST_VIEW_CONTAINER_TITLE_OPTIONS = exports.TEST_VIEW_CONTAINER_ID = exports.TEST_VIEW_INLINE_MENU = exports.TEST_VIEW_CONTEXT_MENU = exports.TestViewCommands = void 0;
28
+ const browser_1 = require("@theia/core/lib/browser");
29
+ const core_1 = require("@theia/core");
30
+ const inversify_1 = require("@theia/core/shared/inversify");
31
+ const test_service_1 = require("../test-service");
32
+ const context_key_service_1 = require("@theia/core/lib/browser/context-key-service");
33
+ const test_tree_widget_1 = require("./test-tree-widget");
34
+ const navigation_location_service_1 = require("@theia/editor/lib/browser/navigation/navigation-location-service");
35
+ const navigation_location_1 = require("@theia/editor/lib/browser/navigation/navigation-location");
36
+ const file_service_1 = require("@theia/filesystem/lib/browser/file-service");
37
+ const file_navigator_commands_1 = require("@theia/navigator/lib/browser/file-navigator-commands");
38
+ var TestViewCommands;
39
+ (function (TestViewCommands) {
40
+ /**
41
+ * Command which refreshes all test.
42
+ */
43
+ TestViewCommands.REFRESH = core_1.Command.toDefaultLocalizedCommand({
44
+ id: "testing.refreshTests" /* RefreshTestsAction */,
45
+ label: 'Refresh Tests',
46
+ category: 'Test',
47
+ iconClass: (0, browser_1.codicon)('refresh')
48
+ });
49
+ /**
50
+ * Command which cancels the refresh
51
+ */
52
+ TestViewCommands.CANCEL_REFRESH = core_1.Command.toDefaultLocalizedCommand({
53
+ id: "testing.cancelTestRefresh" /* CancelTestRefreshAction */,
54
+ label: 'Cancel Test Refresh',
55
+ category: 'Test',
56
+ iconClass: (0, browser_1.codicon)('stop')
57
+ });
58
+ TestViewCommands.RUN_ALL_TESTS = core_1.Command.toDefaultLocalizedCommand({
59
+ id: "testing.runAll" /* RunAllAction */,
60
+ label: 'Run All Tests',
61
+ category: 'Test',
62
+ iconClass: (0, browser_1.codicon)('run-all')
63
+ });
64
+ TestViewCommands.DEBUG_ALL_TESTS = core_1.Command.toDefaultLocalizedCommand({
65
+ id: "testing.debugAll" /* DebugAllAction */,
66
+ label: 'Debug Tests',
67
+ category: 'Test',
68
+ iconClass: (0, browser_1.codicon)('debug-all')
69
+ });
70
+ TestViewCommands.RUN_TEST = core_1.Command.toDefaultLocalizedCommand({
71
+ id: "testing.run" /* RunAction */,
72
+ label: 'Run Test',
73
+ category: 'Test',
74
+ iconClass: (0, browser_1.codicon)('run')
75
+ });
76
+ TestViewCommands.RUN_TEST_WITH_PROFILE = core_1.Command.toDefaultLocalizedCommand({
77
+ id: "testing.runUsing" /* RunUsingProfileAction */,
78
+ category: 'Test',
79
+ label: 'Execute using Profile...'
80
+ });
81
+ TestViewCommands.DEBUG_TEST = core_1.Command.toDefaultLocalizedCommand({
82
+ id: "testing.debug" /* DebugAction */,
83
+ label: 'Debug Test',
84
+ category: 'Test',
85
+ iconClass: (0, browser_1.codicon)('debug-alt')
86
+ });
87
+ TestViewCommands.CANCEL_ALL_RUNS = core_1.Command.toLocalizedCommand({
88
+ id: 'testing.cancelAllRuns',
89
+ label: 'Cancel All Test Runs',
90
+ category: 'Test',
91
+ iconClass: (0, browser_1.codicon)('debug-stop')
92
+ }, 'theia/test/cancelAllTestRuns', core_1.nls.getDefaultKey('Test'));
93
+ TestViewCommands.CANCEL_RUN = core_1.Command.toDefaultLocalizedCommand({
94
+ id: "testing.cancelRun" /* CancelTestRunAction */,
95
+ label: 'Cancel Test Run',
96
+ category: 'Test',
97
+ iconClass: (0, browser_1.codicon)('debug-stop')
98
+ });
99
+ TestViewCommands.GOTO_TEST = core_1.Command.toDefaultLocalizedCommand({
100
+ id: "testing.editFocusedTest" /* GoToTest */,
101
+ label: 'Go to Test',
102
+ category: 'Test',
103
+ iconClass: (0, browser_1.codicon)('go-to-file')
104
+ });
105
+ TestViewCommands.CONFIGURE_PROFILES = core_1.Command.toDefaultLocalizedCommand({
106
+ id: "testing.configureProfile" /* ConfigureTestProfilesAction */,
107
+ label: 'Configure Test Profiles',
108
+ category: 'Test'
109
+ });
110
+ TestViewCommands.CLEAR_ALL_RESULTS = core_1.Command.toDefaultLocalizedCommand({
111
+ id: "testing.clearTestResults" /* ClearTestResultsAction */,
112
+ label: 'Clear All Results',
113
+ category: 'Test',
114
+ iconClass: (0, browser_1.codicon)('trash')
115
+ });
116
+ })(TestViewCommands = exports.TestViewCommands || (exports.TestViewCommands = {}));
117
+ exports.TEST_VIEW_CONTEXT_MENU = ['test-view-context-menu'];
118
+ exports.TEST_VIEW_INLINE_MENU = [...exports.TEST_VIEW_CONTEXT_MENU, 'inline'];
119
+ exports.TEST_VIEW_CONTAINER_ID = 'test-view-container';
120
+ exports.TEST_VIEW_CONTAINER_TITLE_OPTIONS = {
121
+ label: core_1.nls.localizeByDefault('Testing'),
122
+ iconClass: (0, browser_1.codicon)('beaker'),
123
+ closeable: true
124
+ };
125
+ let TestViewContribution = class TestViewContribution extends browser_1.AbstractViewContribution {
126
+ constructor() {
127
+ super({
128
+ viewContainerId: exports.TEST_VIEW_CONTAINER_ID,
129
+ widgetId: test_tree_widget_1.TestTreeWidget.ID,
130
+ widgetName: core_1.nls.localizeByDefault('Test Explorer'),
131
+ defaultWidgetOptions: {
132
+ area: 'left',
133
+ rank: 600,
134
+ }
135
+ });
136
+ }
137
+ async initializeLayout() {
138
+ await this.openView({ activate: false });
139
+ }
140
+ registerCommands(commands) {
141
+ super.registerCommands(commands);
142
+ commands.registerCommand(TestViewCommands.REFRESH, {
143
+ isEnabled: w => this.withWidget(w, () => !this.testService.isRefreshing),
144
+ isVisible: w => this.withWidget(w, () => !this.testService.isRefreshing),
145
+ execute: () => this.testService.refresh()
146
+ });
147
+ commands.registerCommand(TestViewCommands.CANCEL_REFRESH, {
148
+ isEnabled: w => this.withWidget(w, () => this.testService.isRefreshing),
149
+ isVisible: w => this.withWidget(w, () => this.testService.isRefreshing),
150
+ execute: () => this.testService.cancelRefresh()
151
+ });
152
+ commands.registerCommand(TestViewCommands.RUN_ALL_TESTS, {
153
+ isEnabled: w => this.withWidget(w, () => true),
154
+ isVisible: w => this.withWidget(w, () => true),
155
+ execute: () => this.testService.runAllTests(test_service_1.TestRunProfileKind.Run)
156
+ });
157
+ commands.registerCommand(TestViewCommands.DEBUG_ALL_TESTS, {
158
+ isEnabled: w => this.withWidget(w, () => true),
159
+ isVisible: w => this.withWidget(w, () => true),
160
+ execute: () => this.testService.runAllTests(test_service_1.TestRunProfileKind.Debug)
161
+ });
162
+ commands.registerCommand(TestViewCommands.RUN_TEST, {
163
+ isEnabled: t => test_service_1.TestItem.is(t),
164
+ isVisible: t => test_service_1.TestItem.is(t),
165
+ execute: t => {
166
+ this.testService.runTests(test_service_1.TestRunProfileKind.Run, [t]);
167
+ }
168
+ });
169
+ commands.registerCommand(TestViewCommands.DEBUG_TEST, {
170
+ isEnabled: t => test_service_1.TestItem.is(t),
171
+ isVisible: t => test_service_1.TestItem.is(t),
172
+ execute: t => {
173
+ this.testService.runTests(test_service_1.TestRunProfileKind.Debug, [t]);
174
+ }
175
+ });
176
+ commands.registerCommand(TestViewCommands.RUN_TEST_WITH_PROFILE, {
177
+ isEnabled: t => test_service_1.TestItem.is(t),
178
+ isVisible: t => test_service_1.TestItem.is(t),
179
+ execute: t => {
180
+ this.testService.runTestsWithProfile([t]);
181
+ }
182
+ });
183
+ commands.registerCommand(TestViewCommands.CANCEL_ALL_RUNS, {
184
+ isEnabled: w => this.withWidget(w, () => true),
185
+ isVisible: w => this.withWidget(w, () => true),
186
+ execute: () => this.cancelAllRuns()
187
+ });
188
+ commands.registerCommand(TestViewCommands.GOTO_TEST, {
189
+ isEnabled: t => test_service_1.TestItem.is(t) && !!t.uri,
190
+ isVisible: t => test_service_1.TestItem.is(t) && !!t.uri,
191
+ execute: t => {
192
+ if (test_service_1.TestItem.is(t)) {
193
+ this.fileSystem.resolve(t.uri).then(stat => {
194
+ if (stat.isFile) {
195
+ this.navigationService.reveal(navigation_location_1.NavigationLocation.create(t.uri, t.range ? t.range.start : { line: 0, character: 0 }));
196
+ }
197
+ else {
198
+ commands.executeCommand(file_navigator_commands_1.FileNavigatorCommands.REVEAL_IN_NAVIGATOR.id, t.uri);
199
+ }
200
+ });
201
+ }
202
+ }
203
+ });
204
+ commands.registerCommand(TestViewCommands.CONFIGURE_PROFILES, {
205
+ execute: () => {
206
+ this.testService.configureProfile();
207
+ }
208
+ });
209
+ }
210
+ cancelAllRuns() {
211
+ this.testService.getControllers().forEach(controller => controller.testRuns.forEach(run => run.cancel()));
212
+ }
213
+ registerMenus(menus) {
214
+ super.registerMenus(menus);
215
+ menus.registerMenuAction(exports.TEST_VIEW_INLINE_MENU, {
216
+ commandId: TestViewCommands.RUN_TEST.id,
217
+ order: 'a'
218
+ });
219
+ menus.registerMenuAction(exports.TEST_VIEW_INLINE_MENU, {
220
+ commandId: TestViewCommands.DEBUG_TEST.id,
221
+ order: 'aa'
222
+ });
223
+ menus.registerMenuAction(exports.TEST_VIEW_INLINE_MENU, {
224
+ commandId: TestViewCommands.GOTO_TEST.id,
225
+ order: 'aaa'
226
+ });
227
+ menus.registerMenuAction(exports.TEST_VIEW_CONTEXT_MENU, {
228
+ commandId: TestViewCommands.RUN_TEST_WITH_PROFILE.id,
229
+ order: 'aaaa'
230
+ });
231
+ }
232
+ registerToolbarItems(toolbar) {
233
+ toolbar.registerItem({
234
+ id: TestViewCommands.REFRESH.id,
235
+ command: TestViewCommands.REFRESH.id,
236
+ priority: 0,
237
+ onDidChange: this.testService.onDidChangeIsRefreshing
238
+ });
239
+ toolbar.registerItem({
240
+ id: TestViewCommands.CANCEL_REFRESH.id,
241
+ command: TestViewCommands.CANCEL_REFRESH.id,
242
+ priority: 0,
243
+ onDidChange: this.testService.onDidChangeIsRefreshing
244
+ });
245
+ toolbar.registerItem({
246
+ id: TestViewCommands.RUN_ALL_TESTS.id,
247
+ command: TestViewCommands.RUN_ALL_TESTS.id,
248
+ priority: 1
249
+ });
250
+ toolbar.registerItem({
251
+ id: TestViewCommands.DEBUG_ALL_TESTS.id,
252
+ command: TestViewCommands.DEBUG_ALL_TESTS.id,
253
+ priority: 2
254
+ });
255
+ toolbar.registerItem({
256
+ id: TestViewCommands.CANCEL_ALL_RUNS.id,
257
+ command: TestViewCommands.CANCEL_ALL_RUNS.id,
258
+ priority: 3
259
+ });
260
+ }
261
+ withWidget(widget = this.tryGetWidget(), cb) {
262
+ if (widget instanceof test_tree_widget_1.TestTreeWidget && widget.id === test_tree_widget_1.TestTreeWidget.ID) {
263
+ return cb(widget);
264
+ }
265
+ return false;
266
+ }
267
+ };
268
+ __decorate([
269
+ (0, inversify_1.inject)(test_service_1.TestService),
270
+ __metadata("design:type", Object)
271
+ ], TestViewContribution.prototype, "testService", void 0);
272
+ __decorate([
273
+ (0, inversify_1.inject)(context_key_service_1.ContextKeyService),
274
+ __metadata("design:type", Object)
275
+ ], TestViewContribution.prototype, "contextKeys", void 0);
276
+ __decorate([
277
+ (0, inversify_1.inject)(navigation_location_service_1.NavigationLocationService),
278
+ __metadata("design:type", navigation_location_service_1.NavigationLocationService)
279
+ ], TestViewContribution.prototype, "navigationService", void 0);
280
+ __decorate([
281
+ (0, inversify_1.inject)(file_service_1.FileService),
282
+ __metadata("design:type", file_service_1.FileService)
283
+ ], TestViewContribution.prototype, "fileSystem", void 0);
284
+ TestViewContribution = __decorate([
285
+ (0, inversify_1.injectable)(),
286
+ __metadata("design:paramtypes", [])
287
+ ], TestViewContribution);
288
+ exports.TestViewContribution = TestViewContribution;
289
289
  //# sourceMappingURL=test-view-contribution.js.map
@@ -1,7 +1,7 @@
1
- import '../../../src/browser/style/index.css';
2
- import { interfaces, ContainerModule, Container } from '@theia/core/shared/inversify';
3
- declare const _default: ContainerModule;
4
- export default _default;
5
- export declare function createTestTreeContainer(parent: interfaces.Container): Container;
6
- export declare function createTestRunContainer(parent: interfaces.Container): Container;
1
+ import '../../../src/browser/style/index.css';
2
+ import { interfaces, ContainerModule, Container } from '@theia/core/shared/inversify';
3
+ declare const _default: ContainerModule;
4
+ export default _default;
5
+ export declare function createTestTreeContainer(parent: interfaces.Container): Container;
6
+ export declare function createTestRunContainer(parent: interfaces.Container): Container;
7
7
  //# sourceMappingURL=test-view-frontend-module.d.ts.map