Skip to content

Commit 52916c9

Browse files
committed
Enable VS Code extension integration tests for CCA
Add setup steps to copilot-setup-steps.yml for running VS Code Extension Host integration tests: - Install xvfb and VS Code GUI dependencies (libasound2, libgbm1, etc.) - Build the MCP server and bundle the extension - Pre-download VS Code via new download:vscode script Closes #123
1 parent 3bd0471 commit 52916c9

File tree

3 files changed

+45
-0
lines changed

3 files changed

+45
-0
lines changed

.github/workflows/copilot-setup-steps.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,22 @@ jobs:
6060

6161
- name: Copilot Setup - Install CodeQL packs used in integration tests
6262
run: ./server/scripts/install-packs.sh
63+
64+
# VS Code extension integration test prerequisites
65+
- name: Copilot Setup - Install xvfb and VS Code dependencies
66+
run: |
67+
sudo apt-get update
68+
sudo apt-get install -y xvfb libasound2 libgbm1 libgtk-3-0 libxshmfence1
69+
70+
- name: Copilot Setup - Build server (extension dependency)
71+
run: npm run build -w server
72+
73+
- name: Copilot Setup - Bundle extension and server
74+
working-directory: extensions/vscode
75+
run: |
76+
npm run bundle
77+
npm run bundle:server
78+
79+
- name: Copilot Setup - Download VS Code for integration tests
80+
working-directory: extensions/vscode
81+
run: npm run download:vscode

extensions/vscode/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@
148148
"bundle": "node esbuild.config.js",
149149
"bundle:server": "node scripts/bundle-server.js",
150150
"clean": "rm -rf dist server .vscode-test/* *.vsix",
151+
"download:vscode": "node scripts/download-vscode.js",
151152
"lint": "eslint src/ test/",
152153
"lint:fix": "eslint src/ test/ --fix",
153154
"package": "vsce package --no-dependencies --out codeql-development-mcp-server-v$(node -e 'process.stdout.write(require(`./package.json`).version)').vsix",
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/env node
2+
/**
3+
* Downloads VS Code for integration testing.
4+
*
5+
* This script pre-downloads the VS Code instance required by @vscode/test-cli
6+
* for running Extension Host integration tests. Used in CI/copilot setup steps
7+
* to ensure VS Code is available before running tests.
8+
*
9+
* Usage: node scripts/download-vscode.js [version]
10+
* Default version: stable
11+
*/
12+
13+
import { downloadAndUnzipVSCode } from '@vscode/test-electron';
14+
15+
const version = process.argv[2] || 'stable';
16+
17+
console.log(`Downloading VS Code (${version}) for integration tests...`);
18+
19+
try {
20+
const vscodeExecutablePath = await downloadAndUnzipVSCode(version);
21+
console.log(`✅ VS Code downloaded to: ${vscodeExecutablePath}`);
22+
} catch (error) {
23+
console.error('❌ Failed to download VS Code:', error.message);
24+
process.exit(1);
25+
}

0 commit comments

Comments
 (0)