I encountered a mysterious bug while executing tests in Angular using jest.
It reads
TypeError: Converting circular structure to JSON --> starting at object with constructor 'Object' | property 'element' -> object with constructor 'Object' | property 'componentProvider' -> object with constructor 'Object' --- property 'parent' closes the circle at stringify ()
or some variation of that error.
I found a fix for this, look at the answer below.