File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3030
3131 - run : yarn build
3232
33- test :
34- name : Test
33+ test-unit :
34+ name : Unit Test (Electron ${{ matrix.electron-version }})
3535 runs-on : ubuntu-22.04
36+ strategy :
37+ fail-fast : false
38+ matrix :
39+ # Minimum supported version: VS Code 1.95 (Oct 2024) -> Electron 32 -> Node 20
40+ electron-version : ["32", "latest"]
3641
3742 steps :
3843 - uses : actions/checkout@v6
@@ -44,12 +49,38 @@ jobs:
4449
4550 - run : yarn
4651
47- - run : yarn test:ci
52+ - name : Run tests with Electron ${{ matrix.electron-version }}
53+ run : ./scripts/test-electron.sh ${{ matrix.electron-version }}
54+ env :
55+ CI : true
56+
57+ test-integration :
58+ name : Integration Test (VS Code ${{ matrix.vscode-version }})
59+ runs-on : ubuntu-22.04
60+ strategy :
61+ fail-fast : false
62+ matrix :
63+ vscode-version : ["1.95.0", "stable"]
64+
65+ steps :
66+ - uses : actions/checkout@v6
67+
68+ - uses : actions/setup-node@v6
69+ with :
70+ node-version : " 22"
71+ cache : " yarn"
72+
73+ - run : yarn
74+
75+ - run : yarn build
76+
77+ - name : Run integration tests on VS Code ${{ matrix.vscode-version }}
78+ run : xvfb-run -a yarn test:integration --label "VS Code ${{ matrix.vscode-version }}"
4879
4980 package :
5081 name : Package
5182 runs-on : ubuntu-22.04
52- needs : [lint, test]
83+ needs : [lint, test-unit, test-integration ]
5384 steps :
5485 - uses : actions/checkout@v6
5586
Original file line number Diff line number Diff line change 11import { 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+ ) ;
Original file line number Diff line number Diff line change 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
You can’t perform that action at this time.
0 commit comments