@theia/test 1.53.0-next.4 → 1.53.0-next.55

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.
@@ -1,319 +1,328 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2023 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
-
17
- import { AbstractViewContribution, FrontendApplicationContribution, ViewContainerTitleOptions, Widget, codicon } from '@theia/core/lib/browser';
18
- import { Command, CommandRegistry, MenuModelRegistry, nls } from '@theia/core';
19
- import { inject, injectable } from '@theia/core/shared/inversify';
20
- import { TestItem, TestRunProfileKind, TestService } from '../test-service';
21
- import { ContextKeyService } from '@theia/core/lib/browser/context-key-service';
22
- import { TestTreeWidget } from './test-tree-widget';
23
- import { TabBarToolbarContribution, TabBarToolbarRegistry } from '@theia/core/lib/browser/shell/tab-bar-toolbar';
24
- import { TestCommandId } from '../constants';
25
- import { NavigationLocationService } from '@theia/editor/lib/browser/navigation/navigation-location-service';
26
- import { NavigationLocation } from '@theia/editor/lib/browser/navigation/navigation-location';
27
- import { FileService } from '@theia/filesystem/lib/browser/file-service';
28
- import { FileNavigatorCommands } from '@theia/navigator/lib/browser/file-navigator-commands';
29
-
30
- export namespace TestViewCommands {
31
- /**
32
- * Command which refreshes all test.
33
- */
34
- export const REFRESH: Command = Command.toDefaultLocalizedCommand({
35
- id: TestCommandId.RefreshTestsAction,
36
- label: 'Refresh Tests',
37
- category: 'Test',
38
- iconClass: codicon('refresh')
39
- });
40
-
41
- /**
42
- * Command which cancels the refresh
43
- */
44
- export const CANCEL_REFRESH: Command = Command.toDefaultLocalizedCommand({
45
- id: TestCommandId.CancelTestRefreshAction,
46
- label: 'Cancel Test Refresh',
47
- category: 'Test',
48
- iconClass: codicon('stop')
49
- });
50
-
51
- export const RUN_ALL_TESTS: Command = Command.toDefaultLocalizedCommand({
52
- id: TestCommandId.RunAllAction,
53
- label: 'Run All Tests',
54
- category: 'Test',
55
- iconClass: codicon('run-all')
56
- });
57
-
58
- export const DEBUG_ALL_TESTS: Command = Command.toDefaultLocalizedCommand({
59
- id: TestCommandId.DebugAllAction,
60
- label: 'Debug Tests',
61
- category: 'Test',
62
- iconClass: codicon('debug-all')
63
- });
64
-
65
- export const RUN_TEST: Command = Command.toDefaultLocalizedCommand({
66
- id: TestCommandId.RunAction,
67
- label: 'Run Test',
68
- category: 'Test',
69
- iconClass: codicon('run')
70
- });
71
-
72
- export const RUN_TEST_WITH_PROFILE: Command = Command.toDefaultLocalizedCommand({
73
- id: TestCommandId.RunUsingProfileAction,
74
- category: 'Test',
75
- label: 'Execute using Profile...'
76
- });
77
-
78
- export const DEBUG_TEST: Command = Command.toDefaultLocalizedCommand({
79
- id: TestCommandId.DebugAction,
80
- label: 'Debug Test',
81
- category: 'Test',
82
- iconClass: codicon('debug-alt')
83
- });
84
-
85
- export const CANCEL_ALL_RUNS: Command = Command.toLocalizedCommand({
86
- id: 'testing.cancelAllRuns',
87
- label: 'Cancel All Test Runs',
88
- category: 'Test',
89
- iconClass: codicon('debug-stop')
90
- }, 'theia/test/cancelAllTestRuns', nls.getDefaultKey('Test'));
91
-
92
- export const CANCEL_RUN: Command = Command.toDefaultLocalizedCommand({
93
- id: TestCommandId.CancelTestRunAction,
94
- label: 'Cancel Test Run',
95
- category: 'Test',
96
- iconClass: codicon('debug-stop')
97
- });
98
-
99
- export const GOTO_TEST: Command = Command.toDefaultLocalizedCommand({
100
- id: TestCommandId.GoToTest,
101
- label: 'Go to Test',
102
- category: 'Test',
103
- iconClass: codicon('go-to-file')
104
- });
105
-
106
- export const CONFIGURE_PROFILES: Command = Command.toDefaultLocalizedCommand({
107
- id: TestCommandId.ConfigureTestProfilesAction,
108
- label: 'Configure Test Profiles',
109
- category: 'Test'
110
- });
111
-
112
- export const SELECT_DEFAULT_PROFILES: Command = Command.toDefaultLocalizedCommand({
113
- id: TestCommandId.SelectDefaultTestProfiles,
114
- label: 'Select Default Test Profiles...',
115
- category: 'Test'
116
- });
117
-
118
- export const CLEAR_ALL_RESULTS: Command = Command.toDefaultLocalizedCommand({
119
- id: TestCommandId.ClearTestResultsAction,
120
- label: 'Clear All Results',
121
- category: 'Test',
122
- iconClass: codicon('trash')
123
- });
124
- }
125
-
126
- export const TEST_VIEW_CONTEXT_MENU = ['test-view-context-menu'];
127
- export const TEST_VIEW_INLINE_MENU = [...TEST_VIEW_CONTEXT_MENU, 'inline'];
128
-
129
- export const TEST_VIEW_CONTAINER_ID = 'test-view-container';
130
- export const TEST_VIEW_CONTAINER_TITLE_OPTIONS: ViewContainerTitleOptions = {
131
- label: nls.localizeByDefault('Testing'),
132
- iconClass: codicon('beaker'),
133
- closeable: true
134
- };
135
-
136
- @injectable()
137
- export class TestViewContribution extends AbstractViewContribution<TestTreeWidget> implements
138
- FrontendApplicationContribution, TabBarToolbarContribution {
139
-
140
- @inject(TestService) protected readonly testService: TestService;
141
- @inject(ContextKeyService) protected readonly contextKeys: ContextKeyService;
142
- @inject(NavigationLocationService) navigationService: NavigationLocationService;
143
- @inject(FileService) fileSystem: FileService;
144
-
145
- constructor() {
146
- super({
147
- viewContainerId: TEST_VIEW_CONTAINER_ID,
148
- widgetId: TestTreeWidget.ID,
149
- widgetName: nls.localizeByDefault('Test Explorer'),
150
- defaultWidgetOptions: {
151
- area: 'left',
152
- rank: 600,
153
- }
154
- });
155
- }
156
-
157
- async initializeLayout(): Promise<void> {
158
- await this.openView({ activate: false });
159
- }
160
-
161
- override registerCommands(commands: CommandRegistry): void {
162
- super.registerCommands(commands);
163
- commands.registerCommand(TestViewCommands.REFRESH, {
164
- isEnabled: w => this.withWidget(w, () => !this.testService.isRefreshing),
165
- isVisible: w => this.withWidget(w, () => !this.testService.isRefreshing),
166
- execute: () => this.testService.refresh()
167
- });
168
-
169
- commands.registerCommand(TestViewCommands.CANCEL_REFRESH, {
170
- isEnabled: w => this.withWidget(w, () => this.testService.isRefreshing),
171
- isVisible: w => this.withWidget(w, () => this.testService.isRefreshing),
172
- execute: () => this.testService.cancelRefresh()
173
- });
174
-
175
- commands.registerCommand(TestViewCommands.RUN_ALL_TESTS, {
176
- isEnabled: w => this.withWidget(w, () => true),
177
- isVisible: w => this.withWidget(w, () => true),
178
- execute: () => this.testService.runAllTests(TestRunProfileKind.Run)
179
- });
180
-
181
- commands.registerCommand(TestViewCommands.DEBUG_ALL_TESTS, {
182
- isEnabled: w => this.withWidget(w, () => true),
183
- isVisible: w => this.withWidget(w, () => true),
184
- execute: () => this.testService.runAllTests(TestRunProfileKind.Debug)
185
- });
186
-
187
- commands.registerCommand(TestViewCommands.RUN_TEST, {
188
- isEnabled: t => TestItem.is(t),
189
- isVisible: t => TestItem.is(t),
190
- execute: t => {
191
- this.testService.runTests(TestRunProfileKind.Run, [t]);
192
- }
193
- });
194
-
195
- commands.registerCommand(TestViewCommands.SELECT_DEFAULT_PROFILES, {
196
- isEnabled: t => TestItem.is(t),
197
- isVisible: t => TestItem.is(t),
198
- execute: () => {
199
- this.testService.selectDefaultProfile();
200
- }
201
- });
202
-
203
- commands.registerCommand(TestViewCommands.DEBUG_TEST, {
204
- isEnabled: t => TestItem.is(t),
205
- isVisible: t => TestItem.is(t),
206
- execute: t => {
207
- this.testService.runTests(TestRunProfileKind.Debug, [t]);
208
- }
209
- });
210
-
211
- commands.registerCommand(TestViewCommands.RUN_TEST_WITH_PROFILE, {
212
- isEnabled: t => TestItem.is(t),
213
- isVisible: t => TestItem.is(t),
214
- execute: t => {
215
- this.testService.runTestsWithProfile([t]);
216
- }
217
- });
218
-
219
- commands.registerCommand(TestViewCommands.CANCEL_ALL_RUNS, {
220
- isEnabled: w => this.withWidget(w, () => true),
221
- isVisible: w => this.withWidget(w, () => true),
222
- execute: () => this.cancelAllRuns()
223
- });
224
-
225
- commands.registerCommand(TestViewCommands.GOTO_TEST, {
226
- isEnabled: t => TestItem.is(t) && !!t.uri,
227
- isVisible: t => TestItem.is(t) && !!t.uri,
228
- execute: t => {
229
- if (TestItem.is(t)) {
230
- this.fileSystem.resolve(t.uri!).then(stat => {
231
- if (stat.isFile) {
232
- this.navigationService.reveal(NavigationLocation.create(t.uri!, t.range ? t.range.start : { line: 0, character: 0 }));
233
- } else {
234
- commands.executeCommand(FileNavigatorCommands.REVEAL_IN_NAVIGATOR.id, t.uri!);
235
- }
236
- });
237
- }
238
- }
239
- });
240
-
241
- commands.registerCommand(TestViewCommands.CONFIGURE_PROFILES, {
242
- execute: () => {
243
- this.testService.configureProfile();
244
- }
245
- });
246
- }
247
-
248
- protected cancelAllRuns(): void {
249
- this.testService.getControllers().forEach(controller => controller.testRuns.forEach(run => run.cancel()));
250
- }
251
-
252
- override registerMenus(menus: MenuModelRegistry): void {
253
- super.registerMenus(menus);
254
- menus.registerMenuAction(TEST_VIEW_INLINE_MENU, {
255
- commandId: TestViewCommands.RUN_TEST.id,
256
- order: 'a'
257
- });
258
- menus.registerMenuAction(TEST_VIEW_INLINE_MENU, {
259
- commandId: TestViewCommands.DEBUG_TEST.id,
260
- order: 'aa'
261
- });
262
- menus.registerMenuAction(TEST_VIEW_INLINE_MENU, {
263
- commandId: TestViewCommands.GOTO_TEST.id,
264
- order: 'aaa'
265
- });
266
-
267
- menus.registerMenuAction(TEST_VIEW_CONTEXT_MENU, {
268
- commandId: TestViewCommands.RUN_TEST_WITH_PROFILE.id,
269
- order: 'aaaa'
270
- });
271
-
272
- menus.registerMenuAction(TEST_VIEW_CONTEXT_MENU, {
273
- commandId: TestViewCommands.SELECT_DEFAULT_PROFILES.id,
274
- order: 'aaaaa'
275
- });
276
- }
277
-
278
- registerToolbarItems(toolbar: TabBarToolbarRegistry): void {
279
- toolbar.registerItem({
280
- id: TestViewCommands.REFRESH.id,
281
- command: TestViewCommands.REFRESH.id,
282
- priority: 0,
283
- onDidChange: this.testService.onDidChangeIsRefreshing
284
- });
285
-
286
- toolbar.registerItem({
287
- id: TestViewCommands.CANCEL_REFRESH.id,
288
- command: TestViewCommands.CANCEL_REFRESH.id,
289
- priority: 0,
290
- onDidChange: this.testService.onDidChangeIsRefreshing
291
- });
292
-
293
- toolbar.registerItem({
294
- id: TestViewCommands.RUN_ALL_TESTS.id,
295
- command: TestViewCommands.RUN_ALL_TESTS.id,
296
- priority: 1
297
- });
298
-
299
- toolbar.registerItem({
300
- id: TestViewCommands.DEBUG_ALL_TESTS.id,
301
- command: TestViewCommands.DEBUG_ALL_TESTS.id,
302
- priority: 2
303
- });
304
-
305
- toolbar.registerItem({
306
- id: TestViewCommands.CANCEL_ALL_RUNS.id,
307
- command: TestViewCommands.CANCEL_ALL_RUNS.id,
308
- priority: 3
309
- });
310
-
311
- }
312
-
313
- protected withWidget<T>(widget: Widget | undefined = this.tryGetWidget(), cb: (widget: TestTreeWidget) => T): T | false {
314
- if (widget instanceof TestTreeWidget && widget.id === TestTreeWidget.ID) {
315
- return cb(widget);
316
- }
317
- return false;
318
- }
319
- }
1
+ // *****************************************************************************
2
+ // Copyright (C) 2023 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
+
17
+ import { AbstractViewContribution, FrontendApplicationContribution, ViewContainerTitleOptions, Widget, codicon } from '@theia/core/lib/browser';
18
+ import { Command, CommandRegistry, MenuModelRegistry, nls } from '@theia/core';
19
+ import { inject, injectable } from '@theia/core/shared/inversify';
20
+ import { TestItem, TestRunProfileKind, TestService } from '../test-service';
21
+ import { ContextKeyService } from '@theia/core/lib/browser/context-key-service';
22
+ import { TestTreeWidget } from './test-tree-widget';
23
+ import { TabBarToolbarContribution, TabBarToolbarRegistry } from '@theia/core/lib/browser/shell/tab-bar-toolbar';
24
+ import { TestCommandId } from '../constants';
25
+ import { NavigationLocationService } from '@theia/editor/lib/browser/navigation/navigation-location-service';
26
+ import { NavigationLocation } from '@theia/editor/lib/browser/navigation/navigation-location';
27
+ import { FileService } from '@theia/filesystem/lib/browser/file-service';
28
+ import { FileNavigatorCommands } from '@theia/navigator/lib/browser/file-navigator-commands';
29
+ export const PLUGIN_TEST_VIEW_TITLE_MENU = ['plugin_test', 'title'];
30
+
31
+ export namespace TestViewCommands {
32
+ /**
33
+ * Command which refreshes all test.
34
+ */
35
+ export const REFRESH: Command = Command.toDefaultLocalizedCommand({
36
+ id: TestCommandId.RefreshTestsAction,
37
+ label: 'Refresh Tests',
38
+ category: 'Test',
39
+ iconClass: codicon('refresh')
40
+ });
41
+
42
+ /**
43
+ * Command which cancels the refresh
44
+ */
45
+ export const CANCEL_REFRESH: Command = Command.toDefaultLocalizedCommand({
46
+ id: TestCommandId.CancelTestRefreshAction,
47
+ label: 'Cancel Test Refresh',
48
+ category: 'Test',
49
+ iconClass: codicon('stop')
50
+ });
51
+
52
+ export const RUN_ALL_TESTS: Command = Command.toDefaultLocalizedCommand({
53
+ id: TestCommandId.RunAllAction,
54
+ label: 'Run All Tests',
55
+ category: 'Test',
56
+ iconClass: codicon('run-all')
57
+ });
58
+
59
+ export const DEBUG_ALL_TESTS: Command = Command.toDefaultLocalizedCommand({
60
+ id: TestCommandId.DebugAllAction,
61
+ label: 'Debug Tests',
62
+ category: 'Test',
63
+ iconClass: codicon('debug-all')
64
+ });
65
+
66
+ export const RUN_TEST: Command = Command.toDefaultLocalizedCommand({
67
+ id: TestCommandId.RunAction,
68
+ label: 'Run Test',
69
+ category: 'Test',
70
+ iconClass: codicon('run')
71
+ });
72
+
73
+ export const RUN_TEST_WITH_PROFILE: Command = Command.toDefaultLocalizedCommand({
74
+ id: TestCommandId.RunUsingProfileAction,
75
+ category: 'Test',
76
+ label: 'Execute using Profile...'
77
+ });
78
+
79
+ export const DEBUG_TEST: Command = Command.toDefaultLocalizedCommand({
80
+ id: TestCommandId.DebugAction,
81
+ label: 'Debug Test',
82
+ category: 'Test',
83
+ iconClass: codicon('debug-alt')
84
+ });
85
+
86
+ export const CANCEL_ALL_RUNS: Command = Command.toLocalizedCommand({
87
+ id: 'testing.cancelAllRuns',
88
+ label: 'Cancel All Test Runs',
89
+ category: 'Test',
90
+ iconClass: codicon('debug-stop')
91
+ }, 'theia/test/cancelAllTestRuns', nls.getDefaultKey('Test'));
92
+
93
+ export const CANCEL_RUN: Command = Command.toDefaultLocalizedCommand({
94
+ id: TestCommandId.CancelTestRunAction,
95
+ label: 'Cancel Test Run',
96
+ category: 'Test',
97
+ iconClass: codicon('debug-stop')
98
+ });
99
+
100
+ export const GOTO_TEST: Command = Command.toDefaultLocalizedCommand({
101
+ id: TestCommandId.GoToTest,
102
+ label: 'Go to Test',
103
+ category: 'Test',
104
+ iconClass: codicon('go-to-file')
105
+ });
106
+
107
+ export const CONFIGURE_PROFILES: Command = Command.toDefaultLocalizedCommand({
108
+ id: TestCommandId.ConfigureTestProfilesAction,
109
+ label: 'Configure Test Profiles',
110
+ category: 'Test'
111
+ });
112
+
113
+ export const SELECT_DEFAULT_PROFILES: Command = Command.toDefaultLocalizedCommand({
114
+ id: TestCommandId.SelectDefaultTestProfiles,
115
+ label: 'Select Default Test Profiles...',
116
+ category: 'Test'
117
+ });
118
+
119
+ export const CLEAR_ALL_RESULTS: Command = Command.toDefaultLocalizedCommand({
120
+ id: TestCommandId.ClearTestResultsAction,
121
+ label: 'Clear All Results',
122
+ category: 'Test',
123
+ iconClass: codicon('trash')
124
+ });
125
+ }
126
+
127
+ export const TEST_VIEW_CONTEXT_MENU = ['test-view-context-menu'];
128
+ export const TEST_VIEW_INLINE_MENU = [...TEST_VIEW_CONTEXT_MENU, 'inline'];
129
+
130
+ export const TEST_VIEW_CONTAINER_ID = 'test-view-container';
131
+ export const TEST_VIEW_CONTAINER_TITLE_OPTIONS: ViewContainerTitleOptions = {
132
+ label: nls.localizeByDefault('Testing'),
133
+ iconClass: codicon('beaker'),
134
+ closeable: true
135
+ };
136
+
137
+ @injectable()
138
+ export class TestViewContribution extends AbstractViewContribution<TestTreeWidget> implements
139
+ FrontendApplicationContribution, TabBarToolbarContribution {
140
+
141
+ @inject(TestService) protected readonly testService: TestService;
142
+ @inject(ContextKeyService) protected readonly contextKeys: ContextKeyService;
143
+ @inject(NavigationLocationService) navigationService: NavigationLocationService;
144
+ @inject(FileService) fileSystem: FileService;
145
+
146
+ constructor() {
147
+ super({
148
+ viewContainerId: TEST_VIEW_CONTAINER_ID,
149
+ widgetId: TestTreeWidget.ID,
150
+ widgetName: nls.localizeByDefault('Test Explorer'),
151
+ defaultWidgetOptions: {
152
+ area: 'left',
153
+ rank: 600,
154
+ }
155
+ });
156
+ }
157
+
158
+ async initializeLayout(): Promise<void> {
159
+ await this.openView({ activate: false });
160
+ }
161
+
162
+ override registerCommands(commands: CommandRegistry): void {
163
+ super.registerCommands(commands);
164
+ commands.registerCommand(TestViewCommands.REFRESH, {
165
+ isEnabled: w => this.withWidget(w, () => !this.testService.isRefreshing),
166
+ isVisible: w => this.withWidget(w, () => !this.testService.isRefreshing),
167
+ execute: () => this.testService.refresh()
168
+ });
169
+
170
+ commands.registerCommand(TestViewCommands.CANCEL_REFRESH, {
171
+ isEnabled: w => this.withWidget(w, () => this.testService.isRefreshing),
172
+ isVisible: w => this.withWidget(w, () => this.testService.isRefreshing),
173
+ execute: () => this.testService.cancelRefresh()
174
+ });
175
+
176
+ commands.registerCommand(TestViewCommands.RUN_ALL_TESTS, {
177
+ isEnabled: w => this.withWidget(w, () => true),
178
+ isVisible: w => this.withWidget(w, () => true),
179
+ execute: () => this.testService.runAllTests(TestRunProfileKind.Run)
180
+ });
181
+
182
+ commands.registerCommand(TestViewCommands.DEBUG_ALL_TESTS, {
183
+ isEnabled: w => this.withWidget(w, () => true),
184
+ isVisible: w => this.withWidget(w, () => true),
185
+ execute: () => this.testService.runAllTests(TestRunProfileKind.Debug)
186
+ });
187
+
188
+ commands.registerCommand(TestViewCommands.RUN_TEST, {
189
+ isEnabled: t => TestItem.is(t),
190
+ isVisible: t => TestItem.is(t),
191
+ execute: t => {
192
+ this.testService.runTests(TestRunProfileKind.Run, [t]);
193
+ }
194
+ });
195
+
196
+ commands.registerCommand(TestViewCommands.SELECT_DEFAULT_PROFILES, {
197
+ isEnabled: t => TestItem.is(t),
198
+ isVisible: t => TestItem.is(t),
199
+ execute: () => {
200
+ this.testService.selectDefaultProfile();
201
+ }
202
+ });
203
+
204
+ commands.registerCommand(TestViewCommands.DEBUG_TEST, {
205
+ isEnabled: t => TestItem.is(t),
206
+ isVisible: t => TestItem.is(t),
207
+ execute: t => {
208
+ this.testService.runTests(TestRunProfileKind.Debug, [t]);
209
+ }
210
+ });
211
+
212
+ commands.registerCommand(TestViewCommands.RUN_TEST_WITH_PROFILE, {
213
+ isEnabled: t => TestItem.is(t),
214
+ isVisible: t => TestItem.is(t),
215
+ execute: t => {
216
+ this.testService.runTestsWithProfile([t]);
217
+ }
218
+ });
219
+
220
+ commands.registerCommand(TestViewCommands.CANCEL_ALL_RUNS, {
221
+ isEnabled: w => this.withWidget(w, () => true),
222
+ isVisible: w => this.withWidget(w, () => true),
223
+ execute: () => this.cancelAllRuns()
224
+ });
225
+
226
+ commands.registerCommand(TestViewCommands.GOTO_TEST, {
227
+ isEnabled: t => TestItem.is(t) && !!t.uri,
228
+ isVisible: t => TestItem.is(t) && !!t.uri,
229
+ execute: t => {
230
+ if (TestItem.is(t)) {
231
+ this.fileSystem.resolve(t.uri!).then(stat => {
232
+ if (stat.isFile) {
233
+ this.navigationService.reveal(NavigationLocation.create(t.uri!, t.range ? t.range.start : { line: 0, character: 0 }));
234
+ } else {
235
+ commands.executeCommand(FileNavigatorCommands.REVEAL_IN_NAVIGATOR.id, t.uri!);
236
+ }
237
+ });
238
+ }
239
+ }
240
+ });
241
+
242
+ commands.registerCommand(TestViewCommands.CONFIGURE_PROFILES, {
243
+ execute: () => {
244
+ this.testService.configureProfile();
245
+ }
246
+ });
247
+ }
248
+
249
+ protected cancelAllRuns(): void {
250
+ this.testService.getControllers().forEach(controller => controller.testRuns.forEach(run => run.cancel()));
251
+ }
252
+
253
+ override registerMenus(menus: MenuModelRegistry): void {
254
+ super.registerMenus(menus);
255
+ menus.registerMenuAction(TEST_VIEW_INLINE_MENU, {
256
+ commandId: TestViewCommands.RUN_TEST.id,
257
+ order: 'a'
258
+ });
259
+ menus.registerMenuAction(TEST_VIEW_INLINE_MENU, {
260
+ commandId: TestViewCommands.DEBUG_TEST.id,
261
+ order: 'aa'
262
+ });
263
+ menus.registerMenuAction(TEST_VIEW_INLINE_MENU, {
264
+ commandId: TestViewCommands.GOTO_TEST.id,
265
+ order: 'aaa'
266
+ });
267
+
268
+ menus.registerMenuAction(TEST_VIEW_CONTEXT_MENU, {
269
+ commandId: TestViewCommands.RUN_TEST_WITH_PROFILE.id,
270
+ order: 'aaaa'
271
+ });
272
+
273
+ menus.registerMenuAction(TEST_VIEW_CONTEXT_MENU, {
274
+ commandId: TestViewCommands.SELECT_DEFAULT_PROFILES.id,
275
+ order: 'aaaaa'
276
+ });
277
+ }
278
+
279
+ registerToolbarItems(toolbar: TabBarToolbarRegistry): void {
280
+ toolbar.registerItem({
281
+ id: TestViewCommands.REFRESH.id,
282
+ command: TestViewCommands.REFRESH.id,
283
+ priority: 0,
284
+ onDidChange: this.testService.onDidChangeIsRefreshing
285
+ });
286
+
287
+ toolbar.registerItem({
288
+ id: TestViewCommands.CANCEL_REFRESH.id,
289
+ command: TestViewCommands.CANCEL_REFRESH.id,
290
+ priority: 0,
291
+ onDidChange: this.testService.onDidChangeIsRefreshing
292
+ });
293
+
294
+ toolbar.registerItem({
295
+ id: TestViewCommands.RUN_ALL_TESTS.id,
296
+ command: TestViewCommands.RUN_ALL_TESTS.id,
297
+ menuPath: PLUGIN_TEST_VIEW_TITLE_MENU,
298
+ contextKeyOverlays: {
299
+ 'testing.profile.context.group': 'run'
300
+ },
301
+ priority: 1
302
+ });
303
+
304
+ toolbar.registerItem({
305
+ id: TestViewCommands.DEBUG_ALL_TESTS.id,
306
+ command: TestViewCommands.DEBUG_ALL_TESTS.id,
307
+ menuPath: PLUGIN_TEST_VIEW_TITLE_MENU,
308
+ contextKeyOverlays: {
309
+ 'testing.profile.context.group': 'debug'
310
+ },
311
+ priority: 2
312
+ });
313
+
314
+ toolbar.registerItem({
315
+ id: TestViewCommands.CANCEL_ALL_RUNS.id,
316
+ command: TestViewCommands.CANCEL_ALL_RUNS.id,
317
+ priority: 3
318
+ });
319
+
320
+ }
321
+
322
+ protected withWidget<T>(widget: Widget | undefined = this.tryGetWidget(), cb: (widget: TestTreeWidget) => T): T | false {
323
+ if (widget instanceof TestTreeWidget && widget.id === TestTreeWidget.ID) {
324
+ return cb(widget);
325
+ }
326
+ return false;
327
+ }
328
+ }