feat: introduce TestBed.overrideProvider
(#16725)
This allows to overwrite all providers for a token, not matter where they were defined. This can be used to test JIT and AOT’ed code in the same way. Design doc: https://docs.google.com/document/d/1VmTkz0EbEVSWfEEWEvQ5sXyQXSCvtMOw4t7pKU-jOwc/edit?usp=sharing
This commit is contained in:
@ -6,7 +6,7 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {APP_INITIALIZER, ApplicationInitStatus} from './application_init';
|
||||
import {ApplicationInitStatus} from './application_init';
|
||||
import {ApplicationRef, ApplicationRef_} from './application_ref';
|
||||
import {APP_ID_RANDOM_PROVIDER} from './application_tokens';
|
||||
import {IterableDiffers, KeyValueDiffers, defaultIterableDiffers, defaultKeyValueDiffers} from './change_detection/change_detection';
|
||||
@ -14,7 +14,6 @@ import {Inject, Optional, SkipSelf} from './di/metadata';
|
||||
import {LOCALE_ID} from './i18n/tokens';
|
||||
import {Compiler} from './linker/compiler';
|
||||
import {NgModule} from './metadata';
|
||||
import {initServicesIfNeeded} from './view/index';
|
||||
|
||||
export function _iterableDiffersFactory() {
|
||||
return defaultIterableDiffers;
|
||||
@ -28,10 +27,6 @@ export function _localeFactory(locale?: string): string {
|
||||
return locale || 'en-US';
|
||||
}
|
||||
|
||||
export function _initViewEngine() {
|
||||
initServicesIfNeeded();
|
||||
}
|
||||
|
||||
/**
|
||||
* This module includes the providers of @angular/core that are needed
|
||||
* to bootstrap components via `ApplicationRef`.
|
||||
@ -52,7 +47,6 @@ export function _initViewEngine() {
|
||||
useFactory: _localeFactory,
|
||||
deps: [[new Inject(LOCALE_ID), new Optional(), new SkipSelf()]]
|
||||
},
|
||||
{provide: APP_INITIALIZER, useValue: _initViewEngine, multi: true},
|
||||
]
|
||||
})
|
||||
export class ApplicationModule {
|
||||
|
Reference in New Issue
Block a user