Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用comp.triggerLifeTime('ready')或者其他功能时,微信官方api(非wx.xxx)无法成功调用 #103

Closed
dengfenglai0212 opened this issue Jan 30, 2023 · 3 comments

Comments

@dengfenglai0212
Copy link

dengfenglai0212 commented Jan 30, 2023

如业务侧在ready的生命周期中使用 getCurrentPages()等微信api时,测试不会顺利进行。
image
请问是缺少某些配置么? 因为小程序项目中不可避免使用微信官方api(非wx.xxx),感觉不应该不支持才对..

@dengfenglai0212 dengfenglai0212 changed the title 使用comp.triggerLifeTime('ready')或者其他功能时,微信官方api无法成功调用 使用comp.triggerLifeTime('ready')或者其他功能时,微信官方api(非wx.xxx)无法成功调用 Jan 30, 2023
@JuneAndGreen
Copy link
Contributor

JuneAndGreen commented Jan 30, 2023

这是只针对第三方自定义组件的单测,也就是提供了一个组件系统,跑在非微信环境,所有的 wx 等官方特有接口需要自己模拟返回。完整小程序的测试,可使用小程序自动化方案:https://developers.weixin.qq.com/miniprogram/dev/devtools/auto/ 或者使用云测的自定义测试方案:https://developers.weixin.qq.com/miniprogram/dev/devtools/minitest/

@dengfenglai0212
Copy link
Author

dengfenglai0212 commented Jan 30, 2023

这是只针对第三方自定义组件的单测,也就是提供了一个组件系统,跑在非微信环境,所有的 wx 等官方特有接口需要自己模拟返回。完整小程序的测试,可使用小程序自动化方案:https://developers.weixin.qq.com/miniprogram/dev/devtools/auto/ 或者使用云测的自定义测试方案:https://developers.weixin.qq.com/miniprogram/dev/devtools/minitest/

看到了文档中针对wx.xxx的自定义返回,但是非wx的官方接口模拟可以给个简单的例子吗?

@JuneAndGreen
Copy link
Contributor

这是只针对第三方自定义组件的单测,也就是提供了一个组件系统,跑在非微信环境,所有的 wx 等官方特有接口需要自己模拟返回。完整小程序的测试,可使用小程序自动化方案:https://developers.weixin.qq.com/miniprogram/dev/devtools/auto/ 或者使用云测的自定义测试方案:https://developers.weixin.qq.com/miniprogram/dev/devtools/minitest/

看到了文档中针对wx.xxx的自定义返回,但是非wx的官方接口模拟可以给个简单的例子吗?

跟 wx 一样,你挂在 global 上就行。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants