OverviewHistoryStatsSecurity
npx skills add ...
Documentation
SKILL.md
npx skills add rstackjs/agent-skills --skill rstest-best-practices
Set up, write, or review Rstest tests and configuration, including environments, mocks, snapshots, coverage, and CI.
npx skills add rstackjs/agent-skills --skill rstest-best-practices
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, happy-dom or jsdom for simulated DOM tests, and Browser Mode for real-browser behavior; install the selected environment package explicitly..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.--coverage or coverage.enabled.coverage.include deliberately before adding thresholds; choose reporters for humans and CI artifacts separately.rstest for a single run; rstest run is an optional explicit equivalent. Use rstest --watch or rstest watch only for local development.rstest list to verify discovery, positional filters or -t for focused runs, -u for intentional snapshot updates, and -c for a non-default config.rstest merge-reports when distributing tests; use JUnit when the CI system requires machine-readable results.silent: 'passed-only'; disable it temporarily when diagnosing setup or runtime output.--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.