Francesco Borzi
Francesco Borzi

Reputation: 61994

TypeError: Cannot read properties of undefined (reading 'reRenderOnLangChange')

In my Angular project, my unit tests fail with the following error:

TypeError: Cannot read properties of undefined (reading 'reRenderOnLangChange') at shouldListenToLangChanges (node_modules/@ngneat/transloco/fesm2022/ngneat-transloco.mjs:385:33) at TranslocoPipe.transform (node_modules/@ngneat/transloco/fesm2022/ngneat-transloco.mjs:1313:36) at ɵɵpipeBind1 (node_modules/@angular/core/fesm2022/core.mjs:27718:22) at templateFn (ng:///DocumentToPrintRowComponent.js:68:34) at executeTemplate (node_modules/@angular/core/fesm2022/core.mjs:12159:9) at refreshView (node_modules/@angular/core/fesm2022/core.mjs:13392:13) at detectChangesInView (node_modules/@angular/core/fesm2022/core.mjs:13617:9) at detectChangesInViewIfAttached (node_modules/@angular/core/fesm2022/core.mjs:13580:5) at detectChangesInComponent (node_modules/@angular/core/fesm2022/core.mjs:13569:5) at detectChangesInChildComponents (node_modules/@angular/core/fesm2022/core.mjs:13630:9)

Upvotes: 0

Views: 480

Answers (1)

Francesco Borzi
Francesco Borzi

Reputation: 61994

I fixed the problem by importing the TranslocoTestingModule to my tests' setup.

More info about this module here: https://jsverse.github.io/transloco/docs/unit-testing

Upvotes: 1

Related Questions