Skip to content

Commit

Permalink
testing: only reveal testing view for ui-triggered runs
Browse files Browse the repository at this point in the history
  • Loading branch information
connor4312 committed Jan 21, 2022
1 parent 7fc5b75 commit fb1eac3
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/vs/workbench/api/browser/mainThreadTesting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@
import { VSBuffer } from 'vs/base/common/buffer';
import { CancellationToken } from 'vs/base/common/cancellation';
import { Disposable, DisposableStore, IDisposable, MutableDisposable, toDisposable } from 'vs/base/common/lifecycle';
import { revive } from 'vs/base/common/marshalling';
import { isDefined } from 'vs/base/common/types';
import { URI } from 'vs/base/common/uri';
import { Range } from 'vs/editor/common/core/range';
import { extHostNamedCustomer } from 'vs/workbench/api/common/extHostCustomers';
import { MutableObservableValue } from 'vs/workbench/contrib/testing/common/observableValue';
import { ExtensionRunTestsRequest, IFileCoverage, ITestItem, ITestMessage, ITestRunProfile, ITestRunTask, ResolvedTestRunRequest, SerializedTestMessage, TestDiffOpType, TestResultState, TestsDiff } from 'vs/workbench/contrib/testing/common/testCollection';
import { ITestProfileService } from 'vs/workbench/contrib/testing/common/testProfileService';
import { TestCoverage } from 'vs/workbench/contrib/testing/common/testCoverage';
import { ITestProfileService } from 'vs/workbench/contrib/testing/common/testProfileService';
import { LiveTestResult } from 'vs/workbench/contrib/testing/common/testResult';
import { ITestResultService } from 'vs/workbench/contrib/testing/common/testResultService';
import { IMainThreadTestController, ITestRootProvider, ITestService } from 'vs/workbench/contrib/testing/common/testService';
import { ExtHostContext, ExtHostTestingShape, IExtHostContext, ILocationDto, ITestControllerPatch, MainContext, MainThreadTestingShape } from '../common/extHost.protocol';
import { revive } from 'vs/base/common/marshalling';

const reviveDiff = (diff: TestsDiff) => {
for (const entry of diff) {
Expand Down
1 change: 1 addition & 0 deletions src/vs/workbench/api/common/extHostTesting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ export class ExtHostTesting implements ExtHostTestingShape {
}

await this.proxy.$runTests({
isUiTriggered: false,
targets: [{
testIds: req.include?.map(t => t.id) ?? [controller.collection.root.id],
profileGroup: profileGroupToBitset[profile.kind],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ import { ByNameTestItemElement, HierarchicalByNameProjection } from 'vs/workbenc
import { ITestTreeProjection, TestExplorerTreeElement, TestItemTreeElement, TestTreeErrorMessage } from 'vs/workbench/contrib/testing/browser/explorerProjections/index';
import { getTestItemContextOverlay } from 'vs/workbench/contrib/testing/browser/explorerProjections/testItemContextOverlay';
import * as icons from 'vs/workbench/contrib/testing/browser/icons';
import { ConfigureTestProfilesAction, DebugSelectedAction, RunSelectedAction, SelectDefaultTestProfiles } from 'vs/workbench/contrib/testing/browser/testExplorerActions';
import { TestingExplorerFilter } from 'vs/workbench/contrib/testing/browser/testingExplorerFilter';
import { ITestingProgressUiService } from 'vs/workbench/contrib/testing/browser/testingProgressUiService';
import { getTestingConfiguration, TestingConfigKeys } from 'vs/workbench/contrib/testing/common/configuration';
Expand All @@ -69,7 +70,6 @@ import { TestResultItemChangeReason } from 'vs/workbench/contrib/testing/common/
import { ITestResultService } from 'vs/workbench/contrib/testing/common/testResultService';
import { IMainThreadTestCollection, ITestService, testCollectionIsEmpty } from 'vs/workbench/contrib/testing/common/testService';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { ConfigureTestProfilesAction, DebugSelectedAction, RunSelectedAction, SelectDefaultTestProfiles } from './testExplorerActions';

export class TestingExplorerView extends ViewPane {
public viewModel!: TestingExplorerViewModel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ export class TestingProgressTrigger extends Disposable {
}

private attachAutoOpenForNewResults(result: LiveTestResult) {
if (result.request.isUiTriggered === false) {
return;
}

const cfg = getTestingConfiguration(this.configurationService, TestingConfigKeys.OpenTesting);
if (cfg === AutoOpenTesting.NeverOpen) {
return;
Expand Down
4 changes: 3 additions & 1 deletion src/vs/workbench/contrib/testing/common/testCollection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,11 @@ export interface ResolvedTestRunRequest {
controllerId: string;
profileGroup: TestRunProfileBitset;
profileId: number;
}[]
}[];
exclude?: string[];
isAutoRun?: boolean;
/** Whether this was trigged by a user action in UI. Default=true */
isUiTriggered?: boolean;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ export class TestResultService implements ITestResultService {
}

const resolved: ResolvedTestRunRequest = {
isUiTriggered: false,
targets: [],
exclude: req.exclude,
isAutoRun: false,
Expand Down

0 comments on commit fb1eac3

Please sign in to comment.