mcpField
T
testing-reactnative

testing-reactnative

github.com/thebeardedbearsas测试与质量107215 次安装今天更新
代码仓库

关于 testing-reactnative

面向 React Native 0.85+ New Architecture 的测试实践技能,提供组件、原生模块、动画及端到端测试方法。

主要功能

  1. 01用 React Native Testing Library 测试用户行为
  2. 02使用 Jest 和原生模块 mock
  3. 03通过 Maestro 或 Detox 执行端到端测试
  4. 04测试 TurboModules、Fabric 与 Reanimated

适用场景

  1. 01为 React Native 界面编写行为测试
  2. 02为同步 JSI 原生模块配置 mock
  3. 03验证关键用户流程
  4. 04覆盖 Fabric 组件和 Reanimated 动画

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/thebeardedbearsas/claude-craft --skill testing-reactnative

安装后在 Claude Code 中输入/testing-reactnative确认已加载。

详细介绍

测试 React Native 0.85+

此技能提供了使用 New Architecture 测试 React Native 0.85+ 的最佳实践。

核心原则

  • React Native Testing Library (RNTL 14):测试用户行为,而非实现
  • Jest:带有原生模拟的测试运行器
  • Maestro(YAML flows,2.x)或 Detox:用于关键 flows 的 E2E 测试
  • 业务逻辑覆盖率 >= 80%

React Native 0.85+ 的特性

  • TurboModules:模拟同步 JSI 原生模块(无 bridge)
  • Fabric:使用新的渲染架构测试原生组件
  • Reanimated 4.x:使用 useAnimatedStyle 和 worklets 测试动画

参考资料

来源: RN Testing Library、Maestro、Detox

评论

支持 Markdown