File tree Expand file tree Collapse file tree 5 files changed +36
-20
lines changed
test/vscode-tests/cli-integration Expand file tree Collapse file tree 5 files changed +36
-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 @@ -15,6 +15,7 @@ import {
1515 storagePath ,
1616} from "../../global.helper" ;
1717import { createMockCommandManager } from "../../../__mocks__/commandsMock" ;
18+ import { ensureDir , remove } from "fs-extra" ;
1819
1920/**
2021 * Run various integration tests for databases
@@ -41,6 +42,8 @@ describe("database-fetcher", () => {
4142
4243 afterEach ( async ( ) => {
4344 await cleanDatabases ( databaseManager ) ;
45+ await remove ( storagePath ) ;
46+ await ensureDir ( storagePath ) ;
4447 } ) ;
4548
4649 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,25 @@ 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+ // This calls the private `updateConfiguration` method in the `ConfigListener`
43+ // It seems like the CUSTOM_CODEQL_PATH_SETTING.updateValue() call in
44+ // `beforeAllAction` doesn't fire the event that the config has changed.
45+ // This is a hacky workaround.
46+ (
47+ extension . distributionManager . config as unknown as {
48+ updateConfiguration : ( ) => void ;
49+ }
50+ ) . updateConfiguration ( ) ;
51+ }
52+ }
3453} ) ;
3554
3655beforeEach ( 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