name: add-tests description: 为fe-tools实用程序添加或更新Jest单元测试。当添加新功能、现有行为更改或用户要求补测试/add tests时使用。
添加测试
工作流程
- 识别包含目标函数的
packages/下的包。 - 在
packages/<pkg>/__tests__/中查找或创建测试文件。 - 遵循命名模式:
describe('functionName', () => { it('should ...') })
- 至少覆盖:
- 常见预期行为
- 边缘情况
- 使用确定性输入并避免外部I/O,除非必需。
- 建议运行聚焦测试:
TEST_API=<package> npm run test