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

@angular/core/testing

Provides infrastructure for testing Angular core functionality.

入口点的导出

Entry point exports

Classes

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.

函数

Functions

async

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

改用 waitForAsync()(将在 v12 中删除)

discardPeriodicTasks

丢弃所有剩余的定期任务。

Discard all remaining periodic tasks.

fakeAsync

包装一个函数,以便在 fakeAsync Zone 中执行:

Wraps a function to be executed in the fakeAsync zone:

flush

通过清空宏任务队列直到其为空,来为 fakeAsync Zone 中的计时器模拟异步时间流逝。返回的值是本应经过的毫秒数。

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

允许在 beforeEach()it() 中注入依赖项。

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

resetFakeAsyncZone

清除共享的伪异步 Zone 以进行测试。在全局 beforeEach 中调用。

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

tick

为 fakeAsync Zone 中的计时器模拟异步时间流逝。

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

waitForAsync

把一个测试函数包装进一个异步测试 Zone。当该 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

结构

Structures

TestBedStatic

TestBedViewEngineTestBedRender3 实现的静态方法

Static methods implemented by the TestBedViewEngine and TestBedRender3

类型

Types

ComponentFixtureAutoDetect
ComponentFixtureNoNgZone
MetadataOverride

用于修改元数据的类型

Type used for modifications to metadata

TestModuleMetadata
getTestBed

返回适用的 TestBed 单例。

Returns a singleton of the applicable TestBed.