test: static contract checks on package.json manifest - #35
Merged
Conversation
The manifest is the contract between the extension and VS Code, but most of it is unchecked: adding a command without an activation event reintroduces the v0.3.2 "command not found" bug; typoing a command id in a menu entry makes that menu silently dead; forgetting a config description leaves users staring at a blank hover. test/manifest.test.ts parameterizes over the manifest and asserts: - Every tfvc.* command has title + category="TFVC". - Every palette-visible command has onCommand: in activationEvents. (Palette-hidden ones — "when": "false" in commandPalette menu — are allowed to skip, since they're fired from menu surfaces which trigger activation via their own context.) - onStartupFinished is explicitly disallowed — that was the v0.3.2 regression. - workspaceContains:**/.vscode-tfvc/** is preserved so auto-activation still fires on TFVC folders. - Every command referenced in contributes.menus is declared in contributes.commands. - Every configuration property has a >=10 char description. Unit test, not e2e — it's pure JSON parsing. Faster feedback. Test count: 208 → 244 (+36).
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.
Summary
The manifest is the contract between the extension and VS Code, but most of it was unchecked. A command without an
onCommand:activation event reintroduces the v0.3.2 "command not found" bug; a typo in a menucommandreference makes that menu dead; a missing config description leaves users with a blank hover.test/manifest.test.tsparameterizes over the manifest and asserts:tfvc.*command hastitle+category: "TFVC".onCommand:inactivationEvents. Palette-hidden ones ("when": "false"incommandPalettemenu) may skip — menu surfaces trigger activation via their own context.onStartupFinishedis explicitly disallowed — the v0.3.2 regression.workspaceContains:**/.vscode-tfvc/**is preserved.contributes.menusis declared incontributes.commands.Unit test, not e2e — it's pure JSON parsing, faster feedback.
Test plan
npm run compilecleannpm test244/244 (was 208; +36 parameterized cases)🤖 Generated with Claude Code