@theia/test 1.47.0-next.0 → 1.47.1

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 (31) hide show
  1. package/lib/browser/test-service.d.ts +4 -1
  2. package/lib/browser/test-service.d.ts.map +1 -1
  3. package/lib/browser/test-service.js +39 -19
  4. package/lib/browser/test-service.js.map +1 -1
  5. package/lib/browser/view/test-context-key-service.js +8 -16
  6. package/lib/browser/view/test-context-key-service.js.map +1 -1
  7. package/lib/browser/view/test-execution-state-manager.js +8 -16
  8. package/lib/browser/view/test-execution-state-manager.js.map +1 -1
  9. package/lib/browser/view/test-output-ui-model.js +10 -18
  10. package/lib/browser/view/test-output-ui-model.js.map +1 -1
  11. package/lib/browser/view/test-output-view-contribution.js +3 -11
  12. package/lib/browser/view/test-output-view-contribution.js.map +1 -1
  13. package/lib/browser/view/test-output-widget.js +13 -21
  14. package/lib/browser/view/test-output-widget.js.map +1 -1
  15. package/lib/browser/view/test-result-view-contribution.js +3 -11
  16. package/lib/browser/view/test-result-view-contribution.js.map +1 -1
  17. package/lib/browser/view/test-result-widget.js +11 -19
  18. package/lib/browser/view/test-result-widget.js.map +1 -1
  19. package/lib/browser/view/test-run-view-contribution.js +7 -15
  20. package/lib/browser/view/test-run-view-contribution.js.map +1 -1
  21. package/lib/browser/view/test-run-widget.js +27 -38
  22. package/lib/browser/view/test-run-widget.js.map +1 -1
  23. package/lib/browser/view/test-tree-widget.js +33 -44
  24. package/lib/browser/view/test-tree-widget.js.map +1 -1
  25. package/lib/browser/view/test-view-contribution.d.ts +1 -0
  26. package/lib/browser/view/test-view-contribution.d.ts.map +1 -1
  27. package/lib/browser/view/test-view-contribution.js +27 -19
  28. package/lib/browser/view/test-view-contribution.js.map +1 -1
  29. package/package.json +8 -8
  30. package/src/browser/test-service.ts +34 -2
  31. package/src/browser/view/test-view-contribution.ts +19 -0
@@ -32,7 +32,7 @@ export enum TestRunProfileKind {
32
32
  export interface TestRunProfile {
33
33
  readonly kind: TestRunProfileKind;
34
34
  readonly label: string,
35
- readonly isDefault: boolean;
35
+ isDefault: boolean;
36
36
  readonly canConfigure: boolean;
37
37
  readonly tag: string;
38
38
  run(name: string, included: readonly TestItem[], excluded: readonly TestItem[]): void;
@@ -177,6 +177,7 @@ export interface TestController {
177
177
  export interface TestService {
178
178
  clearResults(): void;
179
179
  configureProfile(): void;
180
+ selectDefaultProfile(): void;
180
181
  runTestsWithProfile(tests: TestItem[]): void;
181
182
  runTests(profileKind: TestRunProfileKind, tests: TestItem[]): void;
182
183
  runAllTests(profileKind: TestRunProfileKind): void;
@@ -304,7 +305,7 @@ export class DefaultTestService implements TestService {
304
305
  }
305
306
  return {
306
307
  iconClasses,
307
- label: profile.label,
308
+ label: `${profile.label}${profile.isDefault ? ' (default)' : ''}`,
308
309
  profile: profile
309
310
  };
310
311
  });
@@ -313,6 +314,22 @@ export class DefaultTestService implements TestService {
313
314
 
314
315
  }
315
316
 
317
+ protected async pickProfileKind(): Promise<TestRunProfileKind | undefined> {
318
+ // eslint-disable-next-line arrow-body-style
319
+ const picks = [{
320
+ iconClasses: codiconArray('run'),
321
+ label: 'Run',
322
+ kind: TestRunProfileKind.Run
323
+ }, {
324
+ iconClasses: codiconArray('debug-alt'),
325
+ label: 'Debug',
326
+ kind: TestRunProfileKind.Debug
327
+ }];
328
+
329
+ return (await this.quickpickService.show(picks, { title: 'Select the kind of profiles' }))?.kind;
330
+
331
+ }
332
+
316
333
  runTests(profileKind: TestRunProfileKind, items: TestItem[]): void {
317
334
  groupBy(items, item => item.controller).forEach((tests, controller) => {
318
335
  if (controller) {
@@ -333,6 +350,21 @@ export class DefaultTestService implements TestService {
333
350
  });
334
351
  }
335
352
 
353
+ selectDefaultProfile(): void {
354
+ this.pickProfileKind().then(kind => {
355
+ const profiles = this.getControllers().flatMap(c => c.testRunProfiles).filter(profile => profile.kind === kind);
356
+ this.pickProfile(profiles, nls.localizeByDefault('Pick a test profile to use')).then(activeProfile => {
357
+ if (activeProfile) {
358
+ // only change the default for the controller containing selected profile for default and its profiles with same kind
359
+ const controller = this.getControllers().find(c => c.testRunProfiles.includes(activeProfile));
360
+ controller?.testRunProfiles.filter(profile => profile.kind === activeProfile.kind).forEach(profile => {
361
+ profile.isDefault = profile === activeProfile;
362
+ });
363
+ }
364
+ });
365
+ });
366
+ }
367
+
336
368
  configureProfile(): void {
337
369
  const profiles: TestRunProfile[] = [];
338
370
 
@@ -109,6 +109,12 @@ export namespace TestViewCommands {
109
109
  category: 'Test'
110
110
  });
111
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
+
112
118
  export const CLEAR_ALL_RESULTS: Command = Command.toDefaultLocalizedCommand({
113
119
  id: TestCommandId.ClearTestResultsAction,
114
120
  label: 'Clear All Results',
@@ -186,6 +192,14 @@ export class TestViewContribution extends AbstractViewContribution<TestTreeWidge
186
192
  }
187
193
  });
188
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
+
189
203
  commands.registerCommand(TestViewCommands.DEBUG_TEST, {
190
204
  isEnabled: t => TestItem.is(t),
191
205
  isVisible: t => TestItem.is(t),
@@ -254,6 +268,11 @@ export class TestViewContribution extends AbstractViewContribution<TestTreeWidge
254
268
  commandId: TestViewCommands.RUN_TEST_WITH_PROFILE.id,
255
269
  order: 'aaaa'
256
270
  });
271
+
272
+ menus.registerMenuAction(TEST_VIEW_CONTEXT_MENU, {
273
+ commandId: TestViewCommands.SELECT_DEFAULT_PROFILES.id,
274
+ order: 'aaaaa'
275
+ });
257
276
  }
258
277
 
259
278
  registerToolbarItems(toolbar: TabBarToolbarRegistry): void {