diff --git a/packages/animations/browser/test/dsl/animation_spec.ts b/packages/animations/browser/test/dsl/animation_spec.ts index 084c8e8b95..b683604796 100644 --- a/packages/animations/browser/test/dsl/animation_spec.ts +++ b/packages/animations/browser/test/dsl/animation_spec.ts @@ -18,7 +18,7 @@ function createDiv() { return document.createElement('div'); } -export function main() { +{ describe('Animation', () => { // these tests are only mean't to be run within the DOM (for now) if (typeof Element == 'undefined') return; diff --git a/packages/animations/browser/test/dsl/animation_trigger_spec.ts b/packages/animations/browser/test/dsl/animation_trigger_spec.ts index 416c231317..74a517dec1 100644 --- a/packages/animations/browser/test/dsl/animation_trigger_spec.ts +++ b/packages/animations/browser/test/dsl/animation_trigger_spec.ts @@ -14,7 +14,7 @@ import {ENTER_CLASSNAME, LEAVE_CLASSNAME} from '../../src/util'; import {MockAnimationDriver} from '../../testing'; import {makeTrigger} from '../shared'; -export function main() { +{ describe('AnimationTrigger', () => { // these tests are only mean't to be run within the DOM (for now) if (typeof Element == 'undefined') return; diff --git a/packages/animations/browser/test/dsl/style_normalizer/web_animations_style_normalizer_spec.ts b/packages/animations/browser/test/dsl/style_normalizer/web_animations_style_normalizer_spec.ts index 37d80efb83..003df7678c 100644 --- a/packages/animations/browser/test/dsl/style_normalizer/web_animations_style_normalizer_spec.ts +++ b/packages/animations/browser/test/dsl/style_normalizer/web_animations_style_normalizer_spec.ts @@ -7,7 +7,7 @@ */ import {WebAnimationsStyleNormalizer} from '../../../src/dsl/style_normalization/web_animations_style_normalizer'; -export function main() { +{ describe('WebAnimationsStyleNormalizer', () => { const normalizer = new WebAnimationsStyleNormalizer(); diff --git a/packages/animations/browser/test/render/timeline_animation_engine_spec.ts b/packages/animations/browser/test/render/timeline_animation_engine_spec.ts index 025045b01f..fccdd08215 100644 --- a/packages/animations/browser/test/render/timeline_animation_engine_spec.ts +++ b/packages/animations/browser/test/render/timeline_animation_engine_spec.ts @@ -12,7 +12,7 @@ import {AnimationDriver} from '../../src/render/animation_driver'; import {TimelineAnimationEngine} from '../../src/render/timeline_animation_engine'; import {MockAnimationDriver, MockAnimationPlayer} from '../../testing/src/mock_animation_driver'; -export function main() { +(function(){ const defaultDriver = new MockAnimationDriver(); function makeEngine(driver?: AnimationDriver, normalizer?: AnimationStyleNormalizer) { @@ -93,7 +93,7 @@ export function main() { expect(player.keyframes).toEqual([{width: '*star*', offset: 0}, {width: '999px', offset: 1}]); }); }); -} +})(); function invokeAnimation( engine: TimelineAnimationEngine, element: any, steps: AnimationMetadata | AnimationMetadata[], diff --git a/packages/animations/browser/test/render/transition_animation_engine_spec.ts b/packages/animations/browser/test/render/transition_animation_engine_spec.ts index 0fb955b85d..5206a7f8d1 100644 --- a/packages/animations/browser/test/render/transition_animation_engine_spec.ts +++ b/packages/animations/browser/test/render/transition_animation_engine_spec.ts @@ -16,7 +16,7 @@ import {MockAnimationDriver, MockAnimationPlayer} from '../../testing/src/mock_a const DEFAULT_NAMESPACE_ID = 'id'; -export function main() { +(function(){ const driver = new MockAnimationDriver(); // these tests are only mean't to be run within the DOM @@ -616,7 +616,7 @@ export function main() { }); }); }); -} +})(); class SuffixNormalizer extends AnimationStyleNormalizer { constructor(private _suffix: string) { super(); } diff --git a/packages/animations/browser/test/render/web_animations/web_animations_player_spec.ts b/packages/animations/browser/test/render/web_animations/web_animations_player_spec.ts index 139aecfcf4..0d484c465b 100644 --- a/packages/animations/browser/test/render/web_animations/web_animations_player_spec.ts +++ b/packages/animations/browser/test/render/web_animations/web_animations_player_spec.ts @@ -8,7 +8,7 @@ import {DOMAnimation} from '../../../src/render/web_animations/dom_animation'; import {WebAnimationsPlayer} from '../../../src/render/web_animations/web_animations_player'; -export function main() { +{ let element: any; let innerPlayer: MockDomAnimation|null = null; beforeEach(() => { diff --git a/packages/animations/test/animation_player_spec.ts b/packages/animations/test/animation_player_spec.ts index ae74a7268d..7ad7152d60 100644 --- a/packages/animations/test/animation_player_spec.ts +++ b/packages/animations/test/animation_player_spec.ts @@ -10,7 +10,7 @@ import {flushMicrotasks} from '../../core/testing/src/fake_async'; import {NoopAnimationPlayer} from '../src/players/animation_player'; import {scheduleMicroTask} from '../src/util'; -export function main() { +{ describe('NoopAnimationPlayer', function() { it('should finish after the next microtask once started', fakeAsync(() => { const log: string[] = []; diff --git a/packages/animations/test/util_spec.ts b/packages/animations/test/util_spec.ts index f687d3da7b..dc5070a4c6 100644 --- a/packages/animations/test/util_spec.ts +++ b/packages/animations/test/util_spec.ts @@ -7,7 +7,7 @@ */ import {scheduleMicroTask} from '../src/util'; -export function main() { +{ describe('util', () => { it('should schedule a microtask and not call an async timeout', (done) => { let count = 0; diff --git a/packages/benchpress/test/firefox_extension/parser_util_spec.ts b/packages/benchpress/test/firefox_extension/parser_util_spec.ts index 782a04243e..1669d07036 100644 --- a/packages/benchpress/test/firefox_extension/parser_util_spec.ts +++ b/packages/benchpress/test/firefox_extension/parser_util_spec.ts @@ -19,7 +19,7 @@ function assertEventsEqual(actualEvents: any[], expectedEvents: any[]) { } } -export function main() { +{ describe('convertPerfProfileToEvents', function() { it('should convert single instantaneous event', function() { const profileData = { diff --git a/packages/benchpress/test/metric/multi_metric_spec.ts b/packages/benchpress/test/metric/multi_metric_spec.ts index f8f8a9324f..20f754f541 100644 --- a/packages/benchpress/test/metric/multi_metric_spec.ts +++ b/packages/benchpress/test/metric/multi_metric_spec.ts @@ -10,7 +10,7 @@ import {AsyncTestCompleter, describe, expect, inject, it} from '@angular/core/te import {Injector, Metric, MultiMetric} from '../../index'; -export function main() { +(function(){ function createMetric(ids: any[]) { const m = Injector .create([ @@ -49,7 +49,7 @@ export function main() { }); }); -} +})(); class MockMetric extends Metric { constructor(private _id: string) { super(); } diff --git a/packages/benchpress/test/metric/perflog_metric_spec.ts b/packages/benchpress/test/metric/perflog_metric_spec.ts index a8ad908d50..be578c2bbf 100644 --- a/packages/benchpress/test/metric/perflog_metric_spec.ts +++ b/packages/benchpress/test/metric/perflog_metric_spec.ts @@ -12,7 +12,7 @@ import {AsyncTestCompleter, beforeEach, describe, expect, inject, it} from '@ang import {Injector, Metric, Options, PerfLogEvent, PerfLogFeatures, PerflogMetric, WebDriverExtension} from '../../index'; import {TraceEventFactory} from '../trace_event_factory'; -export function main() { +(function(){ let commandLog: any[]; const eventFactory = new TraceEventFactory('timeline', 'pid0'); @@ -680,7 +680,7 @@ export function main() { }); }); -} +})(); class MockDriverExtension extends WebDriverExtension { constructor( diff --git a/packages/benchpress/test/metric/user_metric_spec.ts b/packages/benchpress/test/metric/user_metric_spec.ts index 6884620b68..681635362a 100644 --- a/packages/benchpress/test/metric/user_metric_spec.ts +++ b/packages/benchpress/test/metric/user_metric_spec.ts @@ -11,7 +11,7 @@ import {AsyncTestCompleter, describe, expect, inject, it} from '@angular/core/te import {Options, PerfLogEvent, PerfLogFeatures, UserMetric, WebDriverAdapter} from '../../index'; -export function main() { +(function(){ let wdAdapter: MockDriverAdapter; function createMetric( @@ -63,7 +63,7 @@ export function main() { }), 600); }); }); -} +})(); class MockDriverAdapter extends WebDriverAdapter { data: any = {}; diff --git a/packages/benchpress/test/reporter/console_reporter_spec.ts b/packages/benchpress/test/reporter/console_reporter_spec.ts index 7e3c15b6cb..950b1a1cc1 100644 --- a/packages/benchpress/test/reporter/console_reporter_spec.ts +++ b/packages/benchpress/test/reporter/console_reporter_spec.ts @@ -11,7 +11,7 @@ import {describe, expect, it} from '@angular/core/testing/src/testing_internal'; import {ConsoleReporter, Injector, MeasureValues, SampleDescription} from '../../index'; -export function main() { +{ describe('console reporter', () => { let reporter: ConsoleReporter; let log: string[]; diff --git a/packages/benchpress/test/reporter/json_file_reporter_spec.ts b/packages/benchpress/test/reporter/json_file_reporter_spec.ts index 6ca8647346..2ca147f237 100644 --- a/packages/benchpress/test/reporter/json_file_reporter_spec.ts +++ b/packages/benchpress/test/reporter/json_file_reporter_spec.ts @@ -10,7 +10,7 @@ import {AsyncTestCompleter, describe, expect, inject, it} from '@angular/core/te import {Injector, JsonFileReporter, MeasureValues, Options, SampleDescription} from '../../index'; -export function main() { +{ describe('file reporter', () => { let loggedFile: any; diff --git a/packages/benchpress/test/reporter/multi_reporter_spec.ts b/packages/benchpress/test/reporter/multi_reporter_spec.ts index 4c9e2c698a..db395128c0 100644 --- a/packages/benchpress/test/reporter/multi_reporter_spec.ts +++ b/packages/benchpress/test/reporter/multi_reporter_spec.ts @@ -10,7 +10,7 @@ import {AsyncTestCompleter, describe, expect, inject, it} from '@angular/core/te import {Injector, MeasureValues, MultiReporter, Reporter} from '../../index'; -export function main() { +(function(){ function createReporters(ids: any[]) { const r = Injector .create([ @@ -51,7 +51,7 @@ export function main() { })); }); -} +})(); class MockReporter extends Reporter { constructor(private _id: string) { super(); } diff --git a/packages/benchpress/test/runner_spec.ts b/packages/benchpress/test/runner_spec.ts index 27683730c5..3487b5988e 100644 --- a/packages/benchpress/test/runner_spec.ts +++ b/packages/benchpress/test/runner_spec.ts @@ -10,7 +10,7 @@ import {AsyncTestCompleter, describe, expect, inject, it} from '@angular/core/te import {Injector, Metric, Options, Runner, SampleDescription, SampleState, Sampler, Validator, WebDriverAdapter} from '../index'; -export function main() { +{ describe('runner', () => { let injector: Injector; let runner: Runner; diff --git a/packages/benchpress/test/sampler_spec.ts b/packages/benchpress/test/sampler_spec.ts index 82ca5d6d64..9b1b7864e3 100644 --- a/packages/benchpress/test/sampler_spec.ts +++ b/packages/benchpress/test/sampler_spec.ts @@ -10,7 +10,7 @@ import {AsyncTestCompleter, describe, expect, inject, it} from '@angular/core/te import {Injector, MeasureValues, Metric, Options, Reporter, Sampler, Validator, WebDriverAdapter} from '../index'; -export function main() { +{ const EMPTY_EXECUTE = () => {}; describe('sampler', () => { diff --git a/packages/benchpress/test/statistic_spec.ts b/packages/benchpress/test/statistic_spec.ts index a1680fe34e..efbeaa8766 100644 --- a/packages/benchpress/test/statistic_spec.ts +++ b/packages/benchpress/test/statistic_spec.ts @@ -9,7 +9,7 @@ import {describe, expect, it} from '@angular/core/testing/src/testing_internal'; import {Statistic} from '../src/statistic'; -export function main() { +{ describe('statistic', () => { it('should calculate the mean', () => { diff --git a/packages/benchpress/test/validator/regression_slope_validator_spec.ts b/packages/benchpress/test/validator/regression_slope_validator_spec.ts index 3b8c3e02ce..07cc120cc9 100644 --- a/packages/benchpress/test/validator/regression_slope_validator_spec.ts +++ b/packages/benchpress/test/validator/regression_slope_validator_spec.ts @@ -10,7 +10,7 @@ import {describe, expect, it} from '@angular/core/testing/src/testing_internal'; import {Injector, MeasureValues, RegressionSlopeValidator} from '../../index'; -export function main() { +{ describe('regression slope validator', () => { let validator: RegressionSlopeValidator; diff --git a/packages/benchpress/test/validator/size_validator_spec.ts b/packages/benchpress/test/validator/size_validator_spec.ts index da5a14ad57..782b36ab1f 100644 --- a/packages/benchpress/test/validator/size_validator_spec.ts +++ b/packages/benchpress/test/validator/size_validator_spec.ts @@ -10,7 +10,7 @@ import {describe, expect, it} from '@angular/core/testing/src/testing_internal'; import {Injector, MeasureValues, SizeValidator} from '../../index'; -export function main() { +{ describe('size validator', () => { let validator: SizeValidator; diff --git a/packages/benchpress/test/web_driver_extension_spec.ts b/packages/benchpress/test/web_driver_extension_spec.ts index 178f851262..9183d58990 100644 --- a/packages/benchpress/test/web_driver_extension_spec.ts +++ b/packages/benchpress/test/web_driver_extension_spec.ts @@ -10,7 +10,7 @@ import {AsyncTestCompleter, describe, expect, inject, it} from '@angular/core/te import {Injector, Options, WebDriverExtension} from '../index'; -export function main() { +(function(){ function createExtension(ids: any[], caps: any) { return new Promise((res, rej) => { try { @@ -45,7 +45,7 @@ export function main() { }); })); }); -} +})(); class MockExtension extends WebDriverExtension { constructor(public id: string) { super(); } diff --git a/packages/benchpress/test/webdriver/chrome_driver_extension_spec.ts b/packages/benchpress/test/webdriver/chrome_driver_extension_spec.ts index ebb17e3d9b..e81e10481d 100644 --- a/packages/benchpress/test/webdriver/chrome_driver_extension_spec.ts +++ b/packages/benchpress/test/webdriver/chrome_driver_extension_spec.ts @@ -11,7 +11,7 @@ import {AsyncTestCompleter, describe, expect, iit, inject, it} from '@angular/co import {ChromeDriverExtension, Injector, Options, WebDriverAdapter, WebDriverExtension} from '../../index'; import {TraceEventFactory} from '../trace_event_factory'; -export function main() { +{ describe('chrome driver extension', () => { const CHROME45_USER_AGENT = '"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2499.0 Safari/537.36"'; diff --git a/packages/benchpress/test/webdriver/ios_driver_extension_spec.ts b/packages/benchpress/test/webdriver/ios_driver_extension_spec.ts index 7ff0cd6b13..f2edbc7740 100644 --- a/packages/benchpress/test/webdriver/ios_driver_extension_spec.ts +++ b/packages/benchpress/test/webdriver/ios_driver_extension_spec.ts @@ -11,7 +11,7 @@ import {AsyncTestCompleter, describe, expect, inject, it} from '@angular/core/te import {IOsDriverExtension, Injector, WebDriverAdapter, WebDriverExtension} from '../../index'; import {TraceEventFactory} from '../trace_event_factory'; -export function main() { +{ describe('ios driver extension', () => { let log: any[]; let extension: IOsDriverExtension; diff --git a/packages/common/http/test/client_spec.ts b/packages/common/http/test/client_spec.ts index b2067d6330..0b901222bb 100644 --- a/packages/common/http/test/client_spec.ts +++ b/packages/common/http/test/client_spec.ts @@ -15,7 +15,7 @@ import {HttpClient} from '../src/client'; import {HttpErrorResponse, HttpEventType, HttpResponse} from '../src/response'; import {HttpClientTestingBackend} from '../testing/src/backend'; -export function main() { +{ describe('HttpClient', () => { let client: HttpClient = null !; let backend: HttpClientTestingBackend = null !; diff --git a/packages/common/http/test/headers_spec.ts b/packages/common/http/test/headers_spec.ts index f161c66d5b..e26b07f4d7 100644 --- a/packages/common/http/test/headers_spec.ts +++ b/packages/common/http/test/headers_spec.ts @@ -8,7 +8,7 @@ import {HttpHeaders} from '../src/headers'; -export function main() { +{ describe('HttpHeaders', () => { describe('initialization', () => { diff --git a/packages/common/http/test/jsonp_spec.ts b/packages/common/http/test/jsonp_spec.ts index 141cd544db..a559af8d51 100644 --- a/packages/common/http/test/jsonp_spec.ts +++ b/packages/common/http/test/jsonp_spec.ts @@ -24,7 +24,7 @@ function runOnlyCallback(home: any, data: Object) { const SAMPLE_REQ = new HttpRequest('JSONP', '/test'); -export function main() { +{ describe('JsonpClientBackend', () => { let home = {}; let document: MockDocument; diff --git a/packages/common/http/test/module_spec.ts b/packages/common/http/test/module_spec.ts index 9d846aa476..7773d115f6 100644 --- a/packages/common/http/test/module_spec.ts +++ b/packages/common/http/test/module_spec.ts @@ -47,7 +47,7 @@ class InterceptorB extends TestInterceptor { constructor() { super('B'); } } -export function main() { +{ describe('HttpClientModule', () => { let injector: Injector; beforeEach(() => { diff --git a/packages/common/http/test/params_spec.ts b/packages/common/http/test/params_spec.ts index 8bc167836b..304ebb1ec2 100644 --- a/packages/common/http/test/params_spec.ts +++ b/packages/common/http/test/params_spec.ts @@ -8,7 +8,7 @@ import {HttpParams} from '../src/params'; -export function main() { +{ describe('HttpUrlEncodedParams', () => { describe('initialization', () => { it('should be empty at construction', () => { diff --git a/packages/common/http/test/request_spec.ts b/packages/common/http/test/request_spec.ts index 23960831a3..d5ed4549ad 100644 --- a/packages/common/http/test/request_spec.ts +++ b/packages/common/http/test/request_spec.ts @@ -15,7 +15,7 @@ import {HttpRequest} from '../src/request'; const TEST_URL = 'http://angular.io'; const TEST_STRING = `I'm a body!`; -export function main() { +{ describe('HttpRequest', () => { describe('constructor', () => { it('initializes url', () => { diff --git a/packages/common/http/test/response_spec.ts b/packages/common/http/test/response_spec.ts index 50eb29b7b2..c2e116a08e 100644 --- a/packages/common/http/test/response_spec.ts +++ b/packages/common/http/test/response_spec.ts @@ -11,7 +11,7 @@ import {ddescribe, describe, it} from '@angular/core/testing/src/testing_interna import {HttpHeaders} from '../src/headers'; import {HttpResponse} from '../src/response'; -export function main() { +{ describe('HttpResponse', () => { describe('constructor()', () => { it('fully constructs responses', () => { diff --git a/packages/common/http/test/xhr_spec.ts b/packages/common/http/test/xhr_spec.ts index f6e3a9ab5d..c5fa3a75fc 100644 --- a/packages/common/http/test/xhr_spec.ts +++ b/packages/common/http/test/xhr_spec.ts @@ -27,7 +27,7 @@ const TEST_POST = new HttpRequest('POST', '/test', 'some body', { const XSSI_PREFIX = ')]}\'\n'; -export function main() { +{ describe('XhrBackend', () => { let factory: MockXhrFactory = null !; let backend: HttpXhrBackend = null !; diff --git a/packages/common/http/test/xsrf_spec.ts b/packages/common/http/test/xsrf_spec.ts index 1c5c235432..20a3ac8250 100644 --- a/packages/common/http/test/xsrf_spec.ts +++ b/packages/common/http/test/xsrf_spec.ts @@ -19,7 +19,7 @@ class SampleTokenExtractor { getToken(): string|null { return this.token; } } -export function main() { +{ describe('HttpXsrfInterceptor', () => { let backend: HttpClientTestingBackend; const interceptor = new HttpXsrfInterceptor(new SampleTokenExtractor('test'), 'X-XSRF-TOKEN'); diff --git a/packages/common/test/common_module_spec.ts b/packages/common/test/common_module_spec.ts index 71b85f1979..be40f6722f 100644 --- a/packages/common/test/common_module_spec.ts +++ b/packages/common/test/common_module_spec.ts @@ -12,7 +12,7 @@ import {DeprecatedI18NPipesModule} from '../src/common_module'; import {Plural} from '../src/i18n/locale_data_api'; import {DEPRECATED_PLURAL_FN, getPluralCase} from '../src/i18n/localization'; -export function main() { +{ describe('DeprecatedI18NPipesModule', () => { beforeEach(() => { TestBed.configureTestingModule({imports: [DeprecatedI18NPipesModule]}); }); diff --git a/packages/common/test/cookie_spec.ts b/packages/common/test/cookie_spec.ts index e0a8eeefa4..36b10c0e35 100644 --- a/packages/common/test/cookie_spec.ts +++ b/packages/common/test/cookie_spec.ts @@ -19,7 +19,7 @@ import {parseCookieValue} from '@angular/common/src/cookie'; import {describe, expect, it} from '@angular/core/testing/src/testing_internal'; -export function main() { +{ describe('cookies', () => { it('parses cookies', () => { const cookie = 'other-cookie=false; xsrf-token=token-value; is_awesome=true; ffo=true;'; diff --git a/packages/common/test/directives/ng_class_spec.ts b/packages/common/test/directives/ng_class_spec.ts index 8d3ecaecc5..4db790b5b7 100644 --- a/packages/common/test/directives/ng_class_spec.ts +++ b/packages/common/test/directives/ng_class_spec.ts @@ -9,7 +9,7 @@ import {Component} from '@angular/core'; import {ComponentFixture, TestBed, async} from '@angular/core/testing'; -export function main() { +{ describe('binding to CSS class list', () => { let fixture: ComponentFixture|null; diff --git a/packages/common/test/directives/ng_component_outlet_spec.ts b/packages/common/test/directives/ng_component_outlet_spec.ts index 45f2c5e8b3..b920952a99 100644 --- a/packages/common/test/directives/ng_component_outlet_spec.ts +++ b/packages/common/test/directives/ng_component_outlet_spec.ts @@ -12,7 +12,7 @@ import {Compiler, Component, ComponentRef, Inject, InjectionToken, Injector, NO_ import {TestBed, async, fakeAsync} from '@angular/core/testing'; import {expect} from '@angular/platform-browser/testing/src/matchers'; -export function main() { +{ describe('insert/remove', () => { beforeEach(() => { TestBed.configureTestingModule({imports: [TestModule]}); }); diff --git a/packages/common/test/directives/ng_for_spec.ts b/packages/common/test/directives/ng_for_spec.ts index ecc6725b98..541d1863cc 100644 --- a/packages/common/test/directives/ng_for_spec.ts +++ b/packages/common/test/directives/ng_for_spec.ts @@ -14,7 +14,7 @@ import {expect} from '@angular/platform-browser/testing/src/matchers'; let thisArg: any; -export function main() { +{ describe('ngFor', () => { let fixture: ComponentFixture; diff --git a/packages/common/test/directives/ng_if_spec.ts b/packages/common/test/directives/ng_if_spec.ts index a0009bf149..a7ac754601 100644 --- a/packages/common/test/directives/ng_if_spec.ts +++ b/packages/common/test/directives/ng_if_spec.ts @@ -13,7 +13,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('ngIf directive', () => { let fixture: ComponentFixture; diff --git a/packages/common/test/directives/ng_plural_spec.ts b/packages/common/test/directives/ng_plural_spec.ts index b12904247e..07e6e66740 100644 --- a/packages/common/test/directives/ng_plural_spec.ts +++ b/packages/common/test/directives/ng_plural_spec.ts @@ -11,7 +11,7 @@ import {Component, Injectable} from '@angular/core'; import {ComponentFixture, TestBed, async} from '@angular/core/testing'; import {expect} from '@angular/platform-browser/testing/src/matchers'; -export function main() { +{ describe('ngPlural', () => { let fixture: ComponentFixture; diff --git a/packages/common/test/directives/ng_style_spec.ts b/packages/common/test/directives/ng_style_spec.ts index 754c05823a..baddb55144 100644 --- a/packages/common/test/directives/ng_style_spec.ts +++ b/packages/common/test/directives/ng_style_spec.ts @@ -10,7 +10,7 @@ import {CommonModule} from '@angular/common'; import {Component} from '@angular/core'; import {ComponentFixture, TestBed, async} from '@angular/core/testing'; -export function main() { +{ describe('NgStyle', () => { let fixture: ComponentFixture; diff --git a/packages/common/test/directives/ng_switch_spec.ts b/packages/common/test/directives/ng_switch_spec.ts index 8587b99a52..3adf2a1614 100644 --- a/packages/common/test/directives/ng_switch_spec.ts +++ b/packages/common/test/directives/ng_switch_spec.ts @@ -11,7 +11,7 @@ import {Attribute, Component, Directive} from '@angular/core'; import {ComponentFixture, TestBed} from '@angular/core/testing'; import {expect} from '@angular/platform-browser/testing/src/matchers'; -export function main() { +{ describe('NgSwitch', () => { let fixture: ComponentFixture; diff --git a/packages/common/test/directives/ng_template_outlet_spec.ts b/packages/common/test/directives/ng_template_outlet_spec.ts index 13135629cd..a9bcca57e2 100644 --- a/packages/common/test/directives/ng_template_outlet_spec.ts +++ b/packages/common/test/directives/ng_template_outlet_spec.ts @@ -11,7 +11,7 @@ import {Component, ContentChildren, Directive, Injectable, NO_ERRORS_SCHEMA, OnD import {ComponentFixture, TestBed, async} from '@angular/core/testing'; import {expect} from '@angular/platform-browser/testing/src/matchers'; -export function main() { +{ describe('NgTemplateOutlet', () => { let fixture: ComponentFixture; diff --git a/packages/common/test/directives/non_bindable_spec.ts b/packages/common/test/directives/non_bindable_spec.ts index 84648ac901..a6ee2330f4 100644 --- a/packages/common/test/directives/non_bindable_spec.ts +++ b/packages/common/test/directives/non_bindable_spec.ts @@ -12,7 +12,7 @@ import {ComponentFixture, TestBed, async} 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('non-bindable', () => { beforeEach(() => { diff --git a/packages/common/test/i18n/locale_data_api_spec.ts b/packages/common/test/i18n/locale_data_api_spec.ts index 7d659446e3..4506b4886f 100644 --- a/packages/common/test/i18n/locale_data_api_spec.ts +++ b/packages/common/test/i18n/locale_data_api_spec.ts @@ -13,7 +13,7 @@ import localeFrCA from '../../locales/fr-CA'; import {registerLocaleData} from '../../src/i18n/locale_data'; import {findLocaleData} from '../../src/i18n/locale_data_api'; -export function main() { +{ describe('locale data api', () => { beforeAll(() => { registerLocaleData(localeCaESVALENCIA); diff --git a/packages/common/test/i18n/localization_spec.ts b/packages/common/test/i18n/localization_spec.ts index f04b5970a4..fea5870e35 100644 --- a/packages/common/test/i18n/localization_spec.ts +++ b/packages/common/test/i18n/localization_spec.ts @@ -16,7 +16,7 @@ import {NgLocaleLocalization, NgLocalization, getPluralCategory, DEPRECATED_PLUR import {Plural} from '../../src/i18n/locale_data_api'; import {registerLocaleData} from '../../src/i18n/locale_data'; -export function main() { +{ describe('l10n', () => { beforeAll(() => { registerLocaleData(localeRo); diff --git a/packages/common/test/location/location_spec.ts b/packages/common/test/location/location_spec.ts index 7a110955d7..7d1fe22ebc 100644 --- a/packages/common/test/location/location_spec.ts +++ b/packages/common/test/location/location_spec.ts @@ -8,7 +8,7 @@ import {Location} from '../../src/location/location'; -export function main() { +{ const baseUrl = '/base'; describe('Location Class', () => { diff --git a/packages/common/test/pipes/async_pipe_spec.ts b/packages/common/test/pipes/async_pipe_spec.ts index 6dece78987..20babf8a9d 100644 --- a/packages/common/test/pipes/async_pipe_spec.ts +++ b/packages/common/test/pipes/async_pipe_spec.ts @@ -14,7 +14,7 @@ import {browserDetection} from '@angular/platform-browser/testing/src/browser_ut import {SpyChangeDetectorRef} from '../spies'; -export function main() { +{ describe('AsyncPipe', () => { describe('Observable', () => { diff --git a/packages/common/test/pipes/case_conversion_pipes_spec.ts b/packages/common/test/pipes/case_conversion_pipes_spec.ts index 808b3f4a78..addde68fed 100644 --- a/packages/common/test/pipes/case_conversion_pipes_spec.ts +++ b/packages/common/test/pipes/case_conversion_pipes_spec.ts @@ -8,7 +8,7 @@ import {LowerCasePipe, TitleCasePipe, UpperCasePipe} from '@angular/common'; -export function main() { +{ describe('LowerCasePipe', () => { let pipe: LowerCasePipe; diff --git a/packages/common/test/pipes/date_pipe_spec.ts b/packages/common/test/pipes/date_pipe_spec.ts index 353b16ba10..a3fc65ecf3 100644 --- a/packages/common/test/pipes/date_pipe_spec.ts +++ b/packages/common/test/pipes/date_pipe_spec.ts @@ -16,7 +16,7 @@ import localeHu from '../../locales/hu'; import localeSr from '../../locales/sr'; import localeTh from '../../locales/th'; -export function main() { +{ describe('DatePipe', () => { let date: Date; const isoStringWithoutTime = '2015-01-01'; diff --git a/packages/common/test/pipes/deprecated/date_pipe_spec.ts b/packages/common/test/pipes/deprecated/date_pipe_spec.ts index d1bbc586ac..b691f53b9a 100644 --- a/packages/common/test/pipes/deprecated/date_pipe_spec.ts +++ b/packages/common/test/pipes/deprecated/date_pipe_spec.ts @@ -11,7 +11,7 @@ import {PipeResolver} from '@angular/compiler/src/pipe_resolver'; import {JitReflector} from '@angular/platform-browser-dynamic/src/compiler_reflector'; import {browserDetection} from '@angular/platform-browser/testing/src/browser_util'; -export function main() { +{ describe('DeprecatedDatePipe', () => { let date: Date; const isoStringWithoutTime = '2015-01-01'; diff --git a/packages/common/test/pipes/deprecated/number_pipe_spec.ts b/packages/common/test/pipes/deprecated/number_pipe_spec.ts index a0fb5edfc7..d4dcda69fd 100644 --- a/packages/common/test/pipes/deprecated/number_pipe_spec.ts +++ b/packages/common/test/pipes/deprecated/number_pipe_spec.ts @@ -10,7 +10,7 @@ import {DeprecatedCurrencyPipe, DeprecatedDecimalPipe, DeprecatedPercentPipe} fr import {beforeEach, describe, expect, it} from '@angular/core/testing/src/testing_internal'; import {browserDetection} from '@angular/platform-browser/testing/src/browser_util'; -export function main() { +(function(){ function isNumeric(value: any): boolean { return !isNaN(value - parseFloat(value)); } // Between the symbol and the number, Edge adds a no breaking space and IE11 adds a standard space @@ -106,4 +106,4 @@ export function main() { () => { expect(isNumeric('2a')).toBe(false); }); }); }); -} +})(); diff --git a/packages/common/test/pipes/i18n_plural_pipe_spec.ts b/packages/common/test/pipes/i18n_plural_pipe_spec.ts index 0dc60f8ad5..2941584b3c 100644 --- a/packages/common/test/pipes/i18n_plural_pipe_spec.ts +++ b/packages/common/test/pipes/i18n_plural_pipe_spec.ts @@ -11,7 +11,7 @@ import {PipeResolver} from '@angular/compiler/src/pipe_resolver'; import {beforeEach, describe, expect, it} from '@angular/core/testing/src/testing_internal'; import {JitReflector} from '@angular/platform-browser-dynamic/src/compiler_reflector'; -export function main() { +{ describe('I18nPluralPipe', () => { let localization: NgLocalization; let pipe: I18nPluralPipe; diff --git a/packages/common/test/pipes/i18n_select_pipe_spec.ts b/packages/common/test/pipes/i18n_select_pipe_spec.ts index d0b716f032..2d68a237d3 100644 --- a/packages/common/test/pipes/i18n_select_pipe_spec.ts +++ b/packages/common/test/pipes/i18n_select_pipe_spec.ts @@ -10,7 +10,7 @@ import {I18nSelectPipe} from '@angular/common'; import {PipeResolver} from '@angular/compiler/src/pipe_resolver'; import {JitReflector} from '@angular/platform-browser-dynamic/src/compiler_reflector'; -export function main() { +{ describe('I18nSelectPipe', () => { const pipe: I18nSelectPipe = new I18nSelectPipe(); const mapping = {'male': 'Invite him.', 'female': 'Invite her.', 'other': 'Invite them.'}; diff --git a/packages/common/test/pipes/json_pipe_spec.ts b/packages/common/test/pipes/json_pipe_spec.ts index 36b5621b59..a9f5e4637d 100644 --- a/packages/common/test/pipes/json_pipe_spec.ts +++ b/packages/common/test/pipes/json_pipe_spec.ts @@ -11,7 +11,7 @@ import {Component} from '@angular/core'; import {TestBed, async} from '@angular/core/testing'; import {expect} from '@angular/platform-browser/testing/src/matchers'; -export function main() { +{ describe('JsonPipe', () => { const regNewLine = '\n'; let inceptionObj: any; diff --git a/packages/common/test/pipes/number_pipe_spec.ts b/packages/common/test/pipes/number_pipe_spec.ts index 5a34182868..af354e9abd 100644 --- a/packages/common/test/pipes/number_pipe_spec.ts +++ b/packages/common/test/pipes/number_pipe_spec.ts @@ -12,7 +12,7 @@ import localeFr from '../../locales/fr'; import {registerLocaleData, CurrencyPipe, DecimalPipe, PercentPipe} from '@angular/common'; import {beforeEach, describe, expect, it} from '@angular/core/testing/src/testing_internal'; -export function main() { +{ describe('Number pipes', () => { beforeAll(() => { registerLocaleData(localeEn); diff --git a/packages/common/test/pipes/slice_pipe_spec.ts b/packages/common/test/pipes/slice_pipe_spec.ts index 4dc7aa9c7f..8ed5c41bb2 100644 --- a/packages/common/test/pipes/slice_pipe_spec.ts +++ b/packages/common/test/pipes/slice_pipe_spec.ts @@ -11,7 +11,7 @@ import {Component} from '@angular/core'; import {TestBed, async} from '@angular/core/testing'; import {expect} from '@angular/platform-browser/testing/src/matchers'; -export function main() { +{ describe('SlicePipe', () => { let list: number[]; let str: string; diff --git a/packages/compiler/test/aot/summary_resolver_spec.ts b/packages/compiler/test/aot/summary_resolver_spec.ts index 87832a1539..c431d863dc 100644 --- a/packages/compiler/test/aot/summary_resolver_spec.ts +++ b/packages/compiler/test/aot/summary_resolver_spec.ts @@ -16,7 +16,7 @@ import {MockStaticSymbolResolverHost, MockSummaryResolver} from './static_symbol const EXT = /(\.d)?\.ts$/; -export function main() { +{ describe('AotSummaryResolver', () => { let summaryResolver: AotSummaryResolver; let symbolCache: StaticSymbolCache; diff --git a/packages/compiler/test/aot/summary_serializer_spec.ts b/packages/compiler/test/aot/summary_serializer_spec.ts index 1ad1ebbafe..26cae7dd97 100644 --- a/packages/compiler/test/aot/summary_serializer_spec.ts +++ b/packages/compiler/test/aot/summary_serializer_spec.ts @@ -15,7 +15,7 @@ import {MockStaticSymbolResolverHost} from './static_symbol_resolver_spec'; import {MockAotSummaryResolverHost, createMockOutputContext} from './summary_resolver_spec'; -export function main() { +{ describe('summary serializer', () => { let summaryResolver: AotSummaryResolver; let symbolResolver: StaticSymbolResolver; diff --git a/packages/compiler/test/config_spec.ts b/packages/compiler/test/config_spec.ts index f7fd61d46d..6d164afc63 100644 --- a/packages/compiler/test/config_spec.ts +++ b/packages/compiler/test/config_spec.ts @@ -9,7 +9,7 @@ import {MissingTranslationStrategy} from '@angular/core'; import {CompilerConfig} from '../src/config'; -export function main() { +{ describe('compiler config', () => { it('should set missing translation strategy', () => { const config = new CompilerConfig({missingTranslation: MissingTranslationStrategy.Error}); diff --git a/packages/compiler/test/core_spec.ts b/packages/compiler/test/core_spec.ts index 315cf073df..fb022ead68 100644 --- a/packages/compiler/test/core_spec.ts +++ b/packages/compiler/test/core_spec.ts @@ -9,7 +9,7 @@ import {core as compilerCore} from '@angular/compiler'; import * as core from '@angular/core'; -export function main() { +{ describe('compiler core', () => { it('Attribute should be equal', () => { typeExtends(); diff --git a/packages/compiler/test/css_parser/css_lexer_spec.ts b/packages/compiler/test/css_parser/css_lexer_spec.ts index 5399131589..4bf82d5613 100644 --- a/packages/compiler/test/css_parser/css_lexer_spec.ts +++ b/packages/compiler/test/css_parser/css_lexer_spec.ts @@ -9,7 +9,7 @@ import {describe, expect, it} from '../../../core/testing/src/testing_internal'; import {CssLexer, CssLexerMode, CssToken, CssTokenType, cssScannerError, getRawMessage, getToken} from '../../src/css_parser/css_lexer'; -export function main() { +(function(){ function tokenize( code: string, trackComments: boolean = false, mode: CssLexerMode = CssLexerMode.ALL): CssToken[] { @@ -373,4 +373,4 @@ export function main() { }); }); }); -} +})(); diff --git a/packages/compiler/test/css_parser/css_parser_spec.ts b/packages/compiler/test/css_parser/css_parser_spec.ts index 979f8b466f..670a48264b 100644 --- a/packages/compiler/test/css_parser/css_parser_spec.ts +++ b/packages/compiler/test/css_parser/css_parser_spec.ts @@ -18,7 +18,7 @@ export function assertTokens(tokens: CssToken[], valuesArr: string[]) { } } -export function main() { +{ describe('CssParser', () => { function parse(css: string): ParsedCssResult { return new CssParser().parse(css, 'some-fake-css-file.css'); diff --git a/packages/compiler/test/css_parser/css_visitor_spec.ts b/packages/compiler/test/css_parser/css_visitor_spec.ts index 46538339f3..248d61df85 100644 --- a/packages/compiler/test/css_parser/css_visitor_spec.ts +++ b/packages/compiler/test/css_parser/css_visitor_spec.ts @@ -115,7 +115,7 @@ function _getCaptureAst(capture: any[], index = 0): CssAst { return capture[index][0]; } -export function main() { +(function(){ function parse(cssCode: string, ignoreErrors: boolean = false) { const output = new CssParser().parse(cssCode, 'some-fake-css-file.css'); const errors = output.errors; @@ -318,4 +318,4 @@ export function main() { _assertTokens(rule.tokens, ['six', 'seven', 'eight']); }); }); -} +})(); diff --git a/packages/compiler/test/directive_lifecycle_spec.ts b/packages/compiler/test/directive_lifecycle_spec.ts index 5d1193ccda..a4bd85928f 100644 --- a/packages/compiler/test/directive_lifecycle_spec.ts +++ b/packages/compiler/test/directive_lifecycle_spec.ts @@ -14,7 +14,7 @@ function hasLifecycleHook(hook: Hooks, directive: any): boolean { return hasLifecycleHookImpl(new JitReflector(), hook, directive); } -export function main() { +{ describe('Create Directive', () => { describe('lifecycle', () => { diff --git a/packages/compiler/test/directive_normalizer_spec.ts b/packages/compiler/test/directive_normalizer_spec.ts index f0504ac148..34bd29d809 100644 --- a/packages/compiler/test/directive_normalizer_spec.ts +++ b/packages/compiler/test/directive_normalizer_spec.ts @@ -42,7 +42,7 @@ function normalizeTemplate(normalizer: DirectiveNormalizer, o: { }); } -export function main() { +{ describe('DirectiveNormalizer', () => { let resourceLoaderSpy: jasmine.Spy; diff --git a/packages/compiler/test/directive_resolver_mock_spec.ts b/packages/compiler/test/directive_resolver_mock_spec.ts index 48be217725..dc1a82cff9 100644 --- a/packages/compiler/test/directive_resolver_mock_spec.ts +++ b/packages/compiler/test/directive_resolver_mock_spec.ts @@ -12,7 +12,7 @@ import {JitReflector} from '@angular/platform-browser-dynamic/src/compiler_refle import {MockDirectiveResolver} from '../testing'; -export function main() { +{ describe('MockDirectiveResolver', () => { let dirResolver: MockDirectiveResolver; diff --git a/packages/compiler/test/directive_resolver_spec.ts b/packages/compiler/test/directive_resolver_spec.ts index f8103b3987..4d211643f9 100644 --- a/packages/compiler/test/directive_resolver_spec.ts +++ b/packages/compiler/test/directive_resolver_spec.ts @@ -112,7 +112,7 @@ class SomeDirectiveWithMalformedHostBinding2 { class SomeDirectiveWithoutMetadata {} -export function main() { +{ describe('DirectiveResolver', () => { let resolver: DirectiveResolver; diff --git a/packages/compiler/test/expression_parser/lexer_spec.ts b/packages/compiler/test/expression_parser/lexer_spec.ts index 74e74c353b..2072748e1d 100644 --- a/packages/compiler/test/expression_parser/lexer_spec.ts +++ b/packages/compiler/test/expression_parser/lexer_spec.ts @@ -58,7 +58,7 @@ function expectErrorToken(token: Token, index: any, message: string) { expect(token.toString()).toEqual(message); } -export function main() { +{ describe('lexer', () => { describe('token', () => { it('should tokenize a simple identifier', () => { diff --git a/packages/compiler/test/expression_parser/parser_spec.ts b/packages/compiler/test/expression_parser/parser_spec.ts index 260a516be0..7a127b852f 100644 --- a/packages/compiler/test/expression_parser/parser_spec.ts +++ b/packages/compiler/test/expression_parser/parser_spec.ts @@ -15,7 +15,7 @@ import {expect} from '@angular/platform-browser/testing/src/matchers'; import {unparse} from './unparser'; import {validate} from './validator'; -export function main() { +(function(){ function createParser() { return new Parser(new Lexer()); } function parseAction(text: string, location: any = null): ASTWithSource { @@ -604,4 +604,4 @@ export function main() { }); }); }); -} +})(); diff --git a/packages/compiler/test/i18n/digest_spec.ts b/packages/compiler/test/i18n/digest_spec.ts index 532430d64f..22bd7b6eb6 100644 --- a/packages/compiler/test/i18n/digest_spec.ts +++ b/packages/compiler/test/i18n/digest_spec.ts @@ -8,7 +8,7 @@ import {computeMsgId, digest, sha1} from '../../src/i18n/digest'; -export function main(): void { +{ describe('digest', () => { describe('digest', () => { it('must return the ID if it\'s explicit', () => { diff --git a/packages/compiler/test/i18n/extractor_merger_spec.ts b/packages/compiler/test/i18n/extractor_merger_spec.ts index ff1809672a..5b1a05b8c0 100644 --- a/packages/compiler/test/i18n/extractor_merger_spec.ts +++ b/packages/compiler/test/i18n/extractor_merger_spec.ts @@ -16,7 +16,7 @@ import {TranslationBundle} from '../../src/i18n/translation_bundle'; import * as html from '../../src/ml_parser/ast'; import {serializeNodes as serializeHtmlNodes} from '../ml_parser/ast_serializer_spec'; -export function main() { +{ describe('Extractor', () => { describe('elements', () => { it('should extract from elements', () => { diff --git a/packages/compiler/test/i18n/i18n_html_parser_spec.ts b/packages/compiler/test/i18n/i18n_html_parser_spec.ts index 84afbd9e7d..e4edccc85b 100644 --- a/packages/compiler/test/i18n/i18n_html_parser_spec.ts +++ b/packages/compiler/test/i18n/i18n_html_parser_spec.ts @@ -11,7 +11,7 @@ import {TranslationBundle} from '@angular/compiler/src/i18n/translation_bundle'; import {HtmlParser} from '@angular/compiler/src/ml_parser/html_parser'; import {ParseTreeResult} from '@angular/compiler/src/ml_parser/parser'; -export function main() { +{ describe('I18N html parser', () => { // https://github.com/angular/angular/issues/14322 it('should parse the translations only once', () => { diff --git a/packages/compiler/test/i18n/i18n_parser_spec.ts b/packages/compiler/test/i18n/i18n_parser_spec.ts index abbd2d1020..4b9994ee27 100644 --- a/packages/compiler/test/i18n/i18n_parser_spec.ts +++ b/packages/compiler/test/i18n/i18n_parser_spec.ts @@ -12,7 +12,7 @@ import {Message} from '@angular/compiler/src/i18n/i18n_ast'; import {HtmlParser} from '@angular/compiler/src/ml_parser/html_parser'; import {DEFAULT_INTERPOLATION_CONFIG} from '@angular/compiler/src/ml_parser/interpolation_config'; -export function main() { +{ describe('I18nParser', () => { describe('elements', () => { diff --git a/packages/compiler/test/i18n/integration_xliff2_spec.ts b/packages/compiler/test/i18n/integration_xliff2_spec.ts index add927a8c1..4c80d1a4ae 100644 --- a/packages/compiler/test/i18n/integration_xliff2_spec.ts +++ b/packages/compiler/test/i18n/integration_xliff2_spec.ts @@ -20,7 +20,7 @@ import {SpyResourceLoader} from '../spies'; import {FrLocalization, HTML, I18nComponent, validateHtml} from './integration_common'; -export function main() { +{ describe('i18n XLIFF 2.0 integration spec', () => { beforeEach(async(() => { diff --git a/packages/compiler/test/i18n/integration_xliff_spec.ts b/packages/compiler/test/i18n/integration_xliff_spec.ts index 7355fff485..dbe823e6f3 100644 --- a/packages/compiler/test/i18n/integration_xliff_spec.ts +++ b/packages/compiler/test/i18n/integration_xliff_spec.ts @@ -20,7 +20,7 @@ import {SpyResourceLoader} from '../spies'; import {FrLocalization, HTML, I18nComponent, validateHtml} from './integration_common'; -export function main() { +{ describe('i18n XLIFF integration spec', () => { beforeEach(async(() => { diff --git a/packages/compiler/test/i18n/integration_xmb_xtb_spec.ts b/packages/compiler/test/i18n/integration_xmb_xtb_spec.ts index 88f249a346..ee85887e68 100644 --- a/packages/compiler/test/i18n/integration_xmb_xtb_spec.ts +++ b/packages/compiler/test/i18n/integration_xmb_xtb_spec.ts @@ -20,7 +20,7 @@ import {SpyResourceLoader} from '../spies'; import {FrLocalization, HTML, I18nComponent, validateHtml} from './integration_common'; -export function main() { +{ describe('i18n XMB/XTB integration spec', () => { beforeEach(async(() => { diff --git a/packages/compiler/test/i18n/message_bundle_spec.ts b/packages/compiler/test/i18n/message_bundle_spec.ts index cae03595bd..ef9cbde561 100644 --- a/packages/compiler/test/i18n/message_bundle_spec.ts +++ b/packages/compiler/test/i18n/message_bundle_spec.ts @@ -13,7 +13,7 @@ import {Serializer} from '../../src/i18n/serializers/serializer'; import {HtmlParser} from '../../src/ml_parser/html_parser'; import {DEFAULT_INTERPOLATION_CONFIG} from '../../src/ml_parser/interpolation_config'; -export function main(): void { +{ describe('MessageBundle', () => { describe('Messages', () => { let messages: MessageBundle; diff --git a/packages/compiler/test/i18n/serializers/i18n_ast_spec.ts b/packages/compiler/test/i18n/serializers/i18n_ast_spec.ts index abc5f370d5..3edf6951a5 100644 --- a/packages/compiler/test/i18n/serializers/i18n_ast_spec.ts +++ b/packages/compiler/test/i18n/serializers/i18n_ast_spec.ts @@ -11,7 +11,7 @@ import * as i18n from '@angular/compiler/src/i18n/i18n_ast'; import {serializeNodes} from '../../../src/i18n/digest'; import {_extractMessages} from '../i18n_parser_spec'; -export function main(): void { +{ describe('i18n AST', () => { describe('CloneVisitor', () => { it('should clone an AST', () => { diff --git a/packages/compiler/test/i18n/serializers/placeholder_spec.ts b/packages/compiler/test/i18n/serializers/placeholder_spec.ts index eb068695c0..e3aa205d17 100644 --- a/packages/compiler/test/i18n/serializers/placeholder_spec.ts +++ b/packages/compiler/test/i18n/serializers/placeholder_spec.ts @@ -8,7 +8,7 @@ import {PlaceholderRegistry} from '../../../src/i18n/serializers/placeholder'; -export function main(): void { +{ describe('PlaceholderRegistry', () => { let reg: PlaceholderRegistry; diff --git a/packages/compiler/test/i18n/serializers/xliff2_spec.ts b/packages/compiler/test/i18n/serializers/xliff2_spec.ts index 2ed9c998ab..1c934a13e8 100644 --- a/packages/compiler/test/i18n/serializers/xliff2_spec.ts +++ b/packages/compiler/test/i18n/serializers/xliff2_spec.ts @@ -242,7 +242,7 @@ lignes `; -export function main(): void { +(function(){ const serializer = new Xliff2(); function toXliff(html: string, locale: string | null = null): string { @@ -413,4 +413,4 @@ lignes` }); }); }); -} +})(); diff --git a/packages/compiler/test/i18n/serializers/xliff_spec.ts b/packages/compiler/test/i18n/serializers/xliff_spec.ts index c5f6a2c128..623f98f9b2 100644 --- a/packages/compiler/test/i18n/serializers/xliff_spec.ts +++ b/packages/compiler/test/i18n/serializers/xliff_spec.ts @@ -226,7 +226,7 @@ lignes `; -export function main(): void { +(function(){ const serializer = new Xliff(); function toXliff(html: string, locale: string | null = null): string { @@ -381,4 +381,4 @@ lignes` }); }); }); -} +})(); diff --git a/packages/compiler/test/i18n/serializers/xmb_spec.ts b/packages/compiler/test/i18n/serializers/xmb_spec.ts index a65678e997..45d0bc6450 100644 --- a/packages/compiler/test/i18n/serializers/xmb_spec.ts +++ b/packages/compiler/test/i18n/serializers/xmb_spec.ts @@ -11,7 +11,7 @@ import {Xmb} from '@angular/compiler/src/i18n/serializers/xmb'; import {HtmlParser} from '@angular/compiler/src/ml_parser/html_parser'; import {DEFAULT_INTERPOLATION_CONFIG} from '@angular/compiler/src/ml_parser/interpolation_config'; -export function main(): void { +{ describe('XMB serializer', () => { const HTML = `

not translatable

diff --git a/packages/compiler/test/i18n/serializers/xml_helper_spec.ts b/packages/compiler/test/i18n/serializers/xml_helper_spec.ts index e1f9215b4d..d8e4016048 100644 --- a/packages/compiler/test/i18n/serializers/xml_helper_spec.ts +++ b/packages/compiler/test/i18n/serializers/xml_helper_spec.ts @@ -8,7 +8,7 @@ import * as xml from '../../../src/i18n/serializers/xml_helper'; -export function main(): void { +{ describe('XML helper', () => { it('should serialize XML declaration', () => { expect(xml.serialize([new xml.Declaration({version: '1.0'})])) diff --git a/packages/compiler/test/i18n/serializers/xtb_spec.ts b/packages/compiler/test/i18n/serializers/xtb_spec.ts index c4557d741d..d162fc9739 100644 --- a/packages/compiler/test/i18n/serializers/xtb_spec.ts +++ b/packages/compiler/test/i18n/serializers/xtb_spec.ts @@ -12,7 +12,7 @@ import * as i18n from '../../../src/i18n/i18n_ast'; import {Xtb} from '../../../src/i18n/serializers/xtb'; -export function main(): void { +{ describe('XTB serializer', () => { const serializer = new Xtb(); diff --git a/packages/compiler/test/i18n/translation_bundle_spec.ts b/packages/compiler/test/i18n/translation_bundle_spec.ts index 1a78e89d2b..6da0e99456 100644 --- a/packages/compiler/test/i18n/translation_bundle_spec.ts +++ b/packages/compiler/test/i18n/translation_bundle_spec.ts @@ -14,7 +14,7 @@ import {ParseLocation, ParseSourceFile, ParseSourceSpan} from '../../src/parse_u import {serializeNodes} from '../ml_parser/ast_serializer_spec'; import {_extractMessages} from './i18n_parser_spec'; -export function main(): void { +{ describe('TranslationBundle', () => { const file = new ParseSourceFile('content', 'url'); const startLocation = new ParseLocation(file, 0, 0, 0); diff --git a/packages/compiler/test/integration_spec.ts b/packages/compiler/test/integration_spec.ts index 321b37c0d9..34587b2ac1 100644 --- a/packages/compiler/test/integration_spec.ts +++ b/packages/compiler/test/integration_spec.ts @@ -12,7 +12,7 @@ import {By} from '@angular/platform-browser/src/dom/debug/by'; import {browserDetection} from '@angular/platform-browser/testing/src/browser_util'; import {expect} from '@angular/platform-browser/testing/src/matchers'; -export function main() { +{ describe('integration tests', () => { let fixture: ComponentFixture; diff --git a/packages/compiler/test/metadata_resolver_spec.ts b/packages/compiler/test/metadata_resolver_spec.ts index 313d95c7d6..2ef89defb0 100644 --- a/packages/compiler/test/metadata_resolver_spec.ts +++ b/packages/compiler/test/metadata_resolver_spec.ts @@ -18,7 +18,7 @@ import {MockResourceLoader} from '../testing/src/resource_loader_mock'; import {MalformedStylesComponent} from './metadata_resolver_fixture'; import {TEST_COMPILER_PROVIDERS} from './test_bindings'; -export function main() { +{ describe('CompileMetadataResolver', () => { beforeEach(() => { TestBed.configureCompiler({providers: TEST_COMPILER_PROVIDERS}); }); diff --git a/packages/compiler/test/ml_parser/ast_serializer_spec.ts b/packages/compiler/test/ml_parser/ast_serializer_spec.ts index 5e33a302d5..2c0fb98700 100644 --- a/packages/compiler/test/ml_parser/ast_serializer_spec.ts +++ b/packages/compiler/test/ml_parser/ast_serializer_spec.ts @@ -10,7 +10,7 @@ import * as html from '@angular/compiler/src/ml_parser/ast'; import {HtmlParser} from '@angular/compiler/src/ml_parser/html_parser'; import {getHtmlTagDefinition} from '@angular/compiler/src/ml_parser/html_tags'; -export function main() { +{ describe('Node serializer', () => { let parser: HtmlParser; diff --git a/packages/compiler/test/ml_parser/html_parser_spec.ts b/packages/compiler/test/ml_parser/html_parser_spec.ts index 837ec0ebb0..bb35da8cb7 100644 --- a/packages/compiler/test/ml_parser/html_parser_spec.ts +++ b/packages/compiler/test/ml_parser/html_parser_spec.ts @@ -13,7 +13,7 @@ import {ParseError} from '../../src/parse_util'; import {humanizeDom, humanizeDomSourceSpans, humanizeLineColumn} from './ast_spec_utils'; -export function main() { +{ describe('HtmlParser', () => { let parser: HtmlParser; diff --git a/packages/compiler/test/ml_parser/html_whitespaces_spec.ts b/packages/compiler/test/ml_parser/html_whitespaces_spec.ts index bb7c9a8470..8da5898353 100644 --- a/packages/compiler/test/ml_parser/html_whitespaces_spec.ts +++ b/packages/compiler/test/ml_parser/html_whitespaces_spec.ts @@ -12,7 +12,7 @@ import {PRESERVE_WS_ATTR_NAME, removeWhitespaces} from '../../src/ml_parser/html import {humanizeDom} from './ast_spec_utils'; -export function main() { +{ describe('removeWhitespaces', () => { function parseAndRemoveWS(template: string): any[] { diff --git a/packages/compiler/test/ml_parser/icu_ast_expander_spec.ts b/packages/compiler/test/ml_parser/icu_ast_expander_spec.ts index 43e71f1102..992675b9b9 100644 --- a/packages/compiler/test/ml_parser/icu_ast_expander_spec.ts +++ b/packages/compiler/test/ml_parser/icu_ast_expander_spec.ts @@ -13,7 +13,7 @@ import {ParseError} from '../../src/parse_util'; import {humanizeNodes} from './ast_spec_utils'; -export function main() { +{ describe('Expander', () => { function expand(template: string): ExpansionResult { const htmlParser = new HtmlParser(); diff --git a/packages/compiler/test/ml_parser/lexer_spec.ts b/packages/compiler/test/ml_parser/lexer_spec.ts index 5c53668298..f2fe62a1d5 100644 --- a/packages/compiler/test/ml_parser/lexer_spec.ts +++ b/packages/compiler/test/ml_parser/lexer_spec.ts @@ -11,7 +11,7 @@ import {InterpolationConfig} from '../../src/ml_parser/interpolation_config'; import * as lex from '../../src/ml_parser/lexer'; import {ParseLocation, ParseSourceFile, ParseSourceSpan} from '../../src/parse_util'; -export function main() { +{ describe('HtmlLexer', () => { describe('line/column numbers', () => { it('should work without newlines', () => { diff --git a/packages/compiler/test/ng_module_resolver_mock_spec.ts b/packages/compiler/test/ng_module_resolver_mock_spec.ts index adf792edde..00a2df52cc 100644 --- a/packages/compiler/test/ng_module_resolver_mock_spec.ts +++ b/packages/compiler/test/ng_module_resolver_mock_spec.ts @@ -12,7 +12,7 @@ import {JitReflector} from '@angular/platform-browser-dynamic/src/compiler_refle import {MockNgModuleResolver} from '../testing'; -export function main() { +{ describe('MockNgModuleResolver', () => { let ngModuleResolver: MockNgModuleResolver; diff --git a/packages/compiler/test/ng_module_resolver_spec.ts b/packages/compiler/test/ng_module_resolver_spec.ts index c56dfc1ec2..d9b019c520 100644 --- a/packages/compiler/test/ng_module_resolver_spec.ts +++ b/packages/compiler/test/ng_module_resolver_spec.ts @@ -29,7 +29,7 @@ class SomeModule { class SimpleClass {} -export function main() { +{ describe('NgModuleResolver', () => { let resolver: NgModuleResolver; diff --git a/packages/compiler/test/output/abstract_emitter_node_only_spec.ts b/packages/compiler/test/output/abstract_emitter_node_only_spec.ts index d0f976e632..affabdad26 100644 --- a/packages/compiler/test/output/abstract_emitter_node_only_spec.ts +++ b/packages/compiler/test/output/abstract_emitter_node_only_spec.ts @@ -11,7 +11,7 @@ import {EmitterVisitorContext} from '@angular/compiler/src/output/abstract_emitt import {SourceMap} from '@angular/compiler/src/output/source_map'; import {extractSourceMap, originalPositionFor} from '@angular/compiler/testing/src/output/source_map_util'; -export function main() { +{ describe('AbstractEmitter', () => { describe('EmitterVisitorContext', () => { const fileA = new ParseSourceFile('a0a1a2a3a4a5a6a7a8a9', 'a.js'); diff --git a/packages/compiler/test/output/abstract_emitter_spec.ts b/packages/compiler/test/output/abstract_emitter_spec.ts index 7f091a3d3a..d28b439ff1 100644 --- a/packages/compiler/test/output/abstract_emitter_spec.ts +++ b/packages/compiler/test/output/abstract_emitter_spec.ts @@ -8,7 +8,7 @@ import {escapeIdentifier} from '@angular/compiler/src/output/abstract_emitter'; -export function main() { +{ describe('AbstractEmitter', () => { describe('escapeIdentifier', () => { it('should escape single quotes', diff --git a/packages/compiler/test/output/js_emitter_node_only_spec.ts b/packages/compiler/test/output/js_emitter_node_only_spec.ts index 03a689fb72..1ec2bb4e3c 100644 --- a/packages/compiler/test/output/js_emitter_node_only_spec.ts +++ b/packages/compiler/test/output/js_emitter_node_only_spec.ts @@ -17,7 +17,7 @@ import {extractSourceMap, originalPositionFor} from '@angular/compiler/testing/s const someGenFilePath = 'somePackage/someGenFile'; -export function main() { +{ describe('JavaScriptEmitter', () => { let emitter: JavaScriptEmitter; let someVar: o.ReadVarExpr; diff --git a/packages/compiler/test/output/js_emitter_spec.ts b/packages/compiler/test/output/js_emitter_spec.ts index a336eba6dc..184cb615e9 100644 --- a/packages/compiler/test/output/js_emitter_spec.ts +++ b/packages/compiler/test/output/js_emitter_spec.ts @@ -19,7 +19,7 @@ const sameModuleIdentifier = new o.ExternalReference(null, 'someLocalId', null); const externalModuleIdentifier = new o.ExternalReference(anotherModuleUrl, 'someExternalId', null); -export function main() { +{ // Note supported features of our OutputAstin JavaScript / ES5: // - types // - declaring fields diff --git a/packages/compiler/test/output/output_ast_spec.ts b/packages/compiler/test/output/output_ast_spec.ts index f21895533c..5e03c617f5 100644 --- a/packages/compiler/test/output/output_ast_spec.ts +++ b/packages/compiler/test/output/output_ast_spec.ts @@ -8,7 +8,7 @@ import * as o from '../../src/output/output_ast'; -export function main() { +{ describe('OutputAst', () => { describe('collectExternalReferences', () => { it('should find expressions of variable types', () => { diff --git a/packages/compiler/test/output/output_jit_spec.ts b/packages/compiler/test/output/output_jit_spec.ts index 5587d4109a..ccdeed559f 100644 --- a/packages/compiler/test/output/output_jit_spec.ts +++ b/packages/compiler/test/output/output_jit_spec.ts @@ -13,7 +13,7 @@ import {JitReflector} from '@angular/platform-browser-dynamic/src/compiler_refle const anotherModuleUrl = 'somePackage/someOtherPath'; -export function main() { +{ describe('Output JIT', () => { describe('regression', () => { it('should generate unique argument names', () => { diff --git a/packages/compiler/test/output/source_map_spec.ts b/packages/compiler/test/output/source_map_spec.ts index b80af659b6..ea76893e11 100644 --- a/packages/compiler/test/output/source_map_spec.ts +++ b/packages/compiler/test/output/source_map_spec.ts @@ -8,7 +8,7 @@ import {SourceMapGenerator, toBase64String} from '@angular/compiler/src/output/source_map'; -export function main() { +{ describe('source map generation', () => { describe('generation', () => { it('should generate a valid source map', () => { diff --git a/packages/compiler/test/output/ts_emitter_node_only_spec.ts b/packages/compiler/test/output/ts_emitter_node_only_spec.ts index b1dbabc82b..b1ce420096 100644 --- a/packages/compiler/test/output/ts_emitter_node_only_spec.ts +++ b/packages/compiler/test/output/ts_emitter_node_only_spec.ts @@ -17,7 +17,7 @@ import {extractSourceMap, originalPositionFor} from '@angular/compiler/testing/s const someGenFilePath = 'somePackage/someGenFile'; -export function main() { +{ // Not supported features of our OutputAst in TS: // - real `const` like in Dart // - final fields diff --git a/packages/compiler/test/output/ts_emitter_spec.ts b/packages/compiler/test/output/ts_emitter_spec.ts index ba5b86c0bb..cc64344e9a 100644 --- a/packages/compiler/test/output/ts_emitter_spec.ts +++ b/packages/compiler/test/output/ts_emitter_spec.ts @@ -19,7 +19,7 @@ const sameModuleIdentifier = new o.ExternalReference(null, 'someLocalId', null); const externalModuleIdentifier = new o.ExternalReference(anotherModuleUrl, 'someExternalId', null); -export function main() { +{ // Not supported features of our OutputAst in TS: // - real `const` like in Dart // - final fields diff --git a/packages/compiler/test/parse_util_spec.ts b/packages/compiler/test/parse_util_spec.ts index 9c9ce43f0b..87420ea83d 100644 --- a/packages/compiler/test/parse_util_spec.ts +++ b/packages/compiler/test/parse_util_spec.ts @@ -8,7 +8,7 @@ import {ParseError, ParseErrorLevel, ParseLocation, ParseSourceFile, ParseSourceSpan} from '../src/parse_util'; -export function main() { +{ describe('ParseError', () => { it('should reflect the level in the message', () => { const file = new ParseSourceFile(`foo\nbar\nfoo`, 'url'); diff --git a/packages/compiler/test/pipe_resolver_mock_spec.ts b/packages/compiler/test/pipe_resolver_mock_spec.ts index 4db3e71a6b..d7ae2ee6c1 100644 --- a/packages/compiler/test/pipe_resolver_mock_spec.ts +++ b/packages/compiler/test/pipe_resolver_mock_spec.ts @@ -12,7 +12,7 @@ import {JitReflector} from '@angular/platform-browser-dynamic/src/compiler_refle import {MockPipeResolver} from '../testing'; -export function main() { +{ describe('MockPipeResolver', () => { let pipeResolver: MockPipeResolver; diff --git a/packages/compiler/test/pipe_resolver_spec.ts b/packages/compiler/test/pipe_resolver_spec.ts index 2e5285c823..e338973107 100644 --- a/packages/compiler/test/pipe_resolver_spec.ts +++ b/packages/compiler/test/pipe_resolver_spec.ts @@ -17,7 +17,7 @@ class SomePipe { class SimpleClass {} -export function main() { +{ describe('PipeResolver', () => { let resolver: PipeResolver; diff --git a/packages/compiler/test/resource_loader_mock_spec.ts b/packages/compiler/test/resource_loader_mock_spec.ts index ea23a9bb45..760ff5fce0 100644 --- a/packages/compiler/test/resource_loader_mock_spec.ts +++ b/packages/compiler/test/resource_loader_mock_spec.ts @@ -9,7 +9,7 @@ import {MockResourceLoader} from '@angular/compiler/testing/src/resource_loader_mock'; import {AsyncTestCompleter, beforeEach, describe, expect, inject, it} from '@angular/core/testing/src/testing_internal'; -export function main() { +{ describe('MockResourceLoader', () => { let resourceLoader: MockResourceLoader; diff --git a/packages/compiler/test/runtime_compiler_spec.ts b/packages/compiler/test/runtime_compiler_spec.ts index 73bedc3d05..47423395bd 100644 --- a/packages/compiler/test/runtime_compiler_spec.ts +++ b/packages/compiler/test/runtime_compiler_spec.ts @@ -25,7 +25,7 @@ class SomeComp { class SomeCompWithUrlTemplate { } -export function main() { +{ describe('RuntimeCompiler', () => { describe('compilerComponentSync', () => { diff --git a/packages/compiler/test/schema/dom_element_schema_registry_spec.ts b/packages/compiler/test/schema/dom_element_schema_registry_spec.ts index 8d8a0d77cf..7c6b98c67c 100644 --- a/packages/compiler/test/schema/dom_element_schema_registry_spec.ts +++ b/packages/compiler/test/schema/dom_element_schema_registry_spec.ts @@ -16,7 +16,7 @@ import {HtmlParser} from '../../src/ml_parser/html_parser'; import {extractSchema} from './schema_extractor'; -export function main() { +{ describe('DOMElementSchema', () => { let registry: DomElementSchemaRegistry; beforeEach(() => { registry = new DomElementSchemaRegistry(); }); diff --git a/packages/compiler/test/selector_spec.ts b/packages/compiler/test/selector_spec.ts index 05faa849cc..8b5e64a378 100644 --- a/packages/compiler/test/selector_spec.ts +++ b/packages/compiler/test/selector_spec.ts @@ -10,7 +10,7 @@ import {CssSelector, SelectorMatcher} from '@angular/compiler/src/selector'; import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter'; import {el} from '@angular/platform-browser/testing/src/browser_util'; -export function main() { +{ describe('SelectorMatcher', () => { let matcher: SelectorMatcher; let selectableCollector: (selector: CssSelector, context: any) => void; diff --git a/packages/compiler/test/shadow_css_spec.ts b/packages/compiler/test/shadow_css_spec.ts index 75c209cb61..646e8658a5 100644 --- a/packages/compiler/test/shadow_css_spec.ts +++ b/packages/compiler/test/shadow_css_spec.ts @@ -9,7 +9,7 @@ import {CssRule, ShadowCss, processRules} from '@angular/compiler/src/shadow_css'; import {normalizeCSS} from '@angular/platform-browser/testing/src/browser_util'; -export function main() { +{ describe('ShadowCss', function() { function s(css: string, contentAttr: string, hostAttr: string = '') { diff --git a/packages/compiler/test/style_url_resolver_spec.ts b/packages/compiler/test/style_url_resolver_spec.ts index 251380768a..ef8aebdb5c 100644 --- a/packages/compiler/test/style_url_resolver_spec.ts +++ b/packages/compiler/test/style_url_resolver_spec.ts @@ -9,7 +9,7 @@ import {extractStyleUrls, isStyleUrlResolvable} from '@angular/compiler/src/style_url_resolver'; import {UrlResolver} from '@angular/compiler/src/url_resolver'; -export function main() { +{ describe('extractStyleUrls', () => { let urlResolver: UrlResolver; diff --git a/packages/compiler/test/template_parser/binding_parser_spec.ts b/packages/compiler/test/template_parser/binding_parser_spec.ts index 50c1991ce4..77656c6bc4 100644 --- a/packages/compiler/test/template_parser/binding_parser_spec.ts +++ b/packages/compiler/test/template_parser/binding_parser_spec.ts @@ -12,7 +12,7 @@ import {inject} from '@angular/core/testing'; import {ElementSchemaRegistry} from '../../src/schema/element_schema_registry'; import {calcPossibleSecurityContexts} from '../../src/template_parser/binding_parser'; -export function main() { +{ describe('BindingParser', () => { let registry: ElementSchemaRegistry; diff --git a/packages/compiler/test/template_parser/template_parser_spec.ts b/packages/compiler/test/template_parser/template_parser_spec.ts index 950a79cf3d..cffdbbf8a5 100644 --- a/packages/compiler/test/template_parser/template_parser_spec.ts +++ b/packages/compiler/test/template_parser/template_parser_spec.ts @@ -116,8 +116,214 @@ function compileTemplateMetadata({encapsulation, template, templateUrl, styles, } +function humanizeTplAst( + templateAsts: TemplateAst[], interpolationConfig?: InterpolationConfig): any[] { + const humanizer = new TemplateHumanizer(false, interpolationConfig); + templateVisitAll(humanizer, templateAsts); + return humanizer.result; +} -export function main() { +function humanizeTplAstSourceSpans( + templateAsts: TemplateAst[], interpolationConfig?: InterpolationConfig): any[] { + const humanizer = new TemplateHumanizer(true, interpolationConfig); + templateVisitAll(humanizer, templateAsts); + return humanizer.result; +} + +class TemplateHumanizer implements TemplateAstVisitor { + result: any[] = []; + + constructor( + private includeSourceSpan: boolean, + private interpolationConfig: InterpolationConfig = DEFAULT_INTERPOLATION_CONFIG) {} + + visitNgContent(ast: NgContentAst, context: any): any { + const res = [NgContentAst]; + this.result.push(this._appendContext(ast, res)); + return null; + } + visitEmbeddedTemplate(ast: EmbeddedTemplateAst, context: any): any { + const res = [EmbeddedTemplateAst]; + this.result.push(this._appendContext(ast, res)); + templateVisitAll(this, ast.attrs); + templateVisitAll(this, ast.outputs); + templateVisitAll(this, ast.references); + templateVisitAll(this, ast.variables); + templateVisitAll(this, ast.directives); + templateVisitAll(this, ast.children); + return null; + } + visitElement(ast: ElementAst, context: any): any { + const res = [ElementAst, ast.name]; + this.result.push(this._appendContext(ast, res)); + templateVisitAll(this, ast.attrs); + templateVisitAll(this, ast.inputs); + templateVisitAll(this, ast.outputs); + templateVisitAll(this, ast.references); + templateVisitAll(this, ast.directives); + templateVisitAll(this, ast.children); + return null; + } + visitReference(ast: ReferenceAst, context: any): any { + const res = [ReferenceAst, ast.name, ast.value]; + this.result.push(this._appendContext(ast, res)); + return null; + } + visitVariable(ast: VariableAst, context: any): any { + const res = [VariableAst, ast.name, ast.value]; + this.result.push(this._appendContext(ast, res)); + return null; + } + visitEvent(ast: BoundEventAst, context: any): any { + const res = + [BoundEventAst, ast.name, ast.target, unparse(ast.handler, this.interpolationConfig)]; + this.result.push(this._appendContext(ast, res)); + return null; + } + visitElementProperty(ast: BoundElementPropertyAst, context: any): any { + const res = [ + BoundElementPropertyAst, ast.type, ast.name, unparse(ast.value, this.interpolationConfig), + ast.unit + ]; + this.result.push(this._appendContext(ast, res)); + return null; + } + visitAttr(ast: AttrAst, context: any): any { + const res = [AttrAst, ast.name, ast.value]; + this.result.push(this._appendContext(ast, res)); + return null; + } + visitBoundText(ast: BoundTextAst, context: any): any { + const res = [BoundTextAst, unparse(ast.value, this.interpolationConfig)]; + this.result.push(this._appendContext(ast, res)); + return null; + } + visitText(ast: TextAst, context: any): any { + const res = [TextAst, ast.value]; + this.result.push(this._appendContext(ast, res)); + return null; + } + visitDirective(ast: DirectiveAst, context: any): any { + const res = [DirectiveAst, ast.directive]; + this.result.push(this._appendContext(ast, res)); + templateVisitAll(this, ast.inputs); + templateVisitAll(this, ast.hostProperties); + templateVisitAll(this, ast.hostEvents); + return null; + } + visitDirectiveProperty(ast: BoundDirectivePropertyAst, context: any): any { + const res = [ + BoundDirectivePropertyAst, ast.directiveName, unparse(ast.value, this.interpolationConfig) + ]; + this.result.push(this._appendContext(ast, res)); + return null; + } + + private _appendContext(ast: TemplateAst, input: any[]): any[] { + if (!this.includeSourceSpan) return input; + input.push(ast.sourceSpan !.toString()); + return input; + } +} + +function humanizeContentProjection(templateAsts: TemplateAst[]): any[] { + const humanizer = new TemplateContentProjectionHumanizer(); + templateVisitAll(humanizer, templateAsts); + return humanizer.result; +} + +class TemplateContentProjectionHumanizer implements TemplateAstVisitor { + result: any[] = []; + visitNgContent(ast: NgContentAst, context: any): any { + this.result.push(['ng-content', ast.ngContentIndex]); + return null; + } + visitEmbeddedTemplate(ast: EmbeddedTemplateAst, context: any): any { + this.result.push(['template', ast.ngContentIndex]); + templateVisitAll(this, ast.children); + return null; + } + visitElement(ast: ElementAst, context: any): any { + this.result.push([ast.name, ast.ngContentIndex]); + templateVisitAll(this, ast.children); + return null; + } + visitReference(ast: ReferenceAst, context: any): any { return null; } + visitVariable(ast: VariableAst, context: any): any { return null; } + visitEvent(ast: BoundEventAst, context: any): any { return null; } + visitElementProperty(ast: BoundElementPropertyAst, context: any): any { return null; } + visitAttr(ast: AttrAst, context: any): any { return null; } + visitBoundText(ast: BoundTextAst, context: any): any { + this.result.push([`#text(${unparse(ast.value)})`, ast.ngContentIndex]); + return null; + } + visitText(ast: TextAst, context: any): any { + this.result.push([`#text(${ast.value})`, ast.ngContentIndex]); + return null; + } + visitDirective(ast: DirectiveAst, context: any): any { return null; } + visitDirectiveProperty(ast: BoundDirectivePropertyAst, context: any): any { return null; } +} + +class ThrowingVisitor implements TemplateAstVisitor { + visitNgContent(ast: NgContentAst, context: any): any { throw 'not implemented'; } + visitEmbeddedTemplate(ast: EmbeddedTemplateAst, context: any): any { throw 'not implemented'; } + visitElement(ast: ElementAst, context: any): any { throw 'not implemented'; } + visitReference(ast: ReferenceAst, context: any): any { throw 'not implemented'; } + visitVariable(ast: VariableAst, context: any): any { throw 'not implemented'; } + visitEvent(ast: BoundEventAst, context: any): any { throw 'not implemented'; } + visitElementProperty(ast: BoundElementPropertyAst, context: any): any { throw 'not implemented'; } + visitAttr(ast: AttrAst, context: any): any { throw 'not implemented'; } + visitBoundText(ast: BoundTextAst, context: any): any { throw 'not implemented'; } + visitText(ast: TextAst, context: any): any { throw 'not implemented'; } + visitDirective(ast: DirectiveAst, context: any): any { throw 'not implemented'; } + visitDirectiveProperty(ast: BoundDirectivePropertyAst, context: any): any { + throw 'not implemented'; + } +} + +class FooAstTransformer extends ThrowingVisitor { + visitElement(ast: ElementAst, context: any): any { + if (ast.name != 'div') return ast; + return new ElementAst( + 'foo', [], [], [], [], [], [], false, [], [], ast.ngContentIndex, ast.sourceSpan, + ast.endSourceSpan); + } +} + +class BarAstTransformer extends FooAstTransformer { + visitElement(ast: ElementAst, context: any): any { + if (ast.name != 'foo') return ast; + return new ElementAst( + 'bar', [], [], [], [], [], [], false, [], [], ast.ngContentIndex, ast.sourceSpan, + ast.endSourceSpan); + } +} + +class NullVisitor implements TemplateAstVisitor { + visitNgContent(ast: NgContentAst, context: any): any {} + visitEmbeddedTemplate(ast: EmbeddedTemplateAst, context: any): any {} + visitElement(ast: ElementAst, context: any): any {} + visitReference(ast: ReferenceAst, context: any): any {} + visitVariable(ast: VariableAst, context: any): any {} + visitEvent(ast: BoundEventAst, context: any): any {} + visitElementProperty(ast: BoundElementPropertyAst, context: any): any {} + visitAttr(ast: AttrAst, context: any): any {} + visitBoundText(ast: BoundTextAst, context: any): any {} + visitText(ast: TextAst, context: any): any {} + visitDirective(ast: DirectiveAst, context: any): any {} + visitDirectiveProperty(ast: BoundDirectivePropertyAst, context: any): any {} +} + +class ArrayConsole implements Console { + logs: string[] = []; + warnings: string[] = []; + log(msg: string) { this.logs.push(msg); } + warn(msg: string) { this.warnings.push(msg); } +} + + +(function(){ let ngIf: CompileDirectiveSummary; let parse: ( template: string, directives: CompileDirectiveSummary[], pipes?: CompilePipeSummary[], @@ -2179,210 +2385,4 @@ The pipe 'test' could not be found ("{{[ERROR ->]a | test}}"): TestComp@0:2`); ]); }); }); -} - -function humanizeTplAst( - templateAsts: TemplateAst[], interpolationConfig?: InterpolationConfig): any[] { - const humanizer = new TemplateHumanizer(false, interpolationConfig); - templateVisitAll(humanizer, templateAsts); - return humanizer.result; -} - -function humanizeTplAstSourceSpans( - templateAsts: TemplateAst[], interpolationConfig?: InterpolationConfig): any[] { - const humanizer = new TemplateHumanizer(true, interpolationConfig); - templateVisitAll(humanizer, templateAsts); - return humanizer.result; -} - -class TemplateHumanizer implements TemplateAstVisitor { - result: any[] = []; - - constructor( - private includeSourceSpan: boolean, - private interpolationConfig: InterpolationConfig = DEFAULT_INTERPOLATION_CONFIG) {} - - visitNgContent(ast: NgContentAst, context: any): any { - const res = [NgContentAst]; - this.result.push(this._appendContext(ast, res)); - return null; - } - visitEmbeddedTemplate(ast: EmbeddedTemplateAst, context: any): any { - const res = [EmbeddedTemplateAst]; - this.result.push(this._appendContext(ast, res)); - templateVisitAll(this, ast.attrs); - templateVisitAll(this, ast.outputs); - templateVisitAll(this, ast.references); - templateVisitAll(this, ast.variables); - templateVisitAll(this, ast.directives); - templateVisitAll(this, ast.children); - return null; - } - visitElement(ast: ElementAst, context: any): any { - const res = [ElementAst, ast.name]; - this.result.push(this._appendContext(ast, res)); - templateVisitAll(this, ast.attrs); - templateVisitAll(this, ast.inputs); - templateVisitAll(this, ast.outputs); - templateVisitAll(this, ast.references); - templateVisitAll(this, ast.directives); - templateVisitAll(this, ast.children); - return null; - } - visitReference(ast: ReferenceAst, context: any): any { - const res = [ReferenceAst, ast.name, ast.value]; - this.result.push(this._appendContext(ast, res)); - return null; - } - visitVariable(ast: VariableAst, context: any): any { - const res = [VariableAst, ast.name, ast.value]; - this.result.push(this._appendContext(ast, res)); - return null; - } - visitEvent(ast: BoundEventAst, context: any): any { - const res = - [BoundEventAst, ast.name, ast.target, unparse(ast.handler, this.interpolationConfig)]; - this.result.push(this._appendContext(ast, res)); - return null; - } - visitElementProperty(ast: BoundElementPropertyAst, context: any): any { - const res = [ - BoundElementPropertyAst, ast.type, ast.name, unparse(ast.value, this.interpolationConfig), - ast.unit - ]; - this.result.push(this._appendContext(ast, res)); - return null; - } - visitAttr(ast: AttrAst, context: any): any { - const res = [AttrAst, ast.name, ast.value]; - this.result.push(this._appendContext(ast, res)); - return null; - } - visitBoundText(ast: BoundTextAst, context: any): any { - const res = [BoundTextAst, unparse(ast.value, this.interpolationConfig)]; - this.result.push(this._appendContext(ast, res)); - return null; - } - visitText(ast: TextAst, context: any): any { - const res = [TextAst, ast.value]; - this.result.push(this._appendContext(ast, res)); - return null; - } - visitDirective(ast: DirectiveAst, context: any): any { - const res = [DirectiveAst, ast.directive]; - this.result.push(this._appendContext(ast, res)); - templateVisitAll(this, ast.inputs); - templateVisitAll(this, ast.hostProperties); - templateVisitAll(this, ast.hostEvents); - return null; - } - visitDirectiveProperty(ast: BoundDirectivePropertyAst, context: any): any { - const res = [ - BoundDirectivePropertyAst, ast.directiveName, unparse(ast.value, this.interpolationConfig) - ]; - this.result.push(this._appendContext(ast, res)); - return null; - } - - private _appendContext(ast: TemplateAst, input: any[]): any[] { - if (!this.includeSourceSpan) return input; - input.push(ast.sourceSpan !.toString()); - return input; - } -} - -function humanizeContentProjection(templateAsts: TemplateAst[]): any[] { - const humanizer = new TemplateContentProjectionHumanizer(); - templateVisitAll(humanizer, templateAsts); - return humanizer.result; -} - -class TemplateContentProjectionHumanizer implements TemplateAstVisitor { - result: any[] = []; - visitNgContent(ast: NgContentAst, context: any): any { - this.result.push(['ng-content', ast.ngContentIndex]); - return null; - } - visitEmbeddedTemplate(ast: EmbeddedTemplateAst, context: any): any { - this.result.push(['template', ast.ngContentIndex]); - templateVisitAll(this, ast.children); - return null; - } - visitElement(ast: ElementAst, context: any): any { - this.result.push([ast.name, ast.ngContentIndex]); - templateVisitAll(this, ast.children); - return null; - } - visitReference(ast: ReferenceAst, context: any): any { return null; } - visitVariable(ast: VariableAst, context: any): any { return null; } - visitEvent(ast: BoundEventAst, context: any): any { return null; } - visitElementProperty(ast: BoundElementPropertyAst, context: any): any { return null; } - visitAttr(ast: AttrAst, context: any): any { return null; } - visitBoundText(ast: BoundTextAst, context: any): any { - this.result.push([`#text(${unparse(ast.value)})`, ast.ngContentIndex]); - return null; - } - visitText(ast: TextAst, context: any): any { - this.result.push([`#text(${ast.value})`, ast.ngContentIndex]); - return null; - } - visitDirective(ast: DirectiveAst, context: any): any { return null; } - visitDirectiveProperty(ast: BoundDirectivePropertyAst, context: any): any { return null; } -} - -class ThrowingVisitor implements TemplateAstVisitor { - visitNgContent(ast: NgContentAst, context: any): any { throw 'not implemented'; } - visitEmbeddedTemplate(ast: EmbeddedTemplateAst, context: any): any { throw 'not implemented'; } - visitElement(ast: ElementAst, context: any): any { throw 'not implemented'; } - visitReference(ast: ReferenceAst, context: any): any { throw 'not implemented'; } - visitVariable(ast: VariableAst, context: any): any { throw 'not implemented'; } - visitEvent(ast: BoundEventAst, context: any): any { throw 'not implemented'; } - visitElementProperty(ast: BoundElementPropertyAst, context: any): any { throw 'not implemented'; } - visitAttr(ast: AttrAst, context: any): any { throw 'not implemented'; } - visitBoundText(ast: BoundTextAst, context: any): any { throw 'not implemented'; } - visitText(ast: TextAst, context: any): any { throw 'not implemented'; } - visitDirective(ast: DirectiveAst, context: any): any { throw 'not implemented'; } - visitDirectiveProperty(ast: BoundDirectivePropertyAst, context: any): any { - throw 'not implemented'; - } -} - -class FooAstTransformer extends ThrowingVisitor { - visitElement(ast: ElementAst, context: any): any { - if (ast.name != 'div') return ast; - return new ElementAst( - 'foo', [], [], [], [], [], [], false, [], [], ast.ngContentIndex, ast.sourceSpan, - ast.endSourceSpan); - } -} - -class BarAstTransformer extends FooAstTransformer { - visitElement(ast: ElementAst, context: any): any { - if (ast.name != 'foo') return ast; - return new ElementAst( - 'bar', [], [], [], [], [], [], false, [], [], ast.ngContentIndex, ast.sourceSpan, - ast.endSourceSpan); - } -} - -class NullVisitor implements TemplateAstVisitor { - visitNgContent(ast: NgContentAst, context: any): any {} - visitEmbeddedTemplate(ast: EmbeddedTemplateAst, context: any): any {} - visitElement(ast: ElementAst, context: any): any {} - visitReference(ast: ReferenceAst, context: any): any {} - visitVariable(ast: VariableAst, context: any): any {} - visitEvent(ast: BoundEventAst, context: any): any {} - visitElementProperty(ast: BoundElementPropertyAst, context: any): any {} - visitAttr(ast: AttrAst, context: any): any {} - visitBoundText(ast: BoundTextAst, context: any): any {} - visitText(ast: TextAst, context: any): any {} - visitDirective(ast: DirectiveAst, context: any): any {} - visitDirectiveProperty(ast: BoundDirectivePropertyAst, context: any): any {} -} - -class ArrayConsole implements Console { - logs: string[] = []; - warnings: string[] = []; - log(msg: string) { this.logs.push(msg); } - warn(msg: string) { this.warnings.push(msg); } -} +})(); diff --git a/packages/compiler/test/template_parser/template_preparser_spec.ts b/packages/compiler/test/template_parser/template_preparser_spec.ts index 6325fe216e..a5fd041632 100644 --- a/packages/compiler/test/template_parser/template_preparser_spec.ts +++ b/packages/compiler/test/template_parser/template_preparser_spec.ts @@ -11,7 +11,7 @@ import {Element} from '../../src/ml_parser/ast'; import {HtmlParser} from '../../src/ml_parser/html_parser'; import {PreparsedElement, PreparsedElementType, preparseElement} from '../../src/template_parser/template_preparser'; -export function main() { +{ describe('preparseElement', () => { let htmlParser: HtmlParser; beforeEach(inject([HtmlParser], (_htmlParser: HtmlParser) => { htmlParser = _htmlParser; })); diff --git a/packages/compiler/test/url_resolver_spec.ts b/packages/compiler/test/url_resolver_spec.ts index 67b693c1fe..c6dc97c8a3 100644 --- a/packages/compiler/test/url_resolver_spec.ts +++ b/packages/compiler/test/url_resolver_spec.ts @@ -9,7 +9,7 @@ import {UrlResolver, createOfflineCompileUrlResolver} from '@angular/compiler/src/url_resolver'; import {beforeEach, describe, expect, inject, it} from '@angular/core/testing/src/testing_internal'; -export function main() { +{ describe('UrlResolver', () => { let resolver = new UrlResolver(); diff --git a/packages/compiler/test/util_spec.ts b/packages/compiler/test/util_spec.ts index 149ed6ae1c..188c6c3739 100644 --- a/packages/compiler/test/util_spec.ts +++ b/packages/compiler/test/util_spec.ts @@ -9,7 +9,7 @@ import {fakeAsync} from '@angular/core/testing/src/fake_async'; import {SyncAsync, escapeRegExp, splitAtColon, utf8Encode} from '../src/util'; -export function main() { +{ describe('util', () => { describe('splitAtColon', () => { it('should split when a single ":" is present', () => { diff --git a/packages/examples/core/di/ts/forward_ref/forward_ref_spec.ts b/packages/examples/core/di/ts/forward_ref/forward_ref_spec.ts index 89fa1324b3..213c972222 100644 --- a/packages/examples/core/di/ts/forward_ref/forward_ref_spec.ts +++ b/packages/examples/core/di/ts/forward_ref/forward_ref_spec.ts @@ -8,7 +8,7 @@ import {Inject, ReflectiveInjector, forwardRef, resolveForwardRef} from '@angular/core'; -export function main() { +{ describe('forwardRef examples', () => { it('ForwardRefFn example works', () => { // #docregion forward_ref_fn diff --git a/packages/examples/core/di/ts/injector_spec.ts b/packages/examples/core/di/ts/injector_spec.ts index e04d2434f0..ab57f44d0e 100644 --- a/packages/examples/core/di/ts/injector_spec.ts +++ b/packages/examples/core/di/ts/injector_spec.ts @@ -8,7 +8,7 @@ import {InjectionToken, Injector, ReflectiveInjector} from '@angular/core'; -export function main() { +{ describe('injector metadata examples', () => { it('works', () => { // #docregion Injector diff --git a/packages/examples/core/di/ts/metadata_spec.ts b/packages/examples/core/di/ts/metadata_spec.ts index 3d847206dc..635c7033bc 100644 --- a/packages/examples/core/di/ts/metadata_spec.ts +++ b/packages/examples/core/di/ts/metadata_spec.ts @@ -9,7 +9,7 @@ import {Component, Directive, Host, Inject, Injectable, Optional, ReflectiveInjector, Self, SkipSelf} from '@angular/core'; import {ComponentFixture, TestBed} from '@angular/core/testing'; -export function main() { +{ describe('di metadata examples', () => { describe('Inject', () => { it('works', () => { diff --git a/packages/examples/core/di/ts/provider_spec.ts b/packages/examples/core/di/ts/provider_spec.ts index e50e36428e..605ec44398 100644 --- a/packages/examples/core/di/ts/provider_spec.ts +++ b/packages/examples/core/di/ts/provider_spec.ts @@ -8,7 +8,7 @@ import {Injectable, InjectionToken, Injector, Optional, ReflectiveInjector} from '@angular/core'; -export function main() { +{ describe('Provider examples', () => { describe('TypeProvider', () => { it('works', () => { diff --git a/packages/examples/core/ts/metadata/lifecycle_hooks_spec.ts b/packages/examples/core/ts/metadata/lifecycle_hooks_spec.ts index 479ba04337..30186709d9 100644 --- a/packages/examples/core/ts/metadata/lifecycle_hooks_spec.ts +++ b/packages/examples/core/ts/metadata/lifecycle_hooks_spec.ts @@ -9,7 +9,7 @@ import {AfterContentChecked, AfterContentInit, AfterViewChecked, AfterViewInit, Component, DoCheck, Input, OnChanges, OnDestroy, OnInit, SimpleChanges, Type} from '@angular/core'; import {TestBed} from '@angular/core/testing'; -export function main() { +(function(){ describe('lifecycle hooks examples', () => { it('should work with ngOnInit', () => { // #docregion OnInit @@ -147,4 +147,4 @@ export function main() { proto[method] = (...args: any[]) => { log.push([method, args]); }; }); } -} +})(); diff --git a/packages/forms/test/directives_spec.ts b/packages/forms/test/directives_spec.ts index 63ab7650b1..cd9c63a81d 100644 --- a/packages/forms/test/directives_spec.ts +++ b/packages/forms/test/directives_spec.ts @@ -40,7 +40,7 @@ function asyncValidator(expected: any, timeout = 0) { }; } -export function main() { +{ describe('Form Directives', () => { let defaultAccessor: DefaultValueAccessor; diff --git a/packages/forms/test/form_array_spec.ts b/packages/forms/test/form_array_spec.ts index 11b0605ae3..ec0a30992d 100644 --- a/packages/forms/test/form_array_spec.ts +++ b/packages/forms/test/form_array_spec.ts @@ -12,7 +12,7 @@ import {AbstractControl, FormArray, FormControl, FormGroup, ValidationErrors} fr import {of } from 'rxjs/observable/of'; import {Validators} from '../src/validators'; -export function main() { +(function(){ function asyncValidator(expected: string, timeouts = {}) { return (c: AbstractControl) => { let resolve: (result: any) => void = undefined !; @@ -1100,4 +1100,4 @@ export function main() { }); }); -} +})(); diff --git a/packages/forms/test/form_builder_spec.ts b/packages/forms/test/form_builder_spec.ts index fbcca1a590..b8c112be3c 100644 --- a/packages/forms/test/form_builder_spec.ts +++ b/packages/forms/test/form_builder_spec.ts @@ -9,7 +9,7 @@ import {beforeEach, describe, expect, it} from '@angular/core/testing/src/testing_internal'; import {FormBuilder} from '@angular/forms'; -export function main() { +(function(){ function syncValidator(_: any /** TODO #9100 */): any /** TODO #9100 */ { return null; } function asyncValidator(_: any /** TODO #9100 */) { return Promise.resolve(null); } @@ -67,4 +67,4 @@ export function main() { expect(a.asyncValidator).toBe(asyncValidator); }); }); -} +})(); diff --git a/packages/forms/test/form_control_spec.ts b/packages/forms/test/form_control_spec.ts index cd3d1fe07b..902c7af226 100644 --- a/packages/forms/test/form_control_spec.ts +++ b/packages/forms/test/form_control_spec.ts @@ -13,7 +13,7 @@ import {FormControl, FormGroup, Validators} from '@angular/forms'; import {FormArray} from '../src/model'; -export function main() { +(function(){ function asyncValidator(expected: string, timeouts = {}) { return (c: FormControl) => { let resolve: (result: any) => void = undefined !; @@ -1142,4 +1142,4 @@ export function main() { }); }); }); -} +})(); diff --git a/packages/forms/test/form_group_spec.ts b/packages/forms/test/form_group_spec.ts index feb20cdf0b..c5edd1112f 100644 --- a/packages/forms/test/form_group_spec.ts +++ b/packages/forms/test/form_group_spec.ts @@ -13,7 +13,7 @@ import {AbstractControl, FormArray, FormControl, FormGroup, ValidationErrors, Va import {of } from 'rxjs/observable/of'; -export function main() { +(function(){ function simpleValidator(c: AbstractControl): ValidationErrors|null { return c.get('one') !.value === 'correct' ? null : {'broken': true}; } @@ -1126,4 +1126,4 @@ export function main() { }); -} +})(); diff --git a/packages/forms/test/reactive_integration_spec.ts b/packages/forms/test/reactive_integration_spec.ts index 03a683f6b7..78ea96ad6c 100644 --- a/packages/forms/test/reactive_integration_spec.ts +++ b/packages/forms/test/reactive_integration_spec.ts @@ -18,7 +18,7 @@ import {_do} from 'rxjs/operator/do'; import {MyInput, MyInputForm} from './value_accessor_integration_spec'; -export function main() { +{ describe('reactive forms integration tests', () => { function initTest(component: Type, ...directives: Type[]): ComponentFixture { diff --git a/packages/forms/test/template_integration_spec.ts b/packages/forms/test/template_integration_spec.ts index 261e4361a6..d4a459a71a 100644 --- a/packages/forms/test/template_integration_spec.ts +++ b/packages/forms/test/template_integration_spec.ts @@ -16,7 +16,7 @@ import {merge} from 'rxjs/observable/merge'; import {NgModelCustomComp, NgModelCustomWrapper} from './value_accessor_integration_spec'; -export function main() { +{ describe('template-driven forms integration tests', () => { function initTest(component: Type, ...directives: Type[]): ComponentFixture { diff --git a/packages/forms/test/validators_spec.ts b/packages/forms/test/validators_spec.ts index 84fa3935ed..8ff86ae504 100644 --- a/packages/forms/test/validators_spec.ts +++ b/packages/forms/test/validators_spec.ts @@ -17,7 +17,7 @@ import {map} from 'rxjs/operator/map'; import {normalizeAsyncValidator} from '../src/directives/normalize_validator'; import {AsyncValidator, ValidationErrors, ValidatorFn} from '../src/directives/validators'; -export function main() { +(function(){ function validator(key: string, error: any): ValidatorFn { return (c: AbstractControl) => { const r: ValidationErrors = {}; @@ -435,4 +435,4 @@ export function main() { }); }); -} +})(); diff --git a/packages/forms/test/value_accessor_integration_spec.ts b/packages/forms/test/value_accessor_integration_spec.ts index 0eb3b25dde..8703bb7b81 100644 --- a/packages/forms/test/value_accessor_integration_spec.ts +++ b/packages/forms/test/value_accessor_integration_spec.ts @@ -12,7 +12,7 @@ import {AbstractControl, ControlValueAccessor, FormControl, FormGroup, FormsModu import {By} from '@angular/platform-browser/src/dom/debug/by'; import {dispatchEvent} from '@angular/platform-browser/testing/src/browser_util'; -export function main() { +{ describe('value accessors', () => { function initTest(component: Type, ...directives: Type[]): ComponentFixture { diff --git a/packages/http/test/backends/jsonp_backend_spec.ts b/packages/http/test/backends/jsonp_backend_spec.ts index 0fcfad3b34..4f98ca8066 100644 --- a/packages/http/test/backends/jsonp_backend_spec.ts +++ b/packages/http/test/backends/jsonp_backend_spec.ts @@ -46,7 +46,7 @@ class MockBrowserJsonp extends BrowserJsonp { } } -export function main() { +{ describe('JSONPBackend', () => { let backend: JSONPBackend; let sampleRequest: Request; diff --git a/packages/http/test/backends/mock_backend_spec.ts b/packages/http/test/backends/mock_backend_spec.ts index 73a2d9df29..88883251e5 100644 --- a/packages/http/test/backends/mock_backend_spec.ts +++ b/packages/http/test/backends/mock_backend_spec.ts @@ -17,7 +17,7 @@ import {Request} from '../../src/static_request'; import {Response} from '../../src/static_response'; import {MockBackend, MockConnection} from '../../testing/src/mock_backend'; -export function main() { +{ describe('MockBackend', () => { let backend: MockBackend; diff --git a/packages/http/test/backends/xhr_backend_spec.ts b/packages/http/test/backends/xhr_backend_spec.ts index d56bdfb290..7c4b117aa6 100644 --- a/packages/http/test/backends/xhr_backend_spec.ts +++ b/packages/http/test/backends/xhr_backend_spec.ts @@ -84,7 +84,7 @@ class MockBrowserXHR extends BrowserXhr { } } -export function main() { +{ describe('XHRBackend', () => { let backend: XHRBackend; let sampleRequest: Request; diff --git a/packages/http/test/base_request_options_spec.ts b/packages/http/test/base_request_options_spec.ts index f42f895e39..bf694d9870 100644 --- a/packages/http/test/base_request_options_spec.ts +++ b/packages/http/test/base_request_options_spec.ts @@ -11,7 +11,7 @@ import {BaseRequestOptions, RequestOptions} from '../src/base_request_options'; import {RequestMethod} from '../src/enums'; import {Headers} from '../src/headers'; -export function main() { +{ describe('BaseRequestOptions', () => { it('should create a new object when calling merge', () => { const options1 = new BaseRequestOptions(); diff --git a/packages/http/test/headers_spec.ts b/packages/http/test/headers_spec.ts index 64107463c3..8bf97cd58a 100644 --- a/packages/http/test/headers_spec.ts +++ b/packages/http/test/headers_spec.ts @@ -8,7 +8,7 @@ import {Headers} from '../src/headers'; -export function main() { +{ describe('Headers', () => { describe('initialization', () => { diff --git a/packages/http/test/http_spec.ts b/packages/http/test/http_spec.ts index 9b7098b3df..383180376f 100644 --- a/packages/http/test/http_spec.ts +++ b/packages/http/test/http_spec.ts @@ -17,7 +17,7 @@ import {BaseRequestOptions, ConnectionBackend, Http, HttpModule, JSONPBackend, J import {stringToArrayBuffer} from '../src/http_utils'; import {MockBackend, MockConnection} from '../testing/src/mock_backend'; -export function main() { +{ describe('injectables', () => { const url = 'http://foo.bar'; let http: Http; diff --git a/packages/http/test/static_request_spec.ts b/packages/http/test/static_request_spec.ts index 79878966da..95e080ba08 100644 --- a/packages/http/test/static_request_spec.ts +++ b/packages/http/test/static_request_spec.ts @@ -15,7 +15,7 @@ import {Headers} from '../src/headers'; import {stringToArrayBuffer, stringToArrayBuffer8} from '../src/http_utils'; import {ArrayBuffer, Request} from '../src/static_request'; -export function main() { +{ describe('Request', () => { describe('detectContentType', () => { it('should return ContentType.NONE', () => { diff --git a/packages/http/test/static_response_spec.ts b/packages/http/test/static_response_spec.ts index b820ca4482..de369f27c7 100644 --- a/packages/http/test/static_response_spec.ts +++ b/packages/http/test/static_response_spec.ts @@ -13,7 +13,7 @@ import {Response} from '../src/static_response'; -export function main() { +{ describe('Response', () => { it('should be ok for 200 statuses', () => { expect(new Response(new ResponseOptions({status: 200})).ok).toEqual(true); diff --git a/packages/http/test/url_search_params_spec.ts b/packages/http/test/url_search_params_spec.ts index e95620ed46..d707dcdc57 100644 --- a/packages/http/test/url_search_params_spec.ts +++ b/packages/http/test/url_search_params_spec.ts @@ -9,7 +9,7 @@ import {describe, expect, it} from '@angular/core/testing/src/testing_internal'; import {URLSearchParams} from '../src/url_search_params'; -export function main() { +{ describe('URLSearchParams', () => { it('should conform to spec', () => { const paramsString = 'q=URLUtils.searchParams&topic=api'; diff --git a/packages/platform-browser-dynamic/test/metadata_overrider_spec.ts b/packages/platform-browser-dynamic/test/metadata_overrider_spec.ts index b56d45b10a..91183e9ceb 100644 --- a/packages/platform-browser-dynamic/test/metadata_overrider_spec.ts +++ b/packages/platform-browser-dynamic/test/metadata_overrider_spec.ts @@ -46,7 +46,7 @@ class OtherMetadata extends SomeMetadata implements OtherMetadataType { } } -export function main() { +{ describe('metadata overrider', () => { let overrider: MetadataOverrider; diff --git a/packages/platform-browser-dynamic/test/resource_loader/resource_loader_cache_spec.ts b/packages/platform-browser-dynamic/test/resource_loader/resource_loader_cache_spec.ts index 0e878e5db6..4f109fbbe1 100644 --- a/packages/platform-browser-dynamic/test/resource_loader/resource_loader_cache_spec.ts +++ b/packages/platform-browser-dynamic/test/resource_loader/resource_loader_cache_spec.ts @@ -15,7 +15,7 @@ import {CachedResourceLoader} from '../../src/resource_loader/resource_loader_ca import {setTemplateCache} from './resource_loader_cache_setter'; -export function main() { +{ describe('CachedResourceLoader', () => { let resourceLoader: CachedResourceLoader; diff --git a/packages/platform-browser-dynamic/test/resource_loader/resource_loader_impl_spec.ts b/packages/platform-browser-dynamic/test/resource_loader/resource_loader_impl_spec.ts index 1a325a8bd9..626fddae8c 100644 --- a/packages/platform-browser-dynamic/test/resource_loader/resource_loader_impl_spec.ts +++ b/packages/platform-browser-dynamic/test/resource_loader/resource_loader_impl_spec.ts @@ -9,7 +9,7 @@ import {AsyncTestCompleter, beforeEach, describe, expect, inject, it} from '@angular/core/testing/src/testing_internal'; import {ResourceLoaderImpl} from '../../src/resource_loader/resource_loader_impl'; -export function main() { +{ describe('ResourceLoaderImpl', () => { let resourceLoader: ResourceLoaderImpl; diff --git a/packages/platform-browser-dynamic/test/testing_public_browser_spec.ts b/packages/platform-browser-dynamic/test/testing_public_browser_spec.ts index b9afecaaf5..a009dcfa02 100644 --- a/packages/platform-browser-dynamic/test/testing_public_browser_spec.ts +++ b/packages/platform-browser-dynamic/test/testing_public_browser_spec.ts @@ -37,7 +37,7 @@ class BadTemplateUrl { // Tests for angular/testing bundle specific to the browser environment. // For general tests, see test/testing/testing_public_spec.ts. -export function main() { +{ describe('test APIs for the browser', () => { describe('using the async helper', () => { let actuallyDone: boolean; diff --git a/packages/platform-browser/animations/test/noop_animations_module_spec.ts b/packages/platform-browser/animations/test/noop_animations_module_spec.ts index 5041fed64e..bb9bb8f76a 100644 --- a/packages/platform-browser/animations/test/noop_animations_module_spec.ts +++ b/packages/platform-browser/animations/test/noop_animations_module_spec.ts @@ -12,7 +12,7 @@ import {TestBed} from '@angular/core/testing'; import {NoopAnimationsModule} from '../src/module'; -export function main() { +{ describe('NoopAnimationsModule', () => { beforeEach(() => { TestBed.configureTestingModule({imports: [NoopAnimationsModule]}); }); diff --git a/packages/platform-browser/test/animation/animation_renderer_spec.ts b/packages/platform-browser/test/animation/animation_renderer_spec.ts index ba44b66176..39e47a42ae 100644 --- a/packages/platform-browser/test/animation/animation_renderer_spec.ts +++ b/packages/platform-browser/test/animation/animation_renderer_spec.ts @@ -14,7 +14,7 @@ import {DomRendererFactory2} from '@angular/platform-browser/src/dom/dom_rendere import {InjectableAnimationEngine} from '../../animations/src/providers'; import {el} from '../../testing/src/browser_util'; -export function main() { +{ describe('AnimationRenderer', () => { let element: any; beforeEach(() => { diff --git a/packages/platform-browser/test/animation/browser_animation_builder_spec.ts b/packages/platform-browser/test/animation/browser_animation_builder_spec.ts index d427a2d629..012b130fe6 100644 --- a/packages/platform-browser/test/animation/browser_animation_builder_spec.ts +++ b/packages/platform-browser/test/animation/browser_animation_builder_spec.ts @@ -15,7 +15,7 @@ import {NoopAnimationsModule} from '@angular/platform-browser/animations'; import {BrowserAnimationBuilder} from '../../animations/src/animation_builder'; import {el} from '../../testing/src/browser_util'; -export function main() { +{ describe('BrowserAnimationBuilder', () => { let element: any; beforeEach(() => { diff --git a/packages/platform-browser/test/browser/bootstrap_spec.ts b/packages/platform-browser/test/browser/bootstrap_spec.ts index e028cbbc1f..f08204ba83 100644 --- a/packages/platform-browser/test/browser/bootstrap_spec.ts +++ b/packages/platform-browser/test/browser/bootstrap_spec.ts @@ -127,7 +127,7 @@ function bootstrap( return platformBrowserDynamic(platformProviders).bootstrapModule(TestModule); } -export function main() { +{ let el: any /** TODO #9100 */, el2: any /** TODO #9100 */, testProviders: Provider[], lightDom: any /** TODO #9100 */; diff --git a/packages/platform-browser/test/browser/browser_adapter_spec.ts b/packages/platform-browser/test/browser/browser_adapter_spec.ts index 5230ed926e..f73b8bc90c 100644 --- a/packages/platform-browser/test/browser/browser_adapter_spec.ts +++ b/packages/platform-browser/test/browser/browser_adapter_spec.ts @@ -10,7 +10,7 @@ import {describe, expect, it} from '@angular/core/testing/src/testing_internal'; import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter'; -export function main() { +{ describe('cookies', () => { it('sets cookie values', () => { getDOM().setCookie('my test cookie', 'my test value'); diff --git a/packages/platform-browser/test/browser/meta_spec.ts b/packages/platform-browser/test/browser/meta_spec.ts index d435f06a01..66325a40f7 100644 --- a/packages/platform-browser/test/browser/meta_spec.ts +++ b/packages/platform-browser/test/browser/meta_spec.ts @@ -12,7 +12,7 @@ import {BrowserModule, Meta} from '@angular/platform-browser'; import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter'; import {expect} from '@angular/platform-browser/testing/src/matchers'; -export function main() { +{ describe('Meta service', () => { let doc: Document; let metaService: Meta; diff --git a/packages/platform-browser/test/browser/title_spec.ts b/packages/platform-browser/test/browser/title_spec.ts index a23ef51fda..a9032eb4f5 100644 --- a/packages/platform-browser/test/browser/title_spec.ts +++ b/packages/platform-browser/test/browser/title_spec.ts @@ -12,7 +12,7 @@ import {BrowserModule, Title} from '@angular/platform-browser'; import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter'; import {expect} from '@angular/platform-browser/testing/src/matchers'; -export function main() { +{ describe('title service', () => { let doc: Document; let initialTitle: string; diff --git a/packages/platform-browser/test/browser/tools/tools_spec.ts b/packages/platform-browser/test/browser/tools/tools_spec.ts index 33676db30c..9985125712 100644 --- a/packages/platform-browser/test/browser/tools/tools_spec.ts +++ b/packages/platform-browser/test/browser/tools/tools_spec.ts @@ -10,7 +10,7 @@ import {disableDebugTools, enableDebugTools} from '@angular/platform-browser'; import {SpyComponentRef, callNgProfilerTimeChangeDetection} from './spies'; -export function main() { +{ describe('profiler', () => { beforeEach(() => { enableDebugTools((new SpyComponentRef())); }); diff --git a/packages/platform-browser/test/browser/transfer_state_spec.ts b/packages/platform-browser/test/browser/transfer_state_spec.ts index 78e4d668c2..975be183ba 100644 --- a/packages/platform-browser/test/browser/transfer_state_spec.ts +++ b/packages/platform-browser/test/browser/transfer_state_spec.ts @@ -12,7 +12,7 @@ import {BrowserModule, BrowserTransferStateModule, TransferState} from '@angular import {StateKey, escapeHtml, makeStateKey, unescapeHtml} from '@angular/platform-browser/src/browser/transfer_state'; import {DOCUMENT} from '@angular/platform-browser/src/dom/dom_tokens'; -export function main() { +(function(){ function removeScriptTag(doc: Document, id: string) { const existing = doc.getElementById(id); if (existing) { @@ -109,4 +109,4 @@ export function main() { expect(unescapedObj['testString']).toBe(testString); }); }); -} \ No newline at end of file +})(); \ No newline at end of file diff --git a/packages/platform-browser/test/browser_util_spec.ts b/packages/platform-browser/test/browser_util_spec.ts index b62d113cf8..664f2cc366 100644 --- a/packages/platform-browser/test/browser_util_spec.ts +++ b/packages/platform-browser/test/browser_util_spec.ts @@ -9,7 +9,7 @@ import {BrowserDetection} from '../testing/src/browser_util'; -export function main() { +{ describe('BrowserDetection', () => { const browsers = [ diff --git a/packages/platform-browser/test/dom/dom_renderer_spec.ts b/packages/platform-browser/test/dom/dom_renderer_spec.ts index e3332ad818..1b4ca221f6 100644 --- a/packages/platform-browser/test/dom/dom_renderer_spec.ts +++ b/packages/platform-browser/test/dom/dom_renderer_spec.ts @@ -12,7 +12,7 @@ import {browserDetection} from '@angular/platform-browser/testing/src/browser_ut import {expect} from '@angular/platform-browser/testing/src/matchers'; import {NAMESPACE_URIS} from '../../src/dom/dom_renderer'; -export function main() { +{ describe('DefaultDomRendererV2', () => { let renderer: Renderer2; diff --git a/packages/platform-browser/test/dom/events/event_manager_spec.ts b/packages/platform-browser/test/dom/events/event_manager_spec.ts index ea4c35c984..8597d1a8a6 100644 --- a/packages/platform-browser/test/dom/events/event_manager_spec.ts +++ b/packages/platform-browser/test/dom/events/event_manager_spec.ts @@ -13,7 +13,7 @@ import {DomEventsPlugin} from '@angular/platform-browser/src/dom/events/dom_even import {EventManager, EventManagerPlugin} from '@angular/platform-browser/src/dom/events/event_manager'; import {el} from '../../../testing/src/browser_util'; -export function main() { +{ let domEventPlugin: DomEventsPlugin; let doc: any; let zone: NgZone; diff --git a/packages/platform-browser/test/dom/events/hammer_gestures_spec.ts b/packages/platform-browser/test/dom/events/hammer_gestures_spec.ts index 1662578ac0..40bc6f8187 100644 --- a/packages/platform-browser/test/dom/events/hammer_gestures_spec.ts +++ b/packages/platform-browser/test/dom/events/hammer_gestures_spec.ts @@ -8,7 +8,7 @@ import {describe, expect, it} from '@angular/core/testing/src/testing_internal'; import {HammerGestureConfig, HammerGesturesPlugin} from '@angular/platform-browser/src/dom/events/hammer_gestures'; -export function main() { +{ describe('HammerGesturesPlugin', () => { it('should implement addGlobalEventListener', () => { diff --git a/packages/platform-browser/test/dom/events/key_events_spec.ts b/packages/platform-browser/test/dom/events/key_events_spec.ts index ba96007c0e..9cbeb2cf73 100644 --- a/packages/platform-browser/test/dom/events/key_events_spec.ts +++ b/packages/platform-browser/test/dom/events/key_events_spec.ts @@ -9,7 +9,7 @@ import {describe, expect, it} from '@angular/core/testing/src/testing_internal'; import {KeyEventsPlugin} from '@angular/platform-browser/src/dom/events/key_events'; -export function main() { +{ describe('KeyEventsPlugin', () => { it('should ignore unrecognized events', () => { diff --git a/packages/platform-browser/test/dom/shared_styles_host_spec.ts b/packages/platform-browser/test/dom/shared_styles_host_spec.ts index c0c10dffab..c7c16bbbd1 100644 --- a/packages/platform-browser/test/dom/shared_styles_host_spec.ts +++ b/packages/platform-browser/test/dom/shared_styles_host_spec.ts @@ -11,7 +11,7 @@ import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter'; import {DomSharedStylesHost} from '@angular/platform-browser/src/dom/shared_styles_host'; import {expect} from '@angular/platform-browser/testing/src/matchers'; -export function main() { +{ describe('DomSharedStylesHost', () => { let doc: Document; let ssh: DomSharedStylesHost; diff --git a/packages/platform-browser/test/security/dom_sanitization_service_spec.ts b/packages/platform-browser/test/security/dom_sanitization_service_spec.ts index 578f9ef7eb..759b95c780 100644 --- a/packages/platform-browser/test/security/dom_sanitization_service_spec.ts +++ b/packages/platform-browser/test/security/dom_sanitization_service_spec.ts @@ -11,7 +11,7 @@ import * as t from '@angular/core/testing/src/testing_internal'; import {DomSanitizerImpl} from '../../src/security/dom_sanitization_service'; -export function main() { +{ t.describe('DOM Sanitization Service', () => { t.it('accepts resource URL values for resource contexts', () => { const svc = new DomSanitizerImpl(null); diff --git a/packages/platform-browser/test/security/html_sanitizer_spec.ts b/packages/platform-browser/test/security/html_sanitizer_spec.ts index a46e139b6f..2e8b489141 100644 --- a/packages/platform-browser/test/security/html_sanitizer_spec.ts +++ b/packages/platform-browser/test/security/html_sanitizer_spec.ts @@ -11,7 +11,7 @@ import {browserDetection} from '@angular/platform-browser/testing/src/browser_ut import {getDOM} from '../../src/dom/dom_adapter'; import {sanitizeHtml} from '../../src/security/html_sanitizer'; -export function main() { +{ describe('HTML sanitizer', () => { let defaultDoc: any; let originalLog: (msg: any) => any = null !; diff --git a/packages/platform-browser/test/security/style_sanitizer_spec.ts b/packages/platform-browser/test/security/style_sanitizer_spec.ts index 72f3784370..0b0942b218 100644 --- a/packages/platform-browser/test/security/style_sanitizer_spec.ts +++ b/packages/platform-browser/test/security/style_sanitizer_spec.ts @@ -11,7 +11,7 @@ import * as t from '@angular/core/testing/src/testing_internal'; import {getDOM} from '../../src/dom/dom_adapter'; import {sanitizeStyle} from '../../src/security/style_sanitizer'; -export function main() { +{ t.describe('Style sanitizer', () => { let logMsgs: string[]; let originalLog: (msg: any) => any; diff --git a/packages/platform-browser/test/security/url_sanitizer_spec.ts b/packages/platform-browser/test/security/url_sanitizer_spec.ts index a39bc3ad47..919909508d 100644 --- a/packages/platform-browser/test/security/url_sanitizer_spec.ts +++ b/packages/platform-browser/test/security/url_sanitizer_spec.ts @@ -11,7 +11,7 @@ import * as t from '@angular/core/testing/src/testing_internal'; import {getDOM} from '../../src/dom/dom_adapter'; import {sanitizeSrcset, sanitizeUrl} from '../../src/security/url_sanitizer'; -export function main() { +{ t.describe('URL sanitizer', () => { let logMsgs: string[]; let originalLog: (msg: any) => any; diff --git a/packages/platform-browser/test/testing_public_spec.ts b/packages/platform-browser/test/testing_public_spec.ts index 62e22ec307..8ca4b05287 100644 --- a/packages/platform-browser/test/testing_public_spec.ts +++ b/packages/platform-browser/test/testing_public_spec.ts @@ -108,7 +108,7 @@ class SomeLibModule { class CompWithUrlTemplate { } -export function main() { +{ describe('public testing API', () => { describe('using the async helper with context passing', () => { beforeEach(function() { this.actuallyDone = false; }); diff --git a/packages/platform-server/test/integration_spec.ts b/packages/platform-server/test/integration_spec.ts index d4598c07e1..bfabca348c 100644 --- a/packages/platform-server/test/integration_spec.ts +++ b/packages/platform-server/test/integration_spec.ts @@ -298,7 +298,7 @@ class TransferStoreModule { class EscapedTransferStoreModule { } -export function main() { +(function(){ if (getDOM().supportsDOMEvents()) return; // NODE only describe('platform-server integration', () => { @@ -756,4 +756,4 @@ export function main() { })); }); }); -} +})(); diff --git a/packages/platform-webworker/test/web_workers/shared/message_bus_spec.ts b/packages/platform-webworker/test/web_workers/shared/message_bus_spec.ts index ffbdb3450c..344c4f4bbc 100644 --- a/packages/platform-webworker/test/web_workers/shared/message_bus_spec.ts +++ b/packages/platform-webworker/test/web_workers/shared/message_bus_spec.ts @@ -13,7 +13,7 @@ import {MessageBus} from '@angular/platform-webworker/src/web_workers/shared/mes import {createConnectedMessageBus} from './message_bus_util'; -export function main() { +{ /** * Tests the PostMessageBus */ diff --git a/packages/platform-webworker/test/web_workers/shared/render_store_spec.ts b/packages/platform-webworker/test/web_workers/shared/render_store_spec.ts index a06460a0c1..35d720a3e9 100644 --- a/packages/platform-webworker/test/web_workers/shared/render_store_spec.ts +++ b/packages/platform-webworker/test/web_workers/shared/render_store_spec.ts @@ -8,7 +8,7 @@ import {RenderStore} from '@angular/platform-webworker/src/web_workers/shared/render_store'; -export function main() { +{ describe('RenderStoreSpec', () => { let store: RenderStore; beforeEach(() => { store = new RenderStore(); }); diff --git a/packages/platform-webworker/test/web_workers/shared/service_message_broker_spec.ts b/packages/platform-webworker/test/web_workers/shared/service_message_broker_spec.ts index 090f1c9908..e4e19b3bce 100644 --- a/packages/platform-webworker/test/web_workers/shared/service_message_broker_spec.ts +++ b/packages/platform-webworker/test/web_workers/shared/service_message_broker_spec.ts @@ -14,7 +14,7 @@ import {ServiceMessageBroker} from '@angular/platform-webworker/src/web_workers/ import {createPairedMessageBuses} from './web_worker_test_util'; -export function main() { +{ const CHANNEL = 'UIMessageBroker Test Channel'; const TEST_METHOD = 'TEST_METHOD'; const PASSED_ARG_1 = 5; diff --git a/packages/platform-webworker/test/web_workers/worker/platform_location_spec.ts b/packages/platform-webworker/test/web_workers/worker/platform_location_spec.ts index a9481c10f9..eae82a00b6 100644 --- a/packages/platform-webworker/test/web_workers/worker/platform_location_spec.ts +++ b/packages/platform-webworker/test/web_workers/worker/platform_location_spec.ts @@ -16,7 +16,7 @@ import {MockMessageBrokerFactory, createPairedMessageBuses, expectBrokerCall} fr import {SpyMessageBroker} from './spies'; -export function main() { +{ describe('WebWorkerPlatformLocation', () => { let uiBus: MessageBus = null !; let workerBus: MessageBus = null !; diff --git a/packages/platform-webworker/test/web_workers/worker/renderer_v2_integration_spec.ts b/packages/platform-webworker/test/web_workers/worker/renderer_v2_integration_spec.ts index 16a26462ff..91db66762a 100644 --- a/packages/platform-webworker/test/web_workers/worker/renderer_v2_integration_spec.ts +++ b/packages/platform-webworker/test/web_workers/worker/renderer_v2_integration_spec.ts @@ -25,7 +25,7 @@ import {PairedMessageBuses, createPairedMessageBuses} from '../shared/web_worker let lastCreatedRenderer: Renderer2; -export function main() { +{ describe('Web Worker Renderer v2', () => { // Don't run on server... if (!getDOM().supportsDOMEvents()) return; diff --git a/packages/service-worker/config/test/generator_spec.ts b/packages/service-worker/config/test/generator_spec.ts index 2511226c61..3510baf7f3 100644 --- a/packages/service-worker/config/test/generator_spec.ts +++ b/packages/service-worker/config/test/generator_spec.ts @@ -9,7 +9,7 @@ import {Generator} from '../src/generator'; import {MockFilesystem} from '../testing/mock'; -export function main() { +{ describe('Generator', () => { it('generates a correct config', (done: DoneFn) => { const fs = new MockFilesystem({ diff --git a/packages/service-worker/test/comm_spec.ts b/packages/service-worker/test/comm_spec.ts index 3d6f27e191..09c22fb2e0 100644 --- a/packages/service-worker/test/comm_spec.ts +++ b/packages/service-worker/test/comm_spec.ts @@ -14,7 +14,7 @@ import {SwPush} from '../src/push'; import {SwUpdate} from '../src/update'; import {MockServiceWorkerContainer, MockServiceWorkerRegistration} from '../testing/mock'; -export function main() { +{ describe('ServiceWorker library', () => { let mock: MockServiceWorkerContainer; let comm: NgswCommChannel; diff --git a/packages/service-worker/test/integration_spec.ts b/packages/service-worker/test/integration_spec.ts index 3a500c1054..b407286ead 100644 --- a/packages/service-worker/test/integration_spec.ts +++ b/packages/service-worker/test/integration_spec.ts @@ -65,7 +65,7 @@ const server = new MockServerStateBuilder().withStaticFiles(dist).withManifest(m const serverUpdate = new MockServerStateBuilder().withStaticFiles(distUpdate).withManifest(manifestUpdate).build(); -export function main() { +(function(){ // Skip environments that don't support the minimum APIs needed to run the SW tests. if (!SwTestHarness.envIsSupported()) { return; @@ -129,4 +129,4 @@ export function main() { await gotPushNotice; }); }); -} +})(); diff --git a/packages/service-worker/worker/test/data_spec.ts b/packages/service-worker/worker/test/data_spec.ts index 1a21a5a84d..10ec69fa64 100644 --- a/packages/service-worker/worker/test/data_spec.ts +++ b/packages/service-worker/worker/test/data_spec.ts @@ -114,7 +114,7 @@ function asyncWrap(fn: () => Promise): (done: DoneFn) => void { return (done: DoneFn) => { fn().then(() => done(), err => done.fail(err)); }; } -export function main() { +(function(){ // Skip environments that don't support the minimum APIs needed to run the SW tests. if (!SwTestHarness.envIsSupported()) { return; @@ -242,7 +242,7 @@ export function main() { }); }); }); -} +})(); async function makeRequest(scope: SwTestHarness, url: string, clientId?: string): Promise { diff --git a/packages/service-worker/worker/test/happy_spec.ts b/packages/service-worker/worker/test/happy_spec.ts index e578b8aeb7..9a9bcec530 100644 --- a/packages/service-worker/worker/test/happy_spec.ts +++ b/packages/service-worker/worker/test/happy_spec.ts @@ -139,7 +139,7 @@ const scope = new SwTestHarnessBuilder().withServerState(server).build(); const manifestHash = sha1(JSON.stringify(manifest)); const manifestUpdateHash = sha1(JSON.stringify(manifestUpdate)); -export function main() { +(function(){ // Skip environments that don't support the minimum APIs needed to run the SW tests. if (!SwTestHarness.envIsSupported()) { return; @@ -674,7 +674,7 @@ export function main() { }); }); }); -} +})(); async function makeRequest( scope: SwTestHarness, url: string, clientId?: string, init?: Object): Promise { diff --git a/packages/service-worker/worker/test/idle_spec.ts b/packages/service-worker/worker/test/idle_spec.ts index 2ebfc023ef..b20c276365 100644 --- a/packages/service-worker/worker/test/idle_spec.ts +++ b/packages/service-worker/worker/test/idle_spec.ts @@ -10,7 +10,7 @@ import {IdleScheduler} from '../src/idle'; import {SwTestHarness, SwTestHarnessBuilder} from '../testing/scope'; import {async_beforeEach, async_fit, async_it} from './async'; -export function main() { +(function(){ // Skip environments that don't support the minimum APIs needed to run the SW tests. if (!SwTestHarness.envIsSupported()) { return; @@ -134,4 +134,4 @@ export function main() { expect(completed).toEqual(true); }); }); -} \ No newline at end of file +})(); \ No newline at end of file diff --git a/packages/service-worker/worker/test/prefetch_spec.ts b/packages/service-worker/worker/test/prefetch_spec.ts index a62277631b..05594f88f4 100644 --- a/packages/service-worker/worker/test/prefetch_spec.ts +++ b/packages/service-worker/worker/test/prefetch_spec.ts @@ -29,7 +29,7 @@ const db = new CacheDatabase(scope, scope); -export function main() { +(function(){ // Skip environments that don't support the minimum APIs needed to run the SW tests. if (!SwTestHarness.envIsSupported()) { return; @@ -86,7 +86,7 @@ export function main() { expect(err.message).toContain('Hash mismatch'); }); }); -} +})(); function errorFrom(promise: Promise): Promise { return promise.catch(err => err); diff --git a/packages/upgrade/test/common/component_info_spec.ts b/packages/upgrade/test/common/component_info_spec.ts index 5bddf8d2ae..63969b110e 100644 --- a/packages/upgrade/test/common/component_info_spec.ts +++ b/packages/upgrade/test/common/component_info_spec.ts @@ -8,7 +8,7 @@ import {PropertyBinding} from '@angular/upgrade/src/common/component_info'; -export function main() { +{ describe('PropertyBinding', () => { it('should process a simple binding', () => { const binding = new PropertyBinding('someBinding', 'someBinding'); diff --git a/packages/upgrade/test/common/downgrade_component_adapter_spec.ts b/packages/upgrade/test/common/downgrade_component_adapter_spec.ts index 7f91397afe..88e80c0751 100644 --- a/packages/upgrade/test/common/downgrade_component_adapter_spec.ts +++ b/packages/upgrade/test/common/downgrade_component_adapter_spec.ts @@ -12,7 +12,7 @@ import {DowngradeComponentAdapter, groupNodesBySelector} from '@angular/upgrade/ import {nodes} from './test_helpers'; -export function main() { +{ describe('DowngradeComponentAdapter', () => { describe('groupNodesBySelector', () => { it('should return an array of node collections for each selector', () => { diff --git a/packages/upgrade/test/common/downgrade_injectable_spec.ts b/packages/upgrade/test/common/downgrade_injectable_spec.ts index fa60022cc4..628d8f1237 100644 --- a/packages/upgrade/test/common/downgrade_injectable_spec.ts +++ b/packages/upgrade/test/common/downgrade_injectable_spec.ts @@ -9,7 +9,7 @@ import {INJECTOR_KEY} from '@angular/upgrade/src/common/constants'; import {downgradeInjectable} from '@angular/upgrade/src/common/downgrade_injectable'; -export function main() { +{ describe('downgradeInjectable', () => { it('should return an AngularJS annotated factory for the token', () => { const factory = downgradeInjectable('someToken'); diff --git a/packages/upgrade/test/dynamic/upgrade_spec.ts b/packages/upgrade/test/dynamic/upgrade_spec.ts index fd4e42d64b..8c6909a26d 100644 --- a/packages/upgrade/test/dynamic/upgrade_spec.ts +++ b/packages/upgrade/test/dynamic/upgrade_spec.ts @@ -14,7 +14,7 @@ import * as angular from '@angular/upgrade/src/common/angular1'; import {UpgradeAdapter, UpgradeAdapterRef} from '@angular/upgrade/src/dynamic/upgrade_adapter'; import {$digest, html, multiTrim} from './test_helpers'; -export function main() { +{ describe('adapter: ng1 to ng2', () => { beforeEach(() => destroyPlatform()); afterEach(() => destroyPlatform()); diff --git a/packages/upgrade/test/static/angular1_providers_spec.ts b/packages/upgrade/test/static/angular1_providers_spec.ts index 85c3d98d9e..3c9956d82f 100644 --- a/packages/upgrade/test/static/angular1_providers_spec.ts +++ b/packages/upgrade/test/static/angular1_providers_spec.ts @@ -9,7 +9,7 @@ import {Ng1Token} from '@angular/upgrade/src/common/angular1'; import {compileFactory, injectorFactory, parseFactory, rootScopeFactory, setTempInjectorRef} from '@angular/upgrade/src/static/angular1_providers'; -export function main() { +{ describe('upgrade angular1_providers', () => { describe('compileFactory', () => { it('should retrieve and return `$compile`', () => { diff --git a/packages/upgrade/test/static/integration/change_detection_spec.ts b/packages/upgrade/test/static/integration/change_detection_spec.ts index 3ab70f5718..465f682b0d 100644 --- a/packages/upgrade/test/static/integration/change_detection_spec.ts +++ b/packages/upgrade/test/static/integration/change_detection_spec.ts @@ -15,7 +15,7 @@ import {UpgradeComponent, UpgradeModule, downgradeComponent} from '@angular/upgr import {bootstrap, html} from '../test_helpers'; -export function main() { +{ describe('scope/component change-detection', () => { beforeEach(() => destroyPlatform()); afterEach(() => destroyPlatform()); diff --git a/packages/upgrade/test/static/integration/content_projection_spec.ts b/packages/upgrade/test/static/integration/content_projection_spec.ts index ef211d229e..90c67208ff 100644 --- a/packages/upgrade/test/static/integration/content_projection_spec.ts +++ b/packages/upgrade/test/static/integration/content_projection_spec.ts @@ -15,7 +15,7 @@ import {UpgradeComponent, UpgradeModule, downgradeComponent} from '@angular/upgr import {bootstrap, html, multiTrim} from '../test_helpers'; -export function main() { +{ describe('content projection', () => { beforeEach(() => destroyPlatform()); diff --git a/packages/upgrade/test/static/integration/downgrade_component_spec.ts b/packages/upgrade/test/static/integration/downgrade_component_spec.ts index 01906ec5c2..8bc3cd0fa5 100644 --- a/packages/upgrade/test/static/integration/downgrade_component_spec.ts +++ b/packages/upgrade/test/static/integration/downgrade_component_spec.ts @@ -15,7 +15,7 @@ import {UpgradeModule, downgradeComponent} from '@angular/upgrade/static'; import {$apply, bootstrap, html, multiTrim} from '../test_helpers'; -export function main() { +{ describe('downgrade ng2 component', () => { beforeEach(() => destroyPlatform()); diff --git a/packages/upgrade/test/static/integration/downgrade_module_spec.ts b/packages/upgrade/test/static/integration/downgrade_module_spec.ts index 52e2da16dd..5a3eba32ce 100644 --- a/packages/upgrade/test/static/integration/downgrade_module_spec.ts +++ b/packages/upgrade/test/static/integration/downgrade_module_spec.ts @@ -19,7 +19,7 @@ import {downgradeComponent, downgradeModule} from '@angular/upgrade/static'; import {html, multiTrim} from '../test_helpers'; -export function main() { +{ [true, false].forEach(propagateDigest => { describe(`lazy-load ng2 module (propagateDigest: ${propagateDigest})`, () => { diff --git a/packages/upgrade/test/static/integration/examples_spec.ts b/packages/upgrade/test/static/integration/examples_spec.ts index 9e9f8dbcad..1a31e6f0e3 100644 --- a/packages/upgrade/test/static/integration/examples_spec.ts +++ b/packages/upgrade/test/static/integration/examples_spec.ts @@ -15,7 +15,7 @@ import {UpgradeComponent, UpgradeModule, downgradeComponent} from '@angular/upgr import {bootstrap, html, multiTrim} from '../test_helpers'; -export function main() { +{ describe('examples', () => { beforeEach(() => destroyPlatform()); diff --git a/packages/upgrade/test/static/integration/injection_spec.ts b/packages/upgrade/test/static/integration/injection_spec.ts index fa7ce8e4e1..128931f92e 100644 --- a/packages/upgrade/test/static/integration/injection_spec.ts +++ b/packages/upgrade/test/static/integration/injection_spec.ts @@ -16,7 +16,7 @@ import {UpgradeModule, downgradeInjectable, getAngularJSGlobal, setAngularJSGlob import {bootstrap, html} from '../test_helpers'; -export function main() { +{ describe('injection', () => { beforeEach(() => destroyPlatform()); diff --git a/packages/upgrade/test/static/integration/testability_spec.ts b/packages/upgrade/test/static/integration/testability_spec.ts index 7fc46c8f2d..d52d6c7f4a 100644 --- a/packages/upgrade/test/static/integration/testability_spec.ts +++ b/packages/upgrade/test/static/integration/testability_spec.ts @@ -16,7 +16,7 @@ import {UpgradeModule} from '@angular/upgrade/static'; import {bootstrap, html} from '../test_helpers'; -export function main() { +{ describe('testability', () => { beforeEach(() => destroyPlatform()); diff --git a/packages/upgrade/test/static/integration/upgrade_component_spec.ts b/packages/upgrade/test/static/integration/upgrade_component_spec.ts index 33f3a8906c..9d96cb0736 100644 --- a/packages/upgrade/test/static/integration/upgrade_component_spec.ts +++ b/packages/upgrade/test/static/integration/upgrade_component_spec.ts @@ -16,7 +16,7 @@ import {UpgradeComponent, UpgradeModule, downgradeComponent} from '@angular/upgr import {$digest, bootstrap, html, multiTrim} from '../test_helpers'; -export function main() { +{ describe('upgrade ng1 component', () => { beforeEach(() => destroyPlatform()); diff --git a/test-main.js b/test-main.js index 46eb33c3b7..a65ecb5970 100644 --- a/test-main.js +++ b/test-main.js @@ -89,7 +89,7 @@ System.import('@angular/core/testing') .map(function(path) { return System.import(path).then(function(module) { if (module.hasOwnProperty('main')) { - module.main(); + throw new Error('main() in specs are no longer supported'); } }); }));