Skip to content

Commit 13b55fb

Browse files
committed
Pin electron to 35.2.1 and split CI test jobs
- Pin electron to exact version to stop Dependabot churn; CI tests minimum (Electron 32) and latest via npx separately - Split CI into extension tests (Electron matrix) and webview tests (own job) since Electron's patched fs.readFileSync crashes vitest's forks pool with jsdom - Add version mapping reference (ewanharris/vscode-versions)
1 parent 0903ade commit 13b55fb

File tree

5 files changed

+56
-20
lines changed

5 files changed

+56
-20
lines changed

.github/workflows/ci.yaml

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,14 @@ jobs:
3434

3535
- run: pnpm build
3636

37-
test-unit:
38-
name: Unit Test (Electron ${{ matrix.electron-version }})
37+
test-extension:
38+
name: Extension Test (Electron ${{ matrix.electron-version }})
3939
runs-on: ubuntu-22.04
4040
strategy:
4141
fail-fast: false
4242
matrix:
43-
# Minimum supported version: VS Code 1.95 (Oct 2024) -> Electron 32 -> Node 20
43+
# Minimum supported version: VS Code 1.95 (Oct 2024) -> Electron 32 -> Node 20
44+
# See https://github.com/ewanharris/vscode-versions for version mapping
4445
electron-version: ["32", "latest"]
4546

4647
steps:
@@ -55,11 +56,32 @@ jobs:
5556

5657
- run: pnpm install
5758

58-
- name: Run tests with Electron ${{ matrix.electron-version }}
59+
- name: Run extension tests with Electron ${{ matrix.electron-version }}
5960
run: ./scripts/test-electron.sh ${{ matrix.electron-version }}
6061
env:
6162
CI: true
6263

64+
test-webview:
65+
name: Webview Test
66+
runs-on: ubuntu-22.04
67+
68+
steps:
69+
- uses: actions/checkout@v6
70+
71+
- uses: pnpm/action-setup@v5
72+
73+
- uses: actions/setup-node@v6
74+
with:
75+
node-version: "22"
76+
cache: "pnpm"
77+
78+
- run: pnpm install
79+
80+
- name: Run webview tests
81+
run: pnpm test:webview
82+
env:
83+
CI: true
84+
6385
test-integration:
6486
name: Integration Test (VS Code ${{ matrix.vscode-version }})
6587
runs-on: ubuntu-22.04
@@ -88,7 +110,7 @@ jobs:
88110
package:
89111
name: Package
90112
runs-on: ubuntu-22.04
91-
needs: [lint, test-unit, test-integration]
113+
needs: [lint, test-extension, test-webview, test-integration]
92114
steps:
93115
- uses: actions/checkout@v6
94116

.vscode-test.mjs

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

33
// VS Code to Electron/Node version mapping:
4-
// VS Code 1.95 (Oct 2024) -> Node 20 - Minimum supported
4+
// VS Code 1.95 (Oct 2024) -> Electron 32, Node 20 - Minimum supported
55
// VS Code stable -> Latest
6+
// See https://github.com/ewanharris/vscode-versions for version mapping
67
const versions = ["1.95.0", "stable"];
78

89
const baseConfig = {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@
549549
"coder": "catalog:",
550550
"concurrently": "^9.2.1",
551551
"dayjs": "^1.11.20",
552-
"electron": "^41.0.3",
552+
"electron": "35.2.1",
553553
"esbuild": "^0.27.4",
554554
"eslint": "^10.0.3",
555555
"eslint-config-prettier": "^10.1.8",

pnpm-lock.yaml

Lines changed: 16 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/test-electron.sh

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
#!/bin/bash
2-
# Run tests inside a specific Electron version's runtime.
2+
# Run extension unit tests inside a specific Electron version's runtime.
33
#
4-
# Requires Electron 32+ due to Vitest ESM requirements.
4+
# Only runs the "extension" project because Electron's patched fs.readFileSync
5+
# causes stack overflows in vitest's forks pool with jsdom (webview tests).
6+
# Webview tests should be run separately via `pnpm test:webview`.
7+
#
8+
# See https://github.com/ewanharris/vscode-versions for version mapping.
59
#
610
# Usage: ./scripts/test-electron.sh <electron-version>
711
# Examples:
@@ -12,7 +16,7 @@ set -e
1216

1317
ELECTRON_VERSION="${1:?Usage: $0 <electron-version>}"
1418

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
19+
echo "Running extension tests with Electron $ELECTRON_VERSION..."
20+
# --experimental-require-module needed for Electron 32-34 (Node 20.18), harmless for 35+ (Node 22+)
21+
ELECTRON_RUN_AS_NODE=1 NODE_OPTIONS="--experimental-require-module --disable-warning=ExperimentalWarning" \
22+
npx --yes "electron@$ELECTRON_VERSION" node_modules/vitest/vitest.mjs --project extension

0 commit comments

Comments
 (0)