wechat-miniprogram/miniprogram-simulate

在调用comp.detach()后. jest测试框架 的test函数无效. 报错:NotFoundError: The node to be removed is not a child of this node.

Closed this issue · 4 comments

test("detached周期后,实例取消监控store变化", () => {
comp.detach();
// 报错:NotFoundError: The node to be removed is not a child of this node.

expect(11).toBe(11); // 无意义的代码

});
image

如何测试detached后运行的代码正确性?
是否可以在detach函数中加入回调函数等方法来处理这个问题。当前只要调用了comp.detach。jest直接报错了,后续代码无意义了。

当前被迫解决方案
image

jest 终端截图
image

我这样试了下貌似没有出现你说的问题,有没有具体的 demo?

image image

#110 (comment)

我这样试了下貌似没有出现你说的问题,有没有具体的 demo?

image image

我这样试了下貌似没有出现你说的问题,有没有具体的 demo?

image image

感谢您的回答,我的问题,关闭了