JavaScript 自动化测试
原名:javascript-testing-patterns
为函数、组件和接口安排单元与集成测试,检查模拟方式和异步断言。
中文 Skills 技能说明
前端或 Node.js 项目经常改一处坏一处时,可让前端开发工程师与 API 测试工程师使用。提供代码、Jest 或 Vitest 版本、需求和已知缺陷,技能选择有效断言、夹具与模拟边界,交付测试草稿和缺失覆盖说明。不能只验证 mock 的行为而忽略真实逻辑,也不把覆盖率百分比当成质量保证。运行、安装依赖和写测试需要授权桌面端;私有代码不外发,外部接口优先模拟,是否合并与上线由人根据证据决定。
上游能力依据
上游原始适用说明:Implement comprehensive testing strategies using Jest, Vitest, and Testing Library for unit tests, integration tests, and end-to-end testing with mocking, fixtures, and test-driven development. Use when writing JavaScript/TypeScript tests, setting up test infrastructure, or implementing TDD/BDD workflows.
上游 SKILL.md 主要章节(保留原文标题):
- When to Use This Skill
- Testing Frameworks
- Jest - Full-Featured Testing Framework
- Vitest - Fast, Vite-Native Testing
- Unit Testing Patterns
- Pattern 1: Testing Pure Functions
- Pattern 2: Testing Classes
- Pattern 3: Testing Async Functions
- Mocking Patterns
- Pattern 1: Mocking Modules
使用边界
先复现问题并固定测试范围,再生成或执行测试。测试通过只能证明已覆盖的场景,不能代替生产环境验收。
作者、翻译与许可证
- 原作者
- Seth Hobson(wshobson)与 agents contributors
- 中文翻译
- CEOFans翻译
- 许可证
- MIT
- 上游来源
- https://github.com/wshobson/agents/tree/46891e7e60da0e52baf1050b7b6391b64e84c6d9/plugins/javascript-typescript/skills/javascript-testing-patterns
适用范围
平台:linux、macos、windows;标签:测试与质量、JavaScript 自动化测试、开源技能
安全提示
基础静态扫描不等于绝对安全。技能可能调用命令、浏览器、云服务或本地文件,请在最小权限环境中使用,高风险操作必须人工确认。
如发现侵权、许可证或安全问题,可在本页前台提交投诉,管理员复核后可立即下架。