【发布时间】:2020-09-10 19:32:04
【问题描述】:
我正在尝试使用 lit-html 创建一个空白项目,例如模板。我还想添加一些测试功能,所以我一直在尝试让它与 Karma 一起使用。
我可以运行正常的测试,比如添加,没有任何错误,所以我认为 Karma 本身运行正常。但我无法运行任何涉及 webcomponent 的测试。 我无法导入网络组件!
我正在导出 web 组件:
export default class MyComponent ...
然后在测试文件上我将其导入:
import MyComponent from 'pathToComponent/MyComponent'
当我运行测试时,我得到:
Error loading test file: /test/example.test.js
TypeError: Failed to fetch dynamically imported module: http://localhost:9876/base/test/example.test.js
我在 github repo 上有它:https://github.com/boguz/rollup-lit-redux,所以如果您需要查看我安装了哪些其他软件包,可以更好地查看。
非常感谢任何帮助。谢谢!
【问题讨论】:
标签: javascript karma-runner web-component lit-element web-component-tester