fix(ivy): Enable AoT tests to run on CI; disable failing tests (#26975)

PR Close #26975
This commit is contained in:
Miško Hevery 2018-11-05 20:31:54 -08:00 committed by Kara Erickson
parent 5e769d9a25
commit 53e4e0c1a3
22 changed files with 71 additions and 51 deletions

View File

@ -258,7 +258,9 @@ function findViaDirective(lViewData: LViewData, directiveInstance: {}): number {
}
function assertDomElement(element: any) {
assertEqual(element.nodeType, 1, 'The provided value must be an instance of an HTMLElement');
assertEqual(
element && (element.nodeType == Node.ELEMENT_NODE || element.nodeType == Node.TEXT_NODE),
true, 'The provided value must be an instance of an HTMLElement');
}
/**

View File

@ -45,15 +45,13 @@ ts_library(
"//packages/core/testing",
"//packages/platform-server",
"//packages/platform-server/testing",
"//packages/private/testing",
],
)
jasmine_node_test(
name = "test",
bootstrap = ["angular/tools/testing/init_node_spec.js"],
tags = [
"fixme-ivy-aot",
],
deps = [
":test_lib",
":test_node_only_lib",

View File

@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/
import {Injector} from '@angular/core';
import {APP_INITIALIZER, ApplicationInitStatus} from '../src/application_init';
import {APP_INITIALIZER, ApplicationInitStatus} from '@angular/core/src/application_init';
import {TestBed, async, inject} from '../testing';
{

View File

@ -9,7 +9,7 @@
import {ApplicationRef, Component, DoCheck, NgModule, OnInit, TestabilityRegistry, ɵivyEnabled as ivyEnabled} from '@angular/core';
import {getTestBed} from '@angular/core/testing';
import {BrowserModule} from '@angular/platform-browser';
import {withBody} from '@angular/private/testing';
import {fixmeIvy, withBody} from '@angular/private/testing';
import {NgModuleFactory} from '../src/render3/ng_module_ref';
@ -35,23 +35,26 @@ ivyEnabled && describe('ApplicationRef bootstrap', () => {
class MyAppModule {
}
it('should bootstrap hello world', withBody('<hello-world></hello-world>', async() => {
const MyAppModuleFactory = new NgModuleFactory(MyAppModule);
const moduleRef =
await getTestBed().platform.bootstrapModuleFactory(MyAppModuleFactory, {ngZone: 'noop'});
const appRef = moduleRef.injector.get(ApplicationRef);
const helloWorldComponent = appRef.components[0].instance as HelloWorldComponent;
expect(document.body.innerHTML).toEqual('<hello-world><div>Hello World</div></hello-world>');
expect(helloWorldComponent.log).toEqual(['OnInit', 'DoCheck']);
fixmeIvy('unknown') &&
it('should bootstrap hello world', withBody('<hello-world></hello-world>', async() => {
const MyAppModuleFactory = new NgModuleFactory(MyAppModule);
const moduleRef = await getTestBed().platform.bootstrapModuleFactory(
MyAppModuleFactory, {ngZone: 'noop'});
const appRef = moduleRef.injector.get(ApplicationRef);
const helloWorldComponent = appRef.components[0].instance as HelloWorldComponent;
expect(document.body.innerHTML)
.toEqual('<hello-world><div>Hello World</div></hello-world>');
expect(helloWorldComponent.log).toEqual(['OnInit', 'DoCheck']);
helloWorldComponent.name = 'Mundo';
appRef.tick();
expect(document.body.innerHTML).toEqual('<hello-world><div>Hello Mundo</div></hello-world>');
expect(helloWorldComponent.log).toEqual(['OnInit', 'DoCheck', 'DoCheck']);
helloWorldComponent.name = 'Mundo';
appRef.tick();
expect(document.body.innerHTML)
.toEqual('<hello-world><div>Hello Mundo</div></hello-world>');
expect(helloWorldComponent.log).toEqual(['OnInit', 'DoCheck', 'DoCheck']);
// Cleanup TestabilityRegistry
const registry: TestabilityRegistry = getTestBed().get(TestabilityRegistry);
registry.unregisterAllApplications();
}));
// Cleanup TestabilityRegistry
const registry: TestabilityRegistry = getTestBed().get(TestabilityRegistry);
registry.unregisterAllApplications();
}));
});

View File

@ -15,6 +15,8 @@ import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
import {DOCUMENT} from '@angular/platform-browser/src/dom/dom_tokens';
import {dispatchEvent} from '@angular/platform-browser/testing/src/browser_util';
import {expect} from '@angular/platform-browser/testing/src/matchers';
import {fixmeIvy} from '@angular/private/testing';
import {NoopNgZone} from '../src/zone/ng_zone';
import {ComponentFixtureNoNgZone, TestBed, async, inject, withModule} from '../testing';
@ -23,7 +25,7 @@ class SomeComponent {
}
{
describe('bootstrap', () => {
fixmeIvy('unknown') && describe('bootstrap', () => {
let mockConsole: MockConsole;
beforeEach(() => { mockConsole = new MockConsole(); });
@ -446,7 +448,7 @@ class SomeComponent {
});
});
describe('AppRef', () => {
fixmeIvy('unknown') && describe('AppRef', () => {
@Component({selector: 'sync-comp', template: `<span>{{text}}</span>`})
class SyncComp {
text: string = '1';

View File

@ -10,6 +10,7 @@ import {Component, Injectable, Input} from '@angular/core';
import {ComponentFixtureAutoDetect, ComponentFixtureNoNgZone, TestBed, async, withModule} from '@angular/core/testing';
import {dispatchEvent} from '@angular/platform-browser/testing/src/browser_util';
import {expect} from '@angular/platform-browser/testing/src/matchers';
import {fixmeIvy} from '@angular/private/testing';
@Component({selector: 'simple-comp', template: `<span>Original {{simpleBinding}}</span>`})
@Injectable()
@ -83,7 +84,7 @@ class NestedAsyncTimeoutComp {
}
{
describe('ComponentFixture', () => {
fixmeIvy('unknown') && describe('ComponentFixture', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [

View File

@ -13,6 +13,7 @@ import {ComponentFixture, TestBed, async} from '@angular/core/testing';
import {By} from '@angular/platform-browser/src/dom/debug/by';
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';
@Injectable()
class Logger {
@ -168,7 +169,7 @@ class TestApp {
}
{
describe('debug element', () => {
fixmeIvy('unknown') && describe('debug element', () => {
let fixture: ComponentFixture<any>;
beforeEach(async(() => {

View File

@ -10,9 +10,10 @@ 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', () => {
fixmeIvy('unknown') && describe('directive lifecycle integration spec', () => {
let log: Log;
beforeEach(() => {

View File

@ -9,6 +9,7 @@
import {discardPeriodicTasks, fakeAsync, flush, flushMicrotasks, tick} from '@angular/core/testing';
import {Log, beforeEach, describe, inject, it} from '@angular/core/testing/src/testing_internal';
import {expect} from '@angular/platform-browser/testing/src/matchers';
import {fixmeIvy} from '@angular/private/testing';
import {Parser} from '../../compiler/src/expression_parser/parser';
@ -17,7 +18,7 @@ const resolvedPromise = Promise.resolve(null);
const ProxyZoneSpec: {assertPresent: () => void} = (Zone as any)['ProxyZoneSpec'];
{
describe('fake async', () => {
fixmeIvy('unknown') && describe('fake async', () => {
it('should run synchronous code', () => {
let ran = false;
fakeAsync(() => { ran = true; })();

View File

@ -10,9 +10,10 @@ import {CommonModule} from '@angular/common';
import {Component, ContentChildren, Directive, Inject, NO_ERRORS_SCHEMA, NgModule, QueryList, asNativeElements, forwardRef} from '@angular/core';
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() {
fixmeIvy('unknown') && describe('forwardRef integration', function() {
beforeEach(() => { TestBed.configureTestingModule({imports: [Module], declarations: [App]}); });
it('should instantiate components which are declared using forwardRef', () => {

View File

@ -7,15 +7,15 @@
*/
import {ANALYZE_FOR_ENTRY_COMPONENTS, Component, ComponentFactoryResolver} from '@angular/core';
import {Console} from '@angular/core/src/console';
import {noComponentFactoryError} from '@angular/core/src/linker/component_factory_resolver';
import {TestBed} from '@angular/core/testing';
import {Console} from '../../src/console';
import {fixmeIvy} from '@angular/private/testing';
{
describe('jit', () => { declareTests({useJit: true}); });
describe('no jit', () => { declareTests({useJit: false}); });
fixmeIvy('unknown') && describe('jit', () => { declareTests({useJit: true}); });
fixmeIvy('unknown') && describe('no jit', () => { declareTests({useJit: false}); });
}
class DummyConsole implements Console {

View File

@ -23,15 +23,16 @@ import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
import {DOCUMENT} from '@angular/platform-browser/src/dom/dom_tokens';
import {dispatchEvent, el} from '@angular/platform-browser/testing/src/browser_util';
import {expect} from '@angular/platform-browser/testing/src/matchers';
import {fixmeIvy} from '@angular/private/testing';
import {stringify} from '../../src/util';
const ANCHOR_ELEMENT = new InjectionToken('AnchorElement');
{
describe('jit', () => { declareTests({useJit: true}); });
fixmeIvy('unknown') && describe('jit', () => { declareTests({useJit: true}); });
describe('no jit', () => { declareTests({useJit: false}); });
fixmeIvy('unknown') && describe('no jit', () => { declareTests({useJit: false}); });
}

View File

@ -12,9 +12,10 @@ import {MockResourceLoader} from '@angular/compiler/testing/src/resource_loader_
import {Component, Directive, Injectable, NgModule, OnDestroy, Pipe, Type} from '@angular/core';
import {TestBed, async, getTestBed} from '@angular/core/testing';
import {expect} from '@angular/platform-browser/testing/src/matchers';
import {fixmeIvy} from '@angular/private/testing';
{
describe('Jit Summaries', () => {
fixmeIvy('unknown') && describe('Jit Summaries', () => {
let instances: Map<any, Base>;
let summaries: () => any[];

View File

@ -11,10 +11,11 @@ import {AfterContentInit, AfterViewInit, Component, ContentChildren, Directive,
import {TestBed} from '@angular/core/testing';
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';
{
describe('jit', () => { declareTests({useJit: true}); });
describe('no jit', () => { declareTests({useJit: false}); });
fixmeIvy('unknown') && describe('jit', () => { declareTests({useJit: true}); });
fixmeIvy('unknown') && describe('no jit', () => { declareTests({useJit: false}); });
}
function declareTests({useJit}: {useJit: boolean}) {

View File

@ -13,6 +13,7 @@ import {NgModuleData} from '@angular/core/src/view/types';
import {tokenKey} from '@angular/core/src/view/util';
import {ComponentFixture, TestBed, inject} from '@angular/core/testing';
import {expect} from '@angular/platform-browser/testing/src/matchers';
import {fixmeIvy} from '@angular/private/testing';
import {InternalNgModuleRef, NgModuleFactory} from '../../src/linker/ng_module_factory';
import {clearModulesForTest} from '../../src/linker/ng_module_factory_loader';
@ -98,9 +99,9 @@ class DummyConsole implements Console {
}
{
describe('jit', () => { declareTests({useJit: true}); });
fixmeIvy('unknown') && describe('jit', () => { declareTests({useJit: true}); });
describe('no jit', () => { declareTests({useJit: false}); });
fixmeIvy('unknown') && describe('no jit', () => { declareTests({useJit: false}); });
}
function declareTests({useJit}: {useJit: boolean}) {

View File

@ -11,9 +11,10 @@ import {TestBed} from '@angular/core/testing';
import {By} from '@angular/platform-browser/src/dom/debug/by';
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';
{
describe('projection', () => {
fixmeIvy('unknown') && describe('projection', () => {
beforeEach(() => TestBed.configureTestingModule({declarations: [MainComp, OtherComp, Simple]}));
it('should support simple components', () => {

View File

@ -9,13 +9,13 @@
import {AfterContentChecked, AfterContentInit, AfterViewChecked, AfterViewInit, Component, ContentChild, ContentChildren, Directive, QueryList, TemplateRef, Type, ViewChild, ViewChildren, ViewContainerRef, asNativeElements} from '@angular/core';
import {ComponentFixture, TestBed, async} from '@angular/core/testing';
import {expect} from '@angular/platform-browser/testing/src/matchers';
import {fixmeIvy} from '@angular/private/testing';
import {Subject} from 'rxjs';
import {stringify} from '../../src/util';
{
describe('Query API', () => {
fixmeIvy('unknown') && describe('Query API', () => {
beforeEach(() => TestBed.configureTestingModule({
declarations: [

View File

@ -12,11 +12,12 @@ 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';
{
describe('jit', () => { declareTests({useJit: true}); });
fixmeIvy('unknown') && describe('jit', () => { declareTests({useJit: true}); });
describe('no jit', () => { declareTests({useJit: false}); });
fixmeIvy('unknown') && describe('no jit', () => { declareTests({useJit: false}); });
declareTestsUsingBootstrap();
}

View File

@ -10,11 +10,12 @@ import {Component, Directive, HostBinding, Input, NO_ERRORS_SCHEMA} from '@angul
import {ComponentFixture, TestBed, getTestBed} from '@angular/core/testing';
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
import {DomSanitizer} from '@angular/platform-browser/src/security/dom_sanitization_service';
import {fixmeIvy} from '@angular/private/testing';
{
describe('jit', () => { declareTests({useJit: true}); });
fixmeIvy('unknown') && describe('jit', () => { declareTests({useJit: true}); });
describe('no jit', () => { declareTests({useJit: false}); });
fixmeIvy('unknown') && describe('no jit', () => { declareTests({useJit: false}); });
}
@Component({selector: 'my-comp', template: ''})

View File

@ -12,10 +12,11 @@ import {extractSourceMap, originalPositionFor} from '@angular/compiler/testing/s
import {MockResourceLoader} from '@angular/compiler/testing/src/resource_loader_mock';
import {Attribute, Component, Directive, ErrorHandler, ɵglobal} from '@angular/core';
import {getErrorLogger} from '@angular/core/src/errors';
import {ComponentFixture, TestBed, fakeAsync, tick} from '@angular/core/testing';
import {TestBed, fakeAsync, tick} from '@angular/core/testing';
import {fixmeIvy} from '@angular/private/testing';
{
describe('jit source mapping', () => {
fixmeIvy('unknown') && describe('jit source mapping', () => {
let jitSpy: jasmine.Spy;
let resourceLoader: MockResourceLoader;

View File

@ -10,6 +10,7 @@ import {Component, Inject, InjectionToken, NgModule, Optional} from '@angular/co
import {TestBed, getTestBed} from '@angular/core/testing/src/test_bed';
import {By} from '@angular/platform-browser';
import {expect} from '@angular/platform-browser/testing/src/matchers';
import {fixmeIvy} from '@angular/private/testing';
const NAME = new InjectionToken<string>('name');
@ -115,7 +116,7 @@ describe('TestBed', () => {
expect(nameInjected).toEqual('World!');
});
it('should give access to the node injector for root node', () => {
fixmeIvy('unknown') && it('should give access to the node injector for root node', () => {
const hello = TestBed.createComponent(HelloWorld);
hello.detectChanges();
const injector = hello.debugElement.injector;

View File

@ -13,6 +13,7 @@ import {TestBed, withModule} from '@angular/core/testing';
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
import {ARG_TYPE_VALUES, checkNodeInlineOrDynamic, createRootView, createAndGetRootNodes, compViewDef, compViewDefFactory} from './helper';
import {fixmeIvy} from '@angular/private/testing';
{
describe(`View Providers`, () => {
@ -113,7 +114,7 @@ import {ARG_TYPE_VALUES, checkNodeInlineOrDynamic, createRootView, createAndGetR
expect(debugCtx.nodeIndex).toBe(1);
});
describe('deps', () => {
fixmeIvy('unknown') && describe('deps', () => {
class Dep {}
it('should inject deps from the same element', () => {