简体   繁体   English

模板单元测试报告(带有 Jest)损坏

[英]Stencil unit test reporting (with Jest) broken

I am currently struggling to unit test my Stencil code, due to its reporting being broken.由于报告被破坏,我目前正在努力对我的 Stencil 代码进行单元测试。 I found some similar questions, but they all mention the problem that there is no percentage being shown.我发现了一些类似的问题,但他们都提到了没有显示百分比的问题。 Mine is different, where the reporter (also in the HTML) is showing me completely wrong line where eg my conditional expression is not fully tested or line is not being covered by test.我的不同,报告者(也在 HTML 中)向我展示了完全错误的行,例如我的条件表达式没有完全测试或测试没有覆盖行。 On top of that, the code highlighting itself is also completely off course.最重要的是,代码突出显示本身也完全偏离了方向。

The HTML reporter looks like the following: HTML 报告器如下所示:

(|| means it's red highlighted, not covered by test, and (i) means eg if-block is partially covered) (|| 表示它是红色突出显示的,未被测试覆盖,并且 (i) 表示例如 if-block 被部分覆盖)

export class Test {
||  @Prop() input: boolean;
||  const aConst = 'abc';
    let counter = 0;
||
    t(i)estMe(a: number, b: number} {
      if (a > b) {
        ... //code
      } else {
||      ... //code
||    }
    } 
}

I am not sure how this could have happened, I suppose it is due to the version mismatch of Stencil and Jest but I can find no official description whatsoever regarding version compatibilities between them both.我不确定这是怎么发生的,我想这是由于 Stencil 和 Jest 的版本不匹配,但我找不到任何关于它们之间版本兼容性的官方描述。 Does someone have any idea on what might cause it?有人对可能导致它的原因有任何想法吗?

Thanks!谢谢!

This is a known issue in Stencil v2.11.0, and has been fixed but not released yet .这是 Stencil v2.11.0 中的一个已知问题,已修复但尚未发布 The fix will be included in the v2.12.0 release, which will occur on 2021.12.13.该修复将包含在 v2.12.0 版本中,该版本将于 2021.12.13 发布。 Once v2.12.0 is out, please try upgrading and let us know if that works (or not).一旦 v2.12.0 发布,请尝试升级并让我们知道它是否有效(或无效)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM