Skip to content

APP_INITIALIZER contract not honoured with TestBed #24218

Open
@victornoel

Description

@victornoel

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report  
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
[ ] Other... Please describe:

Current behavior

When importing a Module providing a promise-based APP_INITIALIZER into a TestBed, the tests are executed before the promise is fully resolved.

There was an issue for this very problem (#16204) but the reporter closed because he found a workaround.

Expected behavior

The promise of an APP_INITIALIZER should be fully resolved, exactly as when running the application that uses this module normally.

Minimal reproduction of the problem with instructions

Hadn't had the time, but I expect that it should be simple to know if is already implemented or not to behave like expected. If yes, I will produce a repro.

What is the motivation / use case for changing the behavior?

Same contract with tests or real app.

Environment


Angular version: 6.0.7

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: testingIssues related to Angular testing features, such as TestBedfreq1: lowtype: bug/fix

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions