Skip to content

Add unit and extension-host tests - #38

Merged
ChrisonSimtian merged 1 commit into
developfrom
add-test-suite
Nov 16, 2026
Merged

ChrisonSimtian merged 1 commit into
developfrom
add-test-suite

Conversation

@ChrisonSimtian

Copy link
Copy Markdown
Contributor

Adds a two-layer test suite so changes can be verified from the command line. npm test runs both.

  • Unit (node:test, plain Node): graph parsing, discovery, compatibility checks, Mermaid edge styles. Needed src/graph.ts, split out of src/model.ts, which re-exports it — no import changes elsewhere.
  • Extension-host (@vscode/test-cli): real VS Code on test/fixtures/workspace. Checks activation, all 6 commands registered, goToTarget landing on the declaration, showGraph opening the panel.
  • AGENTS.md, CONTRIBUTING.md, docs/issue-and-pr-style.md no longer say there is no test suite. New Tests section in CONTRIBUTING.md.
  • Tests and fixtures are excluded from the .vsix.

Not in this PR:

Verified: npm test passes (12 unit, 4 extension-host); vsce ls lists no test files.

🤖 Generated with Claude Code

https://claude.ai/code/session_01G6hKb9Lpz4vBWMgPJS7N6D

Split the vscode-free graph logic out of model.ts into graph.ts so it runs
under plain Node, and add an extension-host suite that drives the registered
commands in a real VS Code against a fixture workspace.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G6hKb9Lpz4vBWMgPJS7N6D
@ChrisonSimtian
ChrisonSimtian requested a review from a team as a code owner November 16, 2026 20:24
@ChrisonSimtian ChrisonSimtian added the enhancement New feature or request label Nov 16, 2026
@ChrisonSimtian
ChrisonSimtian merged commit 40da937 into develop Nov 16, 2026
2 checks passed
@ChrisonSimtian
ChrisonSimtian deleted the add-test-suite branch November 16, 2026 20:31
ChrisonSimtian added a commit that referenced this pull request Nov 16, 2026
…cks (#39)

More test coverage on top of #38. Closes #37.

**Bug fix:** clicking a node in the graph posted `run` for target `flowchart`. Mermaid 11 prefixes node ids with the render id, so `id.split('-')[1]` picked the wrong segment. The page now matches the target name explicitly. Found by the new webview test.

- **Unit:** `RunConfigStore` (parameters, secrets kept out of workspace state, args, env), tree sort and relations. Moved out of `runConfig.ts` / `extension.ts` into `runConfigStore.ts` / `graph.ts`, no behaviour change.
- **Extension-host:** `goToTarget` picks the right file when two types declare the same target (`declaredIn`).
- **Webview** (`npm run test:webview`): `src/graphPage.ts` holds the page HTML; `playwright-core` loads it in installed Chrome or Edge with `acquireVsCodeApi` stubbed. Covers `ready`, rendering, solid/dashed/thick edges, default-target styling, click → `run`, re-render.
- **Contract** (`npm run test:contract`, needs .NET): runs `dotnet fallout --plan` so Fallout emits a real `build-graph.json`, then checks the extension's assumptions. Found that `description` is emitted as `null`; the type now allows it.
- Docs updated. CI wiring follows in a separate commit on this PR.

Verified: unit 28, webview 6, extension-host 5, contract 9, all passing locally.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant