feat: add @rrlab/vitest-plugin and rr test passthrough#244
Merged
Conversation
Introduce a streaming `test` capability so `rr test` is a pure passthrough to vitest, replacing hand-rolled `node --env-file-if-exists=.env ./vitest.mjs` scripts. - New package @rrlab/vitest-plugin: capability `test`, no config scaffolding. Loads an env file first (first-existing of .env.test, then .env; override with `--env <path>`, which errors when the named file is missing). - Kernel: add `ToolService.runStreamed` (inherited-stdio sibling of runReport), the `TestRunner` capability returning an exit code, the `test` command (a passthrough: allowUnknownOption + passThroughOptions + helpOption(false), so flags and --help reach vitest), and the directory entry. `--env` (not `--env-file`): Node's early scanner consumes a literal `--env-file` token off the `rr` process's argv before Commander runs. See decisions/016. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: 9a2ee7f The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
Preview releaseLatest commit: Some packages have been released:
Note Use the PR number as tag to install any package. For instance: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
@rrlab/vitest-pluginand therr testcommand — a pure passthrough to vitest, so projects can drop hand-rolled scripts likenode --env-file-if-exists=.env ./node_modules/vitest/vitest.mjs "$@".How
testis categorically different from the existing verbs:lint/format/tsc/packcapture output into a task-board, but a test runner needs an inherited TTY (watch mode, colors,--helpforwarding). So this adds a streaming capability.Kernel (
@rrlab/cli, additive — no existing plugin changes):ToolService.runStreamed()— inherited-stdio sibling ofrunReport, returns an exit code.TestRunner/TestRunOptionscapability +test?inPluginServices.testcommand:allowUnknownOption+passThroughOptions+helpOption(false)so flags and--helpreach vitest;doctorsubcommand; registered under a new "Testing:" group;vitestentry in the plugin directory.Plugin (
@rrlab/vitest-plugin):test, no config scaffolding.install()only adds thevitestpeer..env.test→.env); explicit--env <path>missing → error (typo protection). Spawnsnode --env-file=<resolved> <vitest-bin> <args>.--env, not--env-fileNode has an early scanner that consumes a literal
--env-filetoken from the entire argv regardless of position. Since therrbin runsnode src/run.ts "$@", a user's--env-filewould be eaten by therrprocess before Commander runs (and crash if the file is missing).--watch/--project/--importare unaffected.--envis not a node flag and vitest uses--environment, so it passes through cleanly. The child spawn still uses node's real--env-file=(there the flag precedes the script).Design
Reviewed by
arch-critic; recorded indecisions/016-vitest-passthrough-plugin.md. One deliberate divergence from the review: the capability is namedtest(not a genericrun), since capability keys are the command's resolution key and a genericrunwould collide across passthrough plugins.Tests / verification
--help/doctor/missing-plugin hint).pnpm build,pnpm test(143 cli + 9 plugin),pnpm rr check(biome + tsc type-aware across all 9 packages).minorfor@rrlab/cliand@rrlab/vitest-plugin.🤖 Generated with Claude Code