Features
Here you can learn about the key features supported by Rstest.
Reuse the Rstack ecosystem
Rstest can directly reuse Rsbuild and Rspack configurations and plugin ecosystems. You can use the same configuration for both development and testing to enjoy a consistent experience across the Rstack toolchain.
Learn more about Configuring Rstest.
Built on Rspack
Rstest is powered by Rspack, enabling high-performance builds and optimizations such as Tree Shaking and lazyBarrel.
Transpiled with SWC
Rstest includes a built-in SWC transpiler, providing out-of-the-box JavaScript/TypeScript transpilation. You can easily customize SWC behavior through the configuration file to meet different project needs.
Learn more about Configuring SWC.
Multi-project testing
Rstest provides multi-project testing capabilities, allowing you to run tests for multiple projects in parallel within a single Rstest process.
Learn more about Test projects.
Test sharding
Rstest supports splitting test files into multiple shards for parallel execution. In CI, you can distribute the same test suite across multiple machines to reduce overall execution time. With the blob reporter and rstest merge-reports, you can merge test results and coverage data after all shards complete.
Learn more about Test sharding.
In-source tests
Rstest supports a Rust-like module testing style, allowing you to write test blocks directly inside source files. This approach is ideal for small utility functions and helpers, enabling quick verification and debugging.
Learn more about In-source tests.
Watch mode
When you modify a test file or one of its dependencies, Rstest analyzes the module graph and only re-runs the affected test files, significantly improving local feedback speed.
DOM testing
Rstest supports simulating the DOM and browser APIs using jsdom and happy-dom. It provides solid support for frameworks such as React and Vue, and is compatible with Testing Library and CSS Modules.
Learn more about DOM testing.
Browser mode
Rstest provides Browser Mode, allowing you to run tests in real browsers instead of relying on simulated environments like jsdom or happy-dom. This helps validate real browser API behavior and reduces gaps between test and production environments.
Browser Mode is powered by Playwright and can run tests in Chromium, Firefox, and WebKit, which is a good fit for cross-browser verification and scenarios that depend on real rendering behavior.
Learn more about Browser mode.
Code coverage
Rstest supports code coverage collection using istanbul. You can enable code coverage collection by setting coverage.enabled to true in your Rstest configuration file.
Learn more about Code coverage.
More capabilities
- Jest-compatible assertions and snapshot testing
- Mock / Spy utilities
- File-level sandbox isolation
- Rich lifecycle hooks
- Reporters and CI integration
- Filtering by directory / project / test name
- VS Code extension