@opensumi/ide-testing 2.21.13 → 2.22.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.
Files changed (109) hide show
  1. package/lib/browser/components/testing.explorer.tree.d.ts.map +1 -1
  2. package/lib/browser/components/testing.explorer.tree.js +7 -5
  3. package/lib/browser/components/testing.explorer.tree.js.map +1 -1
  4. package/lib/browser/components/testing.view.js +1 -1
  5. package/lib/browser/components/testing.view.js.map +1 -1
  6. package/lib/browser/icons/icons.d.ts +1 -0
  7. package/lib/browser/icons/icons.d.ts.map +1 -1
  8. package/lib/browser/icons/icons.js +15 -14
  9. package/lib/browser/icons/icons.js.map +1 -1
  10. package/lib/browser/index.js.map +1 -1
  11. package/lib/browser/outputPeek/test-output-peek.js +9 -9
  12. package/lib/browser/outputPeek/test-output-peek.js.map +1 -1
  13. package/lib/browser/outputPeek/test-peek-message.service.js.map +1 -1
  14. package/lib/browser/outputPeek/test-peek-opener.service.js +1 -1
  15. package/lib/browser/outputPeek/test-peek-opener.service.js.map +1 -1
  16. package/lib/browser/outputPeek/test-peek-widget.js +1 -1
  17. package/lib/browser/outputPeek/test-peek-widget.js.map +1 -1
  18. package/lib/browser/outputPeek/test-tree-container.js +2 -2
  19. package/lib/browser/outputPeek/test-tree-container.js.map +1 -1
  20. package/lib/browser/test-contextkey.service.js.map +1 -1
  21. package/lib/browser/test-decorations.js +19 -19
  22. package/lib/browser/test-decorations.js.map +1 -1
  23. package/lib/browser/test-profile.service.js.map +1 -1
  24. package/lib/browser/test-tree-view.model.d.ts +1 -0
  25. package/lib/browser/test-tree-view.model.d.ts.map +1 -1
  26. package/lib/browser/test-tree-view.model.js +13 -10
  27. package/lib/browser/test-tree-view.model.js.map +1 -1
  28. package/lib/browser/test.result.service.d.ts +1 -1
  29. package/lib/browser/test.result.service.d.ts.map +1 -1
  30. package/lib/browser/test.result.service.js +5 -5
  31. package/lib/browser/test.result.service.js.map +1 -1
  32. package/lib/browser/test.service.d.ts +4 -0
  33. package/lib/browser/test.service.d.ts.map +1 -1
  34. package/lib/browser/test.service.js +31 -4
  35. package/lib/browser/test.service.js.map +1 -1
  36. package/lib/browser/testing.contribution.d.ts.map +1 -1
  37. package/lib/browser/testing.contribution.js +21 -10
  38. package/lib/browser/testing.contribution.js.map +1 -1
  39. package/lib/common/commands.d.ts +1 -0
  40. package/lib/common/commands.d.ts.map +1 -1
  41. package/lib/common/commands.js +6 -1
  42. package/lib/common/commands.js.map +1 -1
  43. package/lib/common/constants.js +12 -12
  44. package/lib/common/constants.js.map +1 -1
  45. package/lib/common/getComputedState.d.ts +1 -1
  46. package/lib/common/getComputedState.d.ts.map +1 -1
  47. package/lib/common/getComputedState.js +1 -1
  48. package/lib/common/getComputedState.js.map +1 -1
  49. package/lib/common/index.d.ts +5 -0
  50. package/lib/common/index.d.ts.map +1 -1
  51. package/lib/common/index.js.map +1 -1
  52. package/lib/common/observableValue.d.ts +14 -0
  53. package/lib/common/observableValue.d.ts.map +1 -0
  54. package/lib/common/observableValue.js +23 -0
  55. package/lib/common/observableValue.js.map +1 -0
  56. package/lib/common/test-result.d.ts +2 -2
  57. package/lib/common/test-result.d.ts.map +1 -1
  58. package/lib/common/test-result.js +19 -19
  59. package/lib/common/test-result.js.map +1 -1
  60. package/lib/common/testCollection.d.ts +9 -8
  61. package/lib/common/testCollection.d.ts.map +1 -1
  62. package/lib/common/testCollection.js +27 -27
  63. package/lib/common/testCollection.js.map +1 -1
  64. package/lib/common/testId.js +21 -21
  65. package/lib/common/testId.js.map +1 -1
  66. package/lib/common/testingStates.js +11 -11
  67. package/lib/common/testingStates.js.map +1 -1
  68. package/lib/common/testingUri.d.ts +1 -1
  69. package/lib/common/testingUri.d.ts.map +1 -1
  70. package/lib/common/testingUri.js +16 -16
  71. package/lib/common/testingUri.js.map +1 -1
  72. package/package.json +14 -13
  73. package/src/browser/components/testing.explorer.tree.tsx +129 -0
  74. package/src/browser/components/testing.module.less +26 -0
  75. package/src/browser/components/testing.view.tsx +35 -0
  76. package/src/browser/icons/icons.less +31 -0
  77. package/src/browser/icons/icons.ts +31 -0
  78. package/src/browser/index.ts +51 -0
  79. package/src/browser/outputPeek/test-message-container.tsx +183 -0
  80. package/src/browser/outputPeek/test-output-peek.ts +282 -0
  81. package/src/browser/outputPeek/test-peek-message.service.ts +15 -0
  82. package/src/browser/outputPeek/test-peek-opener.service.ts +131 -0
  83. package/src/browser/outputPeek/test-peek-widget.less +86 -0
  84. package/src/browser/outputPeek/test-peek-widget.tsx +127 -0
  85. package/src/browser/outputPeek/test-tree-container.tsx +171 -0
  86. package/src/browser/test-contextkey.service.ts +24 -0
  87. package/src/browser/test-decorations.ts +567 -0
  88. package/src/browser/test-profile.service.ts +66 -0
  89. package/src/browser/test-tree-view.model.ts +304 -0
  90. package/src/browser/test.result.service.ts +193 -0
  91. package/src/browser/test.service.ts +190 -0
  92. package/src/browser/testing.contribution.ts +471 -0
  93. package/src/browser/theme.less +6 -0
  94. package/src/common/commands.ts +78 -0
  95. package/src/common/constants.ts +57 -0
  96. package/src/common/contextKeys.ts +0 -0
  97. package/src/common/getComputedState.ts +136 -0
  98. package/src/common/index.ts +55 -0
  99. package/src/common/observableValue.ts +27 -0
  100. package/src/common/test-profile.ts +25 -0
  101. package/src/common/test-result.ts +328 -0
  102. package/src/common/testCollection.ts +680 -0
  103. package/src/common/testId.ts +191 -0
  104. package/src/common/testing-view.ts +28 -0
  105. package/src/common/testingPeekOpener.ts +31 -0
  106. package/src/common/testingStates.ts +92 -0
  107. package/src/common/testingUri.ts +101 -0
  108. package/src/common/tree-view.model.ts +41 -0
  109. package/src/index.ts +1 -0
@@ -0,0 +1,471 @@
1
+ import { Injectable, Autowired, INJECTOR_TOKEN, Injector } from '@opensumi/di';
2
+ import {
3
+ ClientAppContribution,
4
+ CommandContribution,
5
+ CommandRegistry,
6
+ CommandService,
7
+ ComponentContribution,
8
+ ComponentRegistry,
9
+ Domain,
10
+ EDITOR_COMMANDS,
11
+ Event,
12
+ FileType,
13
+ getIcon,
14
+ KeybindingContribution,
15
+ KeybindingRegistry,
16
+ MaybePromise,
17
+ TabBarToolbarContribution,
18
+ ToolbarRegistry,
19
+ URI,
20
+ } from '@opensumi/ide-core-browser';
21
+ import { TestingCanRefreshTests, TestingIsPeekVisible } from '@opensumi/ide-core-browser/lib/contextkey/testing';
22
+ import { IMenuRegistry, MenuContribution, MenuId } from '@opensumi/ide-core-browser/lib/menu/next';
23
+ import { Emitter, IMarkdownString } from '@opensumi/ide-core-common';
24
+ import {
25
+ BrowserEditorContribution,
26
+ IEditorFeatureRegistry,
27
+ IEditorDocumentModelContentRegistry,
28
+ IEditorDocumentModelContentProvider,
29
+ WorkbenchEditorService,
30
+ EditorComponentRegistry,
31
+ ResourceService,
32
+ IResource,
33
+ EditorOpenType,
34
+ } from '@opensumi/ide-editor/lib/browser';
35
+ import { IEditor } from '@opensumi/ide-editor/lib/common';
36
+ import { IFileServiceClient } from '@opensumi/ide-file-service';
37
+ import { MARKDOWN_EDITOR_COMPONENT_ID } from '@opensumi/ide-markdown/lib/browser/contribution';
38
+ import { MarkdownEditorComponent } from '@opensumi/ide-markdown/lib/browser/editor.markdown';
39
+
40
+ import { TestServiceToken } from '../common';
41
+ import {
42
+ ClearTestResults,
43
+ ClosePeekTest,
44
+ DebugAllTestCommand,
45
+ DebugTestCommand,
46
+ GoToNextMessage,
47
+ GoToPreviousMessage,
48
+ GoToTestCommand,
49
+ OpenMessageInEditor,
50
+ PeekTestError,
51
+ RefreshTestsCommand,
52
+ RuntAllTestCommand,
53
+ RuntTestCommand,
54
+ TestingDebugCurrentFile,
55
+ TestingRunCurrentFile,
56
+ } from '../common/commands';
57
+ import { Testing } from '../common/constants';
58
+ import { TestResultServiceToken } from '../common/test-result';
59
+ import { TestRunProfileBitset } from '../common/testCollection';
60
+ import { TestingPeekOpenerServiceToken } from '../common/testingPeekOpener';
61
+ import { ITestTreeViewModel, TestTreeViewModelToken } from '../common/tree-view.model';
62
+
63
+ import { TEST_DATA_SCHEME } from './../common/testingUri';
64
+ import { TestOutputPeekContribution } from './outputPeek/test-output-peek';
65
+ import { TestingPeekOpenerServiceImpl } from './outputPeek/test-peek-opener.service';
66
+ import { TestDecorationsContribution } from './test-decorations';
67
+ import { TestResultServiceImpl } from './test.result.service';
68
+ import { TestServiceImpl } from './test.service';
69
+
70
+ @Injectable()
71
+ export class TestingOutputPeekDocumentProvider implements IEditorDocumentModelContentProvider {
72
+ @Autowired(TestResultServiceToken)
73
+ private readonly testResultService: TestResultServiceImpl;
74
+
75
+ private _onDidChangeContent = new Emitter<URI>();
76
+
77
+ onDidChangeContent: Event<URI> = this._onDidChangeContent.event;
78
+
79
+ provideEditorDocumentModelContent(uri: URI, encoding?: string): MaybePromise<string> {
80
+ const dto = this.testResultService.retrieveTest(uri);
81
+ if (!dto) {
82
+ return '';
83
+ }
84
+
85
+ const message = dto.messages[dto.messageIndex];
86
+
87
+ if (dto.isDiffable || typeof message.message === 'string') {
88
+ return '';
89
+ }
90
+
91
+ const mdStr = message.message;
92
+ const content = mdStr ? (mdStr as IMarkdownString).value.replace(/\t/g, '') : '';
93
+
94
+ return content;
95
+ }
96
+
97
+ isReadonly(uri: URI): MaybePromise<boolean> {
98
+ return true;
99
+ }
100
+
101
+ handlesScheme(scheme: string) {
102
+ return scheme === TEST_DATA_SCHEME;
103
+ }
104
+ }
105
+
106
+ @Injectable()
107
+ @Domain(
108
+ ClientAppContribution,
109
+ ComponentContribution,
110
+ CommandContribution,
111
+ BrowserEditorContribution,
112
+ MenuContribution,
113
+ KeybindingContribution,
114
+ TabBarToolbarContribution,
115
+ )
116
+ export class TestingContribution
117
+ implements
118
+ ClientAppContribution,
119
+ ComponentContribution,
120
+ CommandContribution,
121
+ BrowserEditorContribution,
122
+ MenuContribution,
123
+ KeybindingContribution,
124
+ TabBarToolbarContribution
125
+ {
126
+ @Autowired(TestTreeViewModelToken)
127
+ private readonly testTreeViewModel: ITestTreeViewModel;
128
+
129
+ @Autowired(IFileServiceClient)
130
+ protected readonly filesystem: IFileServiceClient;
131
+
132
+ @Autowired(CommandService)
133
+ private readonly commandService: CommandService;
134
+
135
+ @Autowired(INJECTOR_TOKEN)
136
+ private readonly injector: Injector;
137
+
138
+ @Autowired(TestingPeekOpenerServiceToken)
139
+ private readonly testingPeekOpenerService: TestingPeekOpenerServiceImpl;
140
+
141
+ @Autowired()
142
+ private readonly testingOutputPeekDocumentProvider: TestingOutputPeekDocumentProvider;
143
+
144
+ @Autowired(WorkbenchEditorService)
145
+ private readonly editorService: WorkbenchEditorService;
146
+
147
+ @Autowired(TestServiceToken)
148
+ private readonly testService: TestServiceImpl;
149
+
150
+ @Autowired(TestResultServiceToken)
151
+ private readonly testResultService: TestResultServiceImpl;
152
+
153
+ initialize(): void {
154
+ this.testTreeViewModel.initTreeModel();
155
+ }
156
+
157
+ registerComponent(registry: ComponentRegistry): void {}
158
+
159
+ registerCommands(commands: CommandRegistry): void {
160
+ commands.registerCommand(RuntTestCommand, {
161
+ execute: async (extId: string) => {
162
+ const test = this.testTreeViewModel.getTestItem(extId);
163
+ if (!test) {
164
+ return;
165
+ }
166
+
167
+ await this.testService.runTests({
168
+ group: TestRunProfileBitset.Run,
169
+ tests: [test],
170
+ });
171
+ },
172
+ });
173
+
174
+ commands.registerCommand(DebugTestCommand, {
175
+ execute: async (extId: string) => {
176
+ const test = this.testTreeViewModel.getTestItem(extId);
177
+ if (!test) {
178
+ return;
179
+ }
180
+
181
+ await this.testService.runTests({
182
+ group: TestRunProfileBitset.Debug,
183
+ tests: [test],
184
+ });
185
+ },
186
+ });
187
+
188
+ commands.registerCommand(GoToTestCommand, {
189
+ execute: async (extId: string) => {
190
+ const test = this.testTreeViewModel.getTestItem(extId);
191
+ if (!test) {
192
+ return;
193
+ }
194
+
195
+ const { range, uri } = test.item;
196
+ if (!uri) {
197
+ return;
198
+ }
199
+
200
+ const fileStat = await this.filesystem.getFileStat(uri.toString());
201
+
202
+ if (!fileStat) {
203
+ return;
204
+ }
205
+
206
+ if (fileStat.type === FileType.Directory) {
207
+ // ** filetree 未实现文件夹的 focus , 只能是将窗口切到资源管理器但无法选中文件夹 **
208
+ this.commandService.executeCommand('revealInExplorer', uri);
209
+ return;
210
+ }
211
+
212
+ if (fileStat.type === FileType.File) {
213
+ this.commandService.executeCommand(EDITOR_COMMANDS.OPEN_RESOURCE.id, URI.parse(uri.toString()), {
214
+ range,
215
+ focus: true,
216
+ });
217
+ }
218
+ },
219
+ isVisible: () => false,
220
+ });
221
+
222
+ commands.registerCommand(PeekTestError, {
223
+ execute: async (extId: string) => {
224
+ this.testingPeekOpenerService.open();
225
+ },
226
+ isVisible: () => false,
227
+ });
228
+
229
+ commands.registerCommand(ClosePeekTest, {
230
+ execute: async (uri: string | undefined) => {
231
+ uri = uri ?? this.editorService.currentEditor?.currentUri?.toString();
232
+
233
+ if (!uri) {
234
+ return;
235
+ }
236
+
237
+ const ctor = this.testingPeekOpenerService.peekControllerMap.get(uri);
238
+ if (ctor) {
239
+ ctor.removePeek();
240
+ }
241
+ },
242
+ isVisible: () => false,
243
+ });
244
+
245
+ commands.registerCommand(TestingRunCurrentFile, {
246
+ execute: async () => {
247
+ executeTestsInCurrentFile(TestRunProfileBitset.Run);
248
+ },
249
+ });
250
+
251
+ commands.registerCommand(TestingDebugCurrentFile, {
252
+ execute: async () => {
253
+ executeTestsInCurrentFile(TestRunProfileBitset.Debug);
254
+ },
255
+ });
256
+
257
+ const executeTestsInCurrentFile = (group: TestRunProfileBitset) => {
258
+ const currentEditor = this.editorService.currentEditor;
259
+ const monacoEditor = currentEditor?.monacoEditor;
260
+ const position = monacoEditor?.getPosition();
261
+ const model = monacoEditor?.getModel();
262
+
263
+ if (!position || !model || !('uri' in model)) {
264
+ return;
265
+ }
266
+
267
+ const demandedUri = model.uri.toString();
268
+ for (const test of this.testService.collection.all) {
269
+ if (test.item.uri?.toString() === demandedUri) {
270
+ this.testService.runTests({
271
+ tests: [test],
272
+ group,
273
+ });
274
+ }
275
+ }
276
+ };
277
+
278
+ commands.registerCommand(GoToPreviousMessage, {
279
+ execute: async (uri: string | undefined) => {
280
+ uri = uri ?? this.editorService.currentEditor?.currentUri?.toString();
281
+
282
+ if (!uri) {
283
+ return;
284
+ }
285
+
286
+ const ctor = this.testingPeekOpenerService.peekControllerMap.get(uri);
287
+ if (ctor) {
288
+ ctor.previous();
289
+ }
290
+ },
291
+ });
292
+
293
+ commands.registerCommand(GoToNextMessage, {
294
+ execute: async (uri: string | undefined) => {
295
+ uri = uri ?? this.editorService.currentEditor?.currentUri?.toString();
296
+
297
+ if (!uri) {
298
+ return;
299
+ }
300
+
301
+ const ctor = this.testingPeekOpenerService.peekControllerMap.get(uri);
302
+ if (ctor) {
303
+ ctor.next();
304
+ }
305
+ },
306
+ });
307
+
308
+ commands.registerCommand(ClearTestResults, {
309
+ execute: async (uri: string | undefined) => {
310
+ this.testResultService.clear();
311
+ this.commandService.executeCommand(ClosePeekTest.id, uri);
312
+ },
313
+ });
314
+
315
+ commands.registerCommand(OpenMessageInEditor, {
316
+ execute: async (uri: string | undefined) => {
317
+ uri = uri ?? this.editorService.currentEditor?.currentUri?.toString();
318
+
319
+ if (!uri) {
320
+ return;
321
+ }
322
+
323
+ const ctor = this.testingPeekOpenerService.peekControllerMap.get(uri);
324
+ if (ctor) {
325
+ ctor.openCurrentInEditor();
326
+ }
327
+ },
328
+ });
329
+
330
+ const runOrDebugAllTestsAction = async (group: TestRunProfileBitset) => {
331
+ const roots = [...this.testService.collection.rootItems];
332
+ if (!roots.length) {
333
+ return;
334
+ }
335
+
336
+ await this.testService.runTests({ tests: roots, group });
337
+ };
338
+
339
+ commands.registerCommand(RefreshTestsCommand, {
340
+ execute: async () => {
341
+ await this.testService.refreshTests();
342
+ },
343
+ });
344
+
345
+ commands.registerCommand(RuntAllTestCommand, {
346
+ execute: async () => {
347
+ await runOrDebugAllTestsAction(TestRunProfileBitset.Run);
348
+ },
349
+ });
350
+
351
+ commands.registerCommand(DebugAllTestCommand, {
352
+ execute: async () => {
353
+ await runOrDebugAllTestsAction(TestRunProfileBitset.Debug);
354
+ },
355
+ });
356
+ }
357
+
358
+ registerKeybindings(keybindings: KeybindingRegistry): void {
359
+ keybindings.registerKeybinding({
360
+ command: ClosePeekTest.id,
361
+ keybinding: 'esc',
362
+ when: TestingIsPeekVisible.equalsTo(true),
363
+ });
364
+ }
365
+
366
+ registerMenus(menuRegistry: IMenuRegistry) {
367
+ /** glyph margin start */
368
+ menuRegistry.registerMenuItem(MenuId.TestingGlyphMarginContext, {
369
+ command: RuntTestCommand.id,
370
+ group: '1_has_decoration',
371
+ order: 1,
372
+ });
373
+ menuRegistry.registerMenuItem(MenuId.TestingGlyphMarginContext, {
374
+ command: DebugTestCommand.id,
375
+ group: '1_has_decoration',
376
+ order: 2,
377
+ });
378
+ /** glyph margin end */
379
+
380
+ /** output peek view actions start */
381
+ menuRegistry.registerMenuItem(MenuId.TestPeekTitleContext, {
382
+ command: GoToPreviousMessage.id,
383
+ iconClass: GoToPreviousMessage.iconClass,
384
+ group: 'navigation',
385
+ order: 5,
386
+ });
387
+ menuRegistry.registerMenuItem(MenuId.TestPeekTitleContext, {
388
+ command: GoToNextMessage.id,
389
+ iconClass: GoToNextMessage.iconClass,
390
+ group: 'navigation',
391
+ order: 6,
392
+ });
393
+ menuRegistry.registerMenuItem(MenuId.TestPeekTitleContext, {
394
+ command: ClearTestResults.id,
395
+ iconClass: ClearTestResults.iconClass,
396
+ group: 'navigation',
397
+ order: 7,
398
+ });
399
+ menuRegistry.registerMenuItem(MenuId.TestPeekTitleContext, {
400
+ command: OpenMessageInEditor.id,
401
+ iconClass: OpenMessageInEditor.iconClass,
402
+ group: 'navigation',
403
+ order: 9,
404
+ });
405
+ /** output peek view actions end */
406
+ }
407
+
408
+ registerToolbarItems(registry: ToolbarRegistry): void {
409
+ registry.registerItem({
410
+ id: RefreshTestsCommand.id,
411
+ command: RefreshTestsCommand.id,
412
+ viewId: Testing.ExplorerViewId,
413
+ when: TestingCanRefreshTests.equalsTo(true),
414
+ });
415
+ registry.registerItem({
416
+ id: RuntAllTestCommand.id,
417
+ command: RuntAllTestCommand.id,
418
+ viewId: Testing.ExplorerViewId,
419
+ });
420
+ registry.registerItem({
421
+ id: DebugAllTestCommand.id,
422
+ command: DebugAllTestCommand.id,
423
+ viewId: Testing.ExplorerViewId,
424
+ });
425
+ registry.registerItem({
426
+ id: ClearTestResults.id,
427
+ command: ClearTestResults.id,
428
+ viewId: Testing.ExplorerViewId,
429
+ });
430
+ }
431
+
432
+ registerEditorFeature(registry: IEditorFeatureRegistry) {
433
+ registry.registerEditorFeatureContribution({
434
+ contribute: (editor: IEditor) => this.injector.get(TestDecorationsContribution, [editor]).contribute(),
435
+ });
436
+ registry.registerEditorFeatureContribution({
437
+ contribute: (editor: IEditor) => this.injector.get(TestOutputPeekContribution, [editor]).contribute(),
438
+ });
439
+ }
440
+
441
+ registerEditorDocumentModelContentProvider(registry: IEditorDocumentModelContentRegistry) {
442
+ registry.registerEditorDocumentModelContentProvider(this.testingOutputPeekDocumentProvider);
443
+ }
444
+
445
+ registerEditorComponent(componentRegistry: EditorComponentRegistry) {
446
+ componentRegistry.registerEditorComponent({
447
+ uid: MARKDOWN_EDITOR_COMPONENT_ID,
448
+ component: MarkdownEditorComponent,
449
+ scheme: TEST_DATA_SCHEME,
450
+ });
451
+
452
+ componentRegistry.registerEditorComponentResolver(TEST_DATA_SCHEME, (_, results) => {
453
+ results.push({
454
+ type: EditorOpenType.component,
455
+ componentId: MARKDOWN_EDITOR_COMPONENT_ID,
456
+ weight: 10,
457
+ });
458
+ });
459
+ }
460
+
461
+ registerResource(service: ResourceService) {
462
+ service.registerResourceProvider({
463
+ scheme: TEST_DATA_SCHEME,
464
+ provideResource: async (uri: URI): Promise<IResource<Partial<{ [prop: string]: any }>>> => ({
465
+ uri,
466
+ icon: getIcon('file-text'),
467
+ name: `Preview ${uri.displayName}`,
468
+ }),
469
+ });
470
+ }
471
+ }
@@ -0,0 +1,6 @@
1
+ .monaco-editor {
2
+ // error message
3
+ .testing-inline-message-severity-0 {
4
+ background: rgba(255, 0, 0, 0.2);
5
+ }
6
+ }
@@ -0,0 +1,78 @@
1
+ import { Command, getExternalIcon, getIcon } from '@opensumi/ide-core-browser';
2
+
3
+ export const RuntTestCommand: Command = {
4
+ id: 'testing.run.test',
5
+ label: 'Run Test',
6
+ };
7
+
8
+ export const DebugTestCommand: Command = {
9
+ id: 'testing.debug.test',
10
+ label: 'Debug Test',
11
+ };
12
+
13
+ export const GoToTestCommand: Command = {
14
+ id: 'testing.goto.test',
15
+ label: 'Go To Test',
16
+ };
17
+
18
+ export const TestingRunCurrentFile: Command = {
19
+ id: 'testing.runCurrentFile',
20
+ label: 'Run Tests in Current File',
21
+ };
22
+
23
+ export const TestingDebugCurrentFile: Command = {
24
+ id: 'testing.debugCurrentFile',
25
+ label: 'Debug Tests in Current File',
26
+ };
27
+
28
+ export const PeekTestError: Command = {
29
+ id: 'testing.peek.test.error',
30
+ label: 'Peek Output',
31
+ };
32
+
33
+ export const ClosePeekTest: Command = {
34
+ id: 'testing.peek.test.close',
35
+ label: 'Close Peek Output',
36
+ };
37
+
38
+ export const GoToPreviousMessage: Command = {
39
+ id: 'testing.goToPreviousMessage',
40
+ label: 'Go to Previous Test Failure',
41
+ iconClass: getIcon('arrowup'),
42
+ };
43
+
44
+ export const GoToNextMessage: Command = {
45
+ id: 'testing.goToNextMessage',
46
+ label: 'Go to Next Test Failure',
47
+ iconClass: getIcon('arrowdown'),
48
+ };
49
+
50
+ export const ClearTestResults: Command = {
51
+ id: 'testing.clearTestResults',
52
+ label: 'Clear All Results',
53
+ iconClass: getExternalIcon('clear-all'),
54
+ };
55
+
56
+ export const OpenMessageInEditor: Command = {
57
+ id: 'testing.openMessageInEditor',
58
+ label: 'Open in Editor',
59
+ iconClass: getExternalIcon('link-external'),
60
+ };
61
+
62
+ export const RuntAllTestCommand: Command = {
63
+ id: 'testing.runAll',
64
+ label: 'Run All Test',
65
+ iconClass: getExternalIcon('run-all'),
66
+ };
67
+
68
+ export const DebugAllTestCommand: Command = {
69
+ id: 'testing.debugAll',
70
+ label: 'Debug All Test',
71
+ iconClass: getIcon('debug-alt-small'),
72
+ };
73
+
74
+ export const RefreshTestsCommand: Command = {
75
+ id: 'testing.refresshTests',
76
+ label: 'Refresh Tests',
77
+ iconClass: getIcon('refresh'),
78
+ };
@@ -0,0 +1,57 @@
1
+ /* ---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+
6
+ import { localize } from '@opensumi/ide-core-common';
7
+
8
+ import { TestMessageType, TestResultState, TestRunProfileBitset } from './testCollection';
9
+
10
+ export const enum Testing {
11
+ // marked as "extension" so that any existing test extensions are assigned to it.
12
+ ViewletId = 'workbench.view.extension.test',
13
+ ExplorerViewId = 'workbench.view.testing',
14
+ OutputPeekContributionId = 'editor.contrib.testingOutputPeek',
15
+ DecorationsContributionId = 'editor.contrib.testingDecorations',
16
+ FilterActionId = 'workbench.actions.treeView.testExplorer.filter',
17
+ }
18
+
19
+ export const enum TestExplorerViewMode {
20
+ List = 'list',
21
+ Tree = 'true',
22
+ }
23
+
24
+ export const enum TestExplorerViewSorting {
25
+ ByLocation = 'location',
26
+ ByStatus = 'status',
27
+ }
28
+
29
+ export const enum TestExplorerStateFilter {
30
+ OnlyFailed = 'failed',
31
+ OnlyExecuted = 'excuted',
32
+ All = 'all',
33
+ }
34
+
35
+ export const testStateNames: { [K in TestResultState]: string } = {
36
+ [TestResultState.Errored]: localize('testState.errored', 'Errored'),
37
+ [TestResultState.Failed]: localize('testState.failed', 'Failed'),
38
+ [TestResultState.Passed]: localize('testState.passed', 'Passed'),
39
+ [TestResultState.Queued]: localize('testState.queued', 'Queued'),
40
+ [TestResultState.Running]: localize('testState.running', 'Running'),
41
+ [TestResultState.Skipped]: localize('testState.skipped', 'Skipped'),
42
+ [TestResultState.Unset]: localize('testState.unset', 'Not yet run'),
43
+ };
44
+
45
+ export const labelForTestInState = (label: string, state: TestResultState) =>
46
+ 'label then the unit tests state, for example "Addition Tests (Running)"';
47
+
48
+ export const testConfigurationGroupNames: { [K in TestRunProfileBitset]: string } = {
49
+ [TestRunProfileBitset.Debug]: localize('testGroup.debug', 'Debug'),
50
+ [TestRunProfileBitset.Run]: localize('testGroup.run', 'Run'),
51
+ [TestRunProfileBitset.Coverage]: localize('testGroup.coverage', 'Coverage'),
52
+ };
53
+
54
+ export const testMessageSeverityColors = {
55
+ [TestMessageType.Error]: '#F14C4C',
56
+ [TestMessageType.Info]: '#33333380', // --> #333333 透明度 0.5 的结果
57
+ };
File without changes