Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular unit tests fail, but not locally

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?

like image 255
patiss Avatar asked Jan 21 '21 11:01

patiss


2 Answers

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.

like image 84
Crushnik Avatar answered Nov 03 '22 19:11

Crushnik


Additional here is the corresponding angular github issue.

Using Chrome >= 87 should fix the issue.

like image 20
zerocewl Avatar answered Nov 03 '22 19:11

zerocewl