Angular unit tests fail, but not locally

 ̄綄美尐妖づ 提交于 2021-02-05 06:13:08

问题


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)

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


回答1:


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

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.




回答2:


Additional here is the corresponding angular github issue.

Using Chrome >= 87 should fix the issue.



来源:https://stackoverflow.com/questions/65826615/angular-unit-tests-fail-but-not-locally

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!