Skip to content

Commit 534086f

Browse files
authored
docs: polish coverage doc (#569)
1 parent 939559d commit 534086f

File tree

4 files changed

+24
-2
lines changed

4 files changed

+24
-2
lines changed

website/docs/en/config/test/coverage.mdx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ export default defineConfig({
8181

8282
#### Istanbul provider
8383

84+
[Istanbul](https://istanbul.js.org/) is a widely used JavaScript code coverage tool that collects code coverage information through instrumentation.
85+
8486
To enable istanbul coverage, you need to install the `@rstest/coverage-istanbul` package first.
8587

8688
import { PackageManagerTabs } from '@theme';
@@ -218,3 +220,12 @@ export default defineConfig({
218220
},
219221
});
220222
```
223+
224+
When the code coverage is below the specified thresholds, the test will fail and output an error message like below:
225+
226+
```bash
227+
Coverage for statements 75% does not meet global threshold 80%
228+
Coverage for functions 75% does not meet global threshold 80%
229+
Coverage for branches 75% does not meet global threshold 80%
230+
Coverage for lines 75% does not meet global threshold 80%
231+
```

website/docs/en/guide/start/features.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Learn more about [DOM testing](/config/test/testEnvironment#dom-testing).
3636

3737
## Code coverage
3838

39-
Rstest supports code coverage collection using Istanbul. You can enable code coverage collection by setting `coverage.enabled` to `true` in your Rstest configuration file.
39+
Rstest supports code coverage collection using [istanbul](https://istanbul.js.org/). You can enable code coverage collection by setting `coverage.enabled` to `true` in your Rstest configuration file.
4040

4141
Learn more about [Code coverage](/config/test/coverage).
4242

website/docs/zh/config/test/coverage.mdx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ export default defineConfig({
8181

8282
#### Istanbul provider
8383

84+
[Istanbul](https://istanbul.js.org/) 是一个广泛使用的 JavaScript 代码覆盖率分析工具,它通过插桩的方式来收集代码覆盖率信息。
85+
8486
要启用 istanbul 覆盖率,需要先安装 `@rstest/coverage-istanbul`
8587

8688
import { PackageManagerTabs } from '@theme';
@@ -218,3 +220,12 @@ export default defineConfig({
218220
},
219221
});
220222
```
223+
224+
当代码覆盖率低于指定阈值时,测试将失败并输出如下错误信息:
225+
226+
```bash
227+
Coverage for statements 75% does not meet global threshold 80%
228+
Coverage for functions 75% does not meet global threshold 80%
229+
Coverage for branches 75% does not meet global threshold 80%
230+
Coverage for lines 75% does not meet global threshold 80%
231+
```

website/docs/zh/guide/start/features.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Rstest 支持使用 jsdom 与 happy-dom 模拟 DOM 与浏览器 API,并对 Rea
3636

3737
## 代码覆盖率
3838

39-
Rstest 支持使用 Istanbul 收集代码覆盖率。你可以通过设置 `coverage.enabled``true` 来启用代码覆盖率收集。
39+
Rstest 支持使用 [istanbul](https://istanbul.js.org/) 收集代码覆盖率。你可以通过设置 `coverage.enabled``true` 来启用代码覆盖率收集。
4040

4141
了解更多关于 [代码覆盖率](/config/test/coverage)
4242

0 commit comments

Comments
 (0)