填写这份《一分钟调查》,帮我们(开发组)做得更好!去填写Home

@angular/core/testing

Provides infrastructure for testing Angular core functionality.

入口点的导出

ComponentFixture

Fixture for debugging and testing a component.

InjectSetupWrapper
TestBed

Configures and initializes environment for unit testing and provides methods for creating components and services in unit tests.

TestComponentRenderer

An abstract class for inserting the root test component element in a platform independent way.

函数

async

已废弃: use waitForAsync(), (expected removal in v12)

discardPeriodicTasks

Discard all remaining periodic tasks.

fakeAsync

Wraps a function to be executed in the fakeAsync zone:

  • microtasks are manually executed by calling flushMicrotasks(),
  • timers are synchronous, tick() simulates the asynchronous passage of time.
flush

Simulates the asynchronous passage of time for the timers in the fakeAsync zone by draining the macrotask queue until it is empty. The returned value is the milliseconds of time that would have been elapsed.

flushMicrotasks

Flush any pending microtasks.

inject

Allows injecting dependencies in beforeEach() and it().

resetFakeAsyncZone

Clears out the shared fake async zone for a test. To be called in a global beforeEach.

tick

Simulates the asynchronous passage of time for the timers in the fakeAsync zone.

waitForAsync

把一个测试函数包装进一个异步测试区域(Zone)。当该区域中的所有异步调用都已完成时,该测试将会自动完成。 可用于包装 inject调用。

Wraps a test function in an asynchronous test zone. The test will automatically complete when all asynchronous calls within this zone are done. Can be used to wrap an injectcall.

withModule

结构

TestBedStatic

Static methods implemented by the TestBedViewEngine and TestBedRender3

类型

ComponentFixtureAutoDetect
ComponentFixtureNoNgZone
MetadataOverride

Type used for modifications to metadata

TestModuleMetadata
getTestBed

Returns a singleton of the applicable TestBed.