APP_INITIALIZER contract not honoured with TestBed
- Dominant language
- TypeScript
- Stars
- 101k
- Forks
- 27.5k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 288
Description
## 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
Contributor guide
Research direction
Start by examining the TestBed and APP_INITIALIZER entry points and reproduce the reported promise-based initialization behavior with a minimal test. Done means tests wait for the APP_INITIALIZER promise to resolve before executing, matching the normal application contract.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- angular, typescript
- Domain
- testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100