test(upgrade): add diagnosis to failing ivy tests (#27542)

PR Close #27542
This commit is contained in:
Pete Bacon Darwin 2018-12-07 10:49:39 +00:00 committed by Alex Rickabaugh
parent 055dc2d9a2
commit 2a35471abe
1 changed files with 594 additions and 572 deletions

View File

@ -1641,9 +1641,10 @@ withEachNg1Version(() => {
}); });
})); }));
describe('with lifecycle hooks', () => { describe('with life-cycle hooks', () => {
fixmeIvy('unknown').it( fixmeIvy(
'should call `$onInit()` on controller', async(() => { 'FW-812: Life-cycle hooks not correctly wired up for components that return a different instance from their constructor')
.it('should call `$onInit()` on controller', async(() => {
const adapter: UpgradeAdapter = new UpgradeAdapter(forwardRef(() => Ng2Module)); const adapter: UpgradeAdapter = new UpgradeAdapter(forwardRef(() => Ng2Module));
const $onInitSpyA = jasmine.createSpy('$onInitA'); const $onInitSpyA = jasmine.createSpy('$onInitA');
const $onInitSpyB = jasmine.createSpy('$onInitB'); const $onInitSpyB = jasmine.createSpy('$onInitB');
@ -1734,8 +1735,9 @@ withEachNg1Version(() => {
}); });
})); }));
fixmeIvy('unknown').it( fixmeIvy(
'should call `$doCheck()` on controller', async(() => { 'FW-812: Life-cycle hooks not correctly wired up for components that return a different instance from their constructor')
.it('should call `$doCheck()` on controller', async(() => {
const adapter: UpgradeAdapter = new UpgradeAdapter(forwardRef(() => Ng2Module)); const adapter: UpgradeAdapter = new UpgradeAdapter(forwardRef(() => Ng2Module));
const $doCheckSpyA = jasmine.createSpy('$doCheckA'); const $doCheckSpyA = jasmine.createSpy('$doCheckA');
const $doCheckSpyB = jasmine.createSpy('$doCheckB'); const $doCheckSpyB = jasmine.createSpy('$doCheckB');
@ -1844,8 +1846,9 @@ withEachNg1Version(() => {
}); });
})); }));
fixmeIvy('unknown').it( fixmeIvy(
'should call `$postLink()` on controller', async(() => { 'FW-812: Life-cycle hooks not correctly wired up for components that return a different instance from their constructor')
.it('should call `$postLink()` on controller', async(() => {
const adapter: UpgradeAdapter = new UpgradeAdapter(forwardRef(() => Ng2Module)); const adapter: UpgradeAdapter = new UpgradeAdapter(forwardRef(() => Ng2Module));
const $postLinkSpyA = jasmine.createSpy('$postLinkA'); const $postLinkSpyA = jasmine.createSpy('$postLinkA');
const $postLinkSpyB = jasmine.createSpy('$postLinkB'); const $postLinkSpyB = jasmine.createSpy('$postLinkB');
@ -1862,7 +1865,8 @@ withEachNg1Version(() => {
controllerAs: '$ctrl', controllerAs: '$ctrl',
controller: class {$postLink() { $postLinkSpyA(); }} controller: class {$postLink() { $postLinkSpyA(); }}
})) }))
.directive('ng1B', () => ({ .directive(
'ng1B', () => ({
template: '', template: '',
scope: {}, scope: {},
bindToController: false, bindToController: false,
@ -1936,8 +1940,9 @@ withEachNg1Version(() => {
}); });
})); }));
fixmeIvy('unknown').it( fixmeIvy(
'should call `$onChanges()` on binding destination', fakeAsync(() => { 'FW-812: Life-cycle hooks not correctly wired up for components that return a different instance from their constructor')
.it('should call `$onChanges()` on binding destination', fakeAsync(() => {
const adapter: UpgradeAdapter = new UpgradeAdapter(forwardRef(() => Ng2Module)); const adapter: UpgradeAdapter = new UpgradeAdapter(forwardRef(() => Ng2Module));
const $onChangesControllerSpyA = jasmine.createSpy('$onChangesControllerA'); const $onChangesControllerSpyA = jasmine.createSpy('$onChangesControllerA');
const $onChangesControllerSpyB = jasmine.createSpy('$onChangesControllerB'); const $onChangesControllerSpyB = jasmine.createSpy('$onChangesControllerB');
@ -1962,15 +1967,15 @@ withEachNg1Version(() => {
this.$onChanges = $onChangesControllerSpyA; this.$onChanges = $onChangesControllerSpyA;
} }
})) }))
.directive( .directive('ng1B', () => ({
'ng1B',
() => ({
template: '', template: '',
scope: {valB: '<'}, scope: {valB: '<'},
bindToController: false, bindToController: false,
controllerAs: '$ctrl', controllerAs: '$ctrl',
controller: class { controller: class {
$onChanges(changes: SimpleChanges) { $onChangesControllerSpyB(changes); } $onChanges(changes: SimpleChanges) {
$onChangesControllerSpyB(changes);
}
} }
})) }))
.directive('ng2', adapter.downgradeNg2Component(Ng2Component)) .directive('ng2', adapter.downgradeNg2Component(Ng2Component))
@ -2031,8 +2036,9 @@ withEachNg1Version(() => {
}); });
})); }));
fixmeIvy('unknown').it( fixmeIvy(
'should call `$onDestroy()` on controller', fakeAsync(() => { 'FW-812: Life-cycle hooks not correctly wired up for components that return a different instance from their constructor')
.it('should call `$onDestroy()` on controller', fakeAsync(() => {
const adapter: UpgradeAdapter = new UpgradeAdapter(forwardRef(() => Ng2Module)); const adapter: UpgradeAdapter = new UpgradeAdapter(forwardRef(() => Ng2Module));
const $onDestroySpyA = jasmine.createSpy('$onDestroyA'); const $onDestroySpyA = jasmine.createSpy('$onDestroyA');
const $onDestroySpyB = jasmine.createSpy('$onDestroyB'); const $onDestroySpyB = jasmine.createSpy('$onDestroyB');
@ -2064,7 +2070,8 @@ withEachNg1Version(() => {
controllerAs: '$ctrl', controllerAs: '$ctrl',
controller: class {$onDestroy() { $onDestroySpyA(); }} controller: class {$onDestroy() { $onDestroySpyA(); }}
})) }))
.directive('ng1B', () => ({ .directive(
'ng1B', () => ({
template: '', template: '',
scope: {}, scope: {},
bindToController: false, bindToController: false,
@ -2122,8 +2129,9 @@ withEachNg1Version(() => {
}); });
})); }));
fixmeIvy('unknown').it( fixmeIvy(
'should not call `$onDestroy()` on scope', fakeAsync(() => { 'FW-812: Life-cycle hooks not correctly wired up for components that return a different instance from their constructor')
.it('should not call `$onDestroy()` on scope', fakeAsync(() => {
const adapter: UpgradeAdapter = new UpgradeAdapter(forwardRef(() => Ng2Module)); const adapter: UpgradeAdapter = new UpgradeAdapter(forwardRef(() => Ng2Module));
const $onDestroySpy = jasmine.createSpy('$onDestroy'); const $onDestroySpy = jasmine.createSpy('$onDestroy');
let ng2ComponentInstance: Ng2Component; let ng2ComponentInstance: Ng2Component;
@ -2153,7 +2161,8 @@ withEachNg1Version(() => {
bindToController: true, bindToController: true,
controllerAs: '$ctrl', controllerAs: '$ctrl',
controller: function($scope: angular.IScope) { controller: function($scope: angular.IScope) {
Object.getPrototypeOf($scope).$onDestroy = $onDestroySpy; Object.getPrototypeOf($scope).$onDestroy =
$onDestroySpy;
} }
})) }))
.directive('ng1B', () => ({ .directive('ng1B', () => ({
@ -2446,8 +2455,9 @@ withEachNg1Version(() => {
}); });
describe('linking', () => { describe('linking', () => {
fixmeIvy('unknown').it( fixmeIvy(
'should run the pre-linking after instantiating the controller', async(() => { 'FW-812: Life-cycle hooks not correctly wired up for components that return a different instance from their constructor')
.it('should run the pre-linking after instantiating the controller', async(() => {
const adapter: UpgradeAdapter = new UpgradeAdapter(forwardRef(() => Ng2Module)); const adapter: UpgradeAdapter = new UpgradeAdapter(forwardRef(() => Ng2Module));
const log: string[] = []; const log: string[] = [];
@ -2464,7 +2474,8 @@ withEachNg1Version(() => {
} }
// Define `ng1Module` // Define `ng1Module`
const ng1Module = angular.module('ng1', []) const ng1Module =
angular.module('ng1', [])
.directive('ng1', () => ng1Directive) .directive('ng1', () => ng1Directive)
.directive('ng2', adapter.downgradeNg2Component(Ng2Component)); .directive('ng2', adapter.downgradeNg2Component(Ng2Component));
@ -2484,8 +2495,9 @@ withEachNg1Version(() => {
}); });
})); }));
fixmeIvy('unknown').it( fixmeIvy(
'should run the pre-linking function before linking', async(() => { 'FW-812: Life-cycle hooks not correctly wired up for components that return a different instance from their constructor')
.it('should run the pre-linking function before linking', async(() => {
const adapter: UpgradeAdapter = new UpgradeAdapter(forwardRef(() => Ng2Module)); const adapter: UpgradeAdapter = new UpgradeAdapter(forwardRef(() => Ng2Module));
const log: string[] = []; const log: string[] = [];
@ -2503,7 +2515,8 @@ withEachNg1Version(() => {
} }
// Define `ng1Module` // Define `ng1Module`
const ng1Module = angular.module('ng1', []) const ng1Module =
angular.module('ng1', [])
.directive('ng1A', () => ng1DirectiveA) .directive('ng1A', () => ng1DirectiveA)
.directive('ng1B', () => ng1DirectiveB) .directive('ng1B', () => ng1DirectiveB)
.directive('ng2', adapter.downgradeNg2Component(Ng2Component)); .directive('ng2', adapter.downgradeNg2Component(Ng2Component));
@ -2525,8 +2538,9 @@ withEachNg1Version(() => {
}); });
})); }));
fixmeIvy('unknown').it( fixmeIvy(
'should run the post-linking function after linking (link: object)', async(() => { 'FW-812: Life-cycle hooks not correctly wired up for components that return a different instance from their constructor')
.it('should run the post-linking function after linking (link: object)', async(() => {
const adapter: UpgradeAdapter = new UpgradeAdapter(forwardRef(() => Ng2Module)); const adapter: UpgradeAdapter = new UpgradeAdapter(forwardRef(() => Ng2Module));
const log: string[] = []; const log: string[] = [];
@ -2544,7 +2558,8 @@ withEachNg1Version(() => {
} }
// Define `ng1Module` // Define `ng1Module`
const ng1Module = angular.module('ng1', []) const ng1Module =
angular.module('ng1', [])
.directive('ng1A', () => ng1DirectiveA) .directive('ng1A', () => ng1DirectiveA)
.directive('ng1B', () => ng1DirectiveB) .directive('ng1B', () => ng1DirectiveB)
.directive('ng2', adapter.downgradeNg2Component(Ng2Component)); .directive('ng2', adapter.downgradeNg2Component(Ng2Component));
@ -2566,8 +2581,9 @@ withEachNg1Version(() => {
}); });
})); }));
fixmeIvy('unknown').it( fixmeIvy(
'should run the post-linking function after linking (link: function)', async(() => { 'FW-812: Life-cycle hooks not correctly wired up for components that return a different instance from their constructor')
.it('should run the post-linking function after linking (link: function)', async(() => {
const adapter: UpgradeAdapter = new UpgradeAdapter(forwardRef(() => Ng2Module)); const adapter: UpgradeAdapter = new UpgradeAdapter(forwardRef(() => Ng2Module));
const log: string[] = []; const log: string[] = [];
@ -2585,7 +2601,8 @@ withEachNg1Version(() => {
} }
// Define `ng1Module` // Define `ng1Module`
const ng1Module = angular.module('ng1', []) const ng1Module =
angular.module('ng1', [])
.directive('ng1A', () => ng1DirectiveA) .directive('ng1A', () => ng1DirectiveA)
.directive('ng1B', () => ng1DirectiveB) .directive('ng1B', () => ng1DirectiveB)
.directive('ng2', adapter.downgradeNg2Component(Ng2Component)); .directive('ng2', adapter.downgradeNg2Component(Ng2Component));
@ -2607,8 +2624,9 @@ withEachNg1Version(() => {
}); });
})); }));
fixmeIvy('unknown').it( fixmeIvy(
'should run the post-linking function before `$postLink`', async(() => { 'FW-812: Life-cycle hooks not correctly wired up for components that return a different instance from their constructor')
.it('should run the post-linking function before `$postLink`', async(() => {
const adapter: UpgradeAdapter = new UpgradeAdapter(forwardRef(() => Ng2Module)); const adapter: UpgradeAdapter = new UpgradeAdapter(forwardRef(() => Ng2Module));
const log: string[] = []; const log: string[] = [];
@ -2625,7 +2643,8 @@ withEachNg1Version(() => {
} }
// Define `ng1Module` // Define `ng1Module`
const ng1Module = angular.module('ng1', []) const ng1Module =
angular.module('ng1', [])
.directive('ng1', () => ng1Directive) .directive('ng1', () => ng1Directive)
.directive('ng2', adapter.downgradeNg2Component(Ng2Component)); .directive('ng2', adapter.downgradeNg2Component(Ng2Component));
@ -3096,14 +3115,16 @@ withEachNg1Version(() => {
})); }));
}); });
fixmeIvy('unknown').it( fixmeIvy(
'should bind input properties (<) of components', async(() => { 'FW-812: Life-cycle hooks not correctly wired up for components that return a different instance from their constructor')
.it('should bind input properties (<) of components', async(() => {
const adapter: UpgradeAdapter = new UpgradeAdapter(forwardRef(() => Ng2Module)); const adapter: UpgradeAdapter = new UpgradeAdapter(forwardRef(() => Ng2Module));
const ng1Module = angular.module('ng1', []); const ng1Module = angular.module('ng1', []);
const ng1 = { const ng1 = {
bindings: {personProfile: '<'}, bindings: {personProfile: '<'},
template: 'Hello {{$ctrl.personProfile.firstName}} {{$ctrl.personProfile.lastName}}', template:
'Hello {{$ctrl.personProfile.firstName}} {{$ctrl.personProfile.lastName}}',
controller: class {} controller: class {}
}; };
ng1Module.component('ng1', ng1); ng1Module.component('ng1', ng1);
@ -3129,8 +3150,9 @@ withEachNg1Version(() => {
}); });
})); }));
fixmeIvy('unknown').it( fixmeIvy(
'should support ng2 > ng1 > ng2', async(() => { 'FW-812: Life-cycle hooks not correctly wired up for components that return a different instance from their constructor')
.it('should support ng2 > ng1 > ng2', async(() => {
const adapter: UpgradeAdapter = new UpgradeAdapter(forwardRef(() => Ng2Module)); const adapter: UpgradeAdapter = new UpgradeAdapter(forwardRef(() => Ng2Module));
const ng1Module = angular.module('ng1', []); const ng1Module = angular.module('ng1', []);