Skip to content

Commit 53e4e0c

Browse files
mheverykara
authored andcommitted
fix(ivy): Enable AoT tests to run on CI; disable failing tests (angular#26975)
PR Close angular#26975
1 parent 5e769d9 commit 53e4e0c

22 files changed

+73
-53
lines changed

packages/core/src/render3/context_discovery.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,9 @@ function findViaDirective(lViewData: LViewData, directiveInstance: {}): number {
258258
}
259259

260260
function assertDomElement(element: any) {
261-
assertEqual(element.nodeType, 1, 'The provided value must be an instance of an HTMLElement');
261+
assertEqual(
262+
element && (element.nodeType == Node.ELEMENT_NODE || element.nodeType == Node.TEXT_NODE),
263+
true, 'The provided value must be an instance of an HTMLElement');
262264
}
263265

264266
/**

packages/core/test/BUILD.bazel

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,13 @@ ts_library(
4545
"//packages/core/testing",
4646
"//packages/platform-server",
4747
"//packages/platform-server/testing",
48+
"//packages/private/testing",
4849
],
4950
)
5051

5152
jasmine_node_test(
5253
name = "test",
5354
bootstrap = ["angular/tools/testing/init_node_spec.js"],
54-
tags = [
55-
"fixme-ivy-aot",
56-
],
5755
deps = [
5856
":test_lib",
5957
":test_node_only_lib",

packages/core/test/application_init_spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88
import {Injector} from '@angular/core';
9-
import {APP_INITIALIZER, ApplicationInitStatus} from '../src/application_init';
9+
import {APP_INITIALIZER, ApplicationInitStatus} from '@angular/core/src/application_init';
1010
import {TestBed, async, inject} from '../testing';
1111

1212
{

packages/core/test/application_ref_integration_spec.ts

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import {ApplicationRef, Component, DoCheck, NgModule, OnInit, TestabilityRegistry, ɵivyEnabled as ivyEnabled} from '@angular/core';
1010
import {getTestBed} from '@angular/core/testing';
1111
import {BrowserModule} from '@angular/platform-browser';
12-
import {withBody} from '@angular/private/testing';
12+
import {fixmeIvy, withBody} from '@angular/private/testing';
1313

1414
import {NgModuleFactory} from '../src/render3/ng_module_ref';
1515

@@ -35,23 +35,26 @@ ivyEnabled && describe('ApplicationRef bootstrap', () => {
3535
class MyAppModule {
3636
}
3737

38-
it('should bootstrap hello world', withBody('<hello-world></hello-world>', async() => {
39-
const MyAppModuleFactory = new NgModuleFactory(MyAppModule);
40-
const moduleRef =
41-
await getTestBed().platform.bootstrapModuleFactory(MyAppModuleFactory, {ngZone: 'noop'});
42-
const appRef = moduleRef.injector.get(ApplicationRef);
43-
const helloWorldComponent = appRef.components[0].instance as HelloWorldComponent;
44-
expect(document.body.innerHTML).toEqual('<hello-world><div>Hello World</div></hello-world>');
45-
expect(helloWorldComponent.log).toEqual(['OnInit', 'DoCheck']);
46-
47-
helloWorldComponent.name = 'Mundo';
48-
appRef.tick();
49-
expect(document.body.innerHTML).toEqual('<hello-world><div>Hello Mundo</div></hello-world>');
50-
expect(helloWorldComponent.log).toEqual(['OnInit', 'DoCheck', 'DoCheck']);
51-
52-
// Cleanup TestabilityRegistry
53-
const registry: TestabilityRegistry = getTestBed().get(TestabilityRegistry);
54-
registry.unregisterAllApplications();
55-
}));
38+
fixmeIvy('unknown') &&
39+
it('should bootstrap hello world', withBody('<hello-world></hello-world>', async() => {
40+
const MyAppModuleFactory = new NgModuleFactory(MyAppModule);
41+
const moduleRef = await getTestBed().platform.bootstrapModuleFactory(
42+
MyAppModuleFactory, {ngZone: 'noop'});
43+
const appRef = moduleRef.injector.get(ApplicationRef);
44+
const helloWorldComponent = appRef.components[0].instance as HelloWorldComponent;
45+
expect(document.body.innerHTML)
46+
.toEqual('<hello-world><div>Hello World</div></hello-world>');
47+
expect(helloWorldComponent.log).toEqual(['OnInit', 'DoCheck']);
48+
49+
helloWorldComponent.name = 'Mundo';
50+
appRef.tick();
51+
expect(document.body.innerHTML)
52+
.toEqual('<hello-world><div>Hello Mundo</div></hello-world>');
53+
expect(helloWorldComponent.log).toEqual(['OnInit', 'DoCheck', 'DoCheck']);
54+
55+
// Cleanup TestabilityRegistry
56+
const registry: TestabilityRegistry = getTestBed().get(TestabilityRegistry);
57+
registry.unregisterAllApplications();
58+
}));
5659

5760
});

packages/core/test/application_ref_spec.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
1515
import {DOCUMENT} from '@angular/platform-browser/src/dom/dom_tokens';
1616
import {dispatchEvent} from '@angular/platform-browser/testing/src/browser_util';
1717
import {expect} from '@angular/platform-browser/testing/src/matchers';
18+
import {fixmeIvy} from '@angular/private/testing';
19+
1820
import {NoopNgZone} from '../src/zone/ng_zone';
1921
import {ComponentFixtureNoNgZone, TestBed, async, inject, withModule} from '../testing';
2022

@@ -23,7 +25,7 @@ class SomeComponent {
2325
}
2426

2527
{
26-
describe('bootstrap', () => {
28+
fixmeIvy('unknown') && describe('bootstrap', () => {
2729
let mockConsole: MockConsole;
2830

2931
beforeEach(() => { mockConsole = new MockConsole(); });
@@ -446,7 +448,7 @@ class SomeComponent {
446448
});
447449
});
448450

449-
describe('AppRef', () => {
451+
fixmeIvy('unknown') && describe('AppRef', () => {
450452
@Component({selector: 'sync-comp', template: `<span>{{text}}</span>`})
451453
class SyncComp {
452454
text: string = '1';

packages/core/test/component_fixture_spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {Component, Injectable, Input} from '@angular/core';
1010
import {ComponentFixtureAutoDetect, ComponentFixtureNoNgZone, TestBed, async, withModule} from '@angular/core/testing';
1111
import {dispatchEvent} from '@angular/platform-browser/testing/src/browser_util';
1212
import {expect} from '@angular/platform-browser/testing/src/matchers';
13+
import {fixmeIvy} from '@angular/private/testing';
1314

1415
@Component({selector: 'simple-comp', template: `<span>Original {{simpleBinding}}</span>`})
1516
@Injectable()
@@ -83,7 +84,7 @@ class NestedAsyncTimeoutComp {
8384
}
8485

8586
{
86-
describe('ComponentFixture', () => {
87+
fixmeIvy('unknown') && describe('ComponentFixture', () => {
8788
beforeEach(async(() => {
8889
TestBed.configureTestingModule({
8990
declarations: [

packages/core/test/debug/debug_node_spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {ComponentFixture, TestBed, async} from '@angular/core/testing';
1313
import {By} from '@angular/platform-browser/src/dom/debug/by';
1414
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
1515
import {expect} from '@angular/platform-browser/testing/src/matchers';
16+
import {fixmeIvy} from '@angular/private/testing';
1617

1718
@Injectable()
1819
class Logger {
@@ -168,7 +169,7 @@ class TestApp {
168169
}
169170

170171
{
171-
describe('debug element', () => {
172+
fixmeIvy('unknown') && describe('debug element', () => {
172173
let fixture: ComponentFixture<any>;
173174

174175
beforeEach(async(() => {

packages/core/test/directive_lifecycle_integration_spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@ import {AfterContentChecked, AfterContentInit, AfterViewChecked, AfterViewInit,
1010
import {Component, Directive} from '@angular/core/src/metadata';
1111
import {TestBed, inject} from '@angular/core/testing';
1212
import {Log} from '@angular/core/testing/src/testing_internal';
13+
import {fixmeIvy} from '@angular/private/testing';
1314

1415
{
15-
describe('directive lifecycle integration spec', () => {
16+
fixmeIvy('unknown') && describe('directive lifecycle integration spec', () => {
1617
let log: Log;
1718

1819
beforeEach(() => {

packages/core/test/fake_async_spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import {discardPeriodicTasks, fakeAsync, flush, flushMicrotasks, tick} from '@angular/core/testing';
1010
import {Log, beforeEach, describe, inject, it} from '@angular/core/testing/src/testing_internal';
1111
import {expect} from '@angular/platform-browser/testing/src/matchers';
12+
import {fixmeIvy} from '@angular/private/testing';
1213

1314
import {Parser} from '../../compiler/src/expression_parser/parser';
1415

@@ -17,7 +18,7 @@ const resolvedPromise = Promise.resolve(null);
1718
const ProxyZoneSpec: {assertPresent: () => void} = (Zone as any)['ProxyZoneSpec'];
1819

1920
{
20-
describe('fake async', () => {
21+
fixmeIvy('unknown') && describe('fake async', () => {
2122
it('should run synchronous code', () => {
2223
let ran = false;
2324
fakeAsync(() => { ran = true; })();

packages/core/test/forward_ref_integration_spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@ import {CommonModule} from '@angular/common';
1010
import {Component, ContentChildren, Directive, Inject, NO_ERRORS_SCHEMA, NgModule, QueryList, asNativeElements, forwardRef} from '@angular/core';
1111
import {TestBed} from '@angular/core/testing';
1212
import {expect} from '@angular/platform-browser/testing/src/matchers';
13+
import {fixmeIvy} from '@angular/private/testing';
1314

1415
{
15-
describe('forwardRef integration', function() {
16+
fixmeIvy('unknown') && describe('forwardRef integration', function() {
1617
beforeEach(() => { TestBed.configureTestingModule({imports: [Module], declarations: [App]}); });
1718

1819
it('should instantiate components which are declared using forwardRef', () => {

0 commit comments

Comments
 (0)