rstest-best-practices
Rstest Best Practices
Apply these rules when writing or reviewing Rstest test projects.
Configuration
- Use
rstest.config.tsanddefineConfigfrom@rstest/core - Prefer explicit imports
import { test, expect, describe } from '@rstest/core'overglobals: true - For Rsbuild projects, use
@rstest/adapter-rsbuildwithextends: withRsbuildConfig()to reuse build config - For Rslib projects, use
@rstest/adapter-rslibwithextends: withRslibConfig()to reuse build config - Use
setupFilesfor shared test setup (e.g., custom matchers, cleanup hooks) - When using Rsbuild plugins (e.g.,
@rsbuild/plugin-react), add them via thepluginsfield - For deep-level or advanced build configuration needs, use
tools.rspackortools.bundlerChain
CLI
More from rstackjs/agent-skills
rsbuild-best-practices
Rsbuild best practices for config, CLI workflow, type checking, bundle optimization, assets, and debugging. Use when writing, reviewing, or troubleshooting Rsbuild projects.
569rslib-best-practices
Rslib best practices for config, CLI workflow, output, declaration files, dependency handling, build optimization and toolchain integration. Use when writing, reviewing, or troubleshooting Rslib projects.
408rspack-v2-upgrade
Use when upgrading a Rspack 1.x project to v2, including dependency and configuration updates.
238rspack-best-practices
Rspack best practices for config, CLI workflow, type checking, CSS, bundle optimization, assets and profiling. Use when writing, reviewing, or troubleshooting Rspack projects.
224rsbuild-v2-upgrade
Use when upgrading a Rsbuild 1.x project to v2, including dependency and configuration updates.
209rsdoctor-analysis
Use when analyzing Rspack/Webpack bundles from local `rsdoctor-data.json` and producing evidence-based optimization recommendations.
164