角度单元测试失败,但本地失败

编程入门 行业动态 更新时间:2024-10-11 11:17:42
本文介绍了角度单元测试失败,但本地失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

升级到Angular版本11后,单元测试现在在Travis CI上失败.在本地,它们确实可以成功(即使在使用相同节点,nvm和npm版本的全新安装之后).

After upgrading to Angular version 11, unit tests now fail on Travis CI. Locally they do succeed (even after clean install with the same node, nvm and npm versions).

所有单元测试的错误都相同-

The error for all unit tests is the same -

Failed: fn.bind is not a function TypeError: fn.bind is not a function at newTrustedFunctionForJIT (node_modules/@angular/compiler/fesm2015/compiler.js:6845:1) at JitEvaluator.evaluateCode (node_modules/@angular/compiler/fesm2015/compiler.js:6909:1) at JitEvaluator.evaluateStatements (node_modules/@angular/compiler/fesm2015/compiler.js:6883:1)

根据错误消息,我认为该问题可能与ngcc有关?有人遇到过类似的问题吗?

Based on the error message, I would assume that the issue might be related to ngcc? Anyone had similar issue?

推荐答案

今天,我遇到了同样的问题.它涉及使用ChromeHeadless进行测试.

Today I had the same problem. It involved testing with ChromeHeadless.

我在Docker映像中安装了旧版本的Chrome Headless 83.0.4103.97.将其更新到最新版本88.0.4324.96后,它开始工作.

I had old version of Chrome Headless 83.0.4103.97 installed in docker image. After updating it to latest version 88.0.4324.96 it started to work.

更多推荐

角度单元测试失败,但本地失败

本文发布于:2023-10-10 21:55:28,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1479863.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:单元测试   角度

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!