Skip to content

Commit 910c1b7

Browse files
Stub isVariantAnalysisLiveResultsEnabled instead of updating setting
1 parent f47d6ec commit 910c1b7

2 files changed

Lines changed: 6 additions & 10 deletions

File tree

extensions/ql-vscode/src/config.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,3 @@ const LIVE_RESULTS = new Setting('liveResults', REMOTE_QUERIES_SETTING);
397397
export function isVariantAnalysisLiveResultsEnabled(): boolean {
398398
return !!LIVE_RESULTS.getValue<boolean>();
399399
}
400-
401-
export async function setVariantAnalysisLiveResultsEnabled(enabled: boolean) {
402-
await LIVE_RESULTS.updateValue(enabled, ConfigurationTarget.Global);
403-
}

extensions/ql-vscode/src/vscode-tests/cli-integration/remote-queries/run-remote-query.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ import { QlPack, runRemoteQuery } from '../../../remote-queries/run-remote-query
1010
import { Credentials } from '../../../authentication';
1111
import { CliVersionConstraint, CodeQLCliServer } from '../../../cli';
1212
import { CodeQLExtensionInterface } from '../../../extension';
13-
import { setRemoteControllerRepo, setRemoteRepositoryLists, setVariantAnalysisLiveResultsEnabled } from '../../../config';
13+
import { setRemoteControllerRepo, setRemoteRepositoryLists } from '../../../config';
14+
import * as config from '../../../config';
1415
import { UserCancellationException } from '../../../commandRunner';
1516
import * as ghApiClient from '../../../remote-queries/gh-api/gh-api-client';
1617
import { lte } from 'semver';
@@ -31,6 +32,7 @@ describe('Remote queries', function() {
3132
let progress: sinon.SinonSpy;
3233
let showQuickPickSpy: sinon.SinonStub;
3334
let getRepositoryFromNwoStub: sinon.SinonStub;
35+
let liveResultsStub: sinon.SinonStub;
3436

3537
// use `function` so we have access to `this`
3638
beforeEach(async function() {
@@ -70,6 +72,8 @@ describe('Remote queries', function() {
7072
// always run in the vscode-codeql repo
7173
await setRemoteControllerRepo('github/vscode-codeql');
7274
await setRemoteRepositoryLists({ 'vscode-codeql': ['github/vscode-codeql'] });
75+
76+
liveResultsStub = sandbox.stub(config, 'isVariantAnalysisLiveResultsEnabled').returns(false);
7377
});
7478

7579
afterEach(async () => {
@@ -281,11 +285,7 @@ describe('Remote queries', function() {
281285

282286
describe('when live results are enabled', () => {
283287
beforeEach(async () => {
284-
await setVariantAnalysisLiveResultsEnabled(true);
285-
});
286-
287-
afterEach(async () => {
288-
await setVariantAnalysisLiveResultsEnabled(false);
288+
liveResultsStub.returns(true);
289289
});
290290

291291
it('should run a variant analysis that is part of a qlpack', async () => {

0 commit comments

Comments
 (0)