@codingame/monaco-vscode-testing-service-override 2.0.3 → 2.1.0

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,5 +1,6 @@
1
1
  import { distinct } from 'vscode/vscode/vs/base/common/arrays';
2
2
  import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
3
+ import { Iterable } from 'vscode/vscode/vs/base/common/iterator';
3
4
  import { KeyChord } from 'vscode/vscode/vs/base/common/keyCodes';
4
5
  import { isDefined } from 'vscode/vscode/vs/base/common/types';
5
6
  import { isCodeEditor } from 'vscode/vscode/vs/editor/browser/editorBrowser';
@@ -7,39 +8,54 @@ import { Position } from 'vscode/vscode/vs/editor/common/core/position';
7
8
  import { Range } from 'vscode/vscode/vs/editor/common/core/range';
8
9
  import { EditorContextKeys } from 'vscode/vscode/vs/editor/common/editorContextKeys';
9
10
  import { MessageController } from 'vscode/vscode/vs/editor/contrib/message/browser/messageController';
10
- import { localizeWithPath } from 'vscode/vscode/vs/nls';
11
+ import { localizeWithPath, localize2WithPath } from 'vscode/vscode/vs/nls';
11
12
  import { Categories } from 'vscode/vscode/vs/platform/action/common/actionCommonCategories';
12
13
  import { Action2, MenuId } from 'vscode/vscode/vs/platform/actions/common/actions';
13
14
  import { ICommandService } from 'vscode/vscode/vs/platform/commands/common/commands';
14
15
  import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
15
16
  import { ContextKeyGreaterExpr, ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
16
- import { INotificationService } from 'vscode/vscode/vs/platform/notification/common/notification';
17
+ import { INotificationService, Severity } from 'vscode/vscode/vs/platform/notification/common/notification';
17
18
  import { IProgressService } from 'vscode/vscode/vs/platform/progress/common/progress';
18
19
  import { IQuickInputService } from 'vscode/vscode/vs/platform/quickinput/common/quickInput';
19
20
  import { widgetClose } from 'vscode/vscode/vs/platform/theme/common/iconRegistry';
20
21
  import { IUriIdentityService } from 'vscode/vscode/vs/platform/uriIdentity/common/uriIdentity';
21
22
  import { ViewAction } from 'vscode/vscode/vs/workbench/browser/parts/views/viewPane';
22
23
  import { FocusedViewContext } from 'vscode/vscode/vs/workbench/common/contextkeys';
23
- import { IViewsService } from 'vscode/vscode/vs/workbench/common/views';
24
24
  import { VIEWLET_ID } from 'vscode/vscode/vs/workbench/contrib/extensions/common/extensions';
25
25
  import { TestItemTreeElement } from './explorerProjections/index.js';
26
- import { testingDebugIcon, testingRunIcon, testingUpdateProfiles, testingTurnContinuousRunOn, testingContinuousIsOn, testingTurnContinuousRunOff, testingRunAllIcon, testingDebugAllIcon, testingCancelIcon, testingRefreshTests, testingCancelRefreshTests } from './icons.js';
26
+ import { testingDebugIcon, testingCoverageIcon, testingRunIcon, testingUpdateProfiles, testingTurnContinuousRunOn, testingContinuousIsOn, testingTurnContinuousRunOff, testingRunAllIcon, testingDebugAllIcon, testingCoverageAllIcon, testingCancelIcon, testingRefreshTests, testingCancelRefreshTests } from './icons.js';
27
27
  import { getTestingConfiguration } from '../common/configuration.js';
28
28
  import { testConfigurationGroupNames } from '../common/constants.js';
29
29
  import { ITestCoverageService } from 'vscode/vscode/vs/workbench/contrib/testing/common/testCoverageService';
30
30
  import { TestId } from 'vscode/vscode/vs/workbench/contrib/testing/common/testId';
31
31
  import { canUseProfileWithTest, ITestProfileService } from 'vscode/vscode/vs/workbench/contrib/testing/common/testProfileService';
32
32
  import { ITestResultService } from 'vscode/vscode/vs/workbench/contrib/testing/common/testResultService';
33
- import { expandAndGetTestById, ITestService, testsInFile } from 'vscode/vscode/vs/workbench/contrib/testing/common/testService';
33
+ import { expandAndGetTestById, ITestService, testsInFile, testsUnderUri } from 'vscode/vscode/vs/workbench/contrib/testing/common/testService';
34
34
  import { TestingContextKeys } from 'vscode/vscode/vs/workbench/contrib/testing/common/testingContextKeys';
35
35
  import { ITestingContinuousRunService } from 'vscode/vscode/vs/workbench/contrib/testing/common/testingContinuousRunService';
36
36
  import { ITestingPeekOpener } from 'vscode/vscode/vs/workbench/contrib/testing/common/testingPeekOpener';
37
37
  import { isFailedState } from 'vscode/vscode/vs/workbench/contrib/testing/common/testingStates';
38
38
  import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
39
39
  import { IPaneCompositePartService } from 'vscode/vscode/vs/workbench/services/panecomposite/browser/panecomposite';
40
+ import { IViewsService } from 'vscode/vscode/vs/workbench/services/views/common/viewsService';
40
41
 
41
42
  const category = Categories.Test;
42
43
  const hasAnyTestProvider = ContextKeyGreaterExpr.create(TestingContextKeys.providerCount.key, 0);
44
+ const LABEL_RUN_TESTS = { value: ( localizeWithPath(
45
+ 'vs/workbench/contrib/testing/browser/testExplorerActions',
46
+ 'runSelectedTests',
47
+ 'Run Tests'
48
+ )), original: 'Run Tests' };
49
+ const LABEL_DEBUG_TESTS = { value: ( localizeWithPath(
50
+ 'vs/workbench/contrib/testing/browser/testExplorerActions',
51
+ 'debugSelectedTests',
52
+ 'Debug Tests'
53
+ )), original: 'Debug Tests' };
54
+ const LABEL_COVERAGE_TESTS = { value: ( localizeWithPath(
55
+ 'vs/workbench/contrib/testing/browser/testExplorerActions',
56
+ 'coverageSelectedTests',
57
+ 'Run Tests with Coverage'
58
+ )), original: 'Run Tests withCoverage' };
43
59
  class HideTestAction extends Action2 {
44
60
  constructor() {
45
61
  super({
@@ -120,9 +136,26 @@ const testItemInlineAndInContext = (order, when) => [
120
136
  when,
121
137
  }
122
138
  ];
123
- class DebugAction extends Action2 {
124
- constructor() {
139
+ class RunVisibleAction extends ViewAction {
140
+ constructor(bitset, desc) {
125
141
  super({
142
+ ...desc,
143
+ viewId: "workbench.view.testing" ,
144
+ });
145
+ this.bitset = bitset;
146
+ }
147
+ runInView(accessor, view, ...elements) {
148
+ const { include, exclude } = view.getTreeIncludeExclude(( elements.map(e => e.test)));
149
+ return accessor.get(ITestService).runTests({
150
+ tests: include,
151
+ exclude,
152
+ group: this.bitset,
153
+ });
154
+ }
155
+ }
156
+ class DebugAction extends RunVisibleAction {
157
+ constructor() {
158
+ super(4 , {
126
159
  id: "testing.debug" ,
127
160
  title: ( localizeWithPath(
128
161
  'vs/workbench/contrib/testing/browser/testExplorerActions',
@@ -133,10 +166,18 @@ class DebugAction extends Action2 {
133
166
  menu: testItemInlineAndInContext(12 , ( TestingContextKeys.hasDebuggableTests.isEqualTo(true))),
134
167
  });
135
168
  }
136
- run(acessor, ...elements) {
137
- return acessor.get(ITestService).runTests({
138
- tests: ( elements.map(e => e.test)),
139
- group: 4 ,
169
+ }
170
+ class CoverageAction extends RunVisibleAction {
171
+ constructor() {
172
+ super(8 , {
173
+ id: "testing.coverage" ,
174
+ title: ( localizeWithPath(
175
+ 'vs/workbench/contrib/testing/browser/testExplorerActions',
176
+ 'run with cover test',
177
+ 'Run Test with Coverage'
178
+ )),
179
+ icon: testingCoverageIcon,
180
+ menu: testItemInlineAndInContext(13 , ( TestingContextKeys.hasCoverableTests.isEqualTo(true))),
140
181
  });
141
182
  }
142
183
  }
@@ -177,9 +218,9 @@ class RunUsingProfileAction extends Action2 {
177
218
  });
178
219
  }
179
220
  }
180
- class RunAction extends Action2 {
221
+ class RunAction extends RunVisibleAction {
181
222
  constructor() {
182
- super({
223
+ super(2 , {
183
224
  id: "testing.run" ,
184
225
  title: ( localizeWithPath(
185
226
  'vs/workbench/contrib/testing/browser/testExplorerActions',
@@ -190,12 +231,6 @@ class RunAction extends Action2 {
190
231
  menu: testItemInlineAndInContext(11 , ( TestingContextKeys.hasRunnableTests.isEqualTo(true))),
191
232
  });
192
233
  }
193
- run(acessor, ...elements) {
194
- return acessor.get(ITestService).runTests({
195
- tests: ( elements.map(e => e.test)),
196
- group: 2 ,
197
- });
198
- }
199
234
  }
200
235
  class SelectDefaultTestProfiles extends Action2 {
201
236
  constructor() {
@@ -349,11 +384,11 @@ class StopContinuousRunAction extends Action2 {
349
384
  constructor() {
350
385
  super({
351
386
  id: "testing.stopContinuousRun" ,
352
- title: { value: ( localizeWithPath(
387
+ title: ( localize2WithPath(
353
388
  'vs/workbench/contrib/testing/browser/testExplorerActions',
354
389
  'testing.stopContinuous',
355
- "Stop Continuous Run"
356
- )), original: 'Stop Continuous Run' },
390
+ 'Stop Continuous Run'
391
+ )),
357
392
  category,
358
393
  icon: testingTurnContinuousRunOff,
359
394
  menu: continuousMenus(true),
@@ -504,7 +539,7 @@ class GetExplorerSelection extends ViewAction {
504
539
  )), viewId: "workbench.view.testing" });
505
540
  }
506
541
  runInView(_accessor, view) {
507
- const { include, exclude } = view.getTreeIncludeExclude(undefined, 'selected');
542
+ const { include, exclude } = view.getTreeIncludeExclude(undefined, undefined, 'selected');
508
543
  const mapper = (i) => i.item.extId;
509
544
  return { include: ( include.map(mapper)), exclude: ( exclude.map(mapper)) };
510
545
  }
@@ -513,11 +548,7 @@ class RunSelectedAction extends ExecuteSelectedAction {
513
548
  constructor() {
514
549
  super({
515
550
  id: "testing.runSelected" ,
516
- title: ( localizeWithPath(
517
- 'vs/workbench/contrib/testing/browser/testExplorerActions',
518
- 'runSelectedTests',
519
- 'Run Tests'
520
- )),
551
+ title: LABEL_RUN_TESTS,
521
552
  icon: testingRunAllIcon,
522
553
  }, 2 );
523
554
  }
@@ -526,15 +557,20 @@ class DebugSelectedAction extends ExecuteSelectedAction {
526
557
  constructor() {
527
558
  super({
528
559
  id: "testing.debugSelected" ,
529
- title: ( localizeWithPath(
530
- 'vs/workbench/contrib/testing/browser/testExplorerActions',
531
- 'debugSelectedTests',
532
- 'Debug Tests'
533
- )),
560
+ title: LABEL_DEBUG_TESTS,
534
561
  icon: testingDebugAllIcon,
535
562
  }, 4 );
536
563
  }
537
564
  }
565
+ class CoverageSelectedAction extends ExecuteSelectedAction {
566
+ constructor() {
567
+ super({
568
+ id: "testing.coverageSelected" ,
569
+ title: LABEL_COVERAGE_TESTS,
570
+ icon: testingCoverageAllIcon,
571
+ }, 8 );
572
+ }
573
+ }
538
574
  const showDiscoveringWhile = (progress, task) => {
539
575
  return progress.withProgress({
540
576
  location: 10 ,
@@ -611,15 +647,36 @@ class DebugAllAction extends RunOrDebugAllTestsAction {
611
647
  )));
612
648
  }
613
649
  }
650
+ class CoverageAllAction extends RunOrDebugAllTestsAction {
651
+ constructor() {
652
+ super({
653
+ id: "testing.coverageAll" ,
654
+ title: ( localizeWithPath(
655
+ 'vs/workbench/contrib/testing/browser/testExplorerActions',
656
+ 'runAllWithCoverage',
657
+ 'Run All Tests with Coverage'
658
+ )),
659
+ icon: testingCoverageIcon,
660
+ keybinding: {
661
+ weight: 200 ,
662
+ primary: KeyChord(2048 | 85 , 2048 | 1024 | 31 ),
663
+ },
664
+ }, 8 , ( localizeWithPath(
665
+ 'vs/workbench/contrib/testing/browser/testExplorerActions',
666
+ 'noCoverageTestProvider',
667
+ 'No tests with coverage runners found in this workspace. You may need to install a test provider extension'
668
+ )));
669
+ }
670
+ }
614
671
  class CancelTestRunAction extends Action2 {
615
672
  constructor() {
616
673
  super({
617
674
  id: "testing.cancelRun" ,
618
- title: { value: ( localizeWithPath(
675
+ title: ( localize2WithPath(
619
676
  'vs/workbench/contrib/testing/browser/testExplorerActions',
620
677
  'testing.cancelRun',
621
- "Cancel Test Run"
622
- )), original: 'Cancel Test Run' },
678
+ 'Cancel Test Run'
679
+ )),
623
680
  icon: testingCancelIcon,
624
681
  keybinding: {
625
682
  weight: 200 ,
@@ -648,11 +705,11 @@ class TestingViewAsListAction extends ViewAction {
648
705
  super({
649
706
  id: "testing.viewAsList" ,
650
707
  viewId: "workbench.view.testing" ,
651
- title: { value: ( localizeWithPath(
708
+ title: ( localize2WithPath(
652
709
  'vs/workbench/contrib/testing/browser/testExplorerActions',
653
710
  'testing.viewAsList',
654
- "View as List"
655
- )), original: 'View as List' },
711
+ 'View as List'
712
+ )),
656
713
  toggled: ( TestingContextKeys.viewMode.isEqualTo("list" )),
657
714
  menu: {
658
715
  id: MenuId.ViewTitle,
@@ -671,11 +728,11 @@ class TestingViewAsTreeAction extends ViewAction {
671
728
  super({
672
729
  id: "testing.viewAsTree" ,
673
730
  viewId: "workbench.view.testing" ,
674
- title: { value: ( localizeWithPath(
731
+ title: ( localize2WithPath(
675
732
  'vs/workbench/contrib/testing/browser/testExplorerActions',
676
733
  'testing.viewAsTree',
677
- "View as Tree"
678
- )), original: 'View as Tree' },
734
+ 'View as Tree'
735
+ )),
679
736
  toggled: ( TestingContextKeys.viewMode.isEqualTo("true" )),
680
737
  menu: {
681
738
  id: MenuId.ViewTitle,
@@ -694,11 +751,11 @@ class TestingSortByStatusAction extends ViewAction {
694
751
  super({
695
752
  id: "testing.sortByStatus" ,
696
753
  viewId: "workbench.view.testing" ,
697
- title: { value: ( localizeWithPath(
754
+ title: ( localize2WithPath(
698
755
  'vs/workbench/contrib/testing/browser/testExplorerActions',
699
756
  'testing.sortByStatus',
700
- "Sort by Status"
701
- )), original: 'Sort by Status' },
757
+ 'Sort by Status'
758
+ )),
702
759
  toggled: ( TestingContextKeys.viewSorting.isEqualTo("status" )),
703
760
  menu: {
704
761
  id: MenuId.ViewTitle,
@@ -717,11 +774,11 @@ class TestingSortByLocationAction extends ViewAction {
717
774
  super({
718
775
  id: "testing.sortByLocation" ,
719
776
  viewId: "workbench.view.testing" ,
720
- title: { value: ( localizeWithPath(
777
+ title: ( localize2WithPath(
721
778
  'vs/workbench/contrib/testing/browser/testExplorerActions',
722
779
  'testing.sortByLocation',
723
- "Sort by Location"
724
- )), original: 'Sort by Location' },
780
+ 'Sort by Location'
781
+ )),
725
782
  toggled: ( TestingContextKeys.viewSorting.isEqualTo("location" )),
726
783
  menu: {
727
784
  id: MenuId.ViewTitle,
@@ -740,11 +797,11 @@ class TestingSortByDurationAction extends ViewAction {
740
797
  super({
741
798
  id: "testing.sortByDuration" ,
742
799
  viewId: "workbench.view.testing" ,
743
- title: { value: ( localizeWithPath(
800
+ title: ( localize2WithPath(
744
801
  'vs/workbench/contrib/testing/browser/testExplorerActions',
745
802
  'testing.sortByDuration',
746
- "Sort by Duration"
747
- )), original: 'Sort by Duration' },
803
+ 'Sort by Duration'
804
+ )),
748
805
  toggled: ( TestingContextKeys.viewSorting.isEqualTo("duration" )),
749
806
  menu: {
750
807
  id: MenuId.ViewTitle,
@@ -762,11 +819,11 @@ class ShowMostRecentOutputAction extends Action2 {
762
819
  constructor() {
763
820
  super({
764
821
  id: "testing.showMostRecentOutput" ,
765
- title: { value: ( localizeWithPath(
822
+ title: ( localize2WithPath(
766
823
  'vs/workbench/contrib/testing/browser/testExplorerActions',
767
824
  'testing.showMostRecentOutput',
768
- "Show Output"
769
- )), original: 'Show Output' },
825
+ 'Show Output'
826
+ )),
770
827
  category,
771
828
  icon: Codicon.terminal,
772
829
  keybinding: {
@@ -796,11 +853,11 @@ class CollapseAllAction extends ViewAction {
796
853
  super({
797
854
  id: "testing.collapseAll" ,
798
855
  viewId: "workbench.view.testing" ,
799
- title: { value: ( localizeWithPath(
856
+ title: ( localize2WithPath(
800
857
  'vs/workbench/contrib/testing/browser/testExplorerActions',
801
858
  'testing.collapseAll',
802
- "Collapse All Tests"
803
- )), original: 'Collapse All Tests' },
859
+ 'Collapse All Tests'
860
+ )),
804
861
  icon: Codicon.collapseAll,
805
862
  menu: {
806
863
  id: MenuId.ViewTitle,
@@ -818,13 +875,13 @@ class ClearTestResultsAction extends Action2 {
818
875
  constructor() {
819
876
  super({
820
877
  id: "testing.clearTestResults" ,
821
- title: { value: ( localizeWithPath(
878
+ title: ( localize2WithPath(
822
879
  'vs/workbench/contrib/testing/browser/testExplorerActions',
823
880
  'testing.clearResults',
824
- "Clear All Results"
825
- )), original: 'Clear All Results' },
881
+ 'Clear All Results'
882
+ )),
826
883
  category,
827
- icon: Codicon.trash,
884
+ icon: Codicon.clearAll,
828
885
  menu: [{
829
886
  id: MenuId.TestPeekTitle,
830
887
  }, {
@@ -851,11 +908,11 @@ class GoToTest extends Action2 {
851
908
  constructor() {
852
909
  super({
853
910
  id: "testing.editFocusedTest" ,
854
- title: { value: ( localizeWithPath(
911
+ title: ( localize2WithPath(
855
912
  'vs/workbench/contrib/testing/browser/testExplorerActions',
856
913
  'testing.editFocusedTest',
857
- "Go to Test"
858
- )), original: 'Go to Test' },
914
+ 'Go to Test'
915
+ )),
859
916
  icon: Codicon.goToFile,
860
917
  menu: testItemInlineAndInContext(20 , ( TestingContextKeys.testItemHasUri.isEqualTo(true))),
861
918
  keybinding: {
@@ -968,11 +1025,11 @@ class RunAtCursor extends ExecuteTestAtCursor {
968
1025
  constructor() {
969
1026
  super({
970
1027
  id: "testing.runAtCursor" ,
971
- title: { value: ( localizeWithPath(
1028
+ title: ( localize2WithPath(
972
1029
  'vs/workbench/contrib/testing/browser/testExplorerActions',
973
1030
  'testing.runAtCursor',
974
- "Run Test at Cursor"
975
- )), original: 'Run Test at Cursor' },
1031
+ 'Run Test at Cursor'
1032
+ )),
976
1033
  category,
977
1034
  keybinding: {
978
1035
  weight: 200 ,
@@ -986,11 +1043,11 @@ class DebugAtCursor extends ExecuteTestAtCursor {
986
1043
  constructor() {
987
1044
  super({
988
1045
  id: "testing.debugAtCursor" ,
989
- title: { value: ( localizeWithPath(
1046
+ title: ( localize2WithPath(
990
1047
  'vs/workbench/contrib/testing/browser/testExplorerActions',
991
1048
  'testing.debugAtCursor',
992
- "Debug Test at Cursor"
993
- )), original: 'Debug Test at Cursor' },
1049
+ 'Debug Test at Cursor'
1050
+ )),
994
1051
  category,
995
1052
  keybinding: {
996
1053
  weight: 200 ,
@@ -1000,6 +1057,79 @@ class DebugAtCursor extends ExecuteTestAtCursor {
1000
1057
  }, 4 );
1001
1058
  }
1002
1059
  }
1060
+ class CoverageAtCursor extends ExecuteTestAtCursor {
1061
+ constructor() {
1062
+ super({
1063
+ id: "testing.coverageAtCursor" ,
1064
+ title: ( localize2WithPath(
1065
+ 'vs/workbench/contrib/testing/browser/testExplorerActions',
1066
+ 'testing.coverageAtCursor',
1067
+ 'Run Test at Cursor with Coverage'
1068
+ )),
1069
+ category,
1070
+ keybinding: {
1071
+ weight: 200 ,
1072
+ when: EditorContextKeys.editorTextFocus,
1073
+ primary: KeyChord(2048 | 85 , 2048 | 1024 | 33 ),
1074
+ },
1075
+ }, 8 );
1076
+ }
1077
+ }
1078
+ class ExecuteTestsUnderUriAction extends Action2 {
1079
+ constructor(options, group) {
1080
+ super({
1081
+ ...options,
1082
+ menu: [{
1083
+ id: MenuId.ExplorerContext,
1084
+ when: ( TestingContextKeys.capabilityToContextKey[group].isEqualTo(true)),
1085
+ group: '6.5_testing',
1086
+ order: ((group === 2 ? 11 : 12) ) + 0.1,
1087
+ }],
1088
+ });
1089
+ this.group = group;
1090
+ }
1091
+ async run(accessor, uri) {
1092
+ const testService = accessor.get(ITestService);
1093
+ const notificationService = accessor.get(INotificationService);
1094
+ const tests = await Iterable.asyncToArray(testsUnderUri(testService, accessor.get(IUriIdentityService), uri));
1095
+ if (!tests.length) {
1096
+ notificationService.notify({ message: ( localizeWithPath(
1097
+ 'vs/workbench/contrib/testing/browser/testExplorerActions',
1098
+ 'noTests',
1099
+ 'No tests found in the selected file or folder'
1100
+ )), severity: Severity.Info });
1101
+ return;
1102
+ }
1103
+ return testService.runTests({ tests, group: this.group });
1104
+ }
1105
+ }
1106
+ class RunTestsUnderUri extends ExecuteTestsUnderUriAction {
1107
+ constructor() {
1108
+ super({
1109
+ id: "testing.run.uri" ,
1110
+ title: LABEL_RUN_TESTS,
1111
+ category,
1112
+ }, 2 );
1113
+ }
1114
+ }
1115
+ class DebugTestsUnderUri extends ExecuteTestsUnderUriAction {
1116
+ constructor() {
1117
+ super({
1118
+ id: "testing.debug.uri" ,
1119
+ title: LABEL_DEBUG_TESTS,
1120
+ category,
1121
+ }, 4 );
1122
+ }
1123
+ }
1124
+ class CoverageTestsUnderUri extends ExecuteTestsUnderUriAction {
1125
+ constructor() {
1126
+ super({
1127
+ id: "testing.coverage.uri" ,
1128
+ title: LABEL_COVERAGE_TESTS,
1129
+ category,
1130
+ }, 8 );
1131
+ }
1132
+ }
1003
1133
  class ExecuteTestsInCurrentFile extends Action2 {
1004
1134
  constructor(options, group) {
1005
1135
  super({
@@ -1061,11 +1191,11 @@ class RunCurrentFile extends ExecuteTestsInCurrentFile {
1061
1191
  constructor() {
1062
1192
  super({
1063
1193
  id: "testing.runCurrentFile" ,
1064
- title: { value: ( localizeWithPath(
1194
+ title: ( localize2WithPath(
1065
1195
  'vs/workbench/contrib/testing/browser/testExplorerActions',
1066
1196
  'testing.runCurrentFile',
1067
- "Run Tests in Current File"
1068
- )), original: 'Run Tests in Current File' },
1197
+ 'Run Tests in Current File'
1198
+ )),
1069
1199
  category,
1070
1200
  keybinding: {
1071
1201
  weight: 200 ,
@@ -1079,11 +1209,11 @@ class DebugCurrentFile extends ExecuteTestsInCurrentFile {
1079
1209
  constructor() {
1080
1210
  super({
1081
1211
  id: "testing.debugCurrentFile" ,
1082
- title: { value: ( localizeWithPath(
1212
+ title: ( localize2WithPath(
1083
1213
  'vs/workbench/contrib/testing/browser/testExplorerActions',
1084
1214
  'testing.debugCurrentFile',
1085
- "Debug Tests in Current File"
1086
- )), original: 'Debug Tests in Current File' },
1215
+ 'Debug Tests in Current File'
1216
+ )),
1087
1217
  category,
1088
1218
  keybinding: {
1089
1219
  weight: 200 ,
@@ -1093,6 +1223,24 @@ class DebugCurrentFile extends ExecuteTestsInCurrentFile {
1093
1223
  }, 4 );
1094
1224
  }
1095
1225
  }
1226
+ class CoverageCurrentFile extends ExecuteTestsInCurrentFile {
1227
+ constructor() {
1228
+ super({
1229
+ id: "testing.coverageCurrentFile" ,
1230
+ title: ( localize2WithPath(
1231
+ 'vs/workbench/contrib/testing/browser/testExplorerActions',
1232
+ 'testing.coverageCurrentFile',
1233
+ 'Run Tests with Coverage in Current File'
1234
+ )),
1235
+ category,
1236
+ keybinding: {
1237
+ weight: 200 ,
1238
+ when: EditorContextKeys.editorTextFocus,
1239
+ primary: KeyChord(2048 | 85 , 2048 | 1024 | 36 ),
1240
+ },
1241
+ }, 8 );
1242
+ }
1243
+ }
1096
1244
  const discoverAndRunTests = async (collection, progress, ids, runTests) => {
1097
1245
  const todo = Promise.all(( ids.map(p => expandAndGetTestById(collection, p))));
1098
1246
  const tests = (await showDiscoveringWhile(progress, todo)).filter(isDefined);
@@ -1158,11 +1306,11 @@ class ReRunFailedTests extends RunOrDebugFailedTests {
1158
1306
  constructor() {
1159
1307
  super({
1160
1308
  id: "testing.reRunFailTests" ,
1161
- title: { value: ( localizeWithPath(
1309
+ title: ( localize2WithPath(
1162
1310
  'vs/workbench/contrib/testing/browser/testExplorerActions',
1163
1311
  'testing.reRunFailTests',
1164
- "Rerun Failed Tests"
1165
- )), original: 'Rerun Failed Tests' },
1312
+ 'Rerun Failed Tests'
1313
+ )),
1166
1314
  category,
1167
1315
  keybinding: {
1168
1316
  weight: 200 ,
@@ -1181,11 +1329,11 @@ class DebugFailedTests extends RunOrDebugFailedTests {
1181
1329
  constructor() {
1182
1330
  super({
1183
1331
  id: "testing.debugFailTests" ,
1184
- title: { value: ( localizeWithPath(
1332
+ title: ( localize2WithPath(
1185
1333
  'vs/workbench/contrib/testing/browser/testExplorerActions',
1186
1334
  'testing.debugFailTests',
1187
- "Debug Failed Tests"
1188
- )), original: 'Debug Failed Tests' },
1335
+ 'Debug Failed Tests'
1336
+ )),
1189
1337
  category,
1190
1338
  keybinding: {
1191
1339
  weight: 200 ,
@@ -1204,11 +1352,11 @@ class ReRunLastRun extends RunOrDebugLastRun {
1204
1352
  constructor() {
1205
1353
  super({
1206
1354
  id: "testing.reRunLastRun" ,
1207
- title: { value: ( localizeWithPath(
1355
+ title: ( localize2WithPath(
1208
1356
  'vs/workbench/contrib/testing/browser/testExplorerActions',
1209
1357
  'testing.reRunLastRun',
1210
- "Rerun Last Run"
1211
- )), original: 'Rerun Last Run' },
1358
+ 'Rerun Last Run'
1359
+ )),
1212
1360
  category,
1213
1361
  keybinding: {
1214
1362
  weight: 200 ,
@@ -1227,11 +1375,11 @@ class DebugLastRun extends RunOrDebugLastRun {
1227
1375
  constructor() {
1228
1376
  super({
1229
1377
  id: "testing.debugLastRun" ,
1230
- title: { value: ( localizeWithPath(
1378
+ title: ( localize2WithPath(
1231
1379
  'vs/workbench/contrib/testing/browser/testExplorerActions',
1232
1380
  'testing.debugLastRun',
1233
- "Debug Last Run"
1234
- )), original: 'Debug Last Run' },
1381
+ 'Debug Last Run'
1382
+ )),
1235
1383
  category,
1236
1384
  keybinding: {
1237
1385
  weight: 200 ,
@@ -1246,15 +1394,38 @@ class DebugLastRun extends RunOrDebugLastRun {
1246
1394
  });
1247
1395
  }
1248
1396
  }
1397
+ class CoverageLastRun extends RunOrDebugLastRun {
1398
+ constructor() {
1399
+ super({
1400
+ id: "testing.coverageLastRun" ,
1401
+ title: ( localize2WithPath(
1402
+ 'vs/workbench/contrib/testing/browser/testExplorerActions',
1403
+ 'testing.coverageLastRun',
1404
+ 'Rerun Last Run with Coverage'
1405
+ )),
1406
+ category,
1407
+ keybinding: {
1408
+ weight: 200 ,
1409
+ primary: KeyChord(2048 | 85 , 2048 | 1024 | 42 ),
1410
+ },
1411
+ });
1412
+ }
1413
+ runTest(service, internalTests) {
1414
+ return service.runTests({
1415
+ group: 8 ,
1416
+ tests: internalTests,
1417
+ });
1418
+ }
1419
+ }
1249
1420
  class SearchForTestExtension extends Action2 {
1250
1421
  constructor() {
1251
1422
  super({
1252
1423
  id: "testing.searchForTestExtension" ,
1253
- title: { value: ( localizeWithPath(
1424
+ title: ( localize2WithPath(
1254
1425
  'vs/workbench/contrib/testing/browser/testExplorerActions',
1255
1426
  'testing.searchForTestExtension',
1256
- "Search for Test Extension"
1257
- )), original: 'Search for Test Extension' },
1427
+ 'Search for Test Extension'
1428
+ )),
1258
1429
  });
1259
1430
  }
1260
1431
  async run(accessor) {
@@ -1268,11 +1439,11 @@ class OpenOutputPeek extends Action2 {
1268
1439
  constructor() {
1269
1440
  super({
1270
1441
  id: "testing.openOutputPeek" ,
1271
- title: { value: ( localizeWithPath(
1442
+ title: ( localize2WithPath(
1272
1443
  'vs/workbench/contrib/testing/browser/testExplorerActions',
1273
1444
  'testing.openOutputPeek',
1274
- "Peek Output"
1275
- )), original: 'Peek Output' },
1445
+ 'Peek Output'
1446
+ )),
1276
1447
  category,
1277
1448
  keybinding: {
1278
1449
  weight: 200 ,
@@ -1292,11 +1463,11 @@ class ToggleInlineTestOutput extends Action2 {
1292
1463
  constructor() {
1293
1464
  super({
1294
1465
  id: "testing.toggleInlineTestOutput" ,
1295
- title: { value: ( localizeWithPath(
1466
+ title: ( localize2WithPath(
1296
1467
  'vs/workbench/contrib/testing/browser/testExplorerActions',
1297
1468
  'testing.toggleInlineTestOutput',
1298
- "Toggle Inline Test Output"
1299
- )), original: 'Toggle Inline Test Output' },
1469
+ 'Toggle Inline Test Output'
1470
+ )),
1300
1471
  category,
1301
1472
  keybinding: {
1302
1473
  weight: 200 ,
@@ -1335,11 +1506,11 @@ class RefreshTestsAction extends Action2 {
1335
1506
  constructor() {
1336
1507
  super({
1337
1508
  id: "testing.refreshTests" ,
1338
- title: { value: ( localizeWithPath(
1509
+ title: ( localize2WithPath(
1339
1510
  'vs/workbench/contrib/testing/browser/testExplorerActions',
1340
1511
  'testing.refreshTests',
1341
- "Refresh Tests"
1342
- )), original: 'Refresh Tests' },
1512
+ 'Refresh Tests'
1513
+ )),
1343
1514
  category,
1344
1515
  icon: testingRefreshTests,
1345
1516
  keybinding: {
@@ -1368,11 +1539,11 @@ class CancelTestRefreshAction extends Action2 {
1368
1539
  constructor() {
1369
1540
  super({
1370
1541
  id: "testing.cancelTestRefresh" ,
1371
- title: { value: ( localizeWithPath(
1542
+ title: ( localize2WithPath(
1372
1543
  'vs/workbench/contrib/testing/browser/testExplorerActions',
1373
1544
  'testing.cancelTestRefresh',
1374
- "Cancel Test Refresh"
1375
- )), original: 'Cancel Test Refresh' },
1545
+ 'Cancel Test Refresh'
1546
+ )),
1376
1547
  category,
1377
1548
  icon: testingCancelRefreshTests,
1378
1549
  menu: refreshMenus(true),
@@ -1382,36 +1553,79 @@ class CancelTestRefreshAction extends Action2 {
1382
1553
  accessor.get(ITestService).cancelRefreshTests();
1383
1554
  }
1384
1555
  }
1385
- class TestCoverageClose extends Action2 {
1556
+ class CleareCoverage extends Action2 {
1386
1557
  constructor() {
1387
1558
  super({
1388
1559
  id: "testing.coverage.close" ,
1389
- title: { value: ( localizeWithPath(
1560
+ title: ( localize2WithPath(
1390
1561
  'vs/workbench/contrib/testing/browser/testExplorerActions',
1391
- 'testing.closeCoverage',
1392
- "Close Coverage"
1393
- )), original: 'Close Coverage' },
1562
+ 'testing.clearCoverage',
1563
+ 'Clear Coverage'
1564
+ )),
1394
1565
  icon: widgetClose,
1395
- menu: {
1396
- id: MenuId.ViewTitle,
1397
- group: 'navigation',
1398
- order: 10 ,
1399
- when: ( ContextKeyExpr.equals('view', "workbench.view.testCoverage" ))
1400
- }
1566
+ category,
1567
+ menu: [{
1568
+ id: MenuId.ViewTitle,
1569
+ group: 'navigation',
1570
+ order: 10 ,
1571
+ when: ( ContextKeyExpr.equals('view', "workbench.view.testCoverage" ))
1572
+ }, {
1573
+ id: MenuId.CommandPalette,
1574
+ when: ( TestingContextKeys.isTestCoverageOpen.isEqualTo(true)),
1575
+ }]
1401
1576
  });
1402
1577
  }
1403
1578
  run(accessor) {
1404
1579
  accessor.get(ITestCoverageService).closeCoverage();
1405
1580
  }
1406
1581
  }
1582
+ class OpenCoverage extends Action2 {
1583
+ constructor() {
1584
+ super({
1585
+ id: "testing.openCoverage" ,
1586
+ title: ( localize2WithPath(
1587
+ 'vs/workbench/contrib/testing/browser/testExplorerActions',
1588
+ 'testing.openCoverage',
1589
+ 'Open Coverage'
1590
+ )),
1591
+ category,
1592
+ menu: [{
1593
+ id: MenuId.CommandPalette,
1594
+ when: ( TestingContextKeys.hasAnyResults.isEqualTo(true)),
1595
+ }]
1596
+ });
1597
+ }
1598
+ run(accessor) {
1599
+ const results = accessor.get(ITestResultService).results;
1600
+ const task = results.length && results[0].tasks.find(r => r.coverage);
1601
+ if (!task) {
1602
+ const notificationService = accessor.get(INotificationService);
1603
+ notificationService.info(( localizeWithPath(
1604
+ 'vs/workbench/contrib/testing/browser/testExplorerActions',
1605
+ 'testing.noCoverage',
1606
+ 'No coverage information available on the last test run.'
1607
+ )));
1608
+ return;
1609
+ }
1610
+ accessor.get(ITestCoverageService).openCoverage(task, true);
1611
+ }
1612
+ }
1407
1613
  const allTestActions = [
1408
1614
  CancelTestRefreshAction,
1409
1615
  CancelTestRunAction,
1410
1616
  ClearTestResultsAction,
1617
+ CleareCoverage,
1411
1618
  CollapseAllAction,
1412
1619
  ConfigureTestProfilesAction,
1413
1620
  ContinuousRunTestAction,
1414
1621
  ContinuousRunUsingProfileTestAction,
1622
+ CoverageAction,
1623
+ CoverageAllAction,
1624
+ CoverageAtCursor,
1625
+ CoverageCurrentFile,
1626
+ CoverageLastRun,
1627
+ CoverageSelectedAction,
1628
+ CoverageTestsUnderUri,
1415
1629
  DebugAction,
1416
1630
  DebugAllAction,
1417
1631
  DebugAtCursor,
@@ -1419,10 +1633,12 @@ const allTestActions = [
1419
1633
  DebugFailedTests,
1420
1634
  DebugLastRun,
1421
1635
  DebugSelectedAction,
1422
- GoToTest,
1636
+ DebugTestsUnderUri,
1423
1637
  GetExplorerSelection,
1424
1638
  GetSelectedProfiles,
1639
+ GoToTest,
1425
1640
  HideTestAction,
1641
+ OpenCoverage,
1426
1642
  OpenOutputPeek,
1427
1643
  RefreshTestsAction,
1428
1644
  ReRunFailedTests,
@@ -1432,13 +1648,13 @@ const allTestActions = [
1432
1648
  RunAtCursor,
1433
1649
  RunCurrentFile,
1434
1650
  RunSelectedAction,
1651
+ RunTestsUnderUri,
1435
1652
  RunUsingProfileAction,
1436
1653
  SearchForTestExtension,
1437
1654
  SelectDefaultTestProfiles,
1438
1655
  ShowMostRecentOutputAction,
1439
1656
  StartContinuousRunAction,
1440
1657
  StopContinuousRunAction,
1441
- TestCoverageClose,
1442
1658
  TestingSortByDurationAction,
1443
1659
  TestingSortByLocationAction,
1444
1660
  TestingSortByStatusAction,
@@ -1449,4 +1665,4 @@ const allTestActions = [
1449
1665
  UnhideTestAction,
1450
1666
  ];
1451
1667
 
1452
- export { CancelTestRefreshAction, CancelTestRunAction, ClearTestResultsAction, CollapseAllAction, ConfigureTestProfilesAction, ContinuousRunTestAction, ContinuousRunUsingProfileTestAction, DebugAction, DebugAllAction, DebugAtCursor, DebugCurrentFile, DebugFailedTests, DebugLastRun, DebugSelectedAction, GetExplorerSelection, GetSelectedProfiles, GoToTest, HideTestAction, OpenOutputPeek, ReRunFailedTests, ReRunLastRun, RefreshTestsAction, RunAction, RunAllAction, RunAtCursor, RunCurrentFile, RunSelectedAction, RunUsingProfileAction, SearchForTestExtension, SelectDefaultTestProfiles, ShowMostRecentOutputAction, TestCoverageClose, TestingSortByDurationAction, TestingSortByLocationAction, TestingSortByStatusAction, TestingViewAsListAction, TestingViewAsTreeAction, ToggleInlineTestOutput, UnhideAllTestsAction, UnhideTestAction, allTestActions, discoverAndRunTests };
1668
+ export { CancelTestRefreshAction, CancelTestRunAction, ClearTestResultsAction, CleareCoverage, CollapseAllAction, ConfigureTestProfilesAction, ContinuousRunTestAction, ContinuousRunUsingProfileTestAction, CoverageAction, CoverageAllAction, CoverageAtCursor, CoverageCurrentFile, CoverageLastRun, CoverageSelectedAction, DebugAction, DebugAllAction, DebugAtCursor, DebugCurrentFile, DebugFailedTests, DebugLastRun, DebugSelectedAction, GetExplorerSelection, GetSelectedProfiles, GoToTest, HideTestAction, OpenCoverage, OpenOutputPeek, ReRunFailedTests, ReRunLastRun, RefreshTestsAction, RunAction, RunAllAction, RunAtCursor, RunCurrentFile, RunSelectedAction, RunUsingProfileAction, SearchForTestExtension, SelectDefaultTestProfiles, ShowMostRecentOutputAction, TestingSortByDurationAction, TestingSortByLocationAction, TestingSortByStatusAction, TestingViewAsListAction, TestingViewAsTreeAction, ToggleInlineTestOutput, UnhideAllTestsAction, UnhideTestAction, allTestActions, discoverAndRunTests };