✨ [Feature]: Components of tiny-vue may need to add unit tests
What problem does this feature solve
增加单元测试,有利提高代码质量,简化代码重构。
建议优先完善高频组件的 TypeScript 类型声明。
What does the proposed API look like
增加单元测试。
需要的,我们正在规划这块,也欢迎一起参与进来~
可以在packages/vue目录下搜索it.todo关键字,找到待补充的单元测试。
执行全量单元测试:pnpm test:unit3
执行单个组件的单元测试:pnpm test:unit3 button
The unit testing of components needs to be continuously improved.
单测是否可以参考这个 wiki: TinyVue 高频组件列表
Bot detected the issue body's language is not English, translate it automatically.
Whether you can refer to this wiki for single testing: [TinyVue high-frequency component list](https://github.com/opentiny/tiny-vue/wiki/TinyVue-%E9%AB%98%E9%A2%91%E7%BB %84%E4%BB%B6%E5%88%97%E8%A1%A8)
除了单元测试,也可以补充组件的 e2e 测试用例,基于 Playwright,可以模拟用户实际的操作。目前 PR 合入门禁中已经集成了 e2e 测试,当前组件的 e2e 测试必须通过才能合入。
~e2e 测试执行时会打开浏览器(默认值 3101 端口,如果需要修改端口,需要在 examples/docs/vue3/playwright.config.js 中进行修改),所以需要执行 pnpm site 本地启动项目才行。~
更正:pnpm test:e2e 命令会自动执行 pnpm site 启动本地项目
执行全量 e2e 测试用例:
pnpm test:e2e3
执行单个组件的 e2e 测试用例
pnpm test:e2e3 ./date-picker
Bot detected the issue body's language is not English, translate it automatically.
In addition to unit testing, e2e test cases for components can also be supplemented. Based on Playwright, the actual user operations can be simulated. Currently, the e2e test has been integrated into the PR integration gate. The e2e test of the current component must pass before it can be integrated.
Execute full e2e test cases:
pnpm test:e2e3
Execute e2e test cases for a single component
pnpm test:e2e3 ./date-picker