Skip to content

pnpm test/run test not filtered — rtk pnpm has no test/run subcommand #3876

Description

@TheMedpreneur

Summary

The Claude Code auto-rewrite hook maps pnpm test / pnpm run test to rtk pnpm run test, but rtk pnpm has no test or run subcommand — so the rewritten command silently passes through with zero output filtering. This means the exact commands most JS/TS monorepos run before every PR (pnpm test, pnpm run test, pnpm --filter <pkg> test) get none of rtk's token savings, even though the hook logs them as a "rewrite".

Reproduction

$ rtk pnpm --help
Commands:
  list       List installed packages (ultra-dense)
  outdated   Show outdated packages (condensed)
  install    Install packages (filter progress bars)
  typecheck  Typecheck (delegates to tsc filter)

No test/run subcommand exists. Confirmed via the Claude Code hook directly:

$ echo '{"tool_name":"Bash","tool_input":{"command":"pnpm run test"}}' | rtk hook claude
{"hookSpecificOutput":{"hookEventName":"PreToolUse","permissionDecisionReason":"RTK auto-rewrite","updatedInput":{"command":"rtk pnpm run test"}}}

Running the resulting rtk pnpm run test produces the full, unfiltered raw test-runner output (e.g. every individual TAP ok N - ... line + per-test duration_ms blocks from Node's built-in test runner), identical byte-for-byte to plain pnpm run test. The audit log (RTK_HOOK_AUDIT=1) records it as rewrite, which is misleading — nothing was actually filtered.

Expected behavior

rtk pnpm test / rtk pnpm run test (and --filter <pkg> test) should delegate to the same failure-only filtering logic as the existing generic rtk test <cmd> wrapper, since that already produces excellent results:

$ rtk test pnpm run test
OUTPUT (last 5 lines):
  # fail 0
  # cancelled 0
  # skipped 0
  # todo 0
  # duration_ms 166.358334

(~95% line reduction vs. the ~120-line raw TAP output.)

Current workaround

Explicitly invoke rtk test pnpm run test / rtk test pnpm --filter <pkg> test instead of relying on the auto-rewrite hook. We've also added a local Claude Code PreToolUse hook that detects this specific pattern and rewrites it to rtk test ... client-side, but it'd be much better if rtk pnpm handled test/run natively so the built-in auto-rewrite hook covers it out of the box.

Environment

  • rtk 0.48.0 (Homebrew, homebrew/core formula)
  • macOS (Darwin 25.6.0)
  • pnpm 10.33, monorepo with turbo orchestrating per-package test scripts (Node's built-in test runner via tsx --test, and Jest in other packages)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions