vitest plugin: check turn.complete, session.start and session.end $ answers against claude plugin test

Open
#212 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
54/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
typescript

Research direction

Start by reading call() in packages/vitest-plugin-claude-code-mod/src/testing/engine.ts and the existing conformance tests or pnpm test:e2e setup. For each of turn.complete, session.start, and session.end, compare the same stub under the Vitest plugin and claude plugin test, skipping when claude is unavailable. Done when all three tests confirm matching answers and a changeset is added for any behavior change.

Written by the indexing model from the issue text.

Description

enhancement
Problem

#147 fixed tool.call and #211 fixes prompt.submit: the vitest plugin answered a mod's own $.<event> call with { value } / { deny } where claude plugin test takes the event's own result shape. The same check has not been done for the other events with an own result shape that a mod can call on $: turn.complete, session.start, session.end. No test runs the same stub under both runners, so the two can drift again.

Proposal

For each of turn.complete, session.start, session.end: write a minimal mod that calls $.<event>(...), run it under claude plugin test with a stub answering the event's own result shape and with { value }, and record which one passes and what the mod receives. Where the vitest plugin differs, change call() in packages/vitest-plugin-claude-code-mod/src/testing/engine.ts to follow the engine (recommendation: follow the engine strictly, with a BREAKING minor changeset, as #211 did). Add one conformance test per event that uses the same stub under both runners.

Design points

Where a conformance test lives: recommendation is a test in the vitest plugin package that spawns claude plugin test and skips when claude is not on PATH, like pnpm test:e2e.

Package

@kwitsch/vitest-plugin-claude-code-mod

Scope

Only the three events listed; related: #33 (shape validator).

Acceptance
  • For each of turn.complete, session.start, session.end, a mod's own $.<event> call takes the same stub answer under the vitest plugin and under claude plugin test.
  • A test per event exists and passes under both runners.
  • A changeset is added for any behavior change.
Relations
  • Originating PR: #211
Dominant language
TypeScript
Stars
0
Forks
0
Avg merge
29m
Merged PRs (30d)
138

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from kwitsch/claude-code-plugin-tooling

All issues in kwitsch/claude-code-plugin-tooling

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.