Repository navigation
fix: restore yarn test and yarn package on Yarn 4 - #8
Merged
Merged
Conversation
Yarn 4 dropped yarn list --prod --json, which vsce invokes when it detects a yarn.lock. That broke yarn package outright and would also break the publish workflow, which packaged twice via the HaaLeo action. Fixes: - package: pass --no-yarn so vsce stops shelling out to the removed command - tsconfig: stop excluding src/test, which meant out/test/runTest.js was never emitted - src/test/suite/index.ts: glob v13 no longer has a callable default export; use globSync and drop the nested Promise - .gitignore: ignore .vscode-test/ (the downloaded VS Code archive) - .vscodeignore: exclude .yarn/** to keep install-state.gz out of the vsix (273 KB -> 34 KB) CI: - enable corepack and pin yarn via packageManager, use yarn install --immutable so the lockfile is actually verified - run yarn test under xvfb-run; CI was not running tests at all - publish: package once and hand the same vsix to both registries via extensionFile, so they ship identical bytes - tagger: replace the removed ::set-output with GITHUB_OUTPUT, and fix tag detection, which used a substring match against tags that a shallow clone could not see lockfile regenerated for Yarn 4 (metadata v8 -> v9).
Yarn 4 no longer runs the implicit pretest lifecycle hook, so out/test/runTest.js was never built and CI failed with Cannot find module .../out/test/runTest.js. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
MaikoTan
added a commit
that referenced
this pull request
Oct 5, 2026
master picked up #8, which independently fixes the same Yarn 4 problems this branch had worked around, and does so more completely: it pins yarn via packageManager, regenerates the lockfile for Yarn 4, and makes CI actually run the tests and the package step. Resolved by taking #8's version of both conflicts: - package.json: #8 folds compile and lint into `test` and passes --no-yarn to vsce. Yarn 4 no longer runs the implicit pretest hook, so the previous pretest script would have silently stopped running. Re-applied only this branch's feature metadata (categories, keywords, activationEvents, the yaml dependency). - src/test/suite/index.ts: #8's globSync version is simpler and equivalent. Kept the .sort() this branch had, so test order does not depend on the order the filesystem reports. yarn.lock needed no resolution and came out byte-identical to this branch's: both sides converged on the same content. Verified the same way CI will: yarn install --immutable, yarn test (63 passing), and yarn package, which now succeeds and produces a 254 KB vsix.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The previous toolchain upgrade moved the repo to Yarn 4, which silently broke both
yarn testandyarn package. Neither command was covered by CI, so the breakage went unnoticed.The root cause of the packaging failure is that Yarn 4 removed
yarn list --prod --json, which@vscode/vsceshells out to whenever it detects ayarn.lock. This also meant the publish workflow was broken: both registry steps packaged independently and both would have failed the same way.What was broken
yarn packagefailed withCommand failed: yarn list --prod --json.yarn testfailed with two independent problems, the first masking the second:tsconfig.jsonexcludedsrc/test/**from compilation, soout/test/runTest.jswas never emitted and the entry point simply did not exist.globv13 no longer exposes a callable default export, soimport * as globfollowed byglob(...)threwTypeError: glob is not a function. Rewritten to useglobSync, which also lets the nested Promise collapse into a flatasyncfunction.CI updates
build.yml: enable corepack and useyarn install --immutable, since bareyarn installdoes not verify the lockfile. Addedxvfb-run -a yarn test; CI was not running tests at all, which is how this regressed unnoticed.publish.yml: package once withyarn packageand pass that same.vsixto both registries viaextensionFile. Previously each registry step packaged on its own, so the two uploads could not be guaranteed byte-identical. Also bumped the HaaLeo action v1 -> v2 and Node 18 -> 20.tagger.yml: replaced the removed::set-outputwith$GITHUB_OUTPUT, and fixed tag detection. It comparedgit tag -loutput using a substring match and ran on a shallow clone, so it could miss existing tags and try to push a duplicate.Points worth reviewing
--no-yarndisables vsce's production-dependency scan. This extension ships zero runtime dependencies, so nothing is lost today. If runtime deps are ever added, they will no longer be validated or bundled automatically and the packaging model needs revisiting..vscodeignorenow excludes.yarn/**. This keeps the 239 KBinstall-state.gzout of the package, cutting the vsix from 273 KB to 34 KB.publish.ymlhardcodes the vsix filename askoishi-dev-${version}.vsix, derived from thenamefield inpackage.json. Renaming the extension means updating that line too.yarn.lockmetadata moved v8 -> v9, so this needs a Yarn 4 toolchain on both ends.Verification
All commands run green locally:
yarn install --immutable,yarn test(1 passing),yarn package(21 files, 34 KB), and all three workflow files parse as valid YAML.