@theia/test 1.45.0 → 1.46.0-next.72
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.
- package/lib/browser/constants.d.ts +45 -45
- package/lib/browser/constants.js +17 -17
- package/lib/browser/test-service.d.ts +154 -154
- package/lib/browser/test-service.js +247 -247
- package/lib/browser/view/test-context-key-service.d.ts +7 -7
- package/lib/browser/view/test-context-key-service.js +51 -51
- package/lib/browser/view/test-execution-state-manager.d.ts +13 -13
- package/lib/browser/view/test-execution-state-manager.js +173 -173
- package/lib/browser/view/test-output-ui-model.d.ts +47 -47
- package/lib/browser/view/test-output-ui-model.js +151 -151
- package/lib/browser/view/test-output-view-contribution.d.ts +5 -5
- package/lib/browser/view/test-output-view-contribution.js +47 -47
- package/lib/browser/view/test-output-widget.d.ts +24 -24
- package/lib/browser/view/test-output-widget.js +158 -158
- package/lib/browser/view/test-result-view-contribution.d.ts +5 -5
- package/lib/browser/view/test-result-view-contribution.js +47 -47
- package/lib/browser/view/test-result-widget.d.ts +20 -20
- package/lib/browser/view/test-result-widget.js +108 -108
- package/lib/browser/view/test-run-view-contribution.d.ts +17 -17
- package/lib/browser/view/test-run-view-contribution.js +100 -100
- package/lib/browser/view/test-run-widget.d.ts +58 -58
- package/lib/browser/view/test-run-widget.js +310 -310
- package/lib/browser/view/test-tree-widget.d.ts +67 -67
- package/lib/browser/view/test-tree-widget.js +386 -386
- package/lib/browser/view/test-view-contribution.d.ts +45 -45
- package/lib/browser/view/test-view-contribution.js +288 -288
- package/lib/browser/view/test-view-frontend-module.d.ts +6 -6
- package/lib/browser/view/test-view-frontend-module.js +121 -121
- package/lib/common/collections.d.ts +46 -46
- package/lib/common/collections.js +210 -210
- package/lib/common/tree-delta.d.ts +51 -51
- package/lib/common/tree-delta.js +240 -240
- package/lib/common/tree-delta.spec.d.ts +1 -1
- package/lib/common/tree-delta.spec.js +139 -139
- package/package.json +8 -8
- package/src/browser/constants.ts +71 -71
- package/src/browser/style/index.css +41 -41
- package/src/browser/test-service.ts +355 -355
- package/src/browser/view/test-context-key-service.ts +36 -36
- package/src/browser/view/test-execution-state-manager.ts +147 -147
- package/src/browser/view/test-output-ui-model.ts +156 -156
- package/src/browser/view/test-output-view-contribution.ts +34 -34
- package/src/browser/view/test-output-widget.ts +148 -148
- package/src/browser/view/test-result-view-contribution.ts +34 -34
- package/src/browser/view/test-result-widget.ts +92 -92
- package/src/browser/view/test-run-view-contribution.ts +89 -89
- package/src/browser/view/test-run-widget.tsx +271 -271
- package/src/browser/view/test-tree-widget.tsx +360 -360
- package/src/browser/view/test-view-contribution.ts +300 -300
- package/src/browser/view/test-view-frontend-module.ts +134 -134
- package/src/common/collections.ts +223 -223
- package/src/common/tree-delta.spec.ts +166 -166
- package/src/common/tree-delta.ts +259 -259
|
@@ -1,248 +1,248 @@
|
|
|
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
|
-
// *****************************************************************************
|
|
17
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
18
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
19
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
20
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
21
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
22
|
-
};
|
|
23
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
24
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
25
|
-
};
|
|
26
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
-
exports.DefaultTestService = exports.TestService = exports.TestContribution = exports.TestItem = exports.TestRun = exports.TestFailure = exports.TestMessage = exports.TestExecutionState = exports.TestRunProfileKind = void 0;
|
|
28
|
-
const common_1 = require("@theia/core/lib/common");
|
|
29
|
-
const vscode_languageserver_protocol_1 = require("@theia/core/shared/vscode-languageserver-protocol");
|
|
30
|
-
const markdown_rendering_1 = require("@theia/core/lib/common/markdown-rendering");
|
|
31
|
-
const inversify_1 = require("@theia/core/shared/inversify");
|
|
32
|
-
const collections_1 = require("../common/collections");
|
|
33
|
-
const browser_1 = require("@theia/core/lib/browser");
|
|
34
|
-
var TestRunProfileKind;
|
|
35
|
-
(function (TestRunProfileKind) {
|
|
36
|
-
TestRunProfileKind[TestRunProfileKind["Run"] = 1] = "Run";
|
|
37
|
-
TestRunProfileKind[TestRunProfileKind["Debug"] = 2] = "Debug";
|
|
38
|
-
TestRunProfileKind[TestRunProfileKind["Coverage"] = 3] = "Coverage";
|
|
39
|
-
})(TestRunProfileKind = exports.TestRunProfileKind || (exports.TestRunProfileKind = {}));
|
|
40
|
-
var TestExecutionState;
|
|
41
|
-
(function (TestExecutionState) {
|
|
42
|
-
TestExecutionState[TestExecutionState["Queued"] = 1] = "Queued";
|
|
43
|
-
TestExecutionState[TestExecutionState["Running"] = 2] = "Running";
|
|
44
|
-
TestExecutionState[TestExecutionState["Passed"] = 3] = "Passed";
|
|
45
|
-
TestExecutionState[TestExecutionState["Failed"] = 4] = "Failed";
|
|
46
|
-
TestExecutionState[TestExecutionState["Skipped"] = 5] = "Skipped";
|
|
47
|
-
TestExecutionState[TestExecutionState["Errored"] = 6] = "Errored";
|
|
48
|
-
})(TestExecutionState = exports.TestExecutionState || (exports.TestExecutionState = {}));
|
|
49
|
-
var TestMessage;
|
|
50
|
-
(function (TestMessage) {
|
|
51
|
-
function is(obj) {
|
|
52
|
-
return (0, common_1.isObject)(obj) && (markdown_rendering_1.MarkdownString.is(obj.message) || typeof obj.message === 'string');
|
|
53
|
-
}
|
|
54
|
-
TestMessage.is = is;
|
|
55
|
-
})(TestMessage = exports.TestMessage || (exports.TestMessage = {}));
|
|
56
|
-
var TestFailure;
|
|
57
|
-
(function (TestFailure) {
|
|
58
|
-
function is(obj) {
|
|
59
|
-
return (0, common_1.isObject)(obj) && (obj.state === TestExecutionState.Failed || obj.state === TestExecutionState.Errored) && Array.isArray(obj.messages);
|
|
60
|
-
}
|
|
61
|
-
TestFailure.is = is;
|
|
62
|
-
})(TestFailure = exports.TestFailure || (exports.TestFailure = {}));
|
|
63
|
-
var TestRun;
|
|
64
|
-
(function (TestRun) {
|
|
65
|
-
function is(obj) {
|
|
66
|
-
return (0, common_1.isObject)(obj)
|
|
67
|
-
&& typeof obj.cancel === 'function'
|
|
68
|
-
&& typeof obj.name === 'string'
|
|
69
|
-
&& typeof obj.isRunning === 'boolean'
|
|
70
|
-
&& typeof obj.controller === 'object'
|
|
71
|
-
&& typeof obj.onDidChangeProperty === 'function'
|
|
72
|
-
&& typeof obj.getTestState === 'function'
|
|
73
|
-
&& typeof obj.onDidChangeTestState === 'function'
|
|
74
|
-
&& typeof obj.onDidChangeTestState === 'function'
|
|
75
|
-
&& typeof obj.getOutput === 'function'
|
|
76
|
-
&& typeof obj.onDidChangeTestOutput === 'function'
|
|
77
|
-
&& Array.isArray(obj.items);
|
|
78
|
-
}
|
|
79
|
-
TestRun.is = is;
|
|
80
|
-
})(TestRun = exports.TestRun || (exports.TestRun = {}));
|
|
81
|
-
var TestItem;
|
|
82
|
-
(function (TestItem) {
|
|
83
|
-
function is(obj) {
|
|
84
|
-
return (0, common_1.isObject)(obj)
|
|
85
|
-
&& obj.id !== undefined
|
|
86
|
-
&& obj.label !== undefined
|
|
87
|
-
&& Array.isArray(obj.tags)
|
|
88
|
-
&& Array.isArray(obj.tests)
|
|
89
|
-
&& obj.busy !== undefined
|
|
90
|
-
&& obj.canResolveChildren !== undefined
|
|
91
|
-
&& typeof obj.resolveChildren === 'function';
|
|
92
|
-
}
|
|
93
|
-
TestItem.is = is;
|
|
94
|
-
})(TestItem = exports.TestItem || (exports.TestItem = {}));
|
|
95
|
-
exports.TestContribution = Symbol('TestContribution');
|
|
96
|
-
exports.TestService = Symbol('TestService');
|
|
97
|
-
let DefaultTestService = class DefaultTestService {
|
|
98
|
-
constructor() {
|
|
99
|
-
this.testRunCounter = 0;
|
|
100
|
-
this.onDidChangeIsRefreshingEmitter = new common_1.Emitter();
|
|
101
|
-
this.onDidChangeIsRefreshing = this.onDidChangeIsRefreshingEmitter.event;
|
|
102
|
-
this.controllers = new Map();
|
|
103
|
-
this.refreshing = new Set();
|
|
104
|
-
this.onControllersChangedEmitter = new common_1.Emitter();
|
|
105
|
-
this.onControllersChanged = this.onControllersChangedEmitter.event;
|
|
106
|
-
}
|
|
107
|
-
registerContributions() {
|
|
108
|
-
this.contributionProvider.getContributions().forEach(contribution => contribution.registerTestControllers(this));
|
|
109
|
-
}
|
|
110
|
-
registerTestController(controller) {
|
|
111
|
-
if (this.controllers.has(controller.id)) {
|
|
112
|
-
throw new Error('TestController already registered: ' + controller.id);
|
|
113
|
-
}
|
|
114
|
-
this.controllers.set(controller.id, controller);
|
|
115
|
-
this.onControllersChangedEmitter.fire({ added: [controller] });
|
|
116
|
-
return common_1.Disposable.create(() => {
|
|
117
|
-
this.controllers.delete(controller.id);
|
|
118
|
-
this.onControllersChangedEmitter.fire({ removed: [controller.id] });
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
getControllers() {
|
|
122
|
-
return Array.from(this.controllers.values());
|
|
123
|
-
}
|
|
124
|
-
refresh() {
|
|
125
|
-
const cts = new vscode_languageserver_protocol_1.CancellationTokenSource();
|
|
126
|
-
this.refreshing.add(cts);
|
|
127
|
-
Promise.all(this.getControllers().map(controller => controller.refreshTests(cts.token))).then(() => {
|
|
128
|
-
this.refreshing.delete(cts);
|
|
129
|
-
if (this.refreshing.size === 0) {
|
|
130
|
-
this.onDidChangeIsRefreshingEmitter.fire();
|
|
131
|
-
}
|
|
132
|
-
});
|
|
133
|
-
if (this.refreshing.size === 1) {
|
|
134
|
-
this.onDidChangeIsRefreshingEmitter.fire();
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
cancelRefresh() {
|
|
138
|
-
if (this.refreshing.size > 0) {
|
|
139
|
-
this.refreshing.forEach(cts => cts.cancel());
|
|
140
|
-
this.refreshing.clear();
|
|
141
|
-
this.onDidChangeIsRefreshingEmitter.fire();
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
get isRefreshing() {
|
|
145
|
-
return this.refreshing.size > 0;
|
|
146
|
-
}
|
|
147
|
-
runAllTests(profileKind) {
|
|
148
|
-
this.getControllers().forEach(controller => {
|
|
149
|
-
this.runTestForController(controller, profileKind, controller.tests);
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
|
-
async runTestForController(controller, profileKind, items) {
|
|
153
|
-
const runProfiles = controller.testRunProfiles.filter(profile => profile.kind === profileKind);
|
|
154
|
-
let activeProfile;
|
|
155
|
-
if (runProfiles.length === 1) {
|
|
156
|
-
activeProfile = runProfiles[0];
|
|
157
|
-
}
|
|
158
|
-
else if (runProfiles.length > 1) {
|
|
159
|
-
const defaultProfile = runProfiles.find(p => p.isDefault);
|
|
160
|
-
if (defaultProfile) {
|
|
161
|
-
activeProfile = defaultProfile;
|
|
162
|
-
}
|
|
163
|
-
else {
|
|
164
|
-
activeProfile = await this.pickProfile(runProfiles, common_1.nls.localizeByDefault('Pick a test profile to use'));
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
if (activeProfile) {
|
|
168
|
-
activeProfile.run(`Test run #${this.testRunCounter++}`, items, []);
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
async pickProfile(runProfiles, title) {
|
|
172
|
-
var _a;
|
|
173
|
-
if (runProfiles.length === 0) {
|
|
174
|
-
return undefined;
|
|
175
|
-
}
|
|
176
|
-
// eslint-disable-next-line arrow-body-style
|
|
177
|
-
const picks = runProfiles.map(profile => {
|
|
178
|
-
let iconClasses;
|
|
179
|
-
if (profile.kind === TestRunProfileKind.Run) {
|
|
180
|
-
iconClasses = (0, browser_1.codiconArray)('run');
|
|
181
|
-
}
|
|
182
|
-
else if (profile.kind === TestRunProfileKind.Debug) {
|
|
183
|
-
iconClasses = (0, browser_1.codiconArray)('debug-alt');
|
|
184
|
-
}
|
|
185
|
-
return {
|
|
186
|
-
iconClasses,
|
|
187
|
-
label: profile.label,
|
|
188
|
-
profile: profile
|
|
189
|
-
};
|
|
190
|
-
});
|
|
191
|
-
return (_a = (await this.quickpickService.show(picks, { title: title }))) === null || _a === void 0 ? void 0 : _a.profile;
|
|
192
|
-
}
|
|
193
|
-
runTests(profileKind, items) {
|
|
194
|
-
(0, collections_1.groupBy)(items, item => item.controller).forEach((tests, controller) => {
|
|
195
|
-
if (controller) {
|
|
196
|
-
this.runTestForController(controller, profileKind, tests);
|
|
197
|
-
}
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
runTestsWithProfile(items) {
|
|
201
|
-
(0, collections_1.groupBy)(items, item => item.controller).forEach((tests, controller) => {
|
|
202
|
-
if (controller) {
|
|
203
|
-
this.pickProfile(controller.testRunProfiles, common_1.nls.localizeByDefault('Pick a test profile to use')).then(activeProfile => {
|
|
204
|
-
if (activeProfile) {
|
|
205
|
-
activeProfile.run(`Test run #${this.testRunCounter++}`, items, []);
|
|
206
|
-
}
|
|
207
|
-
});
|
|
208
|
-
}
|
|
209
|
-
});
|
|
210
|
-
}
|
|
211
|
-
configureProfile() {
|
|
212
|
-
const profiles = [];
|
|
213
|
-
for (const controller of this.controllers.values()) {
|
|
214
|
-
profiles.push(...controller.testRunProfiles);
|
|
215
|
-
}
|
|
216
|
-
;
|
|
217
|
-
this.pickProfile(profiles.filter(profile => profile.canConfigure), common_1.nls.localizeByDefault('Select a profile to update')).then(profile => {
|
|
218
|
-
if (profile) {
|
|
219
|
-
profile.configure();
|
|
220
|
-
}
|
|
221
|
-
});
|
|
222
|
-
}
|
|
223
|
-
clearResults() {
|
|
224
|
-
for (const controller of this.controllers.values()) {
|
|
225
|
-
controller.clearRuns();
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
};
|
|
229
|
-
__decorate([
|
|
230
|
-
(0, inversify_1.inject)(common_1.QuickPickService),
|
|
231
|
-
__metadata("design:type", Object)
|
|
232
|
-
], DefaultTestService.prototype, "quickpickService", void 0);
|
|
233
|
-
__decorate([
|
|
234
|
-
(0, inversify_1.inject)(common_1.ContributionProvider),
|
|
235
|
-
(0, inversify_1.named)(exports.TestContribution),
|
|
236
|
-
__metadata("design:type", Object)
|
|
237
|
-
], DefaultTestService.prototype, "contributionProvider", void 0);
|
|
238
|
-
__decorate([
|
|
239
|
-
(0, inversify_1.postConstruct)(),
|
|
240
|
-
__metadata("design:type", Function),
|
|
241
|
-
__metadata("design:paramtypes", []),
|
|
242
|
-
__metadata("design:returntype", void 0)
|
|
243
|
-
], DefaultTestService.prototype, "registerContributions", null);
|
|
244
|
-
DefaultTestService = __decorate([
|
|
245
|
-
(0, inversify_1.injectable)()
|
|
246
|
-
], DefaultTestService);
|
|
247
|
-
exports.DefaultTestService = DefaultTestService;
|
|
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
|
+
// *****************************************************************************
|
|
17
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
18
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
19
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
20
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
21
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
22
|
+
};
|
|
23
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
24
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
25
|
+
};
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
exports.DefaultTestService = exports.TestService = exports.TestContribution = exports.TestItem = exports.TestRun = exports.TestFailure = exports.TestMessage = exports.TestExecutionState = exports.TestRunProfileKind = void 0;
|
|
28
|
+
const common_1 = require("@theia/core/lib/common");
|
|
29
|
+
const vscode_languageserver_protocol_1 = require("@theia/core/shared/vscode-languageserver-protocol");
|
|
30
|
+
const markdown_rendering_1 = require("@theia/core/lib/common/markdown-rendering");
|
|
31
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
32
|
+
const collections_1 = require("../common/collections");
|
|
33
|
+
const browser_1 = require("@theia/core/lib/browser");
|
|
34
|
+
var TestRunProfileKind;
|
|
35
|
+
(function (TestRunProfileKind) {
|
|
36
|
+
TestRunProfileKind[TestRunProfileKind["Run"] = 1] = "Run";
|
|
37
|
+
TestRunProfileKind[TestRunProfileKind["Debug"] = 2] = "Debug";
|
|
38
|
+
TestRunProfileKind[TestRunProfileKind["Coverage"] = 3] = "Coverage";
|
|
39
|
+
})(TestRunProfileKind = exports.TestRunProfileKind || (exports.TestRunProfileKind = {}));
|
|
40
|
+
var TestExecutionState;
|
|
41
|
+
(function (TestExecutionState) {
|
|
42
|
+
TestExecutionState[TestExecutionState["Queued"] = 1] = "Queued";
|
|
43
|
+
TestExecutionState[TestExecutionState["Running"] = 2] = "Running";
|
|
44
|
+
TestExecutionState[TestExecutionState["Passed"] = 3] = "Passed";
|
|
45
|
+
TestExecutionState[TestExecutionState["Failed"] = 4] = "Failed";
|
|
46
|
+
TestExecutionState[TestExecutionState["Skipped"] = 5] = "Skipped";
|
|
47
|
+
TestExecutionState[TestExecutionState["Errored"] = 6] = "Errored";
|
|
48
|
+
})(TestExecutionState = exports.TestExecutionState || (exports.TestExecutionState = {}));
|
|
49
|
+
var TestMessage;
|
|
50
|
+
(function (TestMessage) {
|
|
51
|
+
function is(obj) {
|
|
52
|
+
return (0, common_1.isObject)(obj) && (markdown_rendering_1.MarkdownString.is(obj.message) || typeof obj.message === 'string');
|
|
53
|
+
}
|
|
54
|
+
TestMessage.is = is;
|
|
55
|
+
})(TestMessage = exports.TestMessage || (exports.TestMessage = {}));
|
|
56
|
+
var TestFailure;
|
|
57
|
+
(function (TestFailure) {
|
|
58
|
+
function is(obj) {
|
|
59
|
+
return (0, common_1.isObject)(obj) && (obj.state === TestExecutionState.Failed || obj.state === TestExecutionState.Errored) && Array.isArray(obj.messages);
|
|
60
|
+
}
|
|
61
|
+
TestFailure.is = is;
|
|
62
|
+
})(TestFailure = exports.TestFailure || (exports.TestFailure = {}));
|
|
63
|
+
var TestRun;
|
|
64
|
+
(function (TestRun) {
|
|
65
|
+
function is(obj) {
|
|
66
|
+
return (0, common_1.isObject)(obj)
|
|
67
|
+
&& typeof obj.cancel === 'function'
|
|
68
|
+
&& typeof obj.name === 'string'
|
|
69
|
+
&& typeof obj.isRunning === 'boolean'
|
|
70
|
+
&& typeof obj.controller === 'object'
|
|
71
|
+
&& typeof obj.onDidChangeProperty === 'function'
|
|
72
|
+
&& typeof obj.getTestState === 'function'
|
|
73
|
+
&& typeof obj.onDidChangeTestState === 'function'
|
|
74
|
+
&& typeof obj.onDidChangeTestState === 'function'
|
|
75
|
+
&& typeof obj.getOutput === 'function'
|
|
76
|
+
&& typeof obj.onDidChangeTestOutput === 'function'
|
|
77
|
+
&& Array.isArray(obj.items);
|
|
78
|
+
}
|
|
79
|
+
TestRun.is = is;
|
|
80
|
+
})(TestRun = exports.TestRun || (exports.TestRun = {}));
|
|
81
|
+
var TestItem;
|
|
82
|
+
(function (TestItem) {
|
|
83
|
+
function is(obj) {
|
|
84
|
+
return (0, common_1.isObject)(obj)
|
|
85
|
+
&& obj.id !== undefined
|
|
86
|
+
&& obj.label !== undefined
|
|
87
|
+
&& Array.isArray(obj.tags)
|
|
88
|
+
&& Array.isArray(obj.tests)
|
|
89
|
+
&& obj.busy !== undefined
|
|
90
|
+
&& obj.canResolveChildren !== undefined
|
|
91
|
+
&& typeof obj.resolveChildren === 'function';
|
|
92
|
+
}
|
|
93
|
+
TestItem.is = is;
|
|
94
|
+
})(TestItem = exports.TestItem || (exports.TestItem = {}));
|
|
95
|
+
exports.TestContribution = Symbol('TestContribution');
|
|
96
|
+
exports.TestService = Symbol('TestService');
|
|
97
|
+
let DefaultTestService = class DefaultTestService {
|
|
98
|
+
constructor() {
|
|
99
|
+
this.testRunCounter = 0;
|
|
100
|
+
this.onDidChangeIsRefreshingEmitter = new common_1.Emitter();
|
|
101
|
+
this.onDidChangeIsRefreshing = this.onDidChangeIsRefreshingEmitter.event;
|
|
102
|
+
this.controllers = new Map();
|
|
103
|
+
this.refreshing = new Set();
|
|
104
|
+
this.onControllersChangedEmitter = new common_1.Emitter();
|
|
105
|
+
this.onControllersChanged = this.onControllersChangedEmitter.event;
|
|
106
|
+
}
|
|
107
|
+
registerContributions() {
|
|
108
|
+
this.contributionProvider.getContributions().forEach(contribution => contribution.registerTestControllers(this));
|
|
109
|
+
}
|
|
110
|
+
registerTestController(controller) {
|
|
111
|
+
if (this.controllers.has(controller.id)) {
|
|
112
|
+
throw new Error('TestController already registered: ' + controller.id);
|
|
113
|
+
}
|
|
114
|
+
this.controllers.set(controller.id, controller);
|
|
115
|
+
this.onControllersChangedEmitter.fire({ added: [controller] });
|
|
116
|
+
return common_1.Disposable.create(() => {
|
|
117
|
+
this.controllers.delete(controller.id);
|
|
118
|
+
this.onControllersChangedEmitter.fire({ removed: [controller.id] });
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
getControllers() {
|
|
122
|
+
return Array.from(this.controllers.values());
|
|
123
|
+
}
|
|
124
|
+
refresh() {
|
|
125
|
+
const cts = new vscode_languageserver_protocol_1.CancellationTokenSource();
|
|
126
|
+
this.refreshing.add(cts);
|
|
127
|
+
Promise.all(this.getControllers().map(controller => controller.refreshTests(cts.token))).then(() => {
|
|
128
|
+
this.refreshing.delete(cts);
|
|
129
|
+
if (this.refreshing.size === 0) {
|
|
130
|
+
this.onDidChangeIsRefreshingEmitter.fire();
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
if (this.refreshing.size === 1) {
|
|
134
|
+
this.onDidChangeIsRefreshingEmitter.fire();
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
cancelRefresh() {
|
|
138
|
+
if (this.refreshing.size > 0) {
|
|
139
|
+
this.refreshing.forEach(cts => cts.cancel());
|
|
140
|
+
this.refreshing.clear();
|
|
141
|
+
this.onDidChangeIsRefreshingEmitter.fire();
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
get isRefreshing() {
|
|
145
|
+
return this.refreshing.size > 0;
|
|
146
|
+
}
|
|
147
|
+
runAllTests(profileKind) {
|
|
148
|
+
this.getControllers().forEach(controller => {
|
|
149
|
+
this.runTestForController(controller, profileKind, controller.tests);
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
async runTestForController(controller, profileKind, items) {
|
|
153
|
+
const runProfiles = controller.testRunProfiles.filter(profile => profile.kind === profileKind);
|
|
154
|
+
let activeProfile;
|
|
155
|
+
if (runProfiles.length === 1) {
|
|
156
|
+
activeProfile = runProfiles[0];
|
|
157
|
+
}
|
|
158
|
+
else if (runProfiles.length > 1) {
|
|
159
|
+
const defaultProfile = runProfiles.find(p => p.isDefault);
|
|
160
|
+
if (defaultProfile) {
|
|
161
|
+
activeProfile = defaultProfile;
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
activeProfile = await this.pickProfile(runProfiles, common_1.nls.localizeByDefault('Pick a test profile to use'));
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
if (activeProfile) {
|
|
168
|
+
activeProfile.run(`Test run #${this.testRunCounter++}`, items, []);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
async pickProfile(runProfiles, title) {
|
|
172
|
+
var _a;
|
|
173
|
+
if (runProfiles.length === 0) {
|
|
174
|
+
return undefined;
|
|
175
|
+
}
|
|
176
|
+
// eslint-disable-next-line arrow-body-style
|
|
177
|
+
const picks = runProfiles.map(profile => {
|
|
178
|
+
let iconClasses;
|
|
179
|
+
if (profile.kind === TestRunProfileKind.Run) {
|
|
180
|
+
iconClasses = (0, browser_1.codiconArray)('run');
|
|
181
|
+
}
|
|
182
|
+
else if (profile.kind === TestRunProfileKind.Debug) {
|
|
183
|
+
iconClasses = (0, browser_1.codiconArray)('debug-alt');
|
|
184
|
+
}
|
|
185
|
+
return {
|
|
186
|
+
iconClasses,
|
|
187
|
+
label: profile.label,
|
|
188
|
+
profile: profile
|
|
189
|
+
};
|
|
190
|
+
});
|
|
191
|
+
return (_a = (await this.quickpickService.show(picks, { title: title }))) === null || _a === void 0 ? void 0 : _a.profile;
|
|
192
|
+
}
|
|
193
|
+
runTests(profileKind, items) {
|
|
194
|
+
(0, collections_1.groupBy)(items, item => item.controller).forEach((tests, controller) => {
|
|
195
|
+
if (controller) {
|
|
196
|
+
this.runTestForController(controller, profileKind, tests);
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
runTestsWithProfile(items) {
|
|
201
|
+
(0, collections_1.groupBy)(items, item => item.controller).forEach((tests, controller) => {
|
|
202
|
+
if (controller) {
|
|
203
|
+
this.pickProfile(controller.testRunProfiles, common_1.nls.localizeByDefault('Pick a test profile to use')).then(activeProfile => {
|
|
204
|
+
if (activeProfile) {
|
|
205
|
+
activeProfile.run(`Test run #${this.testRunCounter++}`, items, []);
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
configureProfile() {
|
|
212
|
+
const profiles = [];
|
|
213
|
+
for (const controller of this.controllers.values()) {
|
|
214
|
+
profiles.push(...controller.testRunProfiles);
|
|
215
|
+
}
|
|
216
|
+
;
|
|
217
|
+
this.pickProfile(profiles.filter(profile => profile.canConfigure), common_1.nls.localizeByDefault('Select a profile to update')).then(profile => {
|
|
218
|
+
if (profile) {
|
|
219
|
+
profile.configure();
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
clearResults() {
|
|
224
|
+
for (const controller of this.controllers.values()) {
|
|
225
|
+
controller.clearRuns();
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
};
|
|
229
|
+
__decorate([
|
|
230
|
+
(0, inversify_1.inject)(common_1.QuickPickService),
|
|
231
|
+
__metadata("design:type", Object)
|
|
232
|
+
], DefaultTestService.prototype, "quickpickService", void 0);
|
|
233
|
+
__decorate([
|
|
234
|
+
(0, inversify_1.inject)(common_1.ContributionProvider),
|
|
235
|
+
(0, inversify_1.named)(exports.TestContribution),
|
|
236
|
+
__metadata("design:type", Object)
|
|
237
|
+
], DefaultTestService.prototype, "contributionProvider", void 0);
|
|
238
|
+
__decorate([
|
|
239
|
+
(0, inversify_1.postConstruct)(),
|
|
240
|
+
__metadata("design:type", Function),
|
|
241
|
+
__metadata("design:paramtypes", []),
|
|
242
|
+
__metadata("design:returntype", void 0)
|
|
243
|
+
], DefaultTestService.prototype, "registerContributions", null);
|
|
244
|
+
DefaultTestService = __decorate([
|
|
245
|
+
(0, inversify_1.injectable)()
|
|
246
|
+
], DefaultTestService);
|
|
247
|
+
exports.DefaultTestService = DefaultTestService;
|
|
248
248
|
//# sourceMappingURL=test-service.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ContextKeyService, ContextKey } from '@theia/core/lib/browser/context-key-service';
|
|
2
|
-
export declare class TestContextKeyService {
|
|
3
|
-
protected readonly contextKeyService: ContextKeyService;
|
|
4
|
-
protected _contextValue: ContextKey<string | undefined>;
|
|
5
|
-
get contextValue(): ContextKey<string | undefined>;
|
|
6
|
-
protected init(): void;
|
|
7
|
-
}
|
|
1
|
+
import { ContextKeyService, ContextKey } from '@theia/core/lib/browser/context-key-service';
|
|
2
|
+
export declare class TestContextKeyService {
|
|
3
|
+
protected readonly contextKeyService: ContextKeyService;
|
|
4
|
+
protected _contextValue: ContextKey<string | undefined>;
|
|
5
|
+
get contextValue(): ContextKey<string | undefined>;
|
|
6
|
+
protected init(): void;
|
|
7
|
+
}
|
|
8
8
|
//# sourceMappingURL=test-context-key-service.d.ts.map
|
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// *****************************************************************************
|
|
3
|
-
// Copyright (C) 2023 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
|
-
// *****************************************************************************
|
|
17
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
18
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
19
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
20
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
21
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
22
|
-
};
|
|
23
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
24
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
25
|
-
};
|
|
26
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
-
exports.TestContextKeyService = void 0;
|
|
28
|
-
const inversify_1 = require("@theia/core/shared/inversify");
|
|
29
|
-
const context_key_service_1 = require("@theia/core/lib/browser/context-key-service");
|
|
30
|
-
let TestContextKeyService = class TestContextKeyService {
|
|
31
|
-
get contextValue() {
|
|
32
|
-
return this._contextValue;
|
|
33
|
-
}
|
|
34
|
-
init() {
|
|
35
|
-
this._contextValue = this.contextKeyService.createKey('testMessage', undefined);
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
__decorate([
|
|
39
|
-
(0, inversify_1.inject)(context_key_service_1.ContextKeyService),
|
|
40
|
-
__metadata("design:type", Object)
|
|
41
|
-
], TestContextKeyService.prototype, "contextKeyService", void 0);
|
|
42
|
-
__decorate([
|
|
43
|
-
(0, inversify_1.postConstruct)(),
|
|
44
|
-
__metadata("design:type", Function),
|
|
45
|
-
__metadata("design:paramtypes", []),
|
|
46
|
-
__metadata("design:returntype", void 0)
|
|
47
|
-
], TestContextKeyService.prototype, "init", null);
|
|
48
|
-
TestContextKeyService = __decorate([
|
|
49
|
-
(0, inversify_1.injectable)()
|
|
50
|
-
], TestContextKeyService);
|
|
51
|
-
exports.TestContextKeyService = TestContextKeyService;
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2023 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
|
+
// *****************************************************************************
|
|
17
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
18
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
19
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
20
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
21
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
22
|
+
};
|
|
23
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
24
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
25
|
+
};
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
exports.TestContextKeyService = void 0;
|
|
28
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
29
|
+
const context_key_service_1 = require("@theia/core/lib/browser/context-key-service");
|
|
30
|
+
let TestContextKeyService = class TestContextKeyService {
|
|
31
|
+
get contextValue() {
|
|
32
|
+
return this._contextValue;
|
|
33
|
+
}
|
|
34
|
+
init() {
|
|
35
|
+
this._contextValue = this.contextKeyService.createKey('testMessage', undefined);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
__decorate([
|
|
39
|
+
(0, inversify_1.inject)(context_key_service_1.ContextKeyService),
|
|
40
|
+
__metadata("design:type", Object)
|
|
41
|
+
], TestContextKeyService.prototype, "contextKeyService", void 0);
|
|
42
|
+
__decorate([
|
|
43
|
+
(0, inversify_1.postConstruct)(),
|
|
44
|
+
__metadata("design:type", Function),
|
|
45
|
+
__metadata("design:paramtypes", []),
|
|
46
|
+
__metadata("design:returntype", void 0)
|
|
47
|
+
], TestContextKeyService.prototype, "init", null);
|
|
48
|
+
TestContextKeyService = __decorate([
|
|
49
|
+
(0, inversify_1.injectable)()
|
|
50
|
+
], TestContextKeyService);
|
|
51
|
+
exports.TestContextKeyService = TestContextKeyService;
|
|
52
52
|
//# sourceMappingURL=test-context-key-service.js.map
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { TestController, TestExecutionState, TestItem, TestRun, TestService } from '../test-service';
|
|
2
|
-
/**
|
|
3
|
-
* This class manages the state of "internal" nodes in the test tree
|
|
4
|
-
*/
|
|
5
|
-
export declare class TestExecutionStateManager {
|
|
6
|
-
protected readonly testService: TestService;
|
|
7
|
-
private executionStates;
|
|
8
|
-
init(): void;
|
|
9
|
-
addController(controller: TestController): void;
|
|
10
|
-
addRun(run: TestRun): void;
|
|
11
|
-
protected updateState(run: TestRun, item: TestItem, oldState: TestExecutionState | undefined, newState: TestExecutionState | undefined): void;
|
|
12
|
-
getComputedState(run: TestRun, item: TestItem): TestExecutionState | undefined;
|
|
13
|
-
}
|
|
1
|
+
import { TestController, TestExecutionState, TestItem, TestRun, TestService } from '../test-service';
|
|
2
|
+
/**
|
|
3
|
+
* This class manages the state of "internal" nodes in the test tree
|
|
4
|
+
*/
|
|
5
|
+
export declare class TestExecutionStateManager {
|
|
6
|
+
protected readonly testService: TestService;
|
|
7
|
+
private executionStates;
|
|
8
|
+
init(): void;
|
|
9
|
+
addController(controller: TestController): void;
|
|
10
|
+
addRun(run: TestRun): void;
|
|
11
|
+
protected updateState(run: TestRun, item: TestItem, oldState: TestExecutionState | undefined, newState: TestExecutionState | undefined): void;
|
|
12
|
+
getComputedState(run: TestRun, item: TestItem): TestExecutionState | undefined;
|
|
13
|
+
}
|
|
14
14
|
//# sourceMappingURL=test-execution-state-manager.d.ts.map
|