@theia/test 1.43.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 (82) hide show
  1. package/lib/browser/constants.d.ts +46 -0
  2. package/lib/browser/constants.d.ts.map +1 -0
  3. package/lib/browser/constants.js +18 -0
  4. package/lib/browser/constants.js.map +1 -0
  5. package/lib/browser/test-service.d.ts +150 -0
  6. package/lib/browser/test-service.d.ts.map +1 -0
  7. package/lib/browser/test-service.js +240 -0
  8. package/lib/browser/test-service.js.map +1 -0
  9. package/lib/browser/view/test-execution-state-manager.d.ts +14 -0
  10. package/lib/browser/view/test-execution-state-manager.d.ts.map +1 -0
  11. package/lib/browser/view/test-execution-state-manager.js +174 -0
  12. package/lib/browser/view/test-execution-state-manager.js.map +1 -0
  13. package/lib/browser/view/test-output-ui-model.d.ts +46 -0
  14. package/lib/browser/view/test-output-ui-model.d.ts.map +1 -0
  15. package/lib/browser/view/test-output-ui-model.js +140 -0
  16. package/lib/browser/view/test-output-ui-model.js.map +1 -0
  17. package/lib/browser/view/test-output-view-contribution.d.ts +6 -0
  18. package/lib/browser/view/test-output-view-contribution.d.ts.map +1 -0
  19. package/lib/browser/view/test-output-view-contribution.js +48 -0
  20. package/lib/browser/view/test-output-view-contribution.js.map +1 -0
  21. package/lib/browser/view/test-output-widget.d.ts +25 -0
  22. package/lib/browser/view/test-output-widget.d.ts.map +1 -0
  23. package/lib/browser/view/test-output-widget.js +159 -0
  24. package/lib/browser/view/test-output-widget.js.map +1 -0
  25. package/lib/browser/view/test-result-view-contribution.d.ts +6 -0
  26. package/lib/browser/view/test-result-view-contribution.d.ts.map +1 -0
  27. package/lib/browser/view/test-result-view-contribution.js +48 -0
  28. package/lib/browser/view/test-result-view-contribution.js.map +1 -0
  29. package/lib/browser/view/test-result-widget.d.ts +21 -0
  30. package/lib/browser/view/test-result-widget.d.ts.map +1 -0
  31. package/lib/browser/view/test-result-widget.js +109 -0
  32. package/lib/browser/view/test-result-widget.js.map +1 -0
  33. package/lib/browser/view/test-run-view-contribution.d.ts +18 -0
  34. package/lib/browser/view/test-run-view-contribution.d.ts.map +1 -0
  35. package/lib/browser/view/test-run-view-contribution.js +101 -0
  36. package/lib/browser/view/test-run-view-contribution.js.map +1 -0
  37. package/lib/browser/view/test-run-widget.d.ts +59 -0
  38. package/lib/browser/view/test-run-widget.d.ts.map +1 -0
  39. package/lib/browser/view/test-run-widget.js +306 -0
  40. package/lib/browser/view/test-run-widget.js.map +1 -0
  41. package/lib/browser/view/test-tree-widget.d.ts +68 -0
  42. package/lib/browser/view/test-tree-widget.d.ts.map +1 -0
  43. package/lib/browser/view/test-tree-widget.js +387 -0
  44. package/lib/browser/view/test-tree-widget.js.map +1 -0
  45. package/lib/browser/view/test-view-contribution.d.ts +46 -0
  46. package/lib/browser/view/test-view-contribution.d.ts.map +1 -0
  47. package/lib/browser/view/test-view-contribution.js +289 -0
  48. package/lib/browser/view/test-view-contribution.js.map +1 -0
  49. package/lib/browser/view/test-view-frontend-module.d.ts +7 -0
  50. package/lib/browser/view/test-view-frontend-module.d.ts.map +1 -0
  51. package/lib/browser/view/test-view-frontend-module.js +120 -0
  52. package/lib/browser/view/test-view-frontend-module.js.map +1 -0
  53. package/lib/common/collections.d.ts +47 -0
  54. package/lib/common/collections.d.ts.map +1 -0
  55. package/lib/common/collections.js +211 -0
  56. package/lib/common/collections.js.map +1 -0
  57. package/lib/common/tree-delta.d.ts +52 -0
  58. package/lib/common/tree-delta.d.ts.map +1 -0
  59. package/lib/common/tree-delta.js +241 -0
  60. package/lib/common/tree-delta.js.map +1 -0
  61. package/lib/common/tree-delta.spec.d.ts +2 -0
  62. package/lib/common/tree-delta.spec.d.ts.map +1 -0
  63. package/lib/common/tree-delta.spec.js +140 -0
  64. package/lib/common/tree-delta.spec.js.map +1 -0
  65. package/package.json +53 -0
  66. package/src/browser/constants.ts +71 -0
  67. package/src/browser/style/index.css +42 -0
  68. package/src/browser/test-service.ts +347 -0
  69. package/src/browser/view/test-execution-state-manager.ts +147 -0
  70. package/src/browser/view/test-output-ui-model.ts +148 -0
  71. package/src/browser/view/test-output-view-contribution.ts +34 -0
  72. package/src/browser/view/test-output-widget.ts +148 -0
  73. package/src/browser/view/test-result-view-contribution.ts +34 -0
  74. package/src/browser/view/test-result-widget.ts +92 -0
  75. package/src/browser/view/test-run-view-contribution.ts +89 -0
  76. package/src/browser/view/test-run-widget.tsx +266 -0
  77. package/src/browser/view/test-tree-widget.tsx +360 -0
  78. package/src/browser/view/test-view-contribution.ts +300 -0
  79. package/src/browser/view/test-view-frontend-module.ts +132 -0
  80. package/src/common/collections.ts +223 -0
  81. package/src/common/tree-delta.spec.ts +166 -0
  82. package/src/common/tree-delta.ts +259 -0
