Skip to content
Weapp-vite
Search
⌘
Ctrl
K
Main Navigation
指引
教程
配置
Wevu
Wevu API
Wpi
周边包
AI
社区
迁移
博客
Appearance
Menu
Return to top
本页目录
Are you an LLM? You can read better optimized documentation at /handbook/wevu/testing.md for this page in Markdown format
测试与 Mock
Copy page
本章你会学到什么
在非小程序环境(Vitest/Node)里如何测试 Wevu 逻辑
需要 stub 哪些全局(
Component
、
triggerEvent
等)
最小原则
业务逻辑尽量下沉到纯函数/composable/service:脱离小程序也能测
依赖
Component()
的部分,在测试中 stub 全局并验证调用参数
相关链接
Wevu 运行时提示(Node 环境需要 stub):
/wevu/runtime#defineComponent:注册页面组件