• Overview
@angular/core/testing

TestBedStatic

interface

Static methods implemented by the TestBed.

  
    interface TestBedStatic extends TestBed {
}

platform

ngModule

Type<any> | Type<any>[]

initTestEnvironment

void

Initialize the environment for testing with a compiler factory, a PlatformRef, and an angular module. These are common to every test in the suite.

This may only be called once, to set up the common providers for the current test suite on the current platform. If you absolutely need to change the providers, first use resetTestEnvironment.

Test modules and platforms for individual platforms are available from '@angular//testing'.

@paramngModuleType<any> | Type<any>[]
@paramplatformPlatformRef
@paramoptionsTestEnvironmentOptions | undefined
@returnsvoid

resetTestEnvironment

void

Reset the providers for the test injector.

@returnsvoid

resetTestingModule

@returnsTestBed

configureCompiler

void
@paramconfig{ providers?: any[] | undefined; useJit?: boolean | undefined; }
@returnsvoid

configureTestingModule

@parammoduleDefTestModuleMetadata
@returnsTestBed

compileComponents

Promise<any>
@returnsPromise<any>

inject

T
@paramtokenProviderToken<T>
@paramnotFoundValueundefined
@paramoptionsInjectOptions & { optional?: false | undefined; }
@returnsT

inject

T | null
@paramtokenProviderToken<T>
@paramnotFoundValuenull | undefined
@paramoptionsInjectOptions
@returnsT | null

inject

T
@paramtokenProviderToken<T>
@paramnotFoundValueT | undefined
@paramoptionsInjectOptions | undefined
@returnsT

inject

T
@deprecated

use object-based flags (InjectOptions) instead.

@paramtokenProviderToken<T>
@paramnotFoundValueT | undefined
@paramflagsInjectFlags | undefined
@returnsT

inject

T | null
@deprecated

use object-based flags (InjectOptions) instead.

@paramtokenProviderToken<T>
@paramnotFoundValuenull
@paramflagsInjectFlags | undefined
@returnsT | null

get

any
@deprecated

from v9.0.0 use TestBed.inject

@paramtokenProviderToken<T>
@paramnotFoundValueT | undefined
@paramflagsInjectFlags | undefined
@returnsany

get

any
@deprecated

from v9.0.0 use TestBed.inject

@paramtokenany
@paramnotFoundValueany
@returnsany

runInInjectionContext

T

Runs the given function in the EnvironmentInjector context of TestBed.

@paramfn() => T
@returnsT

execute

any
@paramtokensany[]
@paramfnFunction
@paramcontextany
@returnsany

overrideModule

@paramngModuleType<any>
@paramoverrideMetadataOverride<NgModule>
@returnsTestBed

overrideComponent

@paramcomponentType<any>
@returnsTestBed

overrideDirective

@paramdirectiveType<any>
@returnsTestBed

overridePipe

@parampipeType<any>
@paramoverrideMetadataOverride<Pipe>
@returnsTestBed

overrideTemplate

@paramcomponentType<any>
@paramtemplatestring
@returnsTestBed

overrideProvider

Overwrites all providers for the given token with the given provider definition.

@paramtokenany
@paramprovider{ useFactory: Function; deps: any[]; multi?: boolean | undefined; }
@returnsTestBed

overrideProvider

@paramtokenany
@paramprovider{ useValue: any; multi?: boolean | undefined; }
@returnsTestBed

overrideProvider

@paramtokenany
@paramprovider{ useFactory?: Function | undefined; useValue?: any; deps?: any[] | undefined; multi?: boolean | undefined; }
@returnsTestBed

overrideTemplateUsingTestingModule

@paramcomponentType<any>
@paramtemplatestring
@returnsTestBed

createComponent

@paramcomponentType<T>
@returnsComponentFixture<T>

flushEffects

void

Execute any pending effects.

@returnsvoid
Jump to details