@codingame/monaco-vscode-testing-service-override 3.2.3 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +8 -8
- package/testing.js +5 -4
- package/external/rollup-plugin-styles/dist/runtime/inject-css.js +0 -3
- package/external/tslib/tslib.es6.js +0 -11
- package/vscode/src/vs/workbench/contrib/testing/browser/codeCoverageDecorations.js +0 -567
- package/vscode/src/vs/workbench/contrib/testing/browser/explorerProjections/display.js +0 -3
- package/vscode/src/vs/workbench/contrib/testing/browser/explorerProjections/index.js +0 -83
- package/vscode/src/vs/workbench/contrib/testing/browser/explorerProjections/listProjection.js +0 -186
- package/vscode/src/vs/workbench/contrib/testing/browser/explorerProjections/testItemContextOverlay.js +0 -18
- package/vscode/src/vs/workbench/contrib/testing/browser/explorerProjections/testingObjectTree.js +0 -46
- package/vscode/src/vs/workbench/contrib/testing/browser/explorerProjections/testingViewState.js +0 -17
- package/vscode/src/vs/workbench/contrib/testing/browser/explorerProjections/treeProjection.js +0 -225
- package/vscode/src/vs/workbench/contrib/testing/browser/icons.js +0 -174
- package/vscode/src/vs/workbench/contrib/testing/browser/media/testing.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/testing/browser/testCoverageBars.js +0 -227
- package/vscode/src/vs/workbench/contrib/testing/browser/testCoverageView.js +0 -545
- package/vscode/src/vs/workbench/contrib/testing/browser/testExplorerActions.js +0 -1662
- package/vscode/src/vs/workbench/contrib/testing/browser/testing.contribution.js +0 -219
- package/vscode/src/vs/workbench/contrib/testing/browser/testingDecorations.js +0 -970
- package/vscode/src/vs/workbench/contrib/testing/browser/testingExplorerFilter.js +0 -236
- package/vscode/src/vs/workbench/contrib/testing/browser/testingExplorerView.js +0 -1227
- package/vscode/src/vs/workbench/contrib/testing/browser/testingOutputPeek.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/testing/browser/testingOutputPeek.js +0 -2091
- package/vscode/src/vs/workbench/contrib/testing/browser/testingProgressUiService.js +0 -142
- package/vscode/src/vs/workbench/contrib/testing/browser/testingViewPaneContainer.js +0 -47
- package/vscode/src/vs/workbench/contrib/testing/browser/theme.js +0 -259
- package/vscode/src/vs/workbench/contrib/testing/common/configuration.js +0 -273
- package/vscode/src/vs/workbench/contrib/testing/common/constants.js +0 -59
- package/vscode/src/vs/workbench/contrib/testing/common/mainThreadTestCollection.js +0 -129
- package/vscode/src/vs/workbench/contrib/testing/common/testExclusions.js +0 -48
- package/vscode/src/vs/workbench/contrib/testing/common/testServiceImpl.js +0 -296
- package/vscode/src/vs/workbench/contrib/testing/common/testingContentProvider.js +0 -125
- package/vscode/src/vs/workbench/contrib/testing/common/testingUri.js +0 -67
|
@@ -1,296 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import { groupBy } from 'vscode/vscode/vs/base/common/arrays';
|
|
3
|
-
import { CancellationToken, CancellationTokenSource } from 'vscode/vscode/vs/base/common/cancellation';
|
|
4
|
-
import { Emitter } from 'vscode/vscode/vs/base/common/event';
|
|
5
|
-
import { Iterable } from 'vscode/vscode/vs/base/common/iterator';
|
|
6
|
-
import { Disposable, DisposableStore, toDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
7
|
-
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
8
|
-
import { IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
9
|
-
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
10
|
-
import { INotificationService } from 'vscode/vscode/vs/platform/notification/common/notification';
|
|
11
|
-
import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage';
|
|
12
|
-
import { IWorkspaceTrustRequestService } from 'vscode/vscode/vs/platform/workspace/common/workspaceTrust';
|
|
13
|
-
import { MainThreadTestCollection } from './mainThreadTestCollection.js';
|
|
14
|
-
import { MutableObservableValue } from 'vscode/vscode/vs/workbench/contrib/testing/common/observableValue';
|
|
15
|
-
import { StoredValue } from 'vscode/vscode/vs/workbench/contrib/testing/common/storedValue';
|
|
16
|
-
import { TestExclusions } from './testExclusions.js';
|
|
17
|
-
import { TestId } from 'vscode/vscode/vs/workbench/contrib/testing/common/testId';
|
|
18
|
-
import { TestingContextKeys } from 'vscode/vscode/vs/workbench/contrib/testing/common/testingContextKeys';
|
|
19
|
-
import { canUseProfileWithTest, ITestProfileService } from 'vscode/vscode/vs/workbench/contrib/testing/common/testProfileService';
|
|
20
|
-
import { ITestResultService } from 'vscode/vscode/vs/workbench/contrib/testing/common/testResultService';
|
|
21
|
-
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
|
|
22
|
-
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
|
|
23
|
-
import { getTestingConfiguration } from './configuration.js';
|
|
24
|
-
import { isDefined } from 'vscode/vscode/vs/base/common/types';
|
|
25
|
-
import { IUriIdentityService } from 'vscode/vscode/vs/platform/uriIdentity/common/uriIdentity';
|
|
26
|
-
|
|
27
|
-
let TestService = class TestService extends Disposable {
|
|
28
|
-
constructor(contextKeyService, instantiationService, uriIdentityService, storage, editorService, testProfiles, notificationService, configurationService, testResults, workspaceTrustRequestService) {
|
|
29
|
-
super();
|
|
30
|
-
this.uriIdentityService = uriIdentityService;
|
|
31
|
-
this.storage = storage;
|
|
32
|
-
this.editorService = editorService;
|
|
33
|
-
this.testProfiles = testProfiles;
|
|
34
|
-
this.notificationService = notificationService;
|
|
35
|
-
this.configurationService = configurationService;
|
|
36
|
-
this.testResults = testResults;
|
|
37
|
-
this.workspaceTrustRequestService = workspaceTrustRequestService;
|
|
38
|
-
this.testControllers = ( new Map());
|
|
39
|
-
this.cancelExtensionTestRunEmitter = ( new Emitter());
|
|
40
|
-
this.willProcessDiffEmitter = ( new Emitter());
|
|
41
|
-
this.didProcessDiffEmitter = ( new Emitter());
|
|
42
|
-
this.testRefreshCancellations = ( new Set());
|
|
43
|
-
this.uiRunningTests = ( new Map());
|
|
44
|
-
this.onWillProcessDiff = this.willProcessDiffEmitter.event;
|
|
45
|
-
this.onDidProcessDiff = this.didProcessDiffEmitter.event;
|
|
46
|
-
this.onDidCancelTestRun = this.cancelExtensionTestRunEmitter.event;
|
|
47
|
-
this.collection = ( new MainThreadTestCollection(this.uriIdentityService, this.expandTest.bind(this)));
|
|
48
|
-
this.showInlineOutput = MutableObservableValue.stored(this._register(( new StoredValue({
|
|
49
|
-
key: 'inlineTestOutputVisible',
|
|
50
|
-
scope: 1 ,
|
|
51
|
-
target: 0
|
|
52
|
-
}, this.storage))), true);
|
|
53
|
-
this.excluded = instantiationService.createInstance(TestExclusions);
|
|
54
|
-
this.providerCount = TestingContextKeys.providerCount.bindTo(contextKeyService);
|
|
55
|
-
this.canRefreshTests = TestingContextKeys.canRefreshTests.bindTo(contextKeyService);
|
|
56
|
-
this.isRefreshingTests = TestingContextKeys.isRefreshingTests.bindTo(contextKeyService);
|
|
57
|
-
this.activeEditorHasTests = TestingContextKeys.activeEditorHasTests.bindTo(contextKeyService);
|
|
58
|
-
this._register(editorService.onDidActiveEditorChange(() => this.updateEditorContextKeys()));
|
|
59
|
-
}
|
|
60
|
-
async expandTest(id, levels) {
|
|
61
|
-
await this.testControllers.get(TestId.fromString(id).controllerId)?.expandTest(id, levels);
|
|
62
|
-
}
|
|
63
|
-
cancelTestRun(runId) {
|
|
64
|
-
this.cancelExtensionTestRunEmitter.fire({ runId });
|
|
65
|
-
if (runId === undefined) {
|
|
66
|
-
for (const runCts of ( this.uiRunningTests.values())) {
|
|
67
|
-
runCts.cancel();
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
this.uiRunningTests.get(runId)?.cancel();
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
async runTests(req, token = CancellationToken.None) {
|
|
75
|
-
const resolved = {
|
|
76
|
-
targets: [],
|
|
77
|
-
exclude: req.exclude?.map(t => t.item.extId),
|
|
78
|
-
continuous: req.continuous,
|
|
79
|
-
};
|
|
80
|
-
for (const profile of this.testProfiles.getGroupDefaultProfiles(req.group)) {
|
|
81
|
-
const testIds = ( req.tests.filter(t => canUseProfileWithTest(profile, t)).map(t => t.item.extId));
|
|
82
|
-
if (testIds.length) {
|
|
83
|
-
resolved.targets.push({
|
|
84
|
-
testIds: testIds,
|
|
85
|
-
profileGroup: profile.group,
|
|
86
|
-
profileId: profile.profileId,
|
|
87
|
-
controllerId: profile.controllerId,
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
if (resolved.targets.length === 0) {
|
|
92
|
-
for (const byController of groupBy(req.tests, (a, b) => a.controllerId === b.controllerId ? 0 : 1)) {
|
|
93
|
-
const profiles = this.testProfiles.getControllerProfiles(byController[0].controllerId);
|
|
94
|
-
const withControllers = ( byController.map(test => ({
|
|
95
|
-
profile: profiles.find(p => p.group === req.group && canUseProfileWithTest(p, test)),
|
|
96
|
-
test,
|
|
97
|
-
})));
|
|
98
|
-
for (const byProfile of groupBy(withControllers, (a, b) => a.profile === b.profile ? 0 : 1)) {
|
|
99
|
-
const profile = byProfile[0].profile;
|
|
100
|
-
if (profile) {
|
|
101
|
-
resolved.targets.push({
|
|
102
|
-
testIds: ( byProfile.map(t => t.test.item.extId)),
|
|
103
|
-
profileGroup: req.group,
|
|
104
|
-
profileId: profile.profileId,
|
|
105
|
-
controllerId: profile.controllerId,
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
return this.runResolvedTests(resolved, token);
|
|
112
|
-
}
|
|
113
|
-
async startContinuousRun(req, token) {
|
|
114
|
-
if (!req.exclude) {
|
|
115
|
-
req.exclude = [...this.excluded.all];
|
|
116
|
-
}
|
|
117
|
-
const trust = await this.workspaceTrustRequestService.requestWorkspaceTrust({
|
|
118
|
-
message: ( localizeWithPath(
|
|
119
|
-
'vs/workbench/contrib/testing/common/testServiceImpl',
|
|
120
|
-
'testTrust',
|
|
121
|
-
"Running tests may execute code in your workspace."
|
|
122
|
-
)),
|
|
123
|
-
});
|
|
124
|
-
if (!trust) {
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
const byController = groupBy(req.targets, (a, b) => a.controllerId.localeCompare(b.controllerId));
|
|
128
|
-
const requests = ( byController.map(
|
|
129
|
-
group => this.testControllers.get(group[0].controllerId)?.startContinuousRun(( group.map(controlReq => ({
|
|
130
|
-
excludeExtIds: req.exclude.filter(t => !controlReq.testIds.includes(t)),
|
|
131
|
-
profileId: controlReq.profileId,
|
|
132
|
-
controllerId: controlReq.controllerId,
|
|
133
|
-
testIds: controlReq.testIds,
|
|
134
|
-
}))), token).then(result => {
|
|
135
|
-
const errs = ( result.map(r => r.error)).filter(isDefined);
|
|
136
|
-
if (errs.length) {
|
|
137
|
-
this.notificationService.error(( localizeWithPath(
|
|
138
|
-
'vs/workbench/contrib/testing/common/testServiceImpl',
|
|
139
|
-
'testError',
|
|
140
|
-
'An error occurred attempting to run tests: {0}',
|
|
141
|
-
errs.join(' ')
|
|
142
|
-
)));
|
|
143
|
-
}
|
|
144
|
-
})
|
|
145
|
-
));
|
|
146
|
-
await Promise.all(requests);
|
|
147
|
-
}
|
|
148
|
-
async runResolvedTests(req, token = CancellationToken.None) {
|
|
149
|
-
if (!req.exclude) {
|
|
150
|
-
req.exclude = [...this.excluded.all];
|
|
151
|
-
}
|
|
152
|
-
const result = this.testResults.createLiveResult(req);
|
|
153
|
-
const trust = await this.workspaceTrustRequestService.requestWorkspaceTrust({
|
|
154
|
-
message: ( localizeWithPath(
|
|
155
|
-
'vs/workbench/contrib/testing/common/testServiceImpl',
|
|
156
|
-
'testTrust',
|
|
157
|
-
"Running tests may execute code in your workspace."
|
|
158
|
-
)),
|
|
159
|
-
});
|
|
160
|
-
if (!trust) {
|
|
161
|
-
result.markComplete();
|
|
162
|
-
return result;
|
|
163
|
-
}
|
|
164
|
-
try {
|
|
165
|
-
const cancelSource = ( new CancellationTokenSource(token));
|
|
166
|
-
this.uiRunningTests.set(result.id, cancelSource);
|
|
167
|
-
const byController = groupBy(req.targets, (a, b) => a.controllerId.localeCompare(b.controllerId));
|
|
168
|
-
const requests = ( byController.map(
|
|
169
|
-
group => this.testControllers.get(group[0].controllerId)?.runTests(( group.map(controlReq => ({
|
|
170
|
-
runId: result.id,
|
|
171
|
-
excludeExtIds: req.exclude.filter(t => !controlReq.testIds.includes(t)),
|
|
172
|
-
profileId: controlReq.profileId,
|
|
173
|
-
controllerId: controlReq.controllerId,
|
|
174
|
-
testIds: controlReq.testIds,
|
|
175
|
-
}))), cancelSource.token).then(result => {
|
|
176
|
-
const errs = ( result.map(r => r.error)).filter(isDefined);
|
|
177
|
-
if (errs.length) {
|
|
178
|
-
this.notificationService.error(( localizeWithPath(
|
|
179
|
-
'vs/workbench/contrib/testing/common/testServiceImpl',
|
|
180
|
-
'testError',
|
|
181
|
-
'An error occurred attempting to run tests: {0}',
|
|
182
|
-
errs.join(' ')
|
|
183
|
-
)));
|
|
184
|
-
}
|
|
185
|
-
})
|
|
186
|
-
));
|
|
187
|
-
await this.saveAllBeforeTest(req);
|
|
188
|
-
await Promise.all(requests);
|
|
189
|
-
return result;
|
|
190
|
-
}
|
|
191
|
-
finally {
|
|
192
|
-
this.uiRunningTests.delete(result.id);
|
|
193
|
-
result.markComplete();
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
publishDiff(_controllerId, diff) {
|
|
197
|
-
this.willProcessDiffEmitter.fire(diff);
|
|
198
|
-
this.collection.apply(diff);
|
|
199
|
-
this.updateEditorContextKeys();
|
|
200
|
-
this.didProcessDiffEmitter.fire(diff);
|
|
201
|
-
}
|
|
202
|
-
getTestController(id) {
|
|
203
|
-
return this.testControllers.get(id);
|
|
204
|
-
}
|
|
205
|
-
async syncTests() {
|
|
206
|
-
const cts = ( new CancellationTokenSource());
|
|
207
|
-
try {
|
|
208
|
-
await Promise.all(( [...( this.testControllers.values())].map(c => c.syncTests(cts.token))));
|
|
209
|
-
}
|
|
210
|
-
finally {
|
|
211
|
-
cts.dispose(true);
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
async refreshTests(controllerId) {
|
|
215
|
-
const cts = ( new CancellationTokenSource());
|
|
216
|
-
this.testRefreshCancellations.add(cts);
|
|
217
|
-
this.isRefreshingTests.set(true);
|
|
218
|
-
try {
|
|
219
|
-
if (controllerId) {
|
|
220
|
-
await this.testControllers.get(controllerId)?.refreshTests(cts.token);
|
|
221
|
-
}
|
|
222
|
-
else {
|
|
223
|
-
await Promise.all(( [...( this.testControllers.values())].map(c => c.refreshTests(cts.token))));
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
finally {
|
|
227
|
-
this.testRefreshCancellations.delete(cts);
|
|
228
|
-
this.isRefreshingTests.set(this.testRefreshCancellations.size > 0);
|
|
229
|
-
cts.dispose(true);
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
cancelRefreshTests() {
|
|
233
|
-
for (const cts of this.testRefreshCancellations) {
|
|
234
|
-
cts.cancel();
|
|
235
|
-
}
|
|
236
|
-
this.testRefreshCancellations.clear();
|
|
237
|
-
this.isRefreshingTests.set(false);
|
|
238
|
-
}
|
|
239
|
-
registerTestController(id, controller) {
|
|
240
|
-
this.testControllers.set(id, controller);
|
|
241
|
-
this.providerCount.set(this.testControllers.size);
|
|
242
|
-
this.updateCanRefresh();
|
|
243
|
-
const disposable = ( new DisposableStore());
|
|
244
|
-
disposable.add(toDisposable(() => {
|
|
245
|
-
const diff = [];
|
|
246
|
-
for (const root of this.collection.rootItems) {
|
|
247
|
-
if (root.controllerId === id) {
|
|
248
|
-
diff.push({ op: 3 , itemId: root.item.extId });
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
this.publishDiff(id, diff);
|
|
252
|
-
if (this.testControllers.delete(id)) {
|
|
253
|
-
this.providerCount.set(this.testControllers.size);
|
|
254
|
-
this.updateCanRefresh();
|
|
255
|
-
}
|
|
256
|
-
}));
|
|
257
|
-
disposable.add(controller.canRefresh.onDidChange(this.updateCanRefresh, this));
|
|
258
|
-
return disposable;
|
|
259
|
-
}
|
|
260
|
-
updateEditorContextKeys() {
|
|
261
|
-
const uri = this.editorService.activeEditor?.resource;
|
|
262
|
-
if (uri) {
|
|
263
|
-
this.activeEditorHasTests.set(!Iterable.isEmpty(this.collection.getNodeByUrl(uri)));
|
|
264
|
-
}
|
|
265
|
-
else {
|
|
266
|
-
this.activeEditorHasTests.set(false);
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
async saveAllBeforeTest(req, configurationService = this.configurationService, editorService = this.editorService) {
|
|
270
|
-
if (req.isUiTriggered === false) {
|
|
271
|
-
return;
|
|
272
|
-
}
|
|
273
|
-
const saveBeforeTest = getTestingConfiguration(this.configurationService, "testing.saveBeforeTest" );
|
|
274
|
-
if (saveBeforeTest) {
|
|
275
|
-
await editorService.saveAll();
|
|
276
|
-
}
|
|
277
|
-
return;
|
|
278
|
-
}
|
|
279
|
-
updateCanRefresh() {
|
|
280
|
-
this.canRefreshTests.set(( Iterable.some(( this.testControllers.values()), t => t.canRefresh.value)));
|
|
281
|
-
}
|
|
282
|
-
};
|
|
283
|
-
TestService = ( __decorate([
|
|
284
|
-
( __param(0, IContextKeyService)),
|
|
285
|
-
( __param(1, IInstantiationService)),
|
|
286
|
-
( __param(2, IUriIdentityService)),
|
|
287
|
-
( __param(3, IStorageService)),
|
|
288
|
-
( __param(4, IEditorService)),
|
|
289
|
-
( __param(5, ITestProfileService)),
|
|
290
|
-
( __param(6, INotificationService)),
|
|
291
|
-
( __param(7, IConfigurationService)),
|
|
292
|
-
( __param(8, ITestResultService)),
|
|
293
|
-
( __param(9, IWorkspaceTrustRequestService))
|
|
294
|
-
], TestService));
|
|
295
|
-
|
|
296
|
-
export { TestService };
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import { VSBuffer } from 'vscode/vscode/vs/base/common/buffer';
|
|
3
|
-
import { DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
4
|
-
import { removeAnsiEscapeCodes } from 'vscode/vscode/vs/base/common/strings';
|
|
5
|
-
import { ILanguageService } from 'vscode/vscode/vs/editor/common/languages/language';
|
|
6
|
-
import { IModelService } from 'vscode/vscode/vs/editor/common/services/model';
|
|
7
|
-
import { ITextModelService } from 'vscode/vscode/vs/editor/common/services/resolverService';
|
|
8
|
-
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
9
|
-
import { ITestResultService } from 'vscode/vscode/vs/workbench/contrib/testing/common/testResultService';
|
|
10
|
-
import { TEST_DATA_SCHEME, parseTestUri } from './testingUri.js';
|
|
11
|
-
|
|
12
|
-
let TestingContentProvider = class TestingContentProvider {
|
|
13
|
-
constructor(textModelResolverService, languageService, modelService, resultService) {
|
|
14
|
-
this.languageService = languageService;
|
|
15
|
-
this.modelService = modelService;
|
|
16
|
-
this.resultService = resultService;
|
|
17
|
-
textModelResolverService.registerTextModelContentProvider(TEST_DATA_SCHEME, this);
|
|
18
|
-
}
|
|
19
|
-
async provideTextContent(resource) {
|
|
20
|
-
const existing = this.modelService.getModel(resource);
|
|
21
|
-
if (existing && !existing.isDisposed()) {
|
|
22
|
-
return existing;
|
|
23
|
-
}
|
|
24
|
-
const parsed = parseTestUri(resource);
|
|
25
|
-
if (!parsed) {
|
|
26
|
-
return null;
|
|
27
|
-
}
|
|
28
|
-
const result = this.resultService.getResult(parsed.resultId);
|
|
29
|
-
if (!result) {
|
|
30
|
-
return null;
|
|
31
|
-
}
|
|
32
|
-
if (parsed.type === 0 ) {
|
|
33
|
-
const task = result.tasks[parsed.taskIndex];
|
|
34
|
-
const model = this.modelService.createModel('', null, resource, false);
|
|
35
|
-
const append = (text) => model.applyEdits([{
|
|
36
|
-
range: { startColumn: 1, endColumn: 1, startLineNumber: Infinity, endLineNumber: Infinity },
|
|
37
|
-
text,
|
|
38
|
-
}]);
|
|
39
|
-
const init = ( VSBuffer.concat(task.output.buffers, task.output.length).toString());
|
|
40
|
-
append(removeAnsiEscapeCodes(init));
|
|
41
|
-
let hadContent = init.length > 0;
|
|
42
|
-
const dispose = ( new DisposableStore());
|
|
43
|
-
dispose.add(task.output.onDidWriteData(d => {
|
|
44
|
-
hadContent ||= d.byteLength > 0;
|
|
45
|
-
append(removeAnsiEscapeCodes(( d.toString())));
|
|
46
|
-
}));
|
|
47
|
-
task.output.endPromise.then(() => {
|
|
48
|
-
if (dispose.isDisposed) {
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
if (!hadContent) {
|
|
52
|
-
append(( localizeWithPath(
|
|
53
|
-
'vs/workbench/contrib/testing/common/testingContentProvider',
|
|
54
|
-
'runNoOutout',
|
|
55
|
-
'The test run did not record any output.'
|
|
56
|
-
)));
|
|
57
|
-
dispose.dispose();
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
model.onWillDispose(() => dispose.dispose());
|
|
61
|
-
return model;
|
|
62
|
-
}
|
|
63
|
-
const test = result?.getStateById(parsed.testExtId);
|
|
64
|
-
if (!test) {
|
|
65
|
-
return null;
|
|
66
|
-
}
|
|
67
|
-
let text;
|
|
68
|
-
let language = null;
|
|
69
|
-
switch (parsed.type) {
|
|
70
|
-
case 3 : {
|
|
71
|
-
const message = test.tasks[parsed.taskIndex].messages[parsed.messageIndex];
|
|
72
|
-
if (message?.type === 0 ) {
|
|
73
|
-
text = message.actual;
|
|
74
|
-
}
|
|
75
|
-
break;
|
|
76
|
-
}
|
|
77
|
-
case 1 : {
|
|
78
|
-
text = '';
|
|
79
|
-
const output = result.tasks[parsed.taskIndex].output;
|
|
80
|
-
for (const message of test.tasks[parsed.taskIndex].messages) {
|
|
81
|
-
if (message.type === 1 ) {
|
|
82
|
-
text += removeAnsiEscapeCodes(( output.getRange(message.offset, message.length).toString()));
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
break;
|
|
86
|
-
}
|
|
87
|
-
case 4 : {
|
|
88
|
-
const message = test.tasks[parsed.taskIndex].messages[parsed.messageIndex];
|
|
89
|
-
if (message?.type === 0 ) {
|
|
90
|
-
text = message.expected;
|
|
91
|
-
}
|
|
92
|
-
break;
|
|
93
|
-
}
|
|
94
|
-
case 2 : {
|
|
95
|
-
const message = test.tasks[parsed.taskIndex].messages[parsed.messageIndex];
|
|
96
|
-
if (!message) {
|
|
97
|
-
break;
|
|
98
|
-
}
|
|
99
|
-
if (message.type === 1 ) {
|
|
100
|
-
const content = result.tasks[parsed.taskIndex].output.getRange(message.offset, message.length);
|
|
101
|
-
text = removeAnsiEscapeCodes(( content.toString()));
|
|
102
|
-
}
|
|
103
|
-
else if (typeof message.message === 'string') {
|
|
104
|
-
text = message.message;
|
|
105
|
-
}
|
|
106
|
-
else {
|
|
107
|
-
text = message.message.value;
|
|
108
|
-
language = this.languageService.createById('markdown');
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
if (text === undefined) {
|
|
113
|
-
return null;
|
|
114
|
-
}
|
|
115
|
-
return this.modelService.createModel(text, language, resource, false);
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
TestingContentProvider = ( __decorate([
|
|
119
|
-
( __param(0, ITextModelService)),
|
|
120
|
-
( __param(1, ILanguageService)),
|
|
121
|
-
( __param(2, IModelService)),
|
|
122
|
-
( __param(3, ITestResultService))
|
|
123
|
-
], TestingContentProvider));
|
|
124
|
-
|
|
125
|
-
export { TestingContentProvider };
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { assertNever } from 'vscode/vscode/vs/base/common/assert';
|
|
2
|
-
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
3
|
-
|
|
4
|
-
const TEST_DATA_SCHEME = 'vscode-test-data';
|
|
5
|
-
const parseTestUri = (uri) => {
|
|
6
|
-
const type = uri.authority;
|
|
7
|
-
const [resultId, ...request] = uri.path.slice(1).split('/');
|
|
8
|
-
if (request[0] === "message" ) {
|
|
9
|
-
const taskIndex = Number(request[1]);
|
|
10
|
-
const testExtId = uri.query;
|
|
11
|
-
const index = Number(request[2]);
|
|
12
|
-
const part = request[3];
|
|
13
|
-
if (type === "results" ) {
|
|
14
|
-
switch (part) {
|
|
15
|
-
case "TestFailureMessage" :
|
|
16
|
-
return { resultId, taskIndex, testExtId, messageIndex: index, type: 2 };
|
|
17
|
-
case "ActualOutput" :
|
|
18
|
-
return { resultId, taskIndex, testExtId, messageIndex: index, type: 3 };
|
|
19
|
-
case "ExpectedOutput" :
|
|
20
|
-
return { resultId, taskIndex, testExtId, messageIndex: index, type: 4 };
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
if (request[0] === "output" ) {
|
|
25
|
-
const testExtId = uri.query;
|
|
26
|
-
const taskIndex = Number(request[1]);
|
|
27
|
-
return testExtId
|
|
28
|
-
? { resultId, taskIndex, testExtId, type: 1 }
|
|
29
|
-
: { resultId, taskIndex, type: 0 };
|
|
30
|
-
}
|
|
31
|
-
return undefined;
|
|
32
|
-
};
|
|
33
|
-
const buildTestUri = (parsed) => {
|
|
34
|
-
const uriParts = {
|
|
35
|
-
scheme: TEST_DATA_SCHEME,
|
|
36
|
-
authority: "results"
|
|
37
|
-
};
|
|
38
|
-
if (parsed.type === 0 ) {
|
|
39
|
-
return ( URI.from({
|
|
40
|
-
...uriParts,
|
|
41
|
-
path: ['', parsed.resultId, "output" , parsed.taskIndex].join('/'),
|
|
42
|
-
}));
|
|
43
|
-
}
|
|
44
|
-
const msgRef = (resultId, ...remaining) => ( URI.from({
|
|
45
|
-
...uriParts,
|
|
46
|
-
query: parsed.testExtId,
|
|
47
|
-
path: ['', resultId, "message" , ...remaining].join('/'),
|
|
48
|
-
}));
|
|
49
|
-
switch (parsed.type) {
|
|
50
|
-
case 3 :
|
|
51
|
-
return msgRef(parsed.resultId, parsed.taskIndex, parsed.messageIndex, "ActualOutput" );
|
|
52
|
-
case 4 :
|
|
53
|
-
return msgRef(parsed.resultId, parsed.taskIndex, parsed.messageIndex, "ExpectedOutput" );
|
|
54
|
-
case 2 :
|
|
55
|
-
return msgRef(parsed.resultId, parsed.taskIndex, parsed.messageIndex, "TestFailureMessage" );
|
|
56
|
-
case 1 :
|
|
57
|
-
return ( URI.from({
|
|
58
|
-
...uriParts,
|
|
59
|
-
query: parsed.testExtId,
|
|
60
|
-
path: ['', parsed.resultId, "output" , parsed.taskIndex].join('/'),
|
|
61
|
-
}));
|
|
62
|
-
default:
|
|
63
|
-
assertNever(parsed, 'Invalid test uri');
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
export { TEST_DATA_SCHEME, buildTestUri, parseTestUri };
|