问题描述
使用 karma-typescript 和使用来自@open-wc/testing-helpers 的fixture 对打字稿网络组件进行单元测试会导致以下错误发生:" Uncaught TypeError: Failed to constructor 'HTMLElement': Please use the 'new ' 运算符,此 DOM 对象构造函数不能作为函数调用。"
export class ButtonComponent extends HTMLElement {....}
let elem: Element = await fixture("<button-component></button-component>");
expect(elem).not.toBeUndefined();
花了很多时间解决一个又一个错误,现在这个。不确定还需要什么才能完成这项工作。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)