UNPKG

@orchestrator/ngx-testing

Version:
45 lines (44 loc) 1.71 kB
import { CompilerOptions, Injector, StaticProvider, Type } from '@angular/core'; /** * Allows to compile and instantiate any {@link NgModule} * with optional custom {@link Injector} or {@link StaticProvider}s * * _NOTE:_ Compiler is reused between test cases unless `options` are passed - * in which case a new compiler will be created and reused for the current test case * * **Example:** * ```ts * import { NgModule } from '@angular/core'; * * @NgModule({...}) * class MyModule {} * * it('should instantiate MyModule', () => { * const myModule = createModule(MuModule); * expect(myModule instanceof MyModule).toBeTruthy(); * }); * ``` * * For async module compilation use {@link createModuleAsync()} */ export declare function createModule<T>(moduleType: Type<T>, injectorOrProviders?: Injector | StaticProvider[], options?: CompilerOptions[]): import("@angular/core").NgModuleRef<T>; /** * Allows to compile and instantiate any {@link NgModule} * with optional custom {@link Injector} or {@link StaticProvider}s * in asynchronous manner * * Works same as {@link createModule()} but compiles module asynchronously * @see createModule() */ export declare function createModuleAsync<T>(moduleType: Type<T>, injectorOrProviders?: Injector | StaticProvider[], options?: CompilerOptions[]): Promise<import("@angular/core").NgModuleRef<T>>; /** * Allows to reset {@link Compiler} used to compile modules for current test case * created via {@link createModule()} and {@link createModuleAsync()} */ export declare function resetModuleCompiler(): void; /** * @internal * * Used to simulate complete reset inside unit tests */ export declare function _reset(): void;