create-react-app 使用中相关问题整理
💡
原文中文,约400字,阅读约需1分钟。
📝
内容提要
本文讨论了在使用create-react-app时如何添加代码覆盖率,建议通过修改命令和配置文件来收集代码覆盖率并设置阈值。
🎯
关键要点
- 使用命令 'react-scripts test --coverage --watchAll=false' 来添加代码覆盖率。
- 在 package.json 中配置 'collectCoverageFrom' 以收集代码覆盖率。
- 设置 'coverageThreshold' 来定义代码覆盖率的阈值,建议全局行和语句覆盖率均为 90%。
➡️