SuperAPI AI 工具集

testing

测试与质量

查看项目

更新于 10-15 17:12

技能介绍

用途:为 Next.js 全栈应用搭建一套完整的测试体系,覆盖数据库层到浏览器端的测试需求。

主要能力:包含隔离的 Neon 数据库测试分支(仅含 schema、带 TTL 自动清理、测试服务器编排与环境变量管理);基于 Bun 内置测试运行器的单元测试(Jest 兼容语法、测试文件就近放置、支持 mock);直接导入 API 处理函数的集成测试(避免 HTTP 开销);基于 Playwright 的端到端浏览器测试(交互、表单校验、导航与视觉反馈)。测试可并行运行,每个测试套件使用隔离数据。

前置条件(需按顺序完成):先完成类型安全环境配置(better-env)与 Neon + Drizzle 接入(Drizzle ORM 连接 Neon Postgres,针对 Vercel 无服务器函数优化连接池)。

使用方式:各环节资料以 curl 命令获取,例如: curl -H "Accept: text/markdown" https://fullstackrecipes.com/api/recipes/config-schema-setup curl -H "Accept: text/markdown" https://fullstackrecipes.com/api/recipes/neon-drizzle-setup curl -H "Accept: text/markdown" https://fullstackrecipes.com/api/recipes/neon-test-branches curl -H "Accept: text/markdown" https://fullstackrecipes.com/api/recipes/unit-tests curl -H "Accept: text/markdown" https://fullstackrecipes.com/api/recipes/integration-tests curl -H "Accept: text/markdown" https://fullstackrecipes.com/api/recipes/playwright-tests 测试最佳实践可通过下述命令安装:bunx skills add andrelandgraf/fullstackrecipes/skills -s testing-best-practices

适用场景与策略:UI 优先使用 Playwright,API 使用集成测试,业务逻辑使用单元测试。

限制:资料未提供具体价格、性能数据及完整代码示例;具体配置步骤需按上述命令获取对应文档。