Skip to content

feat(node): handler for node --test (TAP summary) and node --check#1952

Open
thibault-monteiro wants to merge 2 commits into
rtk-ai:developfrom
thibault-monteiro:feat/node-handler
Open

feat(node): handler for node --test (TAP summary) and node --check#1952
thibault-monteiro wants to merge 2 commits into
rtk-ai:developfrom
thibault-monteiro:feat/node-handler

Conversation

@thibault-monteiro
Copy link
Copy Markdown

Closes #1950 (the node half).

What it does

Adds a rtk node subcommand that filters the output of two specific modes of the node binary:

  • node --test [files...] — Forces --test-reporter=tap, parses the TAP 13 stream, emits a compact summary on success (node --test: 42 passed in 1234ms) and a summary + full failure blocks on failure (preserving the test name, error message and stack — the actionable signal). Skipped tests are reported.
  • node --check FILE — Silent "ok" on success; passes through the SyntaxError stack verbatim on failure (already compact, and the agent needs the location to fix the issue).
  • Other modes (node script.js, node -e '...') are intentionally NOT routed by the rewriter — their stdout/stderr is the user's program's output, which we don't want to filter.

Files

  • src/cmds/js/node_cmd.rs — new handler with classify(), filter_node_test_output(), filter_node_check_output(). Wired into js/mod.rs automatically via automod.
  • src/main.rsCommands::Node { args } variant + dispatch + added to the deny-list match arm for command routing.
  • src/discover/rules.rs — new RtkRule matching ^node\s+(--test(=|\s|$)|--check\s|-c\s). Category Tests, estimated savings 80% (test) / 60% (check).
  • src/discover/registry.rs — three new tests: test_classify_node_test, test_classify_node_check, test_classify_node_run_is_not_routed.

Tests

src/cmds/js/node_cmd.rs ships 10 unit tests covering classify(), filter_node_check_output() (success/error), and
filter_node_test_output() (all-passing, with-failure, with-skipped, zero-tests, no-summary-passthrough).

I couldn't run cargo test locally on my Windows-GNU toolchain (the ring build requires gcc which I haven't installed). cargo fmt -- --check passes on all modified files. Counting on the Linux CI to validate.

Summary

Test plan

  • cargo fmt --all && cargo clippy --all-targets && cargo test
  • Manual testing: rtk <command> output inspected

Important: All PRs must target the develop branch (not master).
See CONTRIBUTING.md for details.

Closes rtk-ai#1950 (the `node` half).

## What it does

Adds a `rtk node` subcommand that filters the output of two specific
modes of the `node` binary:

- **`node --test [files...]`** — Forces `--test-reporter=tap`, parses
  the TAP 13 stream, emits a compact summary on success
  (`node --test: 42 passed in 1234ms`) and a summary + full failure
  blocks on failure (preserving the test name, error message and
  stack — the actionable signal). Skipped tests are reported.
- **`node --check FILE`** — Silent "ok" on success; passes through the
  SyntaxError stack verbatim on failure (already compact, and the agent
  needs the location to fix the issue).
- Other modes (`node script.js`, `node -e '...'`) are intentionally NOT
  routed by the rewriter — their stdout/stderr is the user's program's
  output, which we don't want to filter.

## Files

- `src/cmds/js/node_cmd.rs` — new handler with `classify()`,
  `filter_node_test_output()`, `filter_node_check_output()`. Wired
  into `js/mod.rs` automatically via `automod`.
- `src/main.rs` — `Commands::Node { args }` variant + dispatch + added
  to the deny-list match arm for command routing.
- `src/discover/rules.rs` — new `RtkRule` matching
  `^node\s+(--test(=|\s|$)|--check\s|-c\s)`. Category `Tests`,
  estimated savings 80% (test) / 60% (check).
- `src/discover/registry.rs` — three new tests:
  `test_classify_node_test`, `test_classify_node_check`,
  `test_classify_node_run_is_not_routed`.

## Tests

`src/cmds/js/node_cmd.rs` ships 10 unit tests covering classify(),
filter_node_check_output() (success/error), and
filter_node_test_output() (all-passing, with-failure, with-skipped,
zero-tests, no-summary-passthrough).

I couldn't run `cargo test` locally on my Windows-GNU toolchain (the
`ring` build requires gcc which I haven't installed). `cargo fmt --
--check` passes on all modified files. Counting on the Linux CI to
validate.
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented May 18, 2026

CLA assistant check
All committers have signed the CLA.

@thibault-monteiro
Copy link
Copy Markdown
Author

recheck

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.

Add handlers for node and npm test — top unhandled commands in Claude Code workflows

3 participants