W3cubDocs

/Angular

TestBedStatic

interface

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
  get<T>(token: ProviderToken<T>, notFoundValue?: T, flags?: InjectFlags): 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
  overrideTemplateUsingTestingModule(component: Type<any>, template: string): TestBed
  createComponent<T>(component: Type<T>): ComponentFixture<T>
}

Methods

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

Parameters
args any[]
Returns

TestBed

© 2010–2023 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://angular.io/api/core/testing/TestBedStatic