test(ivy): update root causes for @angular/core TestBed failures (#27419)
PR Close #27419
This commit is contained in:

committed by
Igor Minar

parent
f5f323dae0
commit
a1470c94a6
@ -13,13 +13,11 @@ 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}); });
|
||||
}
|
||||
if (ivyEnabled) {
|
||||
describe('ivy', () => { declareTests(); });
|
||||
} else {
|
||||
describe('jit', () => { declareTests({useJit: true}); });
|
||||
describe('no jit', () => { declareTests({useJit: false}); });
|
||||
}
|
||||
|
||||
class DummyConsole implements Console {
|
||||
|
@ -13,13 +13,11 @@ 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}); });
|
||||
}
|
||||
if (ivyEnabled) {
|
||||
describe('ivy', () => { declareTests(); });
|
||||
} else {
|
||||
describe('jit', () => { declareTests({useJit: true}); });
|
||||
describe('no jit', () => { declareTests({useJit: false}); });
|
||||
}
|
||||
|
||||
function declareTests(config?: {useJit: boolean}) {
|
||||
|
@ -142,8 +142,8 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
return new ComponentFixture(comp, null !, false);
|
||||
}
|
||||
|
||||
fixmeIvy('FW-682: Compiler error handling') && //
|
||||
describe('errors', () => {
|
||||
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]})
|
||||
@ -234,7 +239,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)}.`);
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
describe('schemas', () => {
|
||||
fixmeIvy('FW-682: Compiler error handling') &&
|
||||
@ -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,19 +12,17 @@ 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 {
|
||||
describe('jit', () => { declareTests({useJit: true}); });
|
||||
describe('no jit', () => { declareTests({useJit: false}); });
|
||||
}
|
||||
|
||||
declareTestsUsingBootstrap();
|
||||
if (ivyEnabled) {
|
||||
describe('ivy', () => { declareTests(); });
|
||||
} else {
|
||||
describe('jit', () => { declareTests({useJit: true}); });
|
||||
describe('no jit', () => { declareTests({useJit: false}); });
|
||||
}
|
||||
|
||||
declareTestsUsingBootstrap();
|
||||
|
||||
function declareTests(config?: {useJit: boolean}) {
|
||||
// Place to put reproductions for regressions
|
||||
describe('regressions', () => {
|
||||
@ -162,14 +160,13 @@ 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;
|
||||
const injector = createInjector([{provide: token, useValue: tokenValue}]);
|
||||
it('should support providers with string token with a `.` in it', () => {
|
||||
const token = 'a.b';
|
||||
const tokenValue = 1;
|
||||
const injector = createInjector([{provide: token, useValue: tokenValue}]);
|
||||
|
||||
expect(injector.get(token)).toEqual(tokenValue);
|
||||
});
|
||||
expect(injector.get(token)).toEqual(tokenValue);
|
||||
});
|
||||
|
||||
it('should support providers with an anonymous function as token', () => {
|
||||
const token = () => true;
|
||||
@ -191,15 +188,14 @@ 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) {}
|
||||
}
|
||||
const data = [new TestClass(1), new TestClass(2)];
|
||||
const injector = createInjector([{provide: 'someToken', useValue: data}]);
|
||||
expect(injector.get('someToken')).toEqual(data);
|
||||
});
|
||||
it('should support providers that have a `name` property with a number value', () => {
|
||||
class TestClass {
|
||||
constructor(public name: number) {}
|
||||
}
|
||||
const data = [new TestClass(1), new TestClass(2)];
|
||||
const injector = createInjector([{provide: 'someToken', useValue: data}]);
|
||||
expect(injector.get('someToken')).toEqual(data);
|
||||
});
|
||||
|
||||
describe('ANALYZE_FOR_ENTRY_COMPONENTS providers', () => {
|
||||
|
||||
@ -337,21 +333,22 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
expect(fixture.debugElement.childNodes.length).toBe(0);
|
||||
});
|
||||
|
||||
fixmeIvy('unknown') && it('should allow empty embedded templates', () => {
|
||||
@Component({template: '<ng-template [ngIf]="true"></ng-template>'})
|
||||
class MyComp {
|
||||
}
|
||||
modifiedInIvy('Comment node order changed') &&
|
||||
it('should allow empty embedded templates', () => {
|
||||
@Component({template: '<ng-template [ngIf]="true"></ng-template>'})
|
||||
class MyComp {
|
||||
}
|
||||
|
||||
const fixture =
|
||||
TestBed.configureTestingModule({declarations: [MyComp]}).createComponent(MyComp);
|
||||
fixture.detectChanges();
|
||||
const fixture =
|
||||
TestBed.configureTestingModule({declarations: [MyComp]}).createComponent(MyComp);
|
||||
fixture.detectChanges();
|
||||
|
||||
// Note: We always need to create at least a comment in an embedded template,
|
||||
// so we can append other templates after it.
|
||||
// 1 comment for the anchor,
|
||||
// 1 comment for the empty embedded template.
|
||||
expect(fixture.debugElement.childNodes.length).toBe(2);
|
||||
});
|
||||
// Note: We always need to create at least a comment in an embedded template,
|
||||
// so we can append other templates after it.
|
||||
// 1 comment for the anchor,
|
||||
// 1 comment for the empty embedded template.
|
||||
expect(fixture.debugElement.childNodes.length).toBe(2);
|
||||
});
|
||||
});
|
||||
|
||||
fixmeIvy('unknown') &&
|
||||
|
Reference in New Issue
Block a user