Cookies concent notice

This site uses cookies from Google to deliver its services and to analyze traffic.
Learn more
Skip to main content
This site is no longer updated.Head to Angular.devHome
/

This is the archived documentation for Angular v17. Please visit angular.dev to see this page for the current version of Angular.

TestBedStatic

Static methods implemented by the TestBed.

      
      interface TestBedStatic extends TestBed {
new (...args: any[]): TestBed // inherited from core/testing/TestBed platform: PlatformRef ngModule: Type<any> | Type<any>[]
initTestEnvironment(ngModule: Type<any> | Type<any>[], platform: PlatformRef, options?: TestEnvironmentOptions): void
resetTestEnvironment(): void
resetTestingModule(): TestBed
configureCompiler(config: { providers?: any[]; useJit?: boolean; }): void
configureTestingModule(moduleDef: TestModuleMetadata): TestBed
compileComponents(): Promise<any>
inject<T>(token: ProviderToken<T>, notFoundValue: undefined, options: InjectOptions & { optional?: false; }): T
inject<T>(token: ProviderToken<T>, notFoundValue: null, options: InjectOptions): T | null
inject<T>(token: ProviderToken<T>, notFoundValue?: T, options?: InjectOptions): T
inject<T>(token: ProviderToken<T>, notFoundValue?: T, flags?: InjectFlags): T
inject<T>(token: ProviderToken<T>, notFoundValue: null, flags?: InjectFlags): T | null
get<T>(token: ProviderToken<T>, notFoundValue?: T, flags?: InjectFlags): any
get(token: any, notFoundValue?: any): any
runInInjectionContext<T>(fn: () => T): T
execute(tokens: any[], fn: Function, context?: any): any
overrideModule(ngModule: Type<any>, override: MetadataOverride<NgModule>): TestBed
overrideComponent(component: Type<any>, override: MetadataOverride<Component>): TestBed
overrideDirective(directive: Type<any>, override: MetadataOverride<Directive>): TestBed
overridePipe(pipe: Type<any>, override: MetadataOverride<Pipe>): TestBed
overrideTemplate(component: Type<any>, template: string): TestBed
overrideProvider(token: any, provider: { useFactory: Function; deps: any[]; multi?: boolean; }): TestBed
overrideProvider(token: any, provider: { useValue: any; multi?: boolean; }): TestBed
overrideProvider(token: any, provider: { useFactory?: Function; useValue?: any; deps?: any[]; multi?: boolean; }): TestBed
overrideTemplateUsingTestingModule(component: Type<any>, template: string): TestBed
createComponent<T>(component: Type<T>): ComponentFixture<T>
flushEffects(): void }

Methods

      
      new (...args: any[]): TestBed
    
Parameters
args any[]
Returns

TestBed