When performing unit tests with Angular, you usually use a ComponentFixture to get a reference of a component. The auto-generated unit-tests from the Angular CLI give you something like the following:
const fixture = TestBed.createComponent(TestComponent);
const component = fixture.debugElement.componentInstance;
However, I can also use the componentInstance property directly on fixture like so:
const fixture = TestBed.createComponent(TestComponent);
const component = fixture.componentInstance; // note that I don't reference `debugElement` here
What's the difference between the two and when should I use one over the other?