Skip to content

fix(ci): upgrade @vscode/test-electron to fix macOS test failures - #1664

Merged
wenytang-ms merged 1 commit into
mainfrom
fix/test-electron-darwin-executable
Aug 3, 2026
Merged

fix(ci): upgrade @vscode/test-electron to fix macOS test failures#1664
wenytang-ms merged 1 commit into
mainfrom
fix/test-electron-darwin-executable

Conversation

@wenytang-ms

Copy link
Copy Markdown
Contributor

Problem

This repo is not red yet, but only because its last macOS run predates the VS Code 1.131.0 release. The identical failure is already reproducing in sibling repos — vscode-java-test, vscode-java-dependency, vscode-spring-boot-dashboard — each with the same signature:

Test error: Error: spawn .../.vscode-test/vscode-darwin-arm64-1.131.0/Visual Studio Code.app/Contents/MacOS/Electron ENOENT
Error: Test run failed with code -2

This repo downloads VS Code unpinned (so it resolves 1.131.0) and is on an affected @vscode/test-electron, so its next macOS run will fail the same way. This is a pre-emptive fix.

Root cause

VS Code 1.110 renamed the macOS main binary inside the .app bundle from the historical Electron to the product name (Code), keeping a compatibility symlink under the old name. That symlink was removed in microsoft/vscode#326502, so any 1.110+ archive now fails to launch via the old path. The test runner does not pin a VS Code version, so it resolves the latest release (1.131.0) and hits this.

@vscode/test-electron ^2.4.1 hardcodes the old path in out/util.js:

return path.resolve(dir, 'Visual Studio Code.app/Contents/MacOS/Electron');

Only macOS goes through this code path, which is why the other platforms are unaffected. Upstream fixed it in microsoft/vscode-test#350, released in 3.1.0: the executable is resolved from CFBundleExecutable in Info.plist, falling back to the sole regular file in Contents/MacOS/ and finally to the legacy Electron name, so both the new and pre-1.110 layouts work. The fix landed after 3.0.0, so 3.1.0 is the earliest release that carries it — there is no 2.x backport.

Changes

Bump @vscode/test-electron ^2.4.1^3.1.0. package.json (+ lockfile) and one line in tsconfig.json.

Beyond @vscode/test-electron itself, the only lockfile churn is inside the ora dependency tree, which 3.x bumps from ^7 to ^8.

Why skipLibCheck

3.1.0 ships declarations using the generic Buffer<ArrayBufferLike>, which needs @types/node >= 22. This repo is on TypeScript 4.9 with older @types/node, so the upgrade alone fails to compile:

node_modules/@vscode/test-electron/out/util.d.ts(107,82): error TS2315: Type 'Buffer' is not generic.

Raising @types/node was tried first and is not viable — on vscode-java-test it kept the Buffer error and introduced unrelated breakage in src/controller/utils.ts. skipLibCheck is the standard remedy for third-party declaration mismatches, and sibling repos vscode-java-dependency and vscode-spring-boot-dashboard already enable it, so this also brings the repos in line with each other.

On engines.node

3.x declares engines.node >= 22 while CI runs Node 20, so npm ci emits:

npm warn EBADENGINE Unsupported engine
npm warn EBADENGINE   required: { node: '>=22' }
npm warn EBADENGINE   current: { node: 'v20.18.1' }

This is a warning, not an error — the install completes. Verified on Node 20.18.1 that 3.1.0 loads and resolves executable paths correctly; it uses no Node 22 only APIs and its transitive dependencies all accept >=18. A Node bump is therefore not needed to fix this and is deliberately left out to keep the change minimal.

Verification

  • npm install succeeds; installed version confirmed as 3.1.0.
  • tsc -p ./ --noEmit passes.
  • Executable resolution verified directly against downloadDirToExecutablePath(..., "darwin-arm64") with synthetic bundles: the new layout (CFBundleExecutable=Code) resolves to Code, and the legacy Electron layout still resolves to Electron — so the fix covers the failure without regressing older VS Code versions.

The real confirmation is the macOS job in this PR's own CI run.

Related

Same fix applied across the affected Java extension repos: microsoft/vscode-gradle#1907 and the sibling PRs opened alongside this one.

The macOS job is not red yet only because its last run predates the
1.131.0 release; the same failure is already reproducing in sibling repos
(microsoft/vscode-java-test, microsoft/vscode-java-dependency,
microsoft/vscode-spring-boot-dashboard) and this repo will hit it on its
next macOS run. It downloads VS Code unpinned and is on an affected
`@vscode/test-electron`, so it has the same exposure:

    Test error: Error: spawn .../Visual Studio Code.app/Contents/MacOS/Electron ENOENT
    Error: Test run failed with code -2

VS Code 1.110 renamed the macOS main binary inside the app bundle from
`Electron` to the product name (`Code`), keeping a compatibility symlink
under the old name. That symlink was removed in microsoft/vscode#326502,
so every 1.110+ archive now fails to launch. The test runner does not pin
a VS Code version, so it resolves the latest release (1.131.0) and hits
this. Only macOS goes through that code path, which is why the other
platforms pass.

`@vscode/test-electron` ^2.4.1 hardcodes the old path, so the breakage
surfaced as soon as the symlink went away. 3.1.0 resolves the executable
via `CFBundleExecutable` from `Info.plist`, with a fallback to the sole
regular file in `Contents/MacOS/` and finally the legacy `Electron` name,
so both the new and pre-1.110 layouts work.

`skipLibCheck` is enabled alongside the bump. 3.1.0 ships declarations that
use the generic `Buffer<ArrayBufferLike>`, which this repo's TypeScript 4.9
and older `@types/node` cannot resolve, so the upgrade otherwise fails to
compile with `TS2315: Type 'Buffer' is not generic`. Raising `@types/node`
instead was tried and pulls in unrelated type breakage, and sibling repos
(vscode-java-dependency, vscode-spring-boot-dashboard) already set
`skipLibCheck`, so this keeps the repos consistent.

3.x declares `engines.node >= 22` while CI runs Node 20, but this is a
non-blocking `npm warn EBADENGINE`: the install succeeds, the package
loads, and it uses no Node 22 only APIs. A Node bump is therefore left out
to keep this change minimal.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 0b39911b-23b6-4180-ae96-2b6c06d2265b
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@wenytang-ms
wenytang-ms merged commit e0aa887 into main Aug 3, 2026
4 checks passed
@wenytang-ms
wenytang-ms deleted the fix/test-electron-darwin-executable branch August 3, 2026 03:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants