Skip to content

Commit 878e4f0

Browse files
committed
refactor(e2e): fetch vscode version dynamically
1 parent 39aac40 commit 878e4f0

2 files changed

Lines changed: 14 additions & 4 deletions

File tree

.github/workflows/e2e.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,20 @@ jobs:
3535
if: github.event_name != 'pull_request' || steps.e2e-marker.outputs.cache-hit != 'true'
3636
run: sudo apt-get install -y xvfb
3737

38+
- name: Get VS Code version from package.json
39+
if: github.event_name != 'pull_request' || steps.e2e-marker.outputs.cache-hit != 'true'
40+
id: vscode-ver
41+
run: |
42+
VERSION=$(node -p 'require("./apps/vscode-e2e/package.json").devDependencies["@types/vscode"]')
43+
echo "version=$VERSION" >> $GITHUB_OUTPUT
44+
3845
- name: Cache VS Code test binary
3946
if: github.event_name != 'pull_request' || steps.e2e-marker.outputs.cache-hit != 'true'
4047
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
4148
with:
4249
path: |
4350
apps/vscode-e2e/.vscode-test/
44-
key: vscode-test-${{ runner.os }}-1.100.0-v1
45-
restore-keys: |
46-
vscode-test-${{ runner.os }}-1.100.0-
51+
key: vscode-test-${{ runner.os }}-${{ steps.vscode-ver.outputs.version }}-v1
4752

4853
- name: Run mocked E2E tests
4954
id: run-e2e

apps/vscode-e2e/src/runTest.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import * as path from "path"
22
import * as os from "os"
33
import * as fs from "fs/promises"
4+
import { readFileSync } from "fs"
45

56
import { runTests } from "@vscode/test-electron"
67
import { LLMock } from "@copilotkit/aimock"
@@ -156,12 +157,16 @@ async function main() {
156157
}
157158

158159
// Download VS Code, unzip it and run the integration test
160+
// Read VS Code version from package.json to keep in sync with @types/vscode
161+
const pkg = JSON.parse(readFileSync(path.resolve(__dirname, "../package.json"), "utf-8"))
162+
const vscodeVersion = process.env.VSCODE_VERSION || pkg.devDependencies["@types/vscode"]
163+
159164
await runTests({
160165
extensionDevelopmentPath,
161166
extensionTestsPath,
162167
launchArgs: [testWorkspace],
163168
extensionTestsEnv,
164-
version: process.env.VSCODE_VERSION || "1.100.0",
169+
version: vscodeVersion,
165170
})
166171
} catch (error) {
167172
console.error("Failed to run tests", error)

0 commit comments

Comments
 (0)