diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2684be058..c1caccafc 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -126,7 +126,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, windows-latest] - version: ['v2.2.6', 'v2.3.3', 'v2.4.5', 'v2.4.6', 'v2.5.5'] + version: ['v2.2.6', 'v2.3.3', 'v2.4.6', 'v2.5.5'] env: CLI_VERSION: ${{ matrix.version }} TEST_CODEQL_PATH: '${{ github.workspace }}/codeql' diff --git a/extensions/ql-vscode/src/cli.ts b/extensions/ql-vscode/src/cli.ts index 92391192b..f4739cce4 100644 --- a/extensions/ql-vscode/src/cli.ts +++ b/extensions/ql-vscode/src/cli.ts @@ -976,6 +976,7 @@ const lineEndings = ['\r\n', '\r', '\n']; */ async function logStream(stream: Readable, logger: Logger): Promise { for await (const line of await splitStreamAtSeparators(stream, lineEndings)) { + // Await the result of log here in order to ensure the logs are written in the correct order. await logger.log(line); } } diff --git a/extensions/ql-vscode/src/databases.ts b/extensions/ql-vscode/src/databases.ts index b8e4727e4..128c59ab5 100644 --- a/extensions/ql-vscode/src/databases.ts +++ b/extensions/ql-vscode/src/databases.ts @@ -763,7 +763,7 @@ export class DatabaseManager extends DisposableObject { item: DatabaseItem ) { this._databaseItems.push(item); - this.updatePersistedDatabaseList(); + await this.updatePersistedDatabaseList(); // Add this database item to the allow-list // Database items reconstituted from persisted state @@ -780,7 +780,7 @@ export class DatabaseManager extends DisposableObject { public async renameDatabaseItem(item: DatabaseItem, newName: string) { item.name = newName; - this.updatePersistedDatabaseList(); + await this.updatePersistedDatabaseList(); this._onDidChangeDatabaseItem.fire({ // pass undefined so that the entire tree is rebuilt in order to re-sort item: undefined, @@ -800,7 +800,7 @@ export class DatabaseManager extends DisposableObject { if (index >= 0) { this._databaseItems.splice(index, 1); } - this.updatePersistedDatabaseList(); + await this.updatePersistedDatabaseList(); // Delete folder from workspace, if it is still there const folderIndex = (vscode.workspace.workspaceFolders || []).findIndex( @@ -862,8 +862,8 @@ export class DatabaseManager extends DisposableObject { this._currentDatabaseItem.databaseUri.toString(true) : undefined); } - private updatePersistedDatabaseList(): void { - void this.ctx.workspaceState.update(DB_LIST, this._databaseItems.map(item => item.getPersistedState())); + private async updatePersistedDatabaseList(): Promise { + await this.ctx.workspaceState.update(DB_LIST, this._databaseItems.map(item => item.getPersistedState())); } private isExtensionControlledLocation(uri: vscode.Uri) { diff --git a/extensions/ql-vscode/src/telemetry.ts b/extensions/ql-vscode/src/telemetry.ts index 4345e21eb..93f6dd914 100644 --- a/extensions/ql-vscode/src/telemetry.ts +++ b/extensions/ql-vscode/src/telemetry.ts @@ -209,6 +209,8 @@ export let telemetryListener: TelemetryListener; export async function initializeTelemetry(extension: Extension, ctx: ExtensionContext): Promise { telemetryListener = new TelemetryListener(extension.id, extension.packageJSON.version, key, ctx); - await telemetryListener.initialize(); + // do not await initialization, since doing so will sometimes cause a modal popup. + // this is a particular problem during integration tests, which will hang if a modal popup is displayed. + void telemetryListener.initialize(); ctx.subscriptions.push(telemetryListener); } diff --git a/extensions/ql-vscode/src/vscode-tests/ensureCli.ts b/extensions/ql-vscode/src/vscode-tests/ensureCli.ts index a43d97b49..def3e1b63 100644 --- a/extensions/ql-vscode/src/vscode-tests/ensureCli.ts +++ b/extensions/ql-vscode/src/vscode-tests/ensureCli.ts @@ -39,7 +39,7 @@ const _10MB = _1MB * 10; // CLI version to test. Hard code the latest as default. And be sure // to update the env if it is not otherwise set. -const CLI_VERSION = process.env.CLI_VERSION || 'v2.4.2'; +const CLI_VERSION = process.env.CLI_VERSION || 'v2.5.5'; process.env.CLI_VERSION = CLI_VERSION; // Base dir where CLIs will be downloaded into diff --git a/extensions/ql-vscode/src/vscode-tests/run-integration-tests.ts b/extensions/ql-vscode/src/vscode-tests/run-integration-tests.ts index 5651466c0..adf11adc9 100644 --- a/extensions/ql-vscode/src/vscode-tests/run-integration-tests.ts +++ b/extensions/ql-vscode/src/vscode-tests/run-integration-tests.ts @@ -128,6 +128,14 @@ function getLaunchArgs(dir: TestDir) { return [ '--disable-gpu', path.resolve(__dirname, '../../test/data'), + + // explicitly disable extensions that are known to interfere with the CLI integration tests + '--disable-extension', + 'eamodio.gitlens', + '--disable-extension', + 'github.codespaces', + '--disable-extension', + 'github.copilot', process.env.TEST_CODEQL_PATH! ];