Closed
Description
Description
Angular TestBed is not honoring APP_INITIALIZER contract. This means tests are executed before app initialization is finished. The corresponding Angular issue is this one: angular/angular#24218
In a scenario without testing-library we can easily use a workaround in waiting for the initialization before executing our tests.
await TestBed.get(ApplicationInitStatus).donePromise;
However when using testing-libraries render
function we cannot do so, as the lib immediately renders the component after setting up the TestBed
Proposed solution
Insert the above line after setting up the TestBed here:
https://github.com/testing-library/angular-testing-library/blob/master/projects/testing-library/src/lib/testing-library.ts#L76
I'm happy to create a small PR for that :)