From 5b71788a20993670ccd12a3d14296714aaffa660 Mon Sep 17 00:00:00 2001 From: lotte Date: Fri, 12 Oct 2018 14:24:41 +0200 Subject: [PATCH] improved test compiling time --- package.json | 3 +- src/app/core/registry/registry.service.ts | 3 - .../ds-dynamic-form-control.component.ts | 16 +++-- .../ds-dynamic-form.component.ts | 2 +- src/app/shared/form/form.component.ts | 2 +- .../notification.component.spec.ts | 7 +- .../notification/notification.component.ts | 5 +- .../notifications/notifications.service.ts | 9 ++- webpack/webpack.test.js | 18 +++-- yarn.lock | 70 +++++++++++++------ 10 files changed, 83 insertions(+), 52 deletions(-) diff --git a/package.json b/package.json index f4ab6e2ff4..0c2c0a776c 100644 --- a/package.json +++ b/package.json @@ -97,6 +97,7 @@ "express": "4.16.2", "express-session": "1.15.6", "font-awesome": "4.7.0", + "fork-ts-checker-webpack-plugin": "^0.4.10", "http-server": "0.11.1", "https": "1.0.0", "js-cookie": "2.2.0", @@ -119,6 +120,7 @@ "rxjs": "6.2.2", "sortablejs": "1.7.0", "text-mask-core": "5.0.1", + "ts-loader": "^5.2.1", "ts-md5": "^1.2.4", "uuid": "^3.2.1", "webfontloader": "1.6.28", @@ -152,7 +154,6 @@ "ajv-keywords": "^3.1.0", "angular2-template-loader": "0.6.2", "autoprefixer": "^9.1.3", - "awesome-typescript-loader": "5.2.0", "caniuse-lite": "^1.0.30000697", "codelyzer": "^4.4.4", "compression-webpack-plugin": "^1.1.6", diff --git a/src/app/core/registry/registry.service.ts b/src/app/core/registry/registry.service.ts index 8bd2818b78..7e7c18f69e 100644 --- a/src/app/core/registry/registry.service.ts +++ b/src/app/core/registry/registry.service.ts @@ -17,14 +17,11 @@ import { ResponseCacheService } from '../cache/response-cache.service'; import { RegistryMetadataschemasResponse } from './registry-metadataschemas-response.model'; import { ResponseCacheEntry } from '../cache/response-cache.reducer'; import { - MetadataschemaSuccessResponse, RegistryBitstreamformatsSuccessResponse, RegistryMetadatafieldsSuccessResponse, RegistryMetadataschemasSuccessResponse } from '../cache/response-cache.models'; import { HALEndpointService } from '../shared/hal-endpoint.service'; -import { MetadataschemaParsingService } from '../data/metadataschema-parsing.service'; -import { Res } from 'awesome-typescript-loader/dist/checker/protocol'; import { RegistryMetadatafieldsResponseParsingService } from '../data/registry-metadatafields-response-parsing.service'; import { RegistryMetadatafieldsResponse } from './registry-metadatafields-response.model'; import { isNotEmpty } from '../../shared/empty.util'; diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control.component.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control.component.ts index a5d6b923df..3544bce280 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control.component.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control.component.ts @@ -1,12 +1,16 @@ import { - Component, ComponentFactoryResolver, + Component, + ComponentFactoryResolver, ContentChildren, EventEmitter, Input, OnChanges, Output, QueryList, - SimpleChanges, Type, ViewChild, ViewContainerRef + SimpleChanges, + Type, + ViewChild, + ViewContainerRef } from '@angular/core'; import { FormGroup } from '@angular/forms'; import { @@ -20,11 +24,11 @@ import { DYNAMIC_FORM_CONTROL_TYPE_SELECT, DYNAMIC_FORM_CONTROL_TYPE_TEXTAREA, DYNAMIC_FORM_CONTROL_TYPE_TIMEPICKER, - DynamicDatePickerModel, DynamicFormControl, DynamicFormControlComponent, + DynamicDatePickerModel, + DynamicFormControl, DynamicFormControlContainerComponent, DynamicFormControlEvent, - DynamicFormControlModel, - DynamicFormLayout, + DynamicFormControlModel, DynamicFormLayout, DynamicFormLayoutService, DynamicFormValidationService, DynamicTemplateDirective, @@ -77,7 +81,7 @@ export class DsDynamicFormControlComponent extends DynamicFormControlContainerCo @Input() context: any | null = null; @Input() group: FormGroup; @Input() hasErrorMessaging = false; - @Input() layout: DynamicFormLayout; + @Input() layout = null as DynamicFormLayout; @Input() model: any; /* tslint:disable:no-output-rename */ diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form.component.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form.component.ts index c0c207eaff..c1b4ca71c8 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form.component.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form.component.ts @@ -29,7 +29,7 @@ export class DsDynamicFormComponent extends DynamicFormComponent { @Input() formId: string; @Input() formGroup: FormGroup; @Input() formModel: DynamicFormControlModel[]; - @Input() formLayout: DynamicFormLayout = null; + @Input() formLayout = null as DynamicFormLayout; /* tslint:disable:no-output-rename */ @Output('dfBlur') blur: EventEmitter = new EventEmitter(); diff --git a/src/app/shared/form/form.component.ts b/src/app/shared/form/form.component.ts index 97cb76565f..2d74ddf8d4 100644 --- a/src/app/shared/form/form.component.ts +++ b/src/app/shared/form/form.component.ts @@ -59,7 +59,7 @@ export class FormComponent implements OnDestroy, OnInit { @Input() formModel: DynamicFormControlModel[]; @Input() parentFormModel: DynamicFormGroupModel | DynamicFormGroupModel[]; @Input() formGroup: FormGroup; - @Input() formLayout: DynamicFormLayout = null; + @Input() formLayout = null as DynamicFormLayout; /* tslint:disable:no-output-rename */ @Output('dfBlur') blur: EventEmitter = new EventEmitter(); diff --git a/src/app/shared/notifications/notification/notification.component.spec.ts b/src/app/shared/notifications/notification/notification.component.spec.ts index e2a80f9f70..d460a4a67f 100644 --- a/src/app/shared/notifications/notification/notification.component.spec.ts +++ b/src/app/shared/notifications/notification/notification.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, inject, TestBed } from '@angular/core/testing'; +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { BrowserModule, By } from '@angular/platform-browser'; import { ChangeDetectorRef, DebugElement } from '@angular/core'; @@ -9,11 +9,6 @@ import { notificationsReducer } from '../notifications.reducers'; import { Store, StoreModule } from '@ngrx/store'; import { NotificationOptions } from '../models/notification-options.model'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; -import { Router } from '@angular/router'; -import { NotificationsServiceStub } from '../../testing/notifications-service-stub'; -import { AppState } from '../../../app.reducer'; -import { Observable } from 'rxjs'; -import { SearchPageComponent } from '../../../+search-page/search-page.component'; import { INotificationBoardOptions } from '../../../../config/notifications-config.interfaces'; import { GlobalConfig } from '../../../../config/global-config.interface'; import { Notification } from '../models/notification.model'; diff --git a/src/app/shared/notifications/notification/notification.component.ts b/src/app/shared/notifications/notification/notification.component.ts index f3fbe83fde..81842c62f7 100644 --- a/src/app/shared/notifications/notification/notification.component.ts +++ b/src/app/shared/notifications/notification/notification.component.ts @@ -1,4 +1,3 @@ - import {of as observableOf, Observable } from 'rxjs'; import { ChangeDetectionStrategy, @@ -14,7 +13,6 @@ import { import { trigger } from '@angular/animations'; import { DomSanitizer } from '@angular/platform-browser'; import { NotificationsService } from '../notifications.service'; -import { INotification } from '../models/notification.model'; import { scaleEnter, scaleInState, scaleLeave, scaleOutState } from '../../animations/scale'; import { rotateEnter, rotateInState, rotateLeave, rotateOutState } from '../../animations/rotate'; import { fromBottomEnter, fromBottomInState, fromBottomLeave, fromBottomOutState } from '../../animations/fromBottom'; @@ -24,6 +22,7 @@ import { fromTopEnter, fromTopInState, fromTopLeave, fromTopOutState } from '../ import { fadeInEnter, fadeInState, fadeOutLeave, fadeOutState } from '../../animations/fade'; import { NotificationAnimationsStatus } from '../models/notification-animations-type'; import { isNotEmpty } from '../../empty.util'; +import { INotification } from '../models/notification.model'; @Component({ selector: 'ds-notification', @@ -46,7 +45,7 @@ import { isNotEmpty } from '../../empty.util'; export class NotificationComponent implements OnInit, OnDestroy { - @Input() public notification: INotification; + @Input() public notification = null as INotification; // Progress bar variables public title: Observable; diff --git a/src/app/shared/notifications/notifications.service.ts b/src/app/shared/notifications/notifications.service.ts index d6bb210652..55df6a4f7f 100644 --- a/src/app/shared/notifications/notifications.service.ts +++ b/src/app/shared/notifications/notifications.service.ts @@ -1,12 +1,15 @@ - -import {of as observableOf, Observable } from 'rxjs'; +import { of as observableOf, Observable } from 'rxjs'; import { Inject, Injectable } from '@angular/core'; import { INotification, Notification } from './models/notification.model'; import { NotificationType } from './models/notification-type'; import { NotificationOptions } from './models/notification-options.model'; import { uniqueId } from 'lodash'; import { Store } from '@ngrx/store'; -import { NewNotificationAction, RemoveAllNotificationsAction, RemoveNotificationAction } from './notifications.actions'; +import { + NewNotificationAction, + RemoveAllNotificationsAction, + RemoveNotificationAction +} from './notifications.actions'; import { GLOBAL_CONFIG, GlobalConfig } from '../../../config'; @Injectable() diff --git a/webpack/webpack.test.js b/webpack/webpack.test.js index 3c3c46b84c..b0305728d3 100644 --- a/webpack/webpack.test.js +++ b/webpack/webpack.test.js @@ -5,11 +5,14 @@ const { /** * Webpack Plugins */ + + + const ContextReplacementPlugin = require('webpack/lib/ContextReplacementPlugin'); const DefinePlugin = require('webpack/lib/DefinePlugin'); const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin'); const ProvidePlugin = require('webpack/lib/ProvidePlugin'); - +const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin'); /** * Webpack Constants */ @@ -81,14 +84,15 @@ module.exports = function (options) { /** * Typescript loader support for .ts and Angular 2 async routes via .async.ts * - * See: https://github.com/s-panferov/awesome-typescript-loader + * See: https://github.com/TypeStrong/ts-loader */ { - test: /\.ts$/, - loaders: [{ - loader: 'awesome-typescript-loader', + test: /\.tsx?$/, + loaders: [{ + loader: 'ts-loader', options: { - configFileName: './src/tsconfig.test.json' + configFile: root('src/tsconfig.test.json'), + transpileOnly: true } }, 'angular2-template-loader' @@ -249,7 +253,7 @@ module.exports = function (options) { } }), - + new ForkTsCheckerWebpackPlugin() ], /** diff --git a/yarn.lock b/yarn.lock index e509a2878f..da7122c474 100644 --- a/yarn.lock +++ b/yarn.lock @@ -946,19 +946,6 @@ autoprefixer@^9.1.3: postcss "^7.0.2" postcss-value-parser "^3.2.3" -awesome-typescript-loader@5.2.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/awesome-typescript-loader/-/awesome-typescript-loader-5.2.0.tgz#d7bccf4823c45096ec24da4c12a1507d276ba15a" - dependencies: - chalk "^2.4.1" - enhanced-resolve "^4.0.0" - loader-utils "^1.1.0" - lodash "^4.17.5" - micromatch "^3.1.9" - mkdirp "^0.5.1" - source-map-support "^0.5.3" - webpack-log "^1.2.0" - aws-sign2@~0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8" @@ -1569,7 +1556,7 @@ chokidar@^1.4.2: optionalDependencies: fsevents "^1.0.0" -chokidar@^2.0.0, chokidar@^2.0.2, chokidar@^2.0.3: +chokidar@^2.0.0, chokidar@^2.0.2, chokidar@^2.0.3, chokidar@^2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-2.0.4.tgz#356ff4e2b0e8e43e322d18a372460bbcf3accd26" dependencies: @@ -1965,11 +1952,7 @@ copy-webpack-plugin@^4.4.1: p-limit "^1.0.0" serialize-javascript "^1.4.0" -core-js@^2.2.0, core-js@^2.4.0: - version "2.5.7" - resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.5.7.tgz#f972608ff0cead68b841a16a932d0b183791814e" - -core-js@^2.5.7: +core-js@^2.2.0, core-js@^2.4.0, core-js@^2.5.7: version "2.5.7" resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.5.7.tgz#f972608ff0cead68b841a16a932d0b183791814e" @@ -3185,6 +3168,21 @@ forever-agent@~0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" +fork-ts-checker-webpack-plugin@^0.4.10: + version "0.4.10" + resolved "https://registry.yarnpkg.com/fork-ts-checker-webpack-plugin/-/fork-ts-checker-webpack-plugin-0.4.10.tgz#e96f87ea599af4501c1a69f44ecfb3163bbf30b9" + dependencies: + babel-code-frame "^6.22.0" + chalk "^2.4.1" + chokidar "^2.0.4" + lodash.endswith "^4.2.1" + lodash.isfunction "^3.0.8" + lodash.isstring "^4.0.1" + lodash.startswith "^4.2.1" + minimatch "^3.0.4" + resolve "^1.5.0" + tapable "^1.0.0" + form-data@~2.3.1, form-data@~2.3.2: version "2.3.2" resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.3.2.tgz#4970498be604c20c005d4f5c23aecd21d6b49099" @@ -4837,6 +4835,10 @@ lodash.defaults@^4.0.0: version "4.2.0" resolved "https://registry.yarnpkg.com/lodash.defaults/-/lodash.defaults-4.2.0.tgz#d09178716ffea4dde9e5fb7b37f6f0802274580c" +lodash.endswith@^4.2.1: + version "4.2.1" + resolved "https://registry.yarnpkg.com/lodash.endswith/-/lodash.endswith-4.2.1.tgz#fed59ac1738ed3e236edd7064ec456448b37bc09" + lodash.escape@^3.0.0: version "3.2.0" resolved "https://registry.yarnpkg.com/lodash.escape/-/lodash.escape-3.2.0.tgz#995ee0dc18c1b48cc92effae71a10aab5b487698" @@ -4851,6 +4853,14 @@ lodash.isarray@^3.0.0: version "3.0.4" resolved "https://registry.yarnpkg.com/lodash.isarray/-/lodash.isarray-3.0.4.tgz#79e4eb88c36a8122af86f844aa9bcd851b5fbb55" +lodash.isfunction@^3.0.8: + version "3.0.9" + resolved "https://registry.yarnpkg.com/lodash.isfunction/-/lodash.isfunction-3.0.9.tgz#06de25df4db327ac931981d1bdb067e5af68d051" + +lodash.isstring@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/lodash.isstring/-/lodash.isstring-4.0.1.tgz#d527dfb5456eca7cc9bb95d5daeaf88ba54a5451" + lodash.keys@^3.0.0: version "3.1.2" resolved "https://registry.yarnpkg.com/lodash.keys/-/lodash.keys-3.1.2.tgz#4dbc0472b156be50a0b286855d1bd0b0c656098a" @@ -4871,6 +4881,10 @@ lodash.restparam@^3.0.0: version "3.6.1" resolved "https://registry.yarnpkg.com/lodash.restparam/-/lodash.restparam-3.6.1.tgz#936a4e309ef330a7645ed4145986c85ae5b20805" +lodash.startswith@^4.2.1: + version "4.2.1" + resolved "https://registry.yarnpkg.com/lodash.startswith/-/lodash.startswith-4.2.1.tgz#c598c4adce188a27e53145731cdc6c0e7177600c" + lodash.tail@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/lodash.tail/-/lodash.tail-4.1.1.tgz#d2333a36d9e7717c8ad2f7cacafec7c32b444664" @@ -7367,6 +7381,10 @@ semver-intersect@^1.1.2: version "5.5.1" resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.1.tgz#7dfdd8814bdb7cabc7be0fb1d734cfb66c940477" +semver@^5.0.1: + version "5.6.0" + resolved "https://registry.yarnpkg.com/semver/-/semver-5.6.0.tgz#7e74256fbaa49c75aa7c7a205cc22799cac80004" + semver@~5.3.0: version "5.3.0" resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f" @@ -7657,7 +7675,7 @@ source-map-resolve@^0.5.0, source-map-resolve@^0.5.1: source-map-url "^0.4.0" urix "^0.1.0" -source-map-support@^0.5.0, source-map-support@^0.5.3, source-map-support@~0.5.6: +source-map-support@^0.5.0, source-map-support@~0.5.6: version "0.5.9" resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.9.tgz#41bc953b2534267ea2d605bccfa7bfa3111ced5f" dependencies: @@ -8171,6 +8189,16 @@ ts-helpers@1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/ts-helpers/-/ts-helpers-1.1.2.tgz#fc69be9f1f3baed01fb1a0ef8d4cfe748814d835" +ts-loader@^5.2.1: + version "5.2.1" + resolved "https://registry.yarnpkg.com/ts-loader/-/ts-loader-5.2.1.tgz#e6815c631dcafc24319ce8be6f8af94908749cf3" + dependencies: + chalk "^2.3.0" + enhanced-resolve "^4.0.0" + loader-utils "^1.0.2" + micromatch "^3.1.4" + semver "^5.0.1" + ts-md5@^1.2.4: version "1.2.4" resolved "https://registry.yarnpkg.com/ts-md5/-/ts-md5-1.2.4.tgz#7030d7ba9134449deedf6f609d4b4509b94a5712" @@ -8749,7 +8777,7 @@ webpack-dev-server@^3.1.5: webpack-log "^2.0.0" yargs "12.0.1" -webpack-log@^1.0.1, webpack-log@^1.2.0: +webpack-log@^1.0.1: version "1.2.0" resolved "https://registry.yarnpkg.com/webpack-log/-/webpack-log-1.2.0.tgz#a4b34cda6b22b518dbb0ab32e567962d5c72a43d" dependencies: