Skip to content

Commit 04a1e5f

Browse files
committed
Add multi-version testing to CI
- Run unit tests against Electron 32 and latest via matrix - Add integration test job for VS Code 1.95.0 and stable - Add test-electron.sh script for version-specific test runs
1 parent 32974c8 commit 04a1e5f

File tree

3 files changed

+71
-5
lines changed

3 files changed

+71
-5
lines changed

.github/workflows/ci.yaml

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,15 @@ jobs:
3131
- run: yarn build
3232

3333
test:
34-
name: Test
34+
name: Test (Electron ${{ matrix.electron-version }})
3535
runs-on: ubuntu-22.04
36+
strategy:
37+
fail-fast: false
38+
matrix:
39+
# VS Code to Electron version mapping:
40+
# VS Code 1.95 (Oct 2024) -> Electron 32 -> Node 20
41+
# VS Code latest -> Electron latest
42+
electron-version: ["32", "latest"]
3643

3744
steps:
3845
- uses: actions/checkout@v6
@@ -44,12 +51,40 @@ jobs:
4451

4552
- run: yarn
4653

47-
- run: yarn test:ci
54+
- name: Run tests with Electron ${{ matrix.electron-version }}
55+
run: ./scripts/test-electron.sh ${{ matrix.electron-version }}
56+
env:
57+
CI: true
58+
59+
# Integration tests run the extension in actual VS Code versions
60+
# This catches runtime API compatibility issues that unit tests miss
61+
test-integration:
62+
name: Integration (VS Code ${{ matrix.vscode-version }})
63+
runs-on: ubuntu-22.04
64+
strategy:
65+
fail-fast: false
66+
matrix:
67+
vscode-version: ["1.95.0", "stable"]
68+
69+
steps:
70+
- uses: actions/checkout@v6
71+
72+
- uses: actions/setup-node@v6
73+
with:
74+
node-version: "22"
75+
cache: "yarn"
76+
77+
- run: yarn
78+
79+
- run: yarn build
80+
81+
- name: Run integration tests on VS Code ${{ matrix.vscode-version }}
82+
run: xvfb-run -a yarn test:integration --label "VS Code ${{ matrix.vscode-version }}"
4883

4984
package:
5085
name: Package
5186
runs-on: ubuntu-22.04
52-
needs: [lint, test]
87+
needs: [lint, test, test-integration]
5388
steps:
5489
- uses: actions/checkout@v6
5590

.vscode-test.mjs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
import { defineConfig } from "@vscode/test-cli";
22

3-
export default defineConfig({
3+
// VS Code to Electron/Node version mapping:
4+
// VS Code 1.95 (Oct 2024) -> Node 20 - Minimum supported
5+
// VS Code stable -> Latest
6+
const versions = ["1.95.0", "stable"];
7+
8+
const baseConfig = {
49
files: "out/test/integration/**/*.test.js",
510
extensionDevelopmentPath: ".",
611
extensionTestsPath: "./out/test",
@@ -9,4 +14,12 @@ export default defineConfig({
914
ui: "tdd",
1015
timeout: 20000,
1116
},
12-
});
17+
};
18+
19+
export default defineConfig(
20+
versions.map((version) => ({
21+
...baseConfig,
22+
version,
23+
label: `VS Code ${version}`,
24+
})),
25+
);

scripts/test-electron.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
# Run tests inside a specific Electron version's runtime.
3+
#
4+
# Requires Electron 32+ due to Vitest ESM requirements.
5+
#
6+
# Usage: ./scripts/test-electron.sh <electron-version>
7+
# Examples:
8+
# ./scripts/test-electron.sh 32
9+
# ./scripts/test-electron.sh latest
10+
11+
set -e
12+
13+
ELECTRON_VERSION="${1:?Usage: $0 <electron-version>}"
14+
15+
echo "Running tests with Electron $ELECTRON_VERSION..."
16+
# --experimental-require-module needed for Electron 32-33 (Node 20.18), harmless for 34+
17+
ELECTRON_RUN_AS_NODE=1 NODE_OPTIONS="--experimental-require-module" \
18+
npx --yes "electron@$ELECTRON_VERSION" node_modules/vitest/vitest.mjs

0 commit comments

Comments
 (0)