@@ -0,0 +1,140 @@
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2022 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
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ const tree_delta_1 = require("./tree-delta");
18
+ const chai = require("chai");
19
+ const expect = chai.expect;
20
+ describe('TreeDeltaBuilder tests', () => {
21
+ it('should split paths', () => {
22
+ const builder = new tree_delta_1.TreeDeltaBuilderImpl();
23
+ builder.reportAdded(['a', 'b', 'c'], {
24
+ id: 'c',
25
+ prop: 17
26
+ });
27
+ builder.reportRemoved(['a', 'b', 'd', 'e']);
28
+ const expected = {
29
+ path: ['a', 'b'],
30
+ type: tree_delta_1.DeltaKind.NONE,
31
+ childDeltas: [
32
+ {
33
+ path: ['d', 'e'],
34
+ type: tree_delta_1.DeltaKind.REMOVED,
35
+ },
36
+ {
37
+ type: tree_delta_1.DeltaKind.ADDED,
38
+ path: ['c'],
39
+ value: { id: 'c', prop: 17 },
40
+ },
41
+ ]
42
+ };
43
+ expect(builder.currentDelta).deep.equal([
44
+ expected
45
+ ]);
46
+ });
47
+ it('should merge add/remove child', () => {
48
+ const builder = new tree_delta_1.TreeDeltaBuilderImpl();
49
+ builder.reportAdded(['a', 'b', 'c'], {
50
+ id: 'c',
51
+ prop: 17
52
+ });
53
+ builder.reportRemoved(['a', 'b', 'c', 'd']);
54
+ expect(builder.currentDelta).deep.equal([{
55
+ path: ['a', 'b', 'c'],
56
+ type: tree_delta_1.DeltaKind.ADDED,
57
+ value: { id: 'c', prop: 17 },
58
+ }]);
59
+ });
60
+ it('should merge change', () => {
61
+ const builder = new tree_delta_1.TreeDeltaBuilderImpl();
62
+ builder.reportChanged(['a', 'b', 'c'], { id: 'c', prop: 17 });
63
+ builder.reportChanged(['a', 'b', 'c'], { prop: 18 });
64
+ builder.reportChanged(['a', 'b', 'c'], { prop: 19 });
65
+ expect(builder.currentDelta).deep.equal([
66
+ {
67
+ type: tree_delta_1.DeltaKind.CHANGED,
68
+ path: ['a', 'b', 'c'],
69
+ value: { id: 'c', prop: 19 },
70
+ }
71
+ ]);
72
+ });
73
+ it('should merge add/change', () => {
74
+ const builder = new tree_delta_1.TreeDeltaBuilderImpl();
75
+ const obj = {
76
+ id: 'c',
77
+ prop: 17
78
+ };
79
+ builder.reportAdded(['a', 'b', 'c'], obj);
80
+ obj.prop = 18;
81
+ builder.reportChanged(['a', 'b', 'c'], { prop: 18 });
82
+ expect(builder.currentDelta).deep.equal([
83
+ {
84
+ type: tree_delta_1.DeltaKind.ADDED,
85
+ path: ['a', 'b', 'c'],
86
+ value: { id: 'c', prop: 18 },
87
+ }
88
+ ]);
89
+ });
90
+ it('should handle adds/delete', () => {
91
+ const builder = new tree_delta_1.TreeDeltaBuilderImpl();
92
+ builder.reportAdded(['a', 'b'], { id: 'c', prop: 14 });
93
+ builder.reportRemoved(['a', 'b']);
94
+ expect(builder.currentDelta).deep.equal([]);
95
+ builder.reportAdded(['a', 'b'], { id: 'c', prop: 20 });
96
+ expect(builder.currentDelta).deep.equal([{
97
+ path: ['a', 'b'],
98
+ type: tree_delta_1.DeltaKind.ADDED,
99
+ value: { id: 'c', prop: 20 }
100
+ }]);
101
+ });
102
+ it('should handle delete/add', () => {
103
+ const builder = new tree_delta_1.TreeDeltaBuilderImpl();
104
+ builder.reportRemoved(['a', 'b']);
105
+ builder.reportAdded(['a', 'b'], { id: 'c', prop: 14 });
106
+ expect(builder.currentDelta).deep.equal([{
107
+ path: ['a', 'b'],
108
+ type: tree_delta_1.DeltaKind.CHANGED,
109
+ value: { id: 'c', prop: 14 }
110
+ }]);
111
+ builder.reportRemoved(['a', 'b']);
112
+ expect(builder.currentDelta).deep.equal([{
113
+ path: ['a', 'b'],
114
+ type: tree_delta_1.DeltaKind.REMOVED,
115
+ }]);
116
+ });
117
+ it('should handle changed below changed', () => {
118
+ const builder = new tree_delta_1.TreeDeltaBuilderImpl();
119
+ builder.reportChanged(['a', 'b', 'c', 'e'], { id: 'e', prop: 14 });
120
+ builder.reportChanged(['a', 'b', 'c', 'd'], { id: 'd', prop: 23 });
121
+ builder.reportChanged(['a', 'b', 'c'], { id: 'c', prop: 27 });
122
+ expect(builder.currentDelta).deep.equal([{
123
+ path: ['a', 'b', 'c'],
124
+ type: tree_delta_1.DeltaKind.CHANGED,
125
+ value: { id: 'c', prop: 27 },
126
+ childDeltas: [
127
+ {
128
+ path: ['d'],
129
+ type: tree_delta_1.DeltaKind.CHANGED,
130
+ value: { id: 'd', prop: 23 }
131
+ }, {
132
+ path: ['e'],
133
+ type: tree_delta_1.DeltaKind.CHANGED,
134
+ value: { id: 'e', prop: 14 }
135
+ }
136
+ ]
137
+ }]);
138
+ });
139
+ });
140
+ //# sourceMappingURL=tree-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,CAAC;wBACX,IAAI,EAAE,sBAAS,CAAC,OAAO;wBACvB,KAAK,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE;qBAC/B;iBAAC;aACT,CAAC,CAAC,CAAC;IACR,CAAC,CAAC,CAAC;AAEP,CAAC,CAAC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,53 @@
1
+ {
2
+ "name": "@theia/test",
3
+ "version": "1.43.0",
4
+ "description": "Theia - Test Extension",
5
+ "dependencies": {
6
+ "@theia/core": "1.43.0",
7
+ "@theia/editor": "1.43.0",
8
+ "@theia/filesystem": "1.43.0",
9
+ "@theia/navigator": "1.43.0",
10
+ "@theia/terminal": "1.43.0",
11
+ "xterm": "^4.16.0",
12
+ "xterm-addon-fit": "^0.5.0"
13
+ },
14
+ "publishConfig": {
15
+ "access": "public"
16
+ },
17
+ "theiaExtensions": [
18
+ {
19
+ "frontend": "lib/browser/view/test-view-frontend-module"
20
+ }
21
+ ],
22
+ "keywords": [
23
+ "theia-extension"
24
+ ],
25
+ "license": "EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0",
26
+ "repository": {
27
+ "type": "git",
28
+ "url": "https://github.com/eclipse-theia/theia.git"
29
+ },
30
+ "bugs": {
31
+ "url": "https://github.com/eclipse-theia/theia/issues"
32
+ },
33
+ "homepage": "https://github.com/eclipse-theia/theia",
34
+ "files": [
35
+ "lib",
36
+ "src"
37
+ ],
38
+ "scripts": {
39
+ "build": "theiaext build",
40
+ "clean": "theiaext clean",
41
+ "compile": "theiaext compile",
42
+ "lint": "theiaext lint",
43
+ "test": "theiaext test",
44
+ "watch": "theiaext watch"
45
+ },
46
+ "devDependencies": {
47
+ "@theia/ext-scripts": "1.43.0"
48
+ },
49
+ "nyc": {
50
+ "extends": "../../configs/nyc.json"
51
+ },
52
+ "gitHead": "c94caea7fe1cc7c9f05b1c3f55afb6b5eb69bbb2"
53
+ }
@@ -0,0 +1,71 @@
1
+ // *****************************************************************************
2
+ // Copyright (C) 2023 Mathieu Bussieres 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
+ /*---------------------------------------------------------------------------------------------
18
+ * Copyright (c) Microsoft Corporation and others. All rights reserved.
19
+ * Licensed under the MIT License. See https://github.com/Microsoft/vscode/blob/master/LICENSE.txt for license information.
20
+ *--------------------------------------------------------------------------------------------*/
21
+
22
+ // Based on https://github.com/microsoft/vscode/blob/1.72.2/src/vs/workbench/contrib/testing/common/constants.ts
23
+
24
+ /* eslint-disable import/no-extraneous-dependencies */
25
+ export const enum Testing {
26
+ // marked as "extension" so that any existing test extensions are assigned to it.
27
+ ViewletId = 'workbench.view.extension.test',
28
+ ExplorerViewId = 'workbench.view.testing',
29
+ OutputPeekContributionId = 'editor.contrib.testingOutputPeek',
30
+ DecorationsContributionId = 'editor.contrib.testingDecorations',
31
+ }
32
+
33
+ export const enum TestCommandId {
34
+ CancelTestRefreshAction = 'testing.cancelTestRefresh',
35
+ CancelTestRunAction = 'testing.cancelRun',
36
+ ClearTestResultsAction = 'testing.clearTestResults',
37
+ CollapseAllAction = 'testing.collapseAll',
38
+ ConfigureTestProfilesAction = 'testing.configureProfile',
39
+ DebugAction = 'testing.debug',
40
+ DebugAllAction = 'testing.debugAll',
41
+ DebugAtCursor = 'testing.debugAtCursor',
42
+ DebugCurrentFile = 'testing.debugCurrentFile',
43
+ DebugFailedTests = 'testing.debugFailTests',
44
+ DebugLastRun = 'testing.debugLastRun',
45
+ DebugSelectedAction = 'testing.debugSelected',
46
+ FilterAction = 'workbench.actions.treeView.testExplorer.filter',
47
+ GoToTest = 'testing.editFocusedTest',
48
+ HideTestAction = 'testing.hideTest',
49
+ OpenOutputPeek = 'testing.openOutputPeek',
50
+ RefreshTestsAction = 'testing.refreshTests',
51
+ ReRunFailedTests = 'testing.reRunFailTests',
52
+ ReRunLastRun = 'testing.reRunLastRun',
53
+ RunAction = 'testing.run',
54
+ RunAllAction = 'testing.runAll',
55
+ RunAtCursor = 'testing.runAtCursor',
56
+ RunCurrentFile = 'testing.runCurrentFile',
57
+ RunSelectedAction = 'testing.runSelected',
58
+ RunUsingProfileAction = 'testing.runUsing',
59
+ SearchForTestExtension = 'testing.searchForTestExtension',
60
+ SelectDefaultTestProfiles = 'testing.selectDefaultTestProfiles',
61
+ ShowMostRecentOutputAction = 'testing.showMostRecentOutput',
62
+ TestingSortByDurationAction = 'testing.sortByDuration',
63
+ TestingSortByLocationAction = 'testing.sortByLocation',
64
+ TestingSortByStatusAction = 'testing.sortByStatus',
65
+ TestingViewAsListAction = 'testing.viewAsList',
66
+ TestingViewAsTreeAction = 'testing.viewAsTree',
67
+ ToggleAutoRun = 'testing.toggleautoRun',
68
+ ToggleInlineTestOutput = 'testing.toggleInlineTestOutput',
69
+ UnhideTestAction = 'testing.unhideTest',
70
+ UnhideAllTestsAction = 'testing.unhideAllTests',
71
+ }
@@ -0,0 +1,42 @@
1
+ /******************************************************************************
2
+ * Copyright (C) 2023 STMicroelectronics and others.
3
+ * This program and the accompanying materials are made available under the
4
+ * terms of the Eclipse Public License v. 2.0 which is available at
5
+ * http://www.eclipse.org/legal/epl-2.0.
6
+ *
7
+ * This Source Code may also be made available under the following Secondary
8
+ * Licenses when the conditions for such availability set forth in the Eclipse
9
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
10
+ * with the GNU Classpath Exception which is available at
11
+ * https://www.gnu.org/software/classpath/license.html.
12
+ *
13
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
14
+ ********************************************************************************/
15
+
16
+ .theia-test-view {
17
+ height: 100%
18
+ }
19
+
20
+ .theia-test-view .passed,
21
+ .theia-test-result-view .passed {
22
+ color: var(--theia-successBackground);
23
+ }
24
+
25
+ .theia-test-view .failed,
26
+ .theia-test-result-view .failed {
27
+ color: var(--theia-editorError-foreground);
28
+ }
29
+
30
+ .theia-test-view .errored,
31
+ .theia-test-result-view .errored {
32
+ color: var(--theia-editorError-foreground);
33
+ }
34
+
35
+ .theia-test-view .queued,
36
+ .theia-test-result-view .queued {
37
+ color: var(--theia-editorWarning-foreground);
38
+ }
39
+
40
+ .theia-test-view .theia-TreeNode:not(:hover):not(.theia-mod-selected) .theia-test-tree-inline-action {
41
+ display: none;
42
+ }
@@ -0,0 +1,347 @@
1
+ // *****************************************************************************
2
+ // Copyright (C) 2022 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 { CancellationToken, ContributionProvider, Disposable, Emitter, Event, QuickPickService, isObject, nls } from '@theia/core/lib/common';
18
+ import { CancellationTokenSource, Location, Range } from '@theia/core/shared/vscode-languageserver-protocol';
19
+ import { CollectionDelta, TreeDelta } from '../common/tree-delta';
20
+ import { MarkdownString } from '@theia/core/lib/common/markdown-rendering';
21
+ import URI from '@theia/core/lib/common/uri';
22
+ import { inject, injectable, named, postConstruct } from '@theia/core/shared/inversify';
23
+ import { groupBy } from '../common/collections';
24
+ import { codiconArray } from '@theia/core/lib/browser';
25
+
26
+ export enum TestRunProfileKind {
27
+ Run = 1,
28
+ Debug = 2,
29
+ Coverage = 3
30
+ }
31
+
32
+ export interface TestRunProfile {
33
+ readonly kind: TestRunProfileKind;
34
+ readonly label: string,
35
+ readonly isDefault: boolean;
36
+ readonly canConfigure: boolean;
37
+ readonly tag: string;
38
+ run(name: string, included: readonly TestItem[], excluded: readonly TestItem[]): void;
39
+ configure(): void;
40
+ }
41
+
42
+ export interface TestOutputItem {
43
+ readonly output: string;
44
+ readonly location?: Location;
45
+ }
46
+
47
+ export enum TestExecutionState {
48
+ Queued = 1,
49
+ Running = 2,
50
+ Passed = 3,
51
+ Failed = 4,
52
+ Skipped = 5,
53
+ Errored = 6
54
+ }
55
+
56
+ export interface TestMessage {
57
+ readonly expected?: string;
58
+ readonly actual?: string;
59
+ readonly location: Location;
60
+ readonly message: string | MarkdownString;
61
+ }
62
+
63
+ export interface TestState {
64
+ readonly state: TestExecutionState;
65
+ }
66
+
67
+ export interface TestFailure extends TestState {
68
+ readonly state: TestExecutionState.Failed | TestExecutionState.Errored;
69
+ readonly messages: TestMessage[];
70
+ readonly duration?: number;
71
+ }
72
+
73
+ export namespace TestFailure {
74
+ export function is(obj: unknown): obj is TestFailure {
75
+ return isObject<TestFailure>(obj) && (obj.state === TestExecutionState.Failed || obj.state === TestExecutionState.Errored) && Array.isArray(obj.messages);
76
+ }
77
+ }
78
+
79
+ export interface TestSuccess extends TestState {
80
+ readonly state: TestExecutionState.Passed;
81
+ readonly duration?: number;
82
+ }
83
+
84
+ export interface TestStateChangedEvent {
85
+ test: TestItem;
86
+ oldState: TestState | undefined;
87
+ newState: TestState | undefined;
88
+ }
89
+
90
+ export interface TestRun {
91
+ cancel(): void;
92
+ readonly name: string;
93
+ readonly isRunning: boolean;
94
+ readonly controller: TestController;
95
+
96
+ onDidChangeProperty: Event<{ name?: string, isRunning?: boolean }>;
97
+
98
+ getTestState(item: TestItem): TestState | undefined;
99
+ onDidChangeTestState: Event<TestStateChangedEvent[]>;
100
+
101
+ getOutput(item?: TestItem): readonly TestOutputItem[];
102
+ onDidChangeTestOutput: Event<[TestItem | undefined, TestOutputItem][]>;
103
+
104
+ readonly items: readonly TestItem[];
105
+ }
106
+
107
+ export namespace TestRun {
108
+ export function is(obj: unknown): obj is TestRun {
109
+ return isObject<TestRun>(obj)
110
+ && typeof obj.cancel === 'function'
111
+ && typeof obj.name === 'string'
112
+ && typeof obj.isRunning === 'boolean'
113
+ && typeof obj.controller === 'object'
114
+ && typeof obj.onDidChangeProperty === 'function'
115
+ && typeof obj.getTestState === 'function'
116
+ && typeof obj.onDidChangeTestState === 'function'
117
+ && typeof obj.onDidChangeTestState === 'function'
118
+ && typeof obj.getOutput === 'function'
119
+ && typeof obj.onDidChangeTestOutput === 'function'
120
+ && Array.isArray(obj.items);
121
+ }
122
+ }
123
+
124
+ export interface TestItem {
125
+ readonly id: string;
126
+ readonly label: string;
127
+ readonly range?: Range;
128
+ readonly sortKey?: string;
129
+ readonly tags: string[];
130
+ readonly uri?: URI;
131
+ readonly busy: boolean;
132
+ readonly tests: readonly TestItem[];
133
+ readonly description?: string;
134
+ readonly error?: string | MarkdownString;
135
+ readonly parent: TestItem | undefined;
136
+ readonly controller: TestController | undefined;
137
+ readonly canResolveChildren: boolean;
138
+ resolveChildren(): void;
139
+ }
140
+
141
+ export namespace TestItem {
142
+ export function is(obj: unknown): obj is TestItem {
143
+ return isObject<TestItem>(obj)
144
+ && obj.id !== undefined
145
+ && obj.label !== undefined
146
+ && Array.isArray(obj.tags)
147
+ && Array.isArray(obj.tests)
148
+ && obj.busy !== undefined
149
+ && obj.canResolveChildren !== undefined
150
+ && typeof obj.resolveChildren === 'function';
151
+ }
152
+ }
153
+
154
+ export interface TestController {
155
+ readonly id: string;
156
+ readonly label: string;
157
+ readonly tests: readonly TestItem[];
158
+ readonly testRunProfiles: readonly TestRunProfile[];
159
+ readonly testRuns: readonly TestRun[];
160
+
161
+ readonly onItemsChanged: Event<TreeDelta<string, TestItem>[]>;
162
+ readonly onRunsChanged: Event<CollectionDelta<TestRun, TestRun>>;
163
+ readonly onProfilesChanged: Event<CollectionDelta<TestRunProfile, TestRunProfile>>;
164
+
165
+ refreshTests(token: CancellationToken): Promise<void>;
166
+ clearRuns(): void;
167
+ }
168
+
169
+ export interface TestService {
170
+ clearResults(): void;
171
+ configureProfile(): void;
172
+ runTestsWithProfile(tests: TestItem[]): void;
173
+ runTests(profileKind: TestRunProfileKind, tests: TestItem[]): void;
174
+ runAllTests(profileKind: TestRunProfileKind): void;
175
+ getControllers(): TestController[];
176
+ registerTestController(controller: TestController): Disposable;
177
+ onControllersChanged: Event<CollectionDelta<string, TestController>>;
178
+
179
+ refresh(): void;
180
+ cancelRefresh(): void;
181
+ isRefreshing: boolean;
182
+ onDidChangeIsRefreshing: Event<void>;
183
+ }
184
+
185
+ export const TestContribution = Symbol('TestContribution');
186
+
187
+ export interface TestContribution {
188
+ registerTestControllers(service: TestService): void;
189
+ }
190
+
191
+ export const TestService = Symbol('TestService');
192
+
193
+ @injectable()
194
+ export class DefaultTestService implements TestService {
195
+ @inject(QuickPickService) quickpickService: QuickPickService;
196
+
197
+ private testRunCounter = 0;
198
+
199
+ private onDidChangeIsRefreshingEmitter = new Emitter<void>();
200
+ onDidChangeIsRefreshing: Event<void> = this.onDidChangeIsRefreshingEmitter.event;
201
+
202
+ private controllers: Map<string, TestController> = new Map();
203
+ private refreshing: Set<CancellationTokenSource> = new Set();
204
+ private onControllersChangedEmitter = new Emitter<CollectionDelta<string, TestController>>();
205
+
206
+ @inject(ContributionProvider) @named(TestContribution)
207
+ protected readonly contributionProvider: ContributionProvider<TestContribution>;
208
+
209
+ @postConstruct()
210
+ protected registerContributions(): void {
211
+ this.contributionProvider.getContributions().forEach(contribution => contribution.registerTestControllers(this));
212
+ }
213
+
214
+ onControllersChanged: Event<CollectionDelta<string, TestController>> = this.onControllersChangedEmitter.event;
215
+
216
+ registerTestController(controller: TestController): Disposable {
217
+ if (this.controllers.has(controller.id)) {
218
+ throw new Error('TestController already registered: ' + controller.id);
219
+ }
220
+ this.controllers.set(controller.id, controller);
221
+ this.onControllersChangedEmitter.fire({ added: [controller] });
222
+ return Disposable.create(() => {
223
+ this.controllers.delete(controller.id);
224
+ this.onControllersChangedEmitter.fire({ removed: [controller.id] });
225
+ });
226
+ }
227
+
228
+ getControllers(): TestController[] {
229
+ return Array.from(this.controllers.values());
230
+ }
231
+
232
+ refresh(): void {
233
+ const cts = new CancellationTokenSource();
234
+ this.refreshing.add(cts);
235
+
236
+ Promise.all(this.getControllers().map(controller => controller.refreshTests(cts.token))).then(() => {
237
+ this.refreshing.delete(cts);
238
+ if (this.refreshing.size === 0) {
239
+ this.onDidChangeIsRefreshingEmitter.fire();
240
+ }
241
+ });
242
+
243
+ if (this.refreshing.size === 1) {
244
+ this.onDidChangeIsRefreshingEmitter.fire();
245
+ }
246
+ }
247
+
248
+ cancelRefresh(): void {
249
+ if (this.refreshing.size > 0) {
250
+ this.refreshing.forEach(cts => cts.cancel());
251
+ this.refreshing.clear();
252
+ this.onDidChangeIsRefreshingEmitter.fire();
253
+ }
254
+ }
255
+
256
+ get isRefreshing(): boolean {
257
+ return this.refreshing.size > 0;
258
+ }
259
+
260
+ runAllTests(profileKind: TestRunProfileKind): void {
261
+ this.getControllers().forEach(controller => {
262
+ this.runTestForController(controller, profileKind, controller.tests);
263
+ });
264
+ }
265
+
266
+ protected async runTestForController(controller: TestController, profileKind: TestRunProfileKind, items: readonly TestItem[]): Promise<void> {
267
+ const runProfiles = controller.testRunProfiles.filter(profile => profile.kind === profileKind);
268
+ let activeProfile;
269
+ if (runProfiles.length === 1) {
270
+ activeProfile = runProfiles[0];
271
+ } else if (runProfiles.length > 1) {
272
+ const defaultProfile = runProfiles.find(p => p.isDefault);
273
+ if (defaultProfile) {
274
+ activeProfile = defaultProfile;
275
+ } else {
276
+
277
+ activeProfile = await this.pickProfile(runProfiles, nls.localizeByDefault('Pick a test profile to use'));
278
+ }
279
+ }
280
+ if (activeProfile) {
281
+ activeProfile.run(`Test run #${this.testRunCounter++}`, items, []);
282
+ }
283
+ }
284
+
285
+ protected async pickProfile(runProfiles: readonly TestRunProfile[], title: string): Promise<TestRunProfile | undefined> {
286
+ if (runProfiles.length === 0) {
287
+ return undefined;
288
+ }
289
+ // eslint-disable-next-line arrow-body-style
290
+ const picks = runProfiles.map(profile => {
291
+ let iconClasses;
292
+ if (profile.kind === TestRunProfileKind.Run) {
293
+ iconClasses = codiconArray('run');
294
+ } else if (profile.kind === TestRunProfileKind.Debug) {
295
+ iconClasses = codiconArray('debug-alt');
296
+ }
297
+ return {
298
+ iconClasses,
299
+ label: profile.label,
300
+ profile: profile
301
+ };
302
+ });
303
+
304
+ return (await this.quickpickService.show(picks, { title: title }))?.profile;
305
+
306
+ }
307
+
308
+ runTests(profileKind: TestRunProfileKind, items: TestItem[]): void {
309
+ groupBy(items, item => item.controller).forEach((tests, controller) => {
310
+ if (controller) {
311
+ this.runTestForController(controller, profileKind, tests);
312
+ }
313
+ });
314
+ }
315
+
316
+ runTestsWithProfile(items: TestItem[]): void {
317
+ groupBy(items, item => item.controller).forEach((tests, controller) => {
318
+ if (controller) {
319
+ this.pickProfile(controller.testRunProfiles, nls.localizeByDefault('Pick a test profile to use')).then(activeProfile => {
320
+ if (activeProfile) {
321
+ activeProfile.run(`Test run #${this.testRunCounter++}`, items, []);
322
+ }
323
+ });
324
+ }
325
+ });
326
+ }
327
+
328
+ configureProfile(): void {
329
+ const profiles: TestRunProfile[] = [];
330
+
331
+ for (const controller of this.controllers.values()) {
332
+ profiles.push(...controller.testRunProfiles);
333
+ }
334
+ ;
335
+ this.pickProfile(profiles.filter(profile => profile.canConfigure), nls.localizeByDefault('Select a profile to update')).then(profile => {
336
+ if (profile) {
337
+ profile.configure();
338
+ }
339
+ });
340
+ }
341
+
342
+ clearResults(): void {
343
+ for (const controller of this.controllers.values()) {
344
+ controller.clearRuns();
345
+ }
346
+ }
347
+ }