Skip to content

Commit 78c13fb

Browse files
authored
Merge pull request #1566 from easyops-cn/steve/vscode-test
docs(): add docs about testing in contributing guide
2 parents 885a719 + 19c19d8 commit 78c13fb

File tree

6 files changed

+43
-0
lines changed

6 files changed

+43
-0
lines changed

CONTRIBUTING.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,3 +249,37 @@ accessor active: boolean | undefined = false;
249249
```
250250

251251
对于方法,其参数类型和返回类型也都将自动从源代码中识别。
252+
253+
## 测试
254+
255+
框架提供的测试命令是封装的 [Jest](https://jestjs.io/),可以使用大部分 Jest 支持的参数。
256+
257+
```bash
258+
# 测试指定包
259+
yarn test bricks/basic
260+
261+
# 测试指定文件,并 watch
262+
yarn test bricks/basic/src/button/index.spec.ts --watch
263+
```
264+
265+
### VS Code
266+
267+
对于 VS Code 用户,可以使用更便捷和集成化的测试能力,按如下初始化准备:
268+
269+
1. 安装 [vscode-jest](https://marketplace.visualstudio.com/items?itemName=Orta.vscode-jest) 插件
270+
2. 运行 `yarn yo` 并选择 `Setup VSCode testing settings`
271+
272+
常见使用方式:
273+
274+
1. 在 Testing View 中运行指定的包/目录/文件的测试(可选 debug / with coverage / update snapshot 等模式)
275+
2. 可以一键运行指定的测试用例/用例组
276+
3. 可视化的测试覆盖率统计和标注
277+
4. Copilot Agent 可使用该测试工具、并获取覆盖率等信息等帮助其验完善生成的代码和测试用例
278+
279+
![Testing view](assets/testing-view.png)
280+
281+
![Test buttons](assets/test-buttons.png)
282+
283+
![Test coverage stats](assets/test-coverage-stats.png)
284+
285+
![Test coverage marks](assets/test-coverage-marks.png)

assets/test-buttons.png

82.9 KB
Loading

assets/test-coverage-marks.png

192 KB
Loading

assets/test-coverage-stats.png

95 KB
Loading

assets/testing-view.png

116 KB
Loading

bricks/basic/src/link/link.shadow.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,13 @@ eo-icon {
7777
--antd-btn-link-color: var(--elevo-color-brand);
7878
--antd-btn-link-hover-color: var(--elevo-color-brand-hover);
7979
--antd-btn-link-active-color: var(--elevo-color-brand-active);
80+
81+
.text {
82+
color: #595959;
83+
}
84+
85+
.underline {
86+
text-decoration: none;
87+
box-shadow: 0 1px 0 0 currentColor;
88+
}
8089
}

0 commit comments

Comments
 (0)