Rsbuild
Rsbuild is a build tool powered by Rspack for developing web applications. It provides common build features out of the box and supports frameworks such as React and Vue through plugins.
If your application uses Rsbuild, you can use Rstest to test it and reuse the test-relevant parts of your Rsbuild configuration through an adapter. This reduces duplicate configuration and helps keep test compilation consistent with your application build.
Quick start
New project
Create a new Rsbuild + Rstest project with the --tools rstest flag:
The scaffold includes Rstest and demo tests. Run them with npm run test.
Existing project
To add Rstest to an existing project, follow the Quick Start to install and set up test scripts.
Reuse Rsbuild config
@rstest/adapter-rsbuild loads your Rsbuild config and converts the test-relevant parts into Rstest configuration.
Install adapter
Extend your config
The adapter loads rsbuild.config.ts, maps options used by test compilation, merges them with your Rstest config, and adds the loaded config file to forceRerunTriggers, so --changed runs the full test suite when that config changes. It also removes the rsbuild:type-check plugin because type checking does not run in the test pipeline.
It does not copy build-only settings such as dev, server, or html. Use cwd, config, or environmentName when the default config location or environment does not match your project.
If another tool already creates an Rsbuild config object in memory, use toRstestConfig instead of loading a config file. See the configuration reference for both entry points, options, mapping, and debug instructions.