Repository navigation
chore: update vsce to 4 and fix the msal-node advisory - #1927
Conversation
@vscode/test-cli loads the suites from .vscode-test.mjs, so src/test/suite/index.ts is no longer used. Its Mocha import was what pulled in the Mocha globals under TypeScript 7, which defaults types to [], so list mocha and node in tsconfig explicitly.
- Update @vscode/vsce to ^4.1.0, the version ovsx 1.3.0 already pulls in, so only one vsce tree is installed. - Drop the root glob dev dependency; the removed test runner was its only user. - Update @azure/identity to 4.14.1, which depends on @azure/msal-node ^7.1.0 and fixes GHSA-xcx6-jx8p-x3h5. - Drop keytar from allowBuilds; vsce 4 no longer depends on it.
renkun-ken
left a comment
There was a problem hiding this comment.
The dependency cleanup looks consistent: the production dependency graph is unchanged, the MSAL version is patched, and the existing packaging/publishing interfaces remain compatible with vsce 4. I found one regression in the documented Extension Tests debugger workflow that should be fixed before merging; see the inline comment.
Validation on 01f211c: a fresh frozen-lockfile install, typecheck, lint, format:check, pretest, vsce package --no-dependencies, and the packaged sess identity check all pass locally. After that successful pretest, resolving the test runner configured in .vscode/launch.json fails with MODULE_NOT_FOUND. All six hosted CI checks are green; those use the CLI runner and do not exercise this debug configuration.
The Extension Tests launch configuration pointed at the removed legacy runner. Replace it with the Extension Test Runner extension, which reads .vscode-test.mjs and debugs each suite with the same setup as the CLI.
Its integration test was removed, so the configuration ran no tests. Its temporary workspace was also deleted when a separate process only listed the configurations, as the debugger and the Testing view do.
Use js-debug's testConfiguration so the Extension Tests launch reuses .vscode-test.mjs instead of the removed runner. Keep Extension Test Runner as an optional recommendation.
renkun-ken
left a comment
There was a problem hiding this comment.
The testConfiguration migration addresses my previous missing-runner finding. Removing the empty sess-install-tasks configuration is also consistent with the current tree, and the contributor instructions match the new workflow. I found one remaining problem in the F5 integration: loading the configuration from the debugger's inherited working directory can fail while creating test profiles; see the inline comment.
Validation on 8f80914: typecheck, lint, format:check and pretest pass locally. --list-configuration from the checkout resolves all 50 extension test files exactly once (47 provider, 2 editor-command, 1 Interactive), with valid CLI runner, Mocha setup and profiles. I traced the installed js-debug resolver and VS Code Windows bootstrap, then reproduced EACCES by loading this exact configuration from a read-only external working directory. All six hosted CI checks are green, but those invoke the CLI from the checkout and do not cover this F5 configuration-loading context.
renkun-ken
left a comment
There was a problem hiding this comment.
Both previous findings are addressed: Extension Tests uses the supported testConfiguration integration, and test profiles now resolve from the configuration file's URL rather than the debugger's working directory. No further actionable findings.
Verified on 2d46cbb: configuration loading now succeeds from a read-only external working directory, creates no files there, and uses the same checkout profiles as invocation from the repository. All 50 extension test files are discovered exactly once (47 provider, 2 editor-command, 1 Interactive), with valid CLI runner and Mocha setup. JavaScript syntax validation passes, and Windows file-URL conversion handles spaces and special characters correctly. All six hosted CI checks are green.
Motivation
Two Dependabot alerts cannot be fixed automatically:
@azure/msal-nodeGHSA-xcx6-jx8p-x3h5 (fixed in 7.1.0), pulled in by@vscode/vsceandovsxthrough@azure/identity@4.13.3.minimatchGHSA-g3hv-75wg-m249 (affects>=7.0.0 <11.0.1, no fixed 10.x release).Changes
@azure/identityin the lockfile to 4.14.1. It depends on@azure/msal-node^7.1.0, so@azure/msal-nodeis now 7.2.1. This fixes the msal-node alert without changing any version range inpackage.json.@vscode/vscefrom^3.6.0to^4.1.0.ovsx@1.3.0already depends on vsce 4, so two vsce trees were installed. vsce 4 needs Node.js 22 or later (CI uses 24). It replaces glob with tinyglobby and no longer depends onkeytar, sokeytaris removed fromallowBuilds. The lockfile loses about 1,000 lines.src/test/suite/index.ts. It is the old Mocha runner from before@vscode/test-cli, and.vscode-test.mjsdoes not use it. The rootglobdev dependency was only used there, so it is removed too.typesto[]. The removed runner'simport Mocha from 'mocha'was what loaded the Mocha globals (suite,test) for the other test files, sotsconfig.jsonnow listsmochaandnodeintypes.No CHANGELOG entry, as this is an internal change.
Notes: minimatch alert stays open
This PR does not fix the minimatch alert, and it cannot be fixed with an
overridesentry:vscode-languageclient(10.1.2, and also the latest 11.0.0) depends onminimatch ^10.2.6and callsMinimatch#makeRe(). minimatch 11 removesmakeRe(), so forcing 11 would throw aTypeErrorat runtime in the bundled extension. Upstream tracks this inmicrosoft/vscode-languageserver-node#1938(the fix PRmicrosoft/vscode-languageserver-node#1935currently fails CI).@vscode/test-cliandtest-exclude) need glob 14 for minimatch 11, so the dev tools would need several more overrides. The alert would still stay open because ofvscode-languageclient.The vulnerable code (
firstPhasePreProcess) only runs withoptimizationLevel >= 2.vscode-languageclientuses the default level 1, and its patterns come from the R language server. glob uses level 2, but only with the repository's own test globs. Oncevscode-languageclientreleases a version on minimatch 11, the alert should be fixable with a normal update.Update: debugging extension tests
The Extension Tests launch configuration in
.vscode/launch.jsonstill pointed at the removed runner (out/test/suite/index), so it could no longer run any tests. It now uses js-debug'stestConfigurationoption (VS Code 1.87+) with.vscode-test.mjs:pretestpre-launch task, js-debug runsvscode-test --list-configuration, asks which configuration to run, and launches@vscode/test-cli's own runner with that configuration's files, Mocha options and launch arguments. F5 debugging works as before, without a second hand-written runner or theglobdependency.src/test/suite/file in one window withoutout/test/common/extensionSetup.jsor the per-suite profiles.CONTRIBUTING.mdsays this.Extension Test Runner (
ms-vscode.extension-test-runner) is added to the workspace recommendations as an optional way to run or debug individual tests from the Testing view. Neither the debugger nor the CLI requires it.The
sess-install-tasksconfiguration is removed. Its only test (src/test/integration/sessInstall.test.ts) was removed in #1856, so it ran 0 tests. Its temporary workspace was also deleted on process exit, so it was gone when a separate--list-configurationprocess (as used by the debugger and Extension Test Runner) exited.Update: working-directory-independent test profiles
Test profile directories in
.vscode-test.mjsnow resolve relative to the configuration file'simport.meta.url, usingfileURLToPathfor native filesystem paths. js-debug can load the configuration from a working directory outside the checkout, including the VS Code installation directory on Windows. Profiles now consistently stay under the checkout's.vscode-test/user-datadirectory.