Skip to content

Commit a1fa969

Browse files
9aoyCopilot
andauthored
docs: add features chapter (#534)
Co-authored-by: Copilot <[email protected]>
1 parent b820a43 commit a1fa969

File tree

4 files changed

+90
-2
lines changed

4 files changed

+90
-2
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
["index", "quick-start"]
1+
["index", "quick-start", "features"]
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Features
2+
3+
Here you can learn about the key features supported by Rstest.
4+
5+
## Reuse the Rstack ecosystem
6+
7+
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.
8+
9+
Learn more about [Configuring Rstest](/guide/basic/configure-rstest).
10+
11+
### Built on Rspack
12+
13+
Rstest is powered by Rspack, enabling high-performance builds and optimizations such as Tree Shaking and [lazyBarrel](https://rspack.dev/config/experiments#experimentslazybarrel).
14+
15+
## Multi-project testing
16+
17+
Rstest provides multi-project testing capabilities, allowing you to run tests for multiple projects in parallel within a single Rstest process.
18+
19+
Learn more about [Projects](/config/test/projects).
20+
21+
## In-source tests
22+
23+
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.
24+
25+
Learn more about [In-source tests](/config/test/includeSource).
26+
27+
## Watch mode
28+
29+
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.
30+
31+
## DOM testing
32+
33+
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.
34+
35+
Learn more about [DOM testing](/config/test/testEnvironment#dom-testing).
36+
37+
## More capabilities
38+
39+
- Jest-compatible assertions and snapshot testing
40+
- Mock / Spy utilities
41+
- File-level sandbox isolation
42+
- Rich lifecycle hooks
43+
- Reporters and CI integration
44+
- Filtering by directory / project / test name
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
["index", "quick-start"]
1+
["index", "quick-start", "features"]
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# 功能导航
2+
3+
在这里,你可以了解到 Rstest 支持的主要功能。
4+
5+
## 复用 Rstack 生态
6+
7+
Rstest 可直接复用 Rsbuild、Rspack 等构建配置与插件生态。你可以使用同一套配置进行开发与测试,享受 Rstack 工具链带来的一致化体验。
8+
9+
了解更多关于 [配置 Rstest](/guide/basic/configure-rstest)
10+
11+
### 基于 Rspack 构建
12+
13+
Rstest 底层使用 Rspack 构建,能够在 Rstest 中享受 Rspack 带来的高性能构建和 Tree-shaking、[lazyBarrel](https://rspack.rs/zh/config/experiments#experimentslazybarrel) 等优化。
14+
15+
## 多项目测试
16+
17+
Rstest 提供了多项目测试的能力,支持在单个 Rstest 进程中并行对多个项目进行测试。
18+
19+
了解更多关于 [多项目测试](/config/test/projects)
20+
21+
## 源码内联测试
22+
23+
Rstest 支持类 [Rust 的模块测试](https://doc.rust-lang.org/book/ch11-03-test-organization.html#the-tests-module-and-cfgtest)方式,可在源码文件内直接书写测试块。此方式适用于小型功能函数与工具方法,便于快速验证和调试。
24+
25+
了解更多关于 [源码内联测试](/config/test/includeSource)
26+
27+
## Watch 模式
28+
29+
当你修改测试文件或其依赖模块时,Rstest 会基于模块图分析,仅重新运行受影响的测试文件,从而显著提升本地测试效率。
30+
31+
## DOM 测试
32+
33+
Rstest 支持使用 jsdom 与 happy-dom 模拟 DOM 与浏览器 API,并对 React、Vue 等框架提供良好支持,兼容 Testing Library、CSS Modules 等。
34+
35+
了解更多关于 [DOM 测试](/config/test/testEnvironment#dom-测试)
36+
37+
## 更多能力
38+
39+
- 与 Jest 兼容的断言与快照测试
40+
- Mock / Spy 能力
41+
- 文件级沙箱隔离
42+
- 多种生命周期钩子
43+
- 多种报告器与 CI 集成
44+
- 支持按文件夹 / 项目 / 测试名进行过滤

0 commit comments

Comments
 (0)