/rstack:rstest-best-practicesfrom rstack
Guides setting up, writing, and reviewing Rstest tests: configuration, environments, mocking, snapshots, coverage, CI, and worker pool tuning.
Ships in rstack. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Apply these rules when setting up, writing, or reviewing Rstest projects.
@rstest/core, a package-local test script, and a config file whose extension matches the package's module mode.passWithNoTests unless an empty test set is an expected and documented state.rstest list, then run focused tests, the full suite, and the project's existing build or type-check command.defineConfig from @rstest/core and a config file extension compatible with the package's module mode.@rstest/core over globals: true.setupFiles for shared matchers and cleanup; use plugins, resolve, or source for ordinary build integration and low-level tools only when necessary.include explicitly when the package's test layout is non-standard; do not assume the default discovery pattern.node for server/SSR tests or install happy-dom or jsdom for a simulated DOM. Use Browser Mode for component tests that execute in a real browser. For end-to-end tests that drive a running app from a Node worker, use Rstest's Playwright integration..skip or .todo intentionally and never commit .only.await expect(promise).resolves... and .rejects... over try/catch patterns that can miss assertions.includeSource only for small utilities, guard tests with import.meta.rstest, and define it as false in production builds.rs.fn() for functions, rs.spyOn() for object methods, and rs.mock() factories for modules; mock external boundaries rather than the subject under test.clearMocks, resetMocks, or restoreMocks according to whether calls, implementations, or original methods must be restored between tests.rs.mock() for an ESM import and rs.mockRequire() for a CommonJS require(). For a partial ESM mock, import the real exports with import * as actual from './api' with { rstest: 'importActual' } and spread actual in the synchronous factory.--coverage or coverage.enabled.coverage.include to its source globs and check that an untested source file appears in the report. By default, coverage includes only tested files.rstest for a single run; rstest run is an optional explicit equivalent. Use rstest --watch or rstest watch only for local development.rstest list --filesOnly for file discovery and rstest list for test names. Use positional filters or -t for focused runs, -u for intentional snapshot updates, and -c for a non-default config..rstest-reports/, and run rstest merge-reports from the project root with the desired reporters (such as JUnit).silent: 'passed-only'; disable it temporarily when diagnosing setup or runtime output.rstest run --pool.type vmForks --bail 1 for child processes or rstest run --pool.type vmThreads --bail 1 for worker threads.--bail 1 and compare repeated full-suite runs with the same worker count and cache conditions. Set pool.type in the root config only if the suite stays green and the speedup is repeatable within the project's memory budget.--reporter=verbose; use --printConsoleTrace for noisy or unclear console output.DEBUG=rstest and inspect dist/.rstest-temp/.rsbuild/ to verify final Rstest/Rsbuild/Rspack configuration and generated build output.rstest-debugging for systematic startup, build, runtime, logging, memory, or performance diagnosis.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
rstest, test-configuration, test-practices, mocking, coverage
npx claudepluginhub rstackjs/agent-skills --plugin rstack23 skills in this plugin
/migrate-to-rsbuildMigrate webpack, Vite, create-react-app (CRA/CRACO), or Vue CLI projects to Rsbuild./migrate-to-rslibMigrate tsc or tsup library projects to Rslib./migrate-to-rslintMigrate ESLint flat config or Oxlint to Rslint, preserving rule options, file scopes, and plugins while updating lint scripts, editor settings, and inline directives./migrate-to-rstestMigrate Jest, Vitest, or Playwright Test to Rstest while preserving test discovery, assertions, mocks, snapshots, and coverage.Other plugins' skills for the same job