Rslib
Rslib is a library development tool built on Rsbuild for creating JavaScript libraries and UI component libraries.
If your library uses Rslib, you can use Rstest to test it and reuse the test-relevant parts of your Rslib configuration through an adapter. This reduces duplicate configuration and helps keep test compilation consistent with your library build.
Quick start
New project
Create a new Rslib + 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 Rslib config
@rstest/adapter-rslib loads your Rslib config and converts the test-relevant parts into Rstest configuration.
Install adapter
Extend your config
The adapter loads rslib.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 does not copy build-only settings such as dev, server, or html. Use cwd, config, or libId when the default config location or library selection does not match your project.
For all options, configuration mapping, cache behavior, and debug instructions, see the configuration reference.