Skip to content

Claude Code hooks (3/4): test runner#7242

Open
edmundmiller wants to merge 1 commit into
hooks-2-build-checkfrom
hooks-3-test-runner
Open

Claude Code hooks (3/4): test runner#7242
edmundmiller wants to merge 1 commit into
hooks-2-build-checkfrom
hooks-3-test-runner

Conversation

@edmundmiller

Copy link
Copy Markdown
Member

Part 3 of the Claude Code engine-development hooks stack. Targets hooks-2-build-check
(PR #7241).

This PR — Test runner (PostToolUse)

  • hooks/run-tests.sh: after editing a .groovy/.java file under modules/ or plugins/,
    map it to its test class and run it via gradle — e.g.
    modules/nextflow/.../cache/CacheDB.groovy./gradlew :nextflow:test --tests "*CacheDBTest"
    (test files run themselves).
  • On failure: blocks and feeds the failure summary back to Claude (tail-of-output fallback).
  • Wired as a PostToolUse hook because it keys off tool_input.file_path, which is only
    present on Edit/Write/MultiEdit events.
  • Runs per edit, so the timeout is generous (300s); the matcher can be narrowed if per-edit
    test runs are too heavy.

Stack

  1. EditorConfig formatting — Claude Code hooks (1/4): EditorConfig formatting #7240
  2. Build check — Claude Code hooks (2/4): build check on Stop #7241
  3. (this PR) Test runner
  4. IntelliJ IDEA formatter

🤖 Generated with Claude Code

After editing a .groovy/.java file under modules/ or plugins/, map it to
its test class and run it via gradle (e.g. CacheDB.groovy ->
":nextflow:test --tests *CacheDBTest"); test files run themselves. On
failure, block and feed the failure summary back to Claude, falling back
to the tail of the output when no failure lines match. Written in Bash;
parses the payload with jq.

Wired as a PostToolUse hook because it keys off tool_input.file_path,
which is only present on Edit/Write/MultiEdit events. Scoping lives in
the script (covers all three edit tools and both extensions with no
gaps), so no declarative `if` is used here.

Stacked on hooks-2-build-check.

Signed-off-by: Edmund Miller <edmund.miller@seqera.io>
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