test(ivy): update root causes for @angular/core TestBed failures (#27419)
PR Close #27419
This commit is contained in:
parent
f5f323dae0
commit
a1470c94a6
@ -74,7 +74,7 @@ class SomeComponent {
|
||||
return MyModule;
|
||||
}
|
||||
|
||||
fixmeIvy('unknown') &&
|
||||
fixmeIvy('FW-776: Cannot bootstrap as there are still asynchronous initializers running') &&
|
||||
it('should bootstrap a component from a child module',
|
||||
async(inject([ApplicationRef, Compiler], (app: ApplicationRef, compiler: Compiler) => {
|
||||
@Component({
|
||||
@ -103,7 +103,7 @@ class SomeComponent {
|
||||
expect(component.injector.get('hello')).toEqual('component');
|
||||
})));
|
||||
|
||||
fixmeIvy('unknown') &&
|
||||
fixmeIvy('FW-776: Cannot bootstrap as there are still asynchronous initializers running') &&
|
||||
it('should bootstrap a component with a custom selector',
|
||||
async(inject([ApplicationRef, Compiler], (app: ApplicationRef, compiler: Compiler) => {
|
||||
@Component({
|
||||
@ -176,7 +176,8 @@ class SomeComponent {
|
||||
});
|
||||
});
|
||||
|
||||
fixmeIvy('unknown') && it('should be called when a component is bootstrapped',
|
||||
fixmeIvy('FW-776: Cannot bootstrap as there are still asynchronous initializers running') &&
|
||||
it('should be called when a component is bootstrapped',
|
||||
inject([ApplicationRef], (ref: ApplicationRef) => {
|
||||
createRootEl();
|
||||
const compRef = ref.bootstrap(SomeComponent);
|
||||
|
@ -10,9 +10,7 @@ import {AfterContentChecked, AfterContentInit, AfterViewChecked, AfterViewInit,
|
||||
import {Component, Directive} from '@angular/core/src/metadata';
|
||||
import {TestBed, inject} from '@angular/core/testing';
|
||||
import {Log} from '@angular/core/testing/src/testing_internal';
|
||||
import {fixmeIvy} from '@angular/private/testing';
|
||||
|
||||
{
|
||||
describe('directive lifecycle integration spec', () => {
|
||||
let log: Log;
|
||||
|
||||
@ -31,7 +29,6 @@ import {fixmeIvy} from '@angular/private/testing';
|
||||
|
||||
beforeEach(inject([Log], (_log: any) => { log = _log; }));
|
||||
|
||||
fixmeIvy('unknown') &&
|
||||
it('should invoke lifecycle methods ngOnChanges > ngOnInit > ngDoCheck > ngAfterContentChecked',
|
||||
() => {
|
||||
const fixture = TestBed.createComponent(MyComp5);
|
||||
@ -49,7 +46,6 @@ import {fixmeIvy} from '@angular/private/testing';
|
||||
.toEqual('ngDoCheck; ngAfterContentChecked; child_ngDoCheck; ngAfterViewChecked');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Directive({selector: '[lifecycle-dir]'})
|
||||
|
@ -12,11 +12,10 @@ import {TestBed} from '@angular/core/testing';
|
||||
import {expect} from '@angular/platform-browser/testing/src/matchers';
|
||||
import {fixmeIvy} from '@angular/private/testing';
|
||||
|
||||
{
|
||||
describe('forwardRef integration', function() {
|
||||
beforeEach(() => { TestBed.configureTestingModule({imports: [Module], declarations: [App]}); });
|
||||
|
||||
fixmeIvy('unknown') &&
|
||||
fixmeIvy('FW-756: Pipes and directives from imported modules are not taken into account') &&
|
||||
it('should instantiate components which are declared using forwardRef', () => {
|
||||
const a =
|
||||
TestBed.configureTestingModule({schemas: [NO_ERRORS_SCHEMA]}).createComponent(App);
|
||||
@ -25,7 +24,6 @@ import {fixmeIvy} from '@angular/private/testing';
|
||||
expect(TestBed.get(ModuleFrame)).toBeDefined();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@NgModule({
|
||||
imports: [CommonModule],
|
||||
|
@ -13,14 +13,12 @@ import {TestBed} from '@angular/core/testing';
|
||||
import {fixmeIvy} from '@angular/private/testing';
|
||||
|
||||
|
||||
{
|
||||
if (ivyEnabled) {
|
||||
describe('ivy', () => { declareTests(); });
|
||||
} else {
|
||||
describe('jit', () => { declareTests({useJit: true}); });
|
||||
describe('no jit', () => { declareTests({useJit: false}); });
|
||||
}
|
||||
}
|
||||
|
||||
class DummyConsole implements Console {
|
||||
public warnings: string[] = [];
|
||||
|
@ -13,14 +13,12 @@ import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
|
||||
import {expect} from '@angular/platform-browser/testing/src/matchers';
|
||||
import {fixmeIvy, polyfillGoogGetMsg} from '@angular/private/testing';
|
||||
|
||||
{
|
||||
if (ivyEnabled) {
|
||||
describe('ivy', () => { declareTests(); });
|
||||
} else {
|
||||
describe('jit', () => { declareTests({useJit: true}); });
|
||||
describe('no jit', () => { declareTests({useJit: false}); });
|
||||
}
|
||||
}
|
||||
|
||||
function declareTests(config?: {useJit: boolean}) {
|
||||
describe('<ng-container>', function() {
|
||||
|
@ -142,8 +142,8 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
return new ComponentFixture(comp, null !, false);
|
||||
}
|
||||
|
||||
fixmeIvy('FW-682: Compiler error handling') && //
|
||||
describe('errors', () => {
|
||||
fixmeIvy('FW-682: Compiler error handling') &&
|
||||
it('should error when exporting a directive that was neither declared nor imported', () => {
|
||||
@NgModule({exports: [SomeDirective]})
|
||||
class SomeModule {
|
||||
@ -154,6 +154,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
`Can't export directive ${stringify(SomeDirective)} from ${stringify(SomeModule)} as it was neither declared nor imported!`);
|
||||
});
|
||||
|
||||
fixmeIvy('FW-682: Compiler error handling') &&
|
||||
it('should error when exporting a pipe that was neither declared nor imported', () => {
|
||||
@NgModule({exports: [SomePipe]})
|
||||
class SomeModule {
|
||||
@ -164,6 +165,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
`Can't export pipe ${stringify(SomePipe)} from ${stringify(SomeModule)} as it was neither declared nor imported!`);
|
||||
});
|
||||
|
||||
fixmeIvy('FW-682: Compiler error handling') &&
|
||||
it('should error if a directive is declared in more than 1 module', () => {
|
||||
@NgModule({declarations: [SomeDirective]})
|
||||
class Module1 {
|
||||
@ -182,6 +184,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
`You can also create a new NgModule that exports and includes ${stringify(SomeDirective)} then import that NgModule in ${stringify(Module1)} and ${stringify(Module2)}.`);
|
||||
});
|
||||
|
||||
fixmeIvy('FW-682: Compiler error handling') &&
|
||||
it('should error if a directive is declared in more than 1 module also if the module declaring it is imported',
|
||||
() => {
|
||||
@NgModule({declarations: [SomeDirective], exports: [SomeDirective]})
|
||||
@ -199,6 +202,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
`You can also create a new NgModule that exports and includes ${stringify(SomeDirective)} then import that NgModule in ${stringify(Module1)} and ${stringify(Module2)}.`);
|
||||
});
|
||||
|
||||
fixmeIvy('FW-682: Compiler error handling') &&
|
||||
it('should error if a pipe is declared in more than 1 module', () => {
|
||||
@NgModule({declarations: [SomePipe]})
|
||||
class Module1 {
|
||||
@ -217,6 +221,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
`You can also create a new NgModule that exports and includes ${stringify(SomePipe)} then import that NgModule in ${stringify(Module1)} and ${stringify(Module2)}.`);
|
||||
});
|
||||
|
||||
fixmeIvy('FW-682: Compiler error handling') &&
|
||||
it('should error if a pipe is declared in more than 1 module also if the module declaring it is imported',
|
||||
() => {
|
||||
@NgModule({declarations: [SomePipe], exports: [SomePipe]})
|
||||
@ -1048,7 +1053,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
expect(created).toBe(false);
|
||||
});
|
||||
|
||||
fixmeIvy('ngOnDestroy not running') &&
|
||||
fixmeIvy('FW-739: TestBed: destroy on NgModuleRef is not being called') &&
|
||||
it('should support ngOnDestroy on any provider', () => {
|
||||
let destroyed = false;
|
||||
|
||||
@ -1068,7 +1073,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
expect(destroyed).toBe(true);
|
||||
});
|
||||
|
||||
fixmeIvy('ngOnDestroy not running') &&
|
||||
fixmeIvy('FW-739: TestBed: destroy on NgModuleRef is not being called') &&
|
||||
it('should support ngOnDestroy for lazy providers', () => {
|
||||
let created = false;
|
||||
let destroyed = false;
|
||||
@ -1330,7 +1335,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
});
|
||||
|
||||
describe('tree shakable providers', () => {
|
||||
fixmeIvy('providersByKey is not defined') &&
|
||||
fixmeIvy('unknown') &&
|
||||
it('definition should not persist across NgModuleRef instances', () => {
|
||||
@NgModule()
|
||||
class SomeModule {
|
||||
|
@ -12,9 +12,8 @@ import {BrowserModule, By, DOCUMENT} from '@angular/platform-browser';
|
||||
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
|
||||
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
|
||||
import {expect} from '@angular/platform-browser/testing/src/matchers';
|
||||
import {fixmeIvy} from '@angular/private/testing';
|
||||
import {fixmeIvy, modifiedInIvy} from '@angular/private/testing';
|
||||
|
||||
{
|
||||
if (ivyEnabled) {
|
||||
describe('ivy', () => { declareTests(); });
|
||||
} else {
|
||||
@ -23,7 +22,6 @@ import {fixmeIvy} from '@angular/private/testing';
|
||||
}
|
||||
|
||||
declareTestsUsingBootstrap();
|
||||
}
|
||||
|
||||
function declareTests(config?: {useJit: boolean}) {
|
||||
// Place to put reproductions for regressions
|
||||
@ -162,7 +160,6 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
expect(injector.get(token)).toEqual(tokenValue);
|
||||
});
|
||||
|
||||
fixmeIvy('FW-646: Directive providers don\'t support primitive types as DI tokens') &&
|
||||
it('should support providers with string token with a `.` in it', () => {
|
||||
const token = 'a.b';
|
||||
const tokenValue = 1;
|
||||
@ -191,7 +188,6 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
expect(injector.get(token2)).toEqual(tokenValue2);
|
||||
});
|
||||
|
||||
fixmeIvy('FW-646: Directive providers don\'t support primitive types as DI tokens') &&
|
||||
it('should support providers that have a `name` property with a number value', () => {
|
||||
class TestClass {
|
||||
constructor(public name: number) {}
|
||||
@ -337,7 +333,8 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
expect(fixture.debugElement.childNodes.length).toBe(0);
|
||||
});
|
||||
|
||||
fixmeIvy('unknown') && it('should allow empty embedded templates', () => {
|
||||
modifiedInIvy('Comment node order changed') &&
|
||||
it('should allow empty embedded templates', () => {
|
||||
@Component({template: '<ng-template [ngIf]="true"></ng-template>'})
|
||||
class MyComp {
|
||||
}
|
||||
|
@ -1608,7 +1608,6 @@ describe('ViewContainerRef', () => {
|
||||
});
|
||||
}
|
||||
|
||||
fixmeIvy(`Hooks don't run`) &&
|
||||
it('should call all hooks in correct order when creating with createEmbeddedView', () => {
|
||||
function SomeComponent_Template_0(rf: RenderFlags, ctx: any) {
|
||||
if (rf & RenderFlags.Create) {
|
||||
@ -1638,8 +1637,7 @@ describe('ViewContainerRef', () => {
|
||||
template: (rf: RenderFlags, cmp: SomeComponent) => {
|
||||
if (rf & RenderFlags.Create) {
|
||||
template(
|
||||
0, SomeComponent_Template_0, 1, 1, null, [], ['foo', ''],
|
||||
templateRefExtractor);
|
||||
0, SomeComponent_Template_0, 1, 1, null, [], ['foo', ''], templateRefExtractor);
|
||||
element(2, 'hooks', ['vcref', '']);
|
||||
element(3, 'hooks');
|
||||
}
|
||||
@ -1672,8 +1670,7 @@ describe('ViewContainerRef', () => {
|
||||
]);
|
||||
|
||||
log.length = 0;
|
||||
directiveInstance !.vcref.createEmbeddedView(
|
||||
directiveInstance !.tplRef, fixture.component);
|
||||
directiveInstance !.vcref.createEmbeddedView(directiveInstance !.tplRef, fixture.component);
|
||||
expect(fixture.html).toEqual('<hooks vcref="">A</hooks><hooks></hooks><hooks>B</hooks>');
|
||||
expect(log).toEqual([]);
|
||||
|
||||
@ -1682,17 +1679,15 @@ describe('ViewContainerRef', () => {
|
||||
expect(fixture.html).toEqual('<hooks vcref="">A</hooks><hooks>C</hooks><hooks>B</hooks>');
|
||||
expect(log).toEqual([
|
||||
'doCheck-A', 'doCheck-B', 'onChanges-C', 'onInit-C', 'doCheck-C', 'afterContentInit-C',
|
||||
'afterContentChecked-C', 'afterViewInit-C', 'afterViewChecked-C',
|
||||
'afterContentChecked-A', 'afterContentChecked-B', 'afterViewChecked-A',
|
||||
'afterViewChecked-B'
|
||||
'afterContentChecked-C', 'afterViewInit-C', 'afterViewChecked-C', 'afterContentChecked-A',
|
||||
'afterContentChecked-B', 'afterViewChecked-A', 'afterViewChecked-B'
|
||||
]);
|
||||
|
||||
log.length = 0;
|
||||
fixture.update();
|
||||
expect(log).toEqual([
|
||||
'doCheck-A', 'doCheck-B', 'doCheck-C', 'afterContentChecked-C', 'afterViewChecked-C',
|
||||
'afterContentChecked-A', 'afterContentChecked-B', 'afterViewChecked-A',
|
||||
'afterViewChecked-B'
|
||||
'afterContentChecked-A', 'afterContentChecked-B', 'afterViewChecked-A', 'afterViewChecked-B'
|
||||
]);
|
||||
|
||||
log.length = 0;
|
||||
@ -1708,20 +1703,18 @@ describe('ViewContainerRef', () => {
|
||||
fixture.update();
|
||||
expect(log).toEqual([
|
||||
'doCheck-A', 'doCheck-B', 'doCheck-C', 'afterContentChecked-C', 'afterViewChecked-C',
|
||||
'afterContentChecked-A', 'afterContentChecked-B', 'afterViewChecked-A',
|
||||
'afterViewChecked-B'
|
||||
'afterContentChecked-A', 'afterContentChecked-B', 'afterViewChecked-A', 'afterViewChecked-B'
|
||||
]);
|
||||
|
||||
log.length = 0;
|
||||
directiveInstance !.vcref.remove(0);
|
||||
fixture.update();
|
||||
expect(log).toEqual([
|
||||
'onDestroy-C', 'doCheck-A', 'doCheck-B', 'afterContentChecked-A',
|
||||
'afterContentChecked-B', 'afterViewChecked-A', 'afterViewChecked-B'
|
||||
'onDestroy-C', 'doCheck-A', 'doCheck-B', 'afterContentChecked-A', 'afterContentChecked-B',
|
||||
'afterViewChecked-A', 'afterViewChecked-B'
|
||||
]);
|
||||
});
|
||||
|
||||
fixmeIvy(`Hooks don't run`) &&
|
||||
it('should call all hooks in correct order when creating with createComponent', () => {
|
||||
@Component({
|
||||
template: `
|
||||
@ -1780,17 +1773,15 @@ describe('ViewContainerRef', () => {
|
||||
expect(fixture.html).toEqual('<hooks vcref="">A</hooks><hooks>D</hooks><hooks>B</hooks>');
|
||||
expect(log).toEqual([
|
||||
'doCheck-A', 'doCheck-B', 'onChanges-D', 'onInit-D', 'doCheck-D', 'afterContentInit-D',
|
||||
'afterContentChecked-D', 'afterViewInit-D', 'afterViewChecked-D',
|
||||
'afterContentChecked-A', 'afterContentChecked-B', 'afterViewChecked-A',
|
||||
'afterViewChecked-B'
|
||||
'afterContentChecked-D', 'afterViewInit-D', 'afterViewChecked-D', 'afterContentChecked-A',
|
||||
'afterContentChecked-B', 'afterViewChecked-A', 'afterViewChecked-B'
|
||||
]);
|
||||
|
||||
log.length = 0;
|
||||
fixture.update();
|
||||
expect(log).toEqual([
|
||||
'doCheck-A', 'doCheck-B', 'doCheck-D', 'afterContentChecked-D', 'afterViewChecked-D',
|
||||
'afterContentChecked-A', 'afterContentChecked-B', 'afterViewChecked-A',
|
||||
'afterViewChecked-B'
|
||||
'afterContentChecked-A', 'afterContentChecked-B', 'afterViewChecked-A', 'afterViewChecked-B'
|
||||
]);
|
||||
|
||||
log.length = 0;
|
||||
@ -1806,16 +1797,15 @@ describe('ViewContainerRef', () => {
|
||||
fixture.update();
|
||||
expect(log).toEqual([
|
||||
'doCheck-A', 'doCheck-B', 'doCheck-D', 'afterContentChecked-D', 'afterViewChecked-D',
|
||||
'afterContentChecked-A', 'afterContentChecked-B', 'afterViewChecked-A',
|
||||
'afterViewChecked-B'
|
||||
'afterContentChecked-A', 'afterContentChecked-B', 'afterViewChecked-A', 'afterViewChecked-B'
|
||||
]);
|
||||
|
||||
log.length = 0;
|
||||
directiveInstance !.vcref.remove(0);
|
||||
fixture.update();
|
||||
expect(log).toEqual([
|
||||
'onDestroy-D', 'doCheck-A', 'doCheck-B', 'afterContentChecked-A',
|
||||
'afterContentChecked-B', 'afterViewChecked-A', 'afterViewChecked-B'
|
||||
'onDestroy-D', 'doCheck-A', 'doCheck-B', 'afterContentChecked-A', 'afterContentChecked-B',
|
||||
'afterViewChecked-A', 'afterViewChecked-B'
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user