在尝试进行单元测试时遇到错误,我不确定是什么原因。 玩笑测试将正常运行,直到需要从文件中导入功能以进行测试为止。
这是我要运行的笑话测试的一个非常精简的版本,该需求会导致我遇到的错误。
p + scale_y_continuous(trans = "log1p", breaks = c(1, 5, 10, 20))
这是控制台中的错误
//SigninView.test.js
let SigninRouteHandler = require("../../../../../src/js/Modules/Portal/Signin/SigninView");
test('empty passing test', () => {
expect(true).toBe(true);
});
如您所见,它在hyperHTML文件中的某个位置停止。也许这是一个问题吗?
这是错误输出中的代码
$ jest js/ModulesTests/PortalTests/SigninTests/SigninView.test.js
FAIL tests/js/ModulesTests/PortalTests/SigninTests/SigninView.test.js
● Test suite failed to run
TypeError: original.cloneNode is not a function
121 |
122 | render() {
> 123 | return this.html`
| ^
124 | <div class="parts-view-inner" onmouseup="${this.endDragging}">
125 | <div class="" id="sidebar-content-container" data-width=${this.state.sidebarWidth}>
126 | ${CurrentBuildViewComponent}
at setAttribute (node_modules/hyperhtml/cjs/objects/Updates.js:398:32)
at Object.create (node_modules/hyperhtml/cjs/objects/Updates.js:70:22)
at DocumentFragment.upgrade (node_modules/hyperhtml/cjs/hyper/render.js:44:27)
at DocumentFragment.render (node_modules/hyperhtml/cjs/hyper/render.js:30:13)
at PartsView.<anonymous> (node_modules/hyperhtml/cjs/hyper/wire.js:44:13)
at PartsView.render (src/js/Modules/Parts/PartsView.js:123:21)
at PartsView.value (node_modules/hyperhtml/cjs/classes/Component.js:102:36)
at new PartsView (src/js/Modules/Parts/PartsView.js:35:14)
at Object.<anonymous> (src/js/App.js:12:33)
at Object.<anonymous> (src/js/Modules/Portal/Signin/SigninView.js:9:1)
at Object.<anonymous> (tests/js/ModulesTests/PortalTests/SigninTests/SigninView.test.js:2:26)
我可以用开玩笑的方式运行单元测试,唯一遇到问题的时间是当我尝试导入其他这样的文件时。 任何见解将不胜感激!谢谢