Rspack
Rspack is a high-performance JavaScript bundler written in Rust. It provides a webpack-compatible API and supports reusing webpack loaders and plugins.
If your project uses Rspack, you can use Rstest to test it and reuse compatible compiler options from your Rspack configuration through an adapter. This reduces duplicate configuration and helps keep test compilation consistent with your project build.
Quick start
To add Rstest to an existing Rspack project, follow the Quick Start to install and set up test scripts.
Reuse Rspack config
@rstest/adapter-rspack loads your Rspack config and maps compatible options into the Rstest test compiler.
Install adapter
Extend your config
The adapter loads rspack.config.ts, merges compatible compiler options with the generated test build, and adds the loaded config file to forceRerunTriggers, so --changed runs the full test suite when that config changes.
Rstest uses Rsbuild internally, so the adapter keeps Rstest-owned test structure and always removes the built-in CSS plugins rsbuild:css, rsbuild:less, and rsbuild:sass. As a result, some Rsbuild-specific CSS options, such as output.cssModules, are unavailable.
Use cwd, configPath, configName, or the environment options when the default Rspack config does not match your project. See the configuration reference for option details, mapping behavior, and debug instructions.
Example project
See the Rspack adapter example for a complete React project.