Skip to content

Commit

Permalink
testing: adopt workspace trust for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
connor4312 committed Apr 19, 2021
1 parent 94894df commit b0eff48
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion product.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
},
{
"name": "ms-vscode.node-debug2",
"version": "1.42.5",
"version": "1.42.6",
"repo": "https://github.com/microsoft/vscode-node-debug2",
"metadata": {
"id": "36d19e17-7569-4841-a001-947eb18602b2",
Expand Down
11 changes: 11 additions & 0 deletions src/vs/workbench/contrib/testing/common/testServiceImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { localize } from 'vs/nls';
import { IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { INotificationService } from 'vs/platform/notification/common/notification';
import { IStorageService, StorageScope, StorageTarget } from 'vs/platform/storage/common/storage';
import { IWorkspaceTrustRequestService } from 'vs/platform/workspace/common/workspaceTrust';
import { ExtHostTestingResource } from 'vs/workbench/api/common/extHost.protocol';
import { MutableObservableValue } from 'vs/workbench/contrib/testing/common/observableValue';
import { StoredValue } from 'vs/workbench/contrib/testing/common/storedValue';
Expand Down Expand Up @@ -64,6 +65,7 @@ export class TestService extends Disposable implements ITestService {
@IStorageService private readonly storageService: IStorageService,
@INotificationService private readonly notificationService: INotificationService,
@ITestResultService private readonly testResults: ITestResultService,
@IWorkspaceTrustRequestService private readonly workspaceTrustRequestService: IWorkspaceTrustRequestService,
) {
super();
this.providerCount = TestingContextKeys.providerCount.bindTo(contextKeyService);
Expand Down Expand Up @@ -195,6 +197,15 @@ export class TestService extends Disposable implements ITestService {
}

const result = this.testResults.createLiveResult(req);
const trust = await this.workspaceTrustRequestService.requestWorkspaceTrust({
modal: true,
message: localize('testTrust', "Running tests may execute code in your workspace."),
});

if (!trust) {
return result;
}

const testsWithIds = req.tests.map(test => {
if (test.src) {
return test as TestIdWithSrc;
Expand Down

0 comments on commit b0eff48

Please sign in to comment.