From f3fc74ab675ac8e7109493471922a1db09ecbd2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mis=CC=8Cko=20Hevery?= Date: Fri, 15 Dec 2017 16:28:41 -0800 Subject: [PATCH] build(core): remove `main()` from specs (#21053) `main()` function used to be needed to support dart, since dart Does not allow top level statements. Since we no longer use dart The need for `main()` has been removed. In preparation for `Basel` and standardized way of running tests we are removing `main()` PR Close #21053 --- packages/core/test/animation/animation_integration_spec.ts | 4 ++-- .../test/animation/animation_query_integration_spec.ts | 4 ++-- .../test/animation/animation_router_integration_spec.ts | 4 ++-- .../animations_with_web_animations_integration_spec.ts | 4 ++-- packages/core/test/application_init_spec.ts | 2 +- packages/core/test/application_module_spec.ts | 2 +- packages/core/test/application_ref_spec.ts | 7 ++++--- .../test/change_detection/change_detector_util_spec.ts | 2 +- .../differs/default_iterable_differ_spec.ts | 2 +- .../differs/default_keyvalue_differ_spec.ts | 2 +- .../test/change_detection/differs/iterable_differs_spec.ts | 2 +- packages/core/test/component_fixture_spec.ts | 2 +- packages/core/test/debug/debug_node_spec.ts | 2 +- packages/core/test/dev_mode_spec.ts | 2 +- packages/core/test/di/forward_ref_spec.ts | 2 +- packages/core/test/di/injector_spec.ts | 2 +- packages/core/test/di/reflective_injector_spec.ts | 6 +++--- packages/core/test/di/reflective_key_spec.ts | 2 +- packages/core/test/di/static_injector_spec.ts | 4 ++-- packages/core/test/directive_lifecycle_integration_spec.ts | 2 +- packages/core/test/dom/dom_adapter_spec.ts | 2 +- packages/core/test/dom/shim_spec.ts | 2 +- packages/core/test/error_handler_spec.ts | 4 ++-- packages/core/test/event_emitter_spec.ts | 2 +- packages/core/test/fake_async_spec.ts | 3 ++- packages/core/test/forward_ref_integration_spec.ts | 2 +- .../core/test/linker/change_detection_integration_spec.ts | 4 ++-- .../core/test/linker/entry_components_integration_spec.ts | 2 +- packages/core/test/linker/integration_spec.ts | 2 +- .../core/test/linker/jit_summaries_integration_spec.ts | 2 +- packages/core/test/linker/ng_container_integration_spec.ts | 2 +- packages/core/test/linker/ng_module_integration_spec.ts | 2 +- packages/core/test/linker/projection_integration_spec.ts | 2 +- packages/core/test/linker/query_integration_spec.ts | 2 +- packages/core/test/linker/query_list_spec.ts | 2 +- packages/core/test/linker/regression_integration_spec.ts | 2 +- packages/core/test/linker/security_integration_spec.ts | 2 +- .../test/linker/source_map_integration_node_only_spec.ts | 4 ++-- .../test/linker/system_ng_module_factory_loader_spec.ts | 2 +- .../core/test/linker/view_injector_integration_spec.ts | 4 ++-- packages/core/test/metadata/di_spec.ts | 2 +- packages/core/test/reflection/reflector_spec.ts | 2 +- packages/core/test/testability/testability_spec.ts | 2 +- packages/core/test/testing_internal_spec.ts | 2 +- packages/core/test/util/decorators_spec.ts | 2 +- packages/core/test/util/lang_spec.ts | 2 +- packages/core/test/util_spec.ts | 2 +- packages/core/test/view/anchor_spec.ts | 2 +- packages/core/test/view/component_view_spec.ts | 2 +- packages/core/test/view/element_spec.ts | 2 +- packages/core/test/view/embedded_view_spec.ts | 2 +- packages/core/test/view/ng_content_spec.ts | 2 +- packages/core/test/view/provider_spec.ts | 2 +- packages/core/test/view/pure_expression_spec.ts | 2 +- packages/core/test/view/query_spec.ts | 2 +- packages/core/test/view/services_spec.ts | 2 +- packages/core/test/view/text_spec.ts | 2 +- packages/core/test/view/view_def_spec.ts | 2 +- packages/core/test/zone/ng_zone_spec.ts | 3 +-- 59 files changed, 74 insertions(+), 73 deletions(-) diff --git a/packages/core/test/animation/animation_integration_spec.ts b/packages/core/test/animation/animation_integration_spec.ts index 16ddc0d838..1bd7c3b752 100644 --- a/packages/core/test/animation/animation_integration_spec.ts +++ b/packages/core/test/animation/animation_integration_spec.ts @@ -18,7 +18,7 @@ import {TestBed, fakeAsync, flushMicrotasks} from '../../testing'; const DEFAULT_NAMESPACE_ID = 'id'; const DEFAULT_COMPONENT_ID = '1'; -export function main() { +(function() { // these tests are only mean't to be run within the DOM (for now) if (typeof Element == 'undefined') return; @@ -3428,7 +3428,7 @@ export function main() { }); }); }); -} +}); function assertHasParent(element: any, yes: boolean) { const parent = getDOM().parentElement(element); diff --git a/packages/core/test/animation/animation_query_integration_spec.ts b/packages/core/test/animation/animation_query_integration_spec.ts index 89a5d5acaf..3f14f78b7a 100644 --- a/packages/core/test/animation/animation_query_integration_spec.ts +++ b/packages/core/test/animation/animation_query_integration_spec.ts @@ -19,7 +19,7 @@ import {TestBed} from '../../testing'; import {fakeAsync, flushMicrotasks} from '../../testing/src/fake_async'; -export function main() { +(function() { // these tests are only mean't to be run within the DOM (for now) if (typeof Element == 'undefined') return; @@ -3300,7 +3300,7 @@ export function main() { }); }); }); -} +})(); function cancelAllPlayers(players: AnimationPlayer[]) { players.forEach(p => p.destroy()); diff --git a/packages/core/test/animation/animation_router_integration_spec.ts b/packages/core/test/animation/animation_router_integration_spec.ts index e3c8dec217..012adb3a55 100644 --- a/packages/core/test/animation/animation_router_integration_spec.ts +++ b/packages/core/test/animation/animation_router_integration_spec.ts @@ -14,7 +14,7 @@ import {BrowserAnimationsModule} from '@angular/platform-browser/animations'; import {ActivatedRoute, Router, RouterOutlet} from '@angular/router'; import {RouterTestingModule} from '@angular/router/testing'; -export function main() { +(function() { // these tests are only mean't to be run within the DOM (for now) if (typeof Element == 'undefined') return; @@ -519,7 +519,7 @@ export function main() { expect(p2.element.getAttribute('data-depth')).toEqual('1'); })); }); -} +}); function makeAnimationData(value: string, params: {[key: string]: any} = {}): {[key: string]: any} { return {'animation': {value, params}}; diff --git a/packages/core/test/animation/animations_with_web_animations_integration_spec.ts b/packages/core/test/animation/animations_with_web_animations_integration_spec.ts index aab246ed8e..9f21ee3a17 100644 --- a/packages/core/test/animation/animations_with_web_animations_integration_spec.ts +++ b/packages/core/test/animation/animations_with_web_animations_integration_spec.ts @@ -15,7 +15,7 @@ import {browserDetection} from '@angular/platform-browser/testing/src/browser_ut import {TestBed} from '../../testing'; -export function main() { +(function() { // these tests are only mean't to be run within the DOM (for now) // Buggy in Chromium 39, see https://github.com/angular/angular/issues/15793 if (typeof Element == 'undefined' || !ɵsupportsWebAnimations()) return; @@ -452,7 +452,7 @@ export function main() { } }); }); -} +})(); function approximate(value: number, target: number) { return Math.abs(target - value) / value; diff --git a/packages/core/test/application_init_spec.ts b/packages/core/test/application_init_spec.ts index bc39636a85..056a92923c 100644 --- a/packages/core/test/application_init_spec.ts +++ b/packages/core/test/application_init_spec.ts @@ -9,7 +9,7 @@ import {Injector} from '@angular/core'; import {APP_INITIALIZER, ApplicationInitStatus} from '../src/application_init'; import {TestBed, async, inject} from '../testing'; -export function main() { +{ describe('ApplicationInitStatus', () => { describe('no initializers', () => { diff --git a/packages/core/test/application_module_spec.ts b/packages/core/test/application_module_spec.ts index 969ba61233..6400634658 100644 --- a/packages/core/test/application_module_spec.ts +++ b/packages/core/test/application_module_spec.ts @@ -9,7 +9,7 @@ import {LOCALE_ID} from '@angular/core'; import {describe, expect, inject, it} from '../testing/src/testing_internal'; -export function main() { +{ describe('Application module', () => { it('should set the default locale to "en-US"', inject([LOCALE_ID], (defaultLocale: string) => { expect(defaultLocale).toEqual('en-US'); })); diff --git a/packages/core/test/application_ref_spec.ts b/packages/core/test/application_ref_spec.ts index 3b6d497753..8a225f1d9d 100644 --- a/packages/core/test/application_ref_spec.ts +++ b/packages/core/test/application_ref_spec.ts @@ -15,7 +15,6 @@ 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 {ServerModule} from '@angular/platform-server'; import {NoopNgZone} from '../src/zone/ng_zone'; import {ComponentFixtureNoNgZone, TestBed, async, inject, withModule} from '../testing'; @@ -23,7 +22,7 @@ import {ComponentFixtureNoNgZone, TestBed, async, inject, withModule} from '../t class SomeComponent { } -export function main() { +{ describe('bootstrap', () => { let mockConsole: MockConsole; @@ -54,7 +53,9 @@ export function main() { const errorHandler = new ErrorHandler(); (errorHandler as any)._console = mockConsole as any; - const platformModule = getDOM().supportsDOMEvents() ? BrowserModule : ServerModule; + const platformModule = getDOM().supportsDOMEvents() ? + BrowserModule : + require('@angular/platform-server').ServerModule; @NgModule({ providers: [{provide: ErrorHandler, useValue: errorHandler}, options.providers || []], diff --git a/packages/core/test/change_detection/change_detector_util_spec.ts b/packages/core/test/change_detection/change_detector_util_spec.ts index d53569f9dd..8d8cbb7786 100644 --- a/packages/core/test/change_detection/change_detector_util_spec.ts +++ b/packages/core/test/change_detection/change_detector_util_spec.ts @@ -8,7 +8,7 @@ import {devModeEqual} from '@angular/core/src/change_detection/change_detection_util'; -export function main() { +{ describe('ChangeDetectionUtil', () => { describe('devModeEqual', () => { it('should do the deep comparison of iterables', () => { diff --git a/packages/core/test/change_detection/differs/default_iterable_differ_spec.ts b/packages/core/test/change_detection/differs/default_iterable_differ_spec.ts index 39a686c667..cdb62e7990 100644 --- a/packages/core/test/change_detection/differs/default_iterable_differ_spec.ts +++ b/packages/core/test/change_detection/differs/default_iterable_differ_spec.ts @@ -24,7 +24,7 @@ class ComplexItem { } // todo(vicb): UnmodifiableListView / frozen object when implemented -export function main() { +{ describe('iterable differ', function() { describe('DefaultIterableDiffer', function() { let differ: DefaultIterableDiffer; diff --git a/packages/core/test/change_detection/differs/default_keyvalue_differ_spec.ts b/packages/core/test/change_detection/differs/default_keyvalue_differ_spec.ts index e97e444316..cff3397cb5 100644 --- a/packages/core/test/change_detection/differs/default_keyvalue_differ_spec.ts +++ b/packages/core/test/change_detection/differs/default_keyvalue_differ_spec.ts @@ -12,7 +12,7 @@ import {kvChangesAsString, testChangesAsString} from '../../change_detection/uti // todo(vicb): Update the code & tests for object equality -export function main() { +{ describe('keyvalue differ', function() { describe('DefaultKeyValueDiffer', function() { let differ: DefaultKeyValueDiffer; diff --git a/packages/core/test/change_detection/differs/iterable_differs_spec.ts b/packages/core/test/change_detection/differs/iterable_differs_spec.ts index 83a8230ce7..326bd0cfe3 100644 --- a/packages/core/test/change_detection/differs/iterable_differs_spec.ts +++ b/packages/core/test/change_detection/differs/iterable_differs_spec.ts @@ -11,7 +11,7 @@ import {IterableDiffers} from '@angular/core/src/change_detection/differs/iterab import {SpyIterableDifferFactory} from '../../spies'; -export function main() { +{ describe('IterableDiffers', function() { let factory1: any; let factory2: any; diff --git a/packages/core/test/component_fixture_spec.ts b/packages/core/test/component_fixture_spec.ts index 97abe805e6..882bf548cb 100644 --- a/packages/core/test/component_fixture_spec.ts +++ b/packages/core/test/component_fixture_spec.ts @@ -82,7 +82,7 @@ class NestedAsyncTimeoutComp { } } -export function main() { +{ describe('ComponentFixture', () => { beforeEach(async(() => { TestBed.configureTestingModule({ diff --git a/packages/core/test/debug/debug_node_spec.ts b/packages/core/test/debug/debug_node_spec.ts index 33527195a7..97d365d9fe 100644 --- a/packages/core/test/debug/debug_node_spec.ts +++ b/packages/core/test/debug/debug_node_spec.ts @@ -164,7 +164,7 @@ class TestApp { isClosed = true; } -export function main() { +{ describe('debug element', () => { let fixture: ComponentFixture; diff --git a/packages/core/test/dev_mode_spec.ts b/packages/core/test/dev_mode_spec.ts index d94170b63e..926bfd86d3 100644 --- a/packages/core/test/dev_mode_spec.ts +++ b/packages/core/test/dev_mode_spec.ts @@ -8,7 +8,7 @@ import {isDevMode} from '@angular/core'; -export function main() { +{ describe('dev mode', () => { it('is enabled in our tests by default', () => { expect(isDevMode()).toBe(true); }); }); diff --git a/packages/core/test/di/forward_ref_spec.ts b/packages/core/test/di/forward_ref_spec.ts index 932331531f..98fbccc580 100644 --- a/packages/core/test/di/forward_ref_spec.ts +++ b/packages/core/test/di/forward_ref_spec.ts @@ -10,7 +10,7 @@ import {Type} from '@angular/core'; import {forwardRef, resolveForwardRef} from '@angular/core/src/di'; import {describe, expect, it} from '@angular/core/testing/src/testing_internal'; -export function main() { +{ describe('forwardRef', function() { it('should wrap and unwrap the reference', () => { const ref = forwardRef(() => String); diff --git a/packages/core/test/di/injector_spec.ts b/packages/core/test/di/injector_spec.ts index 820d5069da..aef7d802f3 100644 --- a/packages/core/test/di/injector_spec.ts +++ b/packages/core/test/di/injector_spec.ts @@ -10,7 +10,7 @@ import {Injector} from '@angular/core'; import {describe, expect, it} from '@angular/core/testing/src/testing_internal'; -export function main() { +{ describe('Injector.NULL', () => { it('should throw if no arg is given', () => { expect(() => Injector.NULL.get('someToken')) diff --git a/packages/core/test/di/reflective_injector_spec.ts b/packages/core/test/di/reflective_injector_spec.ts index 2df041701d..28bfc0aca7 100644 --- a/packages/core/test/di/reflective_injector_spec.ts +++ b/packages/core/test/di/reflective_injector_spec.ts @@ -66,9 +66,9 @@ class NoAnnotations { constructor(secretDependency: any) {} } -function factoryFn(a: any) {} +function factoryFn(a: any){} -export function main() { +(function() { const dynamicProviders = [ {provide: 'provider0', useValue: 1}, {provide: 'provider1', useValue: 1}, {provide: 'provider2', useValue: 1}, {provide: 'provider3', useValue: 1}, @@ -526,4 +526,4 @@ export function main() { .toEqual('ReflectiveInjector(providers: [ "Engine" , "BrokenEngine" ])'); }); }); -} +})(); diff --git a/packages/core/test/di/reflective_key_spec.ts b/packages/core/test/di/reflective_key_spec.ts index 37ddfda0f0..fe82a254a1 100644 --- a/packages/core/test/di/reflective_key_spec.ts +++ b/packages/core/test/di/reflective_key_spec.ts @@ -8,7 +8,7 @@ import {KeyRegistry} from '@angular/core/src/di/reflective_key'; -export function main() { +{ describe('key', function() { let registry: KeyRegistry; diff --git a/packages/core/test/di/static_injector_spec.ts b/packages/core/test/di/static_injector_spec.ts index d6336ba77e..e9842c8517 100644 --- a/packages/core/test/di/static_injector_spec.ts +++ b/packages/core/test/di/static_injector_spec.ts @@ -75,9 +75,9 @@ class NoAnnotations { constructor(secretDependency: any) {} } -function factoryFn(a: any) {} +function factoryFn(a: any){} -export function main() { +{ const dynamicProviders = [ {provide: 'provider0', useValue: 1}, {provide: 'provider1', useValue: 1}, {provide: 'provider2', useValue: 1}, {provide: 'provider3', useValue: 1}, diff --git a/packages/core/test/directive_lifecycle_integration_spec.ts b/packages/core/test/directive_lifecycle_integration_spec.ts index d218f0b737..83c7893a00 100644 --- a/packages/core/test/directive_lifecycle_integration_spec.ts +++ b/packages/core/test/directive_lifecycle_integration_spec.ts @@ -11,7 +11,7 @@ import {Component, Directive} from '@angular/core/src/metadata'; import {TestBed, inject} from '@angular/core/testing'; import {Log} from '@angular/core/testing/src/testing_internal'; -export function main() { +{ describe('directive lifecycle integration spec', () => { let log: Log; diff --git a/packages/core/test/dom/dom_adapter_spec.ts b/packages/core/test/dom/dom_adapter_spec.ts index 712235781c..03a666963a 100644 --- a/packages/core/test/dom/dom_adapter_spec.ts +++ b/packages/core/test/dom/dom_adapter_spec.ts @@ -10,7 +10,7 @@ import {beforeEach, describe, expect, it} from '@angular/core/testing/src/testin import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter'; import {el, stringifyElement} from '@angular/platform-browser/testing/src/browser_util'; -export function main() { +{ describe('dom adapter', () => { let defaultDoc: any; beforeEach(() => { diff --git a/packages/core/test/dom/shim_spec.ts b/packages/core/test/dom/shim_spec.ts index 87b3119522..07b2bd1738 100644 --- a/packages/core/test/dom/shim_spec.ts +++ b/packages/core/test/dom/shim_spec.ts @@ -8,7 +8,7 @@ import {describe, expect, it} from '@angular/core/testing/src/testing_internal'; -export function main() { +{ describe('Shim', () => { it('should provide correct function.name ', () => { diff --git a/packages/core/test/error_handler_spec.ts b/packages/core/test/error_handler_spec.ts index 27af1beba6..69d4249544 100644 --- a/packages/core/test/error_handler_spec.ts +++ b/packages/core/test/error_handler_spec.ts @@ -15,7 +15,7 @@ class MockConsole { error(...s: any[]): void { this.res.push(s); } } -export function main() { +(function() { function errorToString(error: any) { const logger = new MockConsole(); const errorHandler = new ErrorHandler(); @@ -72,7 +72,7 @@ ERROR CONTEXT#Context`); expect(logger).toHaveBeenCalledWith(console, 'ERROR', err); }); }); -} +})(); function debugError(originalError: any, context: any): Error { const error = wrappedError(`Error in ${context.source}`, originalError); diff --git a/packages/core/test/event_emitter_spec.ts b/packages/core/test/event_emitter_spec.ts index f2aea739bc..1c110bf4d3 100644 --- a/packages/core/test/event_emitter_spec.ts +++ b/packages/core/test/event_emitter_spec.ts @@ -9,7 +9,7 @@ import {AsyncTestCompleter, beforeEach, describe, expect, inject, it} from '@angular/core/testing/src/testing_internal'; import {EventEmitter} from '../src/event_emitter'; -export function main() { +{ describe('EventEmitter', () => { let emitter: EventEmitter; diff --git a/packages/core/test/fake_async_spec.ts b/packages/core/test/fake_async_spec.ts index 1fdc6fb925..d40a915e19 100644 --- a/packages/core/test/fake_async_spec.ts +++ b/packages/core/test/fake_async_spec.ts @@ -12,10 +12,11 @@ import {expect} from '@angular/platform-browser/testing/src/matchers'; import {Parser} from '../../compiler/src/expression_parser/parser'; + const resolvedPromise = Promise.resolve(null); const ProxyZoneSpec: {assertPresent: () => void} = (Zone as any)['ProxyZoneSpec']; -export function main() { +{ describe('fake async', () => { it('should run synchronous code', () => { let ran = false; diff --git a/packages/core/test/forward_ref_integration_spec.ts b/packages/core/test/forward_ref_integration_spec.ts index 998a9f9f7a..5c892aef0c 100644 --- a/packages/core/test/forward_ref_integration_spec.ts +++ b/packages/core/test/forward_ref_integration_spec.ts @@ -11,7 +11,7 @@ import {Component, ContentChildren, Directive, Inject, NO_ERRORS_SCHEMA, NgModul import {TestBed} from '@angular/core/testing'; import {expect} from '@angular/platform-browser/testing/src/matchers'; -export function main() { +{ describe('forwardRef integration', function() { beforeEach(() => { TestBed.configureTestingModule({imports: [Module], declarations: [App]}); }); diff --git a/packages/core/test/linker/change_detection_integration_spec.ts b/packages/core/test/linker/change_detection_integration_spec.ts index 110bab84c1..1d4818bd30 100644 --- a/packages/core/test/linker/change_detection_integration_spec.ts +++ b/packages/core/test/linker/change_detection_integration_spec.ts @@ -25,7 +25,7 @@ const TEST_COMPILER_PROVIDERS: Provider[] = [ ]; -export function main() { +(function() { let elSchema: MockSchemaRegistry; let renderLog: RenderLog; let directiveLog: DirectiveLog; @@ -1608,7 +1608,7 @@ export function main() { }); }); }); -} +})(); @Injectable() class RenderLog { diff --git a/packages/core/test/linker/entry_components_integration_spec.ts b/packages/core/test/linker/entry_components_integration_spec.ts index 2f380aff03..a3caac6001 100644 --- a/packages/core/test/linker/entry_components_integration_spec.ts +++ b/packages/core/test/linker/entry_components_integration_spec.ts @@ -13,7 +13,7 @@ import {TestBed} from '@angular/core/testing'; import {Console} from '../../src/console'; -export function main() { +{ describe('jit', () => { declareTests({useJit: true}); }); describe('no jit', () => { declareTests({useJit: false}); }); } diff --git a/packages/core/test/linker/integration_spec.ts b/packages/core/test/linker/integration_spec.ts index 962c088570..9270c2891c 100644 --- a/packages/core/test/linker/integration_spec.ts +++ b/packages/core/test/linker/integration_spec.ts @@ -28,7 +28,7 @@ import {stringify} from '../../src/util'; const ANCHOR_ELEMENT = new InjectionToken('AnchorElement'); -export function main() { +{ describe('jit', () => { declareTests({useJit: true}); }); describe('no jit', () => { declareTests({useJit: false}); }); diff --git a/packages/core/test/linker/jit_summaries_integration_spec.ts b/packages/core/test/linker/jit_summaries_integration_spec.ts index 8055e41847..dd716741ca 100644 --- a/packages/core/test/linker/jit_summaries_integration_spec.ts +++ b/packages/core/test/linker/jit_summaries_integration_spec.ts @@ -13,7 +13,7 @@ import {Component, Directive, Injectable, NgModule, Pipe, Type} from '@angular/c import {TestBed, async, getTestBed} from '@angular/core/testing'; import {expect} from '@angular/platform-browser/testing/src/matchers'; -export function main() { +{ describe('Jit Summaries', () => { let instances: Map; let summaries: () => any[]; diff --git a/packages/core/test/linker/ng_container_integration_spec.ts b/packages/core/test/linker/ng_container_integration_spec.ts index 6c2feff68f..743478ea0c 100644 --- a/packages/core/test/linker/ng_container_integration_spec.ts +++ b/packages/core/test/linker/ng_container_integration_spec.ts @@ -12,7 +12,7 @@ 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'; -export function main() { +{ describe('jit', () => { declareTests({useJit: true}); }); describe('no jit', () => { declareTests({useJit: false}); }); } diff --git a/packages/core/test/linker/ng_module_integration_spec.ts b/packages/core/test/linker/ng_module_integration_spec.ts index 619faf3ab0..b47384d400 100644 --- a/packages/core/test/linker/ng_module_integration_spec.ts +++ b/packages/core/test/linker/ng_module_integration_spec.ts @@ -102,7 +102,7 @@ class DummyConsole implements Console { warn(message: string) { this.warnings.push(message); } } -export function main() { +{ describe('jit', () => { declareTests({useJit: true}); }); describe('no jit', () => { declareTests({useJit: false}); }); diff --git a/packages/core/test/linker/projection_integration_spec.ts b/packages/core/test/linker/projection_integration_spec.ts index 9ba823ed4b..d616470e42 100644 --- a/packages/core/test/linker/projection_integration_spec.ts +++ b/packages/core/test/linker/projection_integration_spec.ts @@ -12,7 +12,7 @@ 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'; -export function main() { +{ describe('projection', () => { beforeEach(() => TestBed.configureTestingModule({declarations: [MainComp, OtherComp, Simple]})); diff --git a/packages/core/test/linker/query_integration_spec.ts b/packages/core/test/linker/query_integration_spec.ts index 8c8b5d6a43..792d7a577e 100644 --- a/packages/core/test/linker/query_integration_spec.ts +++ b/packages/core/test/linker/query_integration_spec.ts @@ -14,7 +14,7 @@ import {Subject} from 'rxjs/Subject'; import {stringify} from '../../src/util'; -export function main() { +{ describe('Query API', () => { beforeEach(() => TestBed.configureTestingModule({ diff --git a/packages/core/test/linker/query_list_spec.ts b/packages/core/test/linker/query_list_spec.ts index 8e4e85126a..a7fc644296 100644 --- a/packages/core/test/linker/query_list_spec.ts +++ b/packages/core/test/linker/query_list_spec.ts @@ -12,7 +12,7 @@ import {fakeAsync, tick} from '@angular/core/testing'; import {beforeEach, describe, expect, it} from '@angular/core/testing/src/testing_internal'; import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter'; -export function main() { +{ describe('QueryList', () => { let queryList: QueryList; let log: string; diff --git a/packages/core/test/linker/regression_integration_spec.ts b/packages/core/test/linker/regression_integration_spec.ts index 1a785013e7..2986d04a70 100644 --- a/packages/core/test/linker/regression_integration_spec.ts +++ b/packages/core/test/linker/regression_integration_spec.ts @@ -13,7 +13,7 @@ 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'; -export function main() { +{ describe('jit', () => { declareTests({useJit: true}); }); describe('no jit', () => { declareTests({useJit: false}); }); diff --git a/packages/core/test/linker/security_integration_spec.ts b/packages/core/test/linker/security_integration_spec.ts index 2bc4cfcdad..fc8396ef2c 100644 --- a/packages/core/test/linker/security_integration_spec.ts +++ b/packages/core/test/linker/security_integration_spec.ts @@ -11,7 +11,7 @@ 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'; -export function main() { +{ describe('jit', () => { declareTests({useJit: true}); }); describe('no jit', () => { declareTests({useJit: false}); }); diff --git a/packages/core/test/linker/source_map_integration_node_only_spec.ts b/packages/core/test/linker/source_map_integration_node_only_spec.ts index cf29d1bfff..acacc11bca 100644 --- a/packages/core/test/linker/source_map_integration_node_only_spec.ts +++ b/packages/core/test/linker/source_map_integration_node_only_spec.ts @@ -8,13 +8,13 @@ import {ResourceLoader} from '@angular/compiler'; import {SourceMap} from '@angular/compiler/src/output/source_map'; -import {extractSourceMap, originalPositionFor} from '@angular/compiler/test/output/source_map_util'; +import {extractSourceMap, originalPositionFor} from '@angular/compiler/testing/src/output/source_map_util'; 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'; -export function main() { +{ describe('jit source mapping', () => { let jitSpy: jasmine.Spy; let resourceLoader: MockResourceLoader; diff --git a/packages/core/test/linker/system_ng_module_factory_loader_spec.ts b/packages/core/test/linker/system_ng_module_factory_loader_spec.ts index 7b68c7749e..d29f013436 100644 --- a/packages/core/test/linker/system_ng_module_factory_loader_spec.ts +++ b/packages/core/test/linker/system_ng_module_factory_loader_spec.ts @@ -20,7 +20,7 @@ function mockSystem(modules: {[module: string]: any}) { }; } -export function main() { +{ describe('SystemJsNgModuleLoader', () => { let oldSystem: any = null; beforeEach(() => { diff --git a/packages/core/test/linker/view_injector_integration_spec.ts b/packages/core/test/linker/view_injector_integration_spec.ts index 9df00ad40c..dbab78ab74 100644 --- a/packages/core/test/linker/view_injector_integration_spec.ts +++ b/packages/core/test/linker/view_injector_integration_spec.ts @@ -182,7 +182,7 @@ export class DuplicatePipe2 implements PipeTransform { class TestComp { } -export function main() { +(function() { function createComponentFixture( template: string, providers?: Provider[] | null, comp?: Type): ComponentFixture { if (!comp) { @@ -932,7 +932,7 @@ export function main() { }); }); }); -} +})(); class TestValue { constructor(public value: string) {} diff --git a/packages/core/test/metadata/di_spec.ts b/packages/core/test/metadata/di_spec.ts index 7a1e6a6249..c42b6135ad 100644 --- a/packages/core/test/metadata/di_spec.ts +++ b/packages/core/test/metadata/di_spec.ts @@ -9,7 +9,7 @@ import {Component, Directive, ElementRef, Input, NO_ERRORS_SCHEMA, QueryList, ViewChild, ViewChildren} from '@angular/core'; import {TestBed} from '@angular/core/testing'; -export function main() { +{ describe('ViewChild', () => { beforeEach(() => { TestBed.configureTestingModule({ diff --git a/packages/core/test/reflection/reflector_spec.ts b/packages/core/test/reflection/reflector_spec.ts index 6b18c31a67..0ca80cd81a 100644 --- a/packages/core/test/reflection/reflector_spec.ts +++ b/packages/core/test/reflection/reflector_spec.ts @@ -67,7 +67,7 @@ class TestObj { identity(arg: any) { return arg; } } -export function main() { +{ describe('Reflector', () => { let reflector: Reflector; diff --git a/packages/core/test/testability/testability_spec.ts b/packages/core/test/testability/testability_spec.ts index d65b6fb360..ee5e7560c5 100644 --- a/packages/core/test/testability/testability_spec.ts +++ b/packages/core/test/testability/testability_spec.ts @@ -44,7 +44,7 @@ class MockNgZone extends NgZone { stable(): void { this.onStable.emit(null); } } -export function main() { +{ describe('Testability', () => { let testability: Testability; let execute: any; diff --git a/packages/core/test/testing_internal_spec.ts b/packages/core/test/testing_internal_spec.ts index 49611645ac..03320aa72f 100644 --- a/packages/core/test/testing_internal_spec.ts +++ b/packages/core/test/testing_internal_spec.ts @@ -19,7 +19,7 @@ class SpyTestObj extends SpyObject { constructor() { super(TestObj); } } -export function main() { +{ describe('testing', () => { describe('equality', () => { it('should structurally compare objects', () => { diff --git a/packages/core/test/util/decorators_spec.ts b/packages/core/test/util/decorators_spec.ts index 7de8af451f..f657f96f25 100644 --- a/packages/core/test/util/decorators_spec.ts +++ b/packages/core/test/util/decorators_spec.ts @@ -12,7 +12,7 @@ import {ANNOTATIONS, makeDecorator, makePropDecorator} from '../../src/util/deco class DecoratedParent {} class DecoratedChild extends DecoratedParent {} -export function main() { +{ const TerminalDecorator = makeDecorator('TerminalDecorator', (data: any) => ({terminal: true, ...data})); const TestDecorator = makeDecorator( diff --git a/packages/core/test/util/lang_spec.ts b/packages/core/test/util/lang_spec.ts index 343087da82..3fa338d55e 100644 --- a/packages/core/test/util/lang_spec.ts +++ b/packages/core/test/util/lang_spec.ts @@ -8,7 +8,7 @@ import {isObservable, isPromise} from '@angular/core/src/util/lang'; import {of } from 'rxjs/observable/of'; -export function main() { +{ describe('isPromise', () => { it('should be true for native Promises', () => expect(isPromise(Promise.resolve(true))).toEqual(true)); diff --git a/packages/core/test/util_spec.ts b/packages/core/test/util_spec.ts index 1397005351..cd11cbd9ed 100644 --- a/packages/core/test/util_spec.ts +++ b/packages/core/test/util_spec.ts @@ -8,7 +8,7 @@ import {stringify} from '../src/util'; -export function main() { +{ describe('stringify', () => { it('should return string undefined when toString returns undefined', () => expect(stringify({toString: (): any => undefined})).toBe('undefined')); diff --git a/packages/core/test/view/anchor_spec.ts b/packages/core/test/view/anchor_spec.ts index c50b1e14cc..703c5a376e 100644 --- a/packages/core/test/view/anchor_spec.ts +++ b/packages/core/test/view/anchor_spec.ts @@ -12,7 +12,7 @@ import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter'; import {compViewDef, createAndGetRootNodes} from './helper'; -export function main() { +{ describe(`View Anchor`, () => { describe('create', () => { diff --git a/packages/core/test/view/component_view_spec.ts b/packages/core/test/view/component_view_spec.ts index dee406acff..2ccba8ed1a 100644 --- a/packages/core/test/view/component_view_spec.ts +++ b/packages/core/test/view/component_view_spec.ts @@ -20,7 +20,7 @@ import {callMostRecentEventListenerHandler, compViewDef, createAndGetRootNodes, */ const addEventListener = '__zone_symbol__addEventListener'; -export function main() { +{ describe(`Component Views`, () => { it('should create and attach component views', () => { let instance: AComp = undefined !; diff --git a/packages/core/test/view/element_spec.ts b/packages/core/test/view/element_spec.ts index 21dba2e136..43d111a09e 100644 --- a/packages/core/test/view/element_spec.ts +++ b/packages/core/test/view/element_spec.ts @@ -23,7 +23,7 @@ import {ARG_TYPE_VALUES, callMostRecentEventListenerHandler, checkNodeInlineOrDy const addEventListener = '__zone_symbol__addEventListener'; const removeEventListener = '__zone_symbol__removeEventListener'; -export function main() { +{ describe(`View Elements`, () => { describe('create', () => { diff --git a/packages/core/test/view/embedded_view_spec.ts b/packages/core/test/view/embedded_view_spec.ts index c67c080555..9ad1556b07 100644 --- a/packages/core/test/view/embedded_view_spec.ts +++ b/packages/core/test/view/embedded_view_spec.ts @@ -12,7 +12,7 @@ import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter'; import {compViewDef, compViewDefFactory, createAndGetRootNodes, createEmbeddedView} from './helper'; -export function main() { +{ describe(`Embedded Views`, () => { it('should create embedded views with the right context', () => { diff --git a/packages/core/test/view/ng_content_spec.ts b/packages/core/test/view/ng_content_spec.ts index 954ee66e93..d893cd98be 100644 --- a/packages/core/test/view/ng_content_spec.ts +++ b/packages/core/test/view/ng_content_spec.ts @@ -12,7 +12,7 @@ import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter'; import {compViewDef, compViewDefFactory, createEmbeddedView, createRootView, isBrowser} from './helper'; -export function main() { +{ describe(`View NgContent`, () => { function hostElDef( checkIndex: number, contentNodes: NodeDef[], viewNodes: NodeDef[]): NodeDef[] { diff --git a/packages/core/test/view/provider_spec.ts b/packages/core/test/view/provider_spec.ts index fed49c5ca8..3d3bcd88c7 100644 --- a/packages/core/test/view/provider_spec.ts +++ b/packages/core/test/view/provider_spec.ts @@ -14,7 +14,7 @@ import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter'; import {ARG_TYPE_VALUES, checkNodeInlineOrDynamic, createRootView, createAndGetRootNodes, compViewDef, compViewDefFactory} from './helper'; -export function main() { +{ describe(`View Providers`, () => { describe('create', () => { diff --git a/packages/core/test/view/pure_expression_spec.ts b/packages/core/test/view/pure_expression_spec.ts index 70bcc3628b..03e42cd2ce 100644 --- a/packages/core/test/view/pure_expression_spec.ts +++ b/packages/core/test/view/pure_expression_spec.ts @@ -11,7 +11,7 @@ import {NodeFlags, Services, asProviderData, directiveDef, elementDef, nodeValue import {ARG_TYPE_VALUES, checkNodeInlineOrDynamic, compViewDef, createAndGetRootNodes} from './helper'; -export function main() { +{ describe(`View Pure Expressions`, () => { class Service { diff --git a/packages/core/test/view/query_spec.ts b/packages/core/test/view/query_spec.ts index 8e01e713cf..4aded64ac0 100644 --- a/packages/core/test/view/query_spec.ts +++ b/packages/core/test/view/query_spec.ts @@ -12,7 +12,7 @@ import {NodeDef, NodeFlags, QueryBindingType, QueryValueType, Services, anchorDe import {compViewDef, compViewDefFactory, createAndGetRootNodes, createEmbeddedView} from './helper'; -export function main() { +{ describe(`Query Views`, () => { const someQueryId = 1; diff --git a/packages/core/test/view/services_spec.ts b/packages/core/test/view/services_spec.ts index decfb59862..c97ff6c7b5 100644 --- a/packages/core/test/view/services_spec.ts +++ b/packages/core/test/view/services_spec.ts @@ -10,7 +10,7 @@ import {DebugContext, NodeFlags, QueryValueType, Services, asElementData, asText import {compViewDef, createAndGetRootNodes} from './helper'; -export function main() { +{ describe('View Services', () => { describe('DebugContext', () => { diff --git a/packages/core/test/view/text_spec.ts b/packages/core/test/view/text_spec.ts index 14bad7a892..427fdad852 100644 --- a/packages/core/test/view/text_spec.ts +++ b/packages/core/test/view/text_spec.ts @@ -12,7 +12,7 @@ import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter'; import {ARG_TYPE_VALUES, checkNodeInlineOrDynamic, compViewDef, createAndGetRootNodes} from './helper'; -export function main() { +{ describe(`View Text`, () => { describe('create', () => { diff --git a/packages/core/test/view/view_def_spec.ts b/packages/core/test/view/view_def_spec.ts index d1182bb479..99fc389ce9 100644 --- a/packages/core/test/view/view_def_spec.ts +++ b/packages/core/test/view/view_def_spec.ts @@ -9,7 +9,7 @@ import {NodeFlags, QueryValueType, ViewDefinition, ViewFlags, anchorDef, directiveDef, elementDef, textDef, viewDef} from '@angular/core/src/view/index'; import {filterQueryId} from '@angular/core/src/view/util'; -export function main() { +{ describe('viewDef', () => { describe('parent', () => { diff --git a/packages/core/test/zone/ng_zone_spec.ts b/packages/core/test/zone/ng_zone_spec.ts index ccc5189cfc..10307a5bbd 100644 --- a/packages/core/test/zone/ng_zone_spec.ts +++ b/packages/core/test/zone/ng_zone_spec.ts @@ -62,9 +62,8 @@ function runNgZoneNoLog(fn: () => any) { } } -export function main() { +{ describe('NgZone', () => { - function createZone(enableLongStackTrace: boolean) { return new NgZone({enableLongStackTrace: enableLongStackTrace}); }