refactor(testing): introduce new testing api to support ng modules
BREAKING CHANGE: - deprecations: * `withProviders`, use `TestBed.withModule` instead * `addProviders`, use `TestBed.configureTestingModule` instead * `TestComponentBuilder`, use `TestBed.configureTestModule` / `TestBed.override...` / `TestBed.createComponent` instead. Closes #10354
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
|
||||
import {UrlResolver, XHR} from '@angular/compiler';
|
||||
import {Component} from '@angular/core';
|
||||
import {TestComponentBuilder, configureCompiler, fakeAsync, flushMicrotasks, tick} from '@angular/core/testing';
|
||||
import {TestBed, TestComponentBuilder, fakeAsync, flushMicrotasks, tick} from '@angular/core/testing';
|
||||
import {AsyncTestCompleter, beforeEach, beforeEachProviders, ddescribe, describe, iit, inject, it, xit} from '@angular/core/testing/testing_internal';
|
||||
import {expect} from '@angular/platform-browser/testing/matchers';
|
||||
|
||||
@ -26,7 +26,7 @@ export function main() {
|
||||
return new CachedXHR();
|
||||
}
|
||||
beforeEach(() => {
|
||||
configureCompiler({
|
||||
TestBed.configureCompiler({
|
||||
providers: [
|
||||
{provide: UrlResolver, useClass: TestUrlResolver},
|
||||
{provide: XHR, useFactory: createCachedXHR}
|
||||
|
@ -9,7 +9,7 @@
|
||||
import {CompilerConfig, DirectiveResolver, NgModuleResolver, analyzeAppProvidersForDeprecatedConfiguration} from '@angular/compiler';
|
||||
import {OverridingTestComponentBuilder, platformCoreDynamicTesting} from '@angular/compiler/testing';
|
||||
import {Compiler, CompilerFactory, CompilerOptions, NgModule, PlatformRef, Provider, ReflectiveInjector, Type, createPlatform, createPlatformFactory} from '@angular/core';
|
||||
import {TestComponentBuilder, TestComponentRenderer, initTestEnvironment} from '@angular/core/testing';
|
||||
import {TestBed, TestComponentBuilder, TestComponentRenderer} from '@angular/core/testing';
|
||||
import {BrowserTestingModule, platformBrowserTesting} from '@angular/platform-browser/testing';
|
||||
|
||||
import {Console} from './core_private';
|
||||
@ -62,7 +62,7 @@ export const TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS: Array<any /*Type | Provide
|
||||
class DynamicTestModule {
|
||||
}
|
||||
|
||||
const testInjector = initTestEnvironment(DynamicTestModule, platformRef);
|
||||
const testInjector = TestBed.initTestEnvironment(DynamicTestModule, platformRef);
|
||||
const console: Console = testInjector.get(Console);
|
||||
deprecatedConfiguration.deprecationMessages.forEach((msg) => console.warn(msg));
|
||||
}];
|
||||
|
Reference in New Issue
Block a user