Skip to content

test: static contract checks on package.json manifest - #35

Merged
jschfflr merged 1 commit into
mainfrom
test/manifest-contract
Apr 21, 2026
Merged

test: static contract checks on package.json manifest#35
jschfflr merged 1 commit into
mainfrom
test/manifest-contract

Conversation

@jschfflr

Copy link
Copy Markdown
Contributor

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 menu command reference makes that menu dead; a missing config description leaves users with 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) may skip — menu surfaces trigger activation via their own context.
  • onStartupFinished is explicitly disallowed — the v0.3.2 regression.
  • workspaceContains:**/.vscode-tfvc/** is preserved.
  • 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 plan

  • npm run compile clean
  • npm test 244/244 (was 208; +36 parameterized cases)

🤖 Generated with Claude Code

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).
@jschfflr
jschfflr merged commit 9f132a2 into main Apr 21, 2026
2 checks passed
@jschfflr
jschfflr deleted the test/manifest-contract branch April 21, 2026 21:59
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.

1 participant