File tree Expand file tree Collapse file tree 6 files changed +43
-20
lines changed
test/vscode-tests/cli-integration Expand file tree Collapse file tree 6 files changed +43
-20
lines changed Original file line number Diff line number Diff line change 3939 " onWebviewPanel:resultsView" ,
4040 " onWebviewPanel:codeQL.variantAnalysis" ,
4141 " onWebviewPanel:codeQL.dataFlowPaths" ,
42- " onFileSystem:codeql-zip-archive"
42+ " onFileSystem:codeql-zip-archive" ,
43+ " workspaceContains:.git"
4344 ],
4445 "main" : " ./out/extension" ,
4546 "files" : [
Original file line number Diff line number Diff line change @@ -241,15 +241,11 @@ export class CodeQLCliServer implements Disposable {
241241 if ( this . distributionProvider . onDidChangeDistribution ) {
242242 this . distributionProvider . onDidChangeDistribution ( ( ) => {
243243 this . restartCliServer ( ) ;
244- this . _version = undefined ;
245- this . _supportedLanguages = undefined ;
246244 } ) ;
247245 }
248246 if ( this . cliConfig . onDidChangeConfiguration ) {
249247 this . cliConfig . onDidChangeConfiguration ( ( ) => {
250248 this . restartCliServer ( ) ;
251- this . _version = undefined ;
252- this . _supportedLanguages = undefined ;
253249 } ) ;
254250 }
255251 }
@@ -290,6 +286,8 @@ export class CodeQLCliServer implements Disposable {
290286 const callback = ( ) : void => {
291287 try {
292288 this . killProcessIfRunning ( ) ;
289+ this . _version = undefined ;
290+ this . _supportedLanguages = undefined ;
293291 } finally {
294292 this . runNext ( ) ;
295293 }
Original file line number Diff line number Diff line change @@ -119,6 +119,14 @@ export interface DistributionConfig {
119119 ownerName ?: string ;
120120 repositoryName ?: string ;
121121 onDidChangeConfiguration ?: Event < void > ;
122+
123+ /**
124+ * This forces an update of the distribution, even if the settings haven't changed.
125+ *
126+ * This should only be used when the distribution has been updated outside of the extension
127+ * and only in tests. It should not be called in production code.
128+ */
129+ forceUpdateConfiguration ( ) : void ;
122130}
123131
124132// Query server configuration
@@ -275,6 +283,10 @@ export class DistributionConfigListener
275283 ) ;
276284 }
277285
286+ public forceUpdateConfiguration ( ) {
287+ this . _onDidChangeConfiguration . fire ( undefined ) ;
288+ }
289+
278290 protected handleDidChangeConfiguration ( e : ConfigurationChangeEvent ) : void {
279291 this . handleDidChangeConfigurationForRelevantSettings (
280292 DISTRIBUTION_CHANGE_SETTINGS ,
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ import {
1515 storagePath ,
1616} from "../../global.helper" ;
1717import { createMockCommandManager } from "../../../__mocks__/commandsMock" ;
18+ import { remove } from "fs-extra" ;
1819
1920/**
2021 * Run various integration tests for databases
@@ -41,6 +42,7 @@ describe("database-fetcher", () => {
4142
4243 afterEach ( async ( ) => {
4344 await cleanDatabases ( databaseManager ) ;
45+ await remove ( storagePath ) ;
4446 } ) ;
4547
4648 describe ( "importArchiveDatabase" , ( ) => {
Original file line number Diff line number Diff line change 77} from "../jest.activated-extension.setup" ;
88import { createWriteStream , existsSync , mkdirpSync } from "fs-extra" ;
99import { dirname } from "path" ;
10- import { DB_URL , dbLoc } from "../global.helper" ;
10+ import { DB_URL , dbLoc , getActivatedExtension } from "../global.helper" ;
1111import fetch from "node-fetch" ;
1212
1313beforeAll ( async ( ) => {
@@ -31,6 +31,21 @@ beforeAll(async () => {
3131 }
3232
3333 await beforeAllAction ( ) ;
34+
35+ // Activate the extension
36+ const extension = await getActivatedExtension ( ) ;
37+
38+ if ( process . env . CLI_VERSION && process . env . CLI_VERSION !== "nightly" ) {
39+ const cliVersion = await extension . cliServer . getVersion ( ) ;
40+
41+ if ( cliVersion . compare ( process . env . CLI_VERSION ) !== 0 ) {
42+ // It seems like the CUSTOM_CODEQL_PATH_SETTING.updateValue() call in
43+ // `beforeAllAction` doesn't fire the event that the config has changed.
44+ // `forceUpdateConfiguration` will fire the event manually.
45+ // This is a hacky workaround.
46+ extension . distributionManager . config . forceUpdateConfiguration ( ) ;
47+ }
48+ }
3449} ) ;
3550
3651beforeEach ( async ( ) => {
Original file line number Diff line number Diff line change @@ -53,20 +53,6 @@ describe("modeled-method-fs", () => {
5353 let workspacePath : string ;
5454 let cli : CodeQLCliServer ;
5555
56- beforeAll ( async ( ) => {
57- const extension = await getActivatedExtension ( ) ;
58- cli = extension . cliServer ;
59-
60- // All transitive dependencies must be available for resolve extensions to succeed.
61- const packUsingExtensionsPath = join (
62- __dirname ,
63- "../../.." ,
64- "data-extensions" ,
65- "pack-using-extensions" ,
66- ) ;
67- await cli . packInstall ( packUsingExtensionsPath ) ;
68- } ) ;
69-
7056 beforeEach ( async ( ) => {
7157 // On windows, make sure to use a temp directory that isn't an alias and therefore won't be canonicalised by CodeQL.
7258 // See https://github.com/github/vscode-codeql/pull/2605 for more context.
@@ -92,6 +78,15 @@ describe("modeled-method-fs", () => {
9278
9379 const extension = await getActivatedExtension ( ) ;
9480 cli = extension . cliServer ;
81+
82+ // All transitive dependencies must be available for resolve extensions to succeed.
83+ const packUsingExtensionsPath = join (
84+ __dirname ,
85+ "../../.." ,
86+ "data-extensions" ,
87+ "pack-using-extensions" ,
88+ ) ;
89+ await cli . packInstall ( packUsingExtensionsPath ) ;
9590 } ) ;
9691
9792 afterEach ( ( ) => {
You can’t perform that action at this time.
0 commit comments