Angular unit test fails with error `Browser does not support HTML Canvas Element`

Angular tests are failing for components which do not use gojs diagram directly. I have angular components which use some other component where the gojs diagram is drawn. The unit test for the parent fails by throwing the following error.

Although i have not defined TextBlock directly in orchestration-run-details.component but it still throws this error.
What can be the cause for it?

What is the value of “$” at the moment in which that statement is executed?

The error is resolved. The template where columnText was used was defined like

const columnTemplate = $(Panel, Panel.Horizontal, columnText());

Changing it to a function resolved the error

const columnTemplate = () => $(Panel, Panel.Horizontal, columnText());