update dependencies and fix unit tests

This commit is contained in:
Sebastian Peischl
2018-02-19 21:12:37 +01:00
parent 1ae6f7aedc
commit 4d3ca6e1b1
9 changed files with 155 additions and 128 deletions

View File

@@ -22,8 +22,7 @@
"styles": [ "styles": [
"styles.scss" "styles.scss"
], ],
"scripts": [ "scripts": [],
],
"environmentSource": "environments/environment.ts", "environmentSource": "environments/environment.ts",
"environments": { "environments": {
"dev": "environments/environment.ts", "dev": "environments/environment.ts",
@@ -38,13 +37,16 @@
}, },
"lint": [ "lint": [
{ {
"project": "src/tsconfig.app.json" "project": "src/tsconfig.app.json",
"exclude": "**/node_modules/**"
}, },
{ {
"project": "src/tsconfig.spec.json" "project": "src/tsconfig.spec.json",
"exclude": "**/node_modules/**"
}, },
{ {
"project": "e2e/tsconfig.e2e.json" "project": "e2e/tsconfig.e2e.json",
"exclude": "**/node_modules/**"
} }
], ],
"test": { "test": {
@@ -54,7 +56,6 @@
}, },
"defaults": { "defaults": {
"styleExt": "scss", "styleExt": "scss",
"component": { "component": {}
}
} }
} }

View File

@@ -38,77 +38,76 @@
}, },
"dependencies": {}, "dependencies": {},
"devDependencies": { "devDependencies": {
"@angular/common": "5.2.5", "@angular/cli": "~1.7.0",
"@angular/compiler": "5.2.5", "@angular/common": "^5.2.5",
"@angular/core": "5.2.5", "@angular/compiler": "^5.2.5",
"@angular/forms": "5.2.5", "@angular/compiler-cli": "^5.2.5",
"@angular/http": "5.2.5", "@angular/core": "^5.2.5",
"@angular/platform-browser": "5.2.5", "@angular/forms": "^5.2.5",
"@angular/platform-browser-dynamic": "5.2.5", "@angular/http": "^5.2.5",
"@angular/router": "5.2.5", "@angular/language-service": "^5.2.5",
"@ngx-translate/core": "9.1.1", "@angular/platform-browser": "^5.2.5",
"@ngx-translate/http-loader": "2.0.1", "@angular/platform-browser-dynamic": "^5.2.5",
"core-js": "2.4.1", "@angular/router": "^5.2.5",
"enhanced-resolve": "3.3.0", "@ngx-translate/core": "^9.1.1",
"rxjs": "5.5.2", "@ngx-translate/http-loader": "^2.0.1",
"zone.js": "0.8.17", "@types/jasmine": "~2.8.3",
"@angular/cli": "1.6.8", "@types/jasminewd2": "^2.0.3",
"@angular/compiler-cli": "5.2.5", "@types/node": "^9.4.6",
"@angular/language-service": "5.2.5", "autoprefixer": "^8.0.0",
"@types/core-js": "0.9.36", "circular-dependency-plugin": "^4.4.0",
"@types/jasmine": "2.5.54", "codelyzer": "^4.1.0",
"@types/jasminewd2": "2.0.2", "copy-webpack-plugin": "~4.4.1",
"@types/node": "7.0.7", "copyfiles": "^1.2.0",
"autoprefixer": "8.0.0", "core-js": "^2.4.1",
"circular-dependency-plugin": "4.4.0", "cross-env": "^5.1.3",
"codelyzer": "4.1.0", "css-loader": "^0.28.9",
"copy-webpack-plugin": "4.1.1", "cssnano": "^3.10.0",
"copyfiles": "1.2.0", "electron": "^1.8.2",
"cross-env": "5.0.5", "electron-builder": "^20.0.5",
"css-loader": "0.28.9", "electron-reload": "^1.2.2",
"cssnano": "3.10.0", "enhanced-resolve": "^3.4.1",
"electron": "1.8.2", "exports-loader": "^0.7.0",
"electron-builder": "20.0.4", "file-loader": "^1.1.6",
"electron-reload": "1.2.2", "html-loader": "^0.5.5",
"exports-loader": "0.7.0", "html-webpack-plugin": "^2.30.1",
"file-loader": "1.1.6", "istanbul-instrumenter-loader": "^3.0.0",
"html-loader": "0.5.5", "jasmine-core": "~2.99.1",
"html-webpack-plugin": "2.30.1", "jasmine-spec-reporter": "~4.2.1",
"istanbul-instrumenter-loader": "3.0.0", "json-loader": "^0.5.7",
"jasmine-core": "2.8.0", "karma": "~2.0.0",
"jasmine-spec-reporter": "4.2.1", "karma-chrome-launcher": "~2.2.0",
"json-loader": "0.5.7", "karma-cli": "^1.0.1",
"karma": "1.7.1", "karma-coverage-istanbul-reporter": "^1.4.1",
"karma-chrome-launcher": "2.2.0", "karma-jasmine": "~1.1.1",
"karma-cli": "1.0.1", "karma-jasmine-html-reporter": "^0.2.2",
"karma-coverage-istanbul-reporter": "1.3.0", "karma-sourcemap-loader": "^0.3.7",
"karma-jasmine": "1.1.0", "less-loader": "^4.0.5",
"karma-jasmine-html-reporter": "0.2.2", "minimist": "^1.2.0",
"karma-sourcemap-loader": "0.3.7", "mkdirp": "^0.5.1",
"less-loader": "4.0.5", "npm-run-all": "^4.1.2",
"minimist": "1.2.0", "npx": "^9.7.1",
"mkdirp": "0.5.1", "postcss-custom-properties": "^7.0.0",
"npm-run-all": "4.1.2", "postcss-loader": "^2.1.0",
"npx": "9.7.1", "postcss-url": "^7.3.0",
"postcss-loader": "2.1.0", "protractor": "~5.3.0",
"postcss-url": "7.3.0", "raw-loader": "^0.5.1",
"postcss-custom-properties": "6.2.0", "rxjs": "^5.5.6",
"protractor": "5.3.0", "sass-loader": "^6.0.6",
"raw-loader": "0.5.1", "script-loader": "^0.7.2",
"sass-loader": "6.0.6", "source-map-loader": "^0.2.3",
"script-loader": "0.7.2", "style-loader": "^0.20.2",
"source-map-loader": "0.2.3", "stylus-loader": "^3.0.1",
"style-loader": "0.20.1", "ts-node": "~4.1.0",
"stylus-loader": "3.0.1", "tslint": "~5.9.1",
"ts-node": "4.1.0", "typescript": "~2.6.2",
"tslint": "5.9.1", "uglifyjs-webpack-plugin": "^1.2.0",
"typescript": "2.6.2", "url-loader": "^0.6.2",
"uglifyjs-webpack-plugin": "1.1.8", "webdriver-manager": "^12.0.6",
"url-loader": "0.6.2", "webpack": "~3.11.0",
"webdriver-manager": "12.0.6", "webpack-concat-plugin": "^2.4.2",
"webpack": "3.11.0", "webpack-dev-server": "^2.11.1",
"webpack-concat-plugin": "2.4.2", "zone.js": "^0.8.20"
"webpack-dev-server": "2.11.1"
}, },
"license": "SEE LICENSE IN LICENSE.md" "license": "SEE LICENSE IN LICENSE.md"
} }

View File

@@ -2,6 +2,7 @@ import { TestBed, async } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing'; import { RouterTestingModule } from '@angular/router/testing';
import { AppComponent } from './app.component'; import { AppComponent } from './app.component';
import { ElectronService } from 'app/providers/electron.service'; import { ElectronService } from 'app/providers/electron.service';
import { TranslateModule } from '@ngx-translate/core';
describe('AppComponent', () => { describe('AppComponent', () => {
beforeEach(async(() => { beforeEach(async(() => {
@@ -12,7 +13,10 @@ describe('AppComponent', () => {
providers : [ providers : [
ElectronService ElectronService
], ],
imports: [RouterTestingModule] imports: [
RouterTestingModule,
TranslateModule.forRoot()
]
}).compileComponents(); }).compileComponents();
})); }));

View File

@@ -1,6 +1,6 @@
import 'zone.js/dist/zone-mix'; import 'zone.js/dist/zone-mix';
import 'reflect-metadata'; import 'reflect-metadata';
import 'polyfills'; import '../polyfills';
import { BrowserModule } from '@angular/platform-browser'; import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms'; import { FormsModule } from '@angular/forms';
@@ -15,7 +15,7 @@ import { TranslateHttpLoader } from '@ngx-translate/http-loader';
import { ElectronService } from './providers/electron.service'; import { ElectronService } from './providers/electron.service';
import { WebviewDirective } from 'app/directives/webview.directive'; import { WebviewDirective } from './directives/webview.directive';
import { AppComponent } from './app.component'; import { AppComponent } from './app.component';
import { HomeComponent } from './components/home/home.component'; import { HomeComponent } from './components/home/home.component';

View File

@@ -1,6 +1,7 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { HomeComponent } from './home.component'; import { HomeComponent } from './home.component';
import { TranslateModule } from '@ngx-translate/core';
describe('HomeComponent', () => { describe('HomeComponent', () => {
let component: HomeComponent; let component: HomeComponent;
@@ -8,7 +9,8 @@ describe('HomeComponent', () => {
beforeEach(async(() => { beforeEach(async(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
declarations: [ HomeComponent ] declarations: [ HomeComponent ],
imports: [ TranslateModule.forRoot() ]
}) })
.compileComponents(); .compileComponents();
})); }));
@@ -23,16 +25,10 @@ describe('HomeComponent', () => {
expect(component).toBeTruthy(); expect(component).toBeTruthy();
}); });
it(`should have as title 'App works !'`, async(() => {
fixture = TestBed.createComponent(HomeComponent);
const app = fixture.debugElement.componentInstance;
expect(app.title).toEqual('App works !');
}));
it('should render title in a h1 tag', async(() => { it('should render title in a h1 tag', async(() => {
fixture = TestBed.createComponent(HomeComponent); fixture = TestBed.createComponent(HomeComponent);
fixture.detectChanges(); fixture.detectChanges();
const compiled = fixture.debugElement.nativeElement; const compiled = fixture.debugElement.nativeElement;
expect(compiled.querySelector('h1').textContent).toContain('App works !'); expect(compiled.querySelector('h1').textContent).toContain('PAGES.HOME.TITLE');
})); }));
}); });

View File

@@ -31,37 +31,49 @@
// import 'core-js/es6/array'; // import 'core-js/es6/array';
// import 'core-js/es6/regexp'; // import 'core-js/es6/regexp';
// import 'core-js/es6/map'; // import 'core-js/es6/map';
// import 'core-js/es6/weak-map';
// import 'core-js/es6/set'; // import 'core-js/es6/set';
/** IE10 and IE11 requires the following for NgClass support on SVG elements */ /** IE10 and IE11 requires the following for NgClass support on SVG elements */
// import 'classlist.js'; // Run `npm install --save classlist.js`. // import 'classlist.js'; // Run `npm install --save classlist.js`.
/** IE10 and IE11 requires the following to support `@angular/animation`. */ /** IE10 and IE11 requires the following for the Reflect API. */
// import 'web-animations-js'; // Run `npm install --save web-animations-js`. // import 'core-js/es6/reflect';
/** Evergreen browsers require these. **/ /** Evergreen browsers require these. **/
import 'core-js/es6/reflect'; // Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove.
import 'core-js/es7/reflect'; import 'core-js/es7/reflect';
/** ALL Firefox browsers require the following to support `@angular/animation`. **/ /**
* Required to support Web Animations `@angular/platform-browser/animations`.
* Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-animation
**/
// import 'web-animations-js'; // Run `npm install --save web-animations-js`. // import 'web-animations-js'; // Run `npm install --save web-animations-js`.
/**
* By default, zone.js will patch all possible macroTask and DomEvents
* user can disable parts of macroTask/DomEvents patch by setting following flags
*/
// (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
// (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
// (window as any).__zone_symbol__BLACK_LISTED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
/*
* in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
* with the following flag, it will bypass `zone.js` patch for IE/Edge
*/
// (window as any).__Zone_enable_cross_context_check = true;
/*************************************************************************************************** /***************************************************************************************************
* Zone JS is required by Angular itself. * Zone JS is required by default for Angular itself.
*/ */
import 'zone.js/dist/zone-mix'; // Included with Angular CLI. import 'zone.js/dist/zone-mix'; // Included with Angular CLI.
/*************************************************************************************************** /***************************************************************************************************
* APPLICATION IMPORTS * APPLICATION IMPORTS
*/ */
/**
* Date, currency, decimal and percent pipes.
* Needed for: All but Chrome, Firefox, Edge, IE11 and Safari 10
*/
// import 'intl'; // Run `npm install --save intl`.

View File

@@ -1,24 +1,14 @@
// This file is required by karma.conf.js and loads recursively all the .spec and framework files // This file is required by karma.conf.js and loads recursively all the .spec and framework files
import 'zone.js/dist/long-stack-trace-zone'; import 'zone.js/dist/zone-testing';
import 'zone.js/dist/proxy.js';
import 'zone.js/dist/sync-test';
import 'zone.js/dist/jasmine-patch';
import 'zone.js/dist/async-test';
import 'zone.js/dist/fake-async-test';
import { getTestBed } from '@angular/core/testing'; import { getTestBed } from '@angular/core/testing';
import { import {
BrowserDynamicTestingModule, BrowserDynamicTestingModule,
platformBrowserDynamicTesting platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing'; } from '@angular/platform-browser-dynamic/testing';
// Unfortunately there's no typing for the `__karma__` variable. Just declare it as any.
declare const __karma__: any;
declare const require: any; declare const require: any;
// Prevent Karma from running prematurely.
__karma__.loaded = function () {};
// First, initialize the Angular testing environment. // First, initialize the Angular testing environment.
getTestBed().initTestEnvironment( getTestBed().initTestEnvironment(
BrowserDynamicTestingModule, BrowserDynamicTestingModule,
@@ -28,5 +18,3 @@ getTestBed().initTestEnvironment(
const context = require.context('./', true, /\.spec\.ts$/); const context = require.context('./', true, /\.spec\.ts$/);
// And load the modules. // And load the modules.
context.keys().map(context); context.keys().map(context);
// Finally, start Karma to run the tests.
__karma__.start();

View File

@@ -23,7 +23,7 @@
"node_modules/@types" "node_modules/@types"
], ],
"lib": [ "lib": [
"es2016", "es2017",
"dom" "dom"
] ]
}, },

View File

@@ -3,6 +3,7 @@
"node_modules/codelyzer" "node_modules/codelyzer"
], ],
"rules": { "rules": {
"arrow-return-shorthand": true,
"callable-types": true, "callable-types": true,
"class-name": true, "class-name": true,
"comment-format": [ "comment-format": [
@@ -10,9 +11,16 @@
"check-space" "check-space"
], ],
"curly": true, "curly": true,
"deprecation": {
"severity": "warn"
},
"eofline": true, "eofline": true,
"forin": true, "forin": true,
"import-blacklist": [true, "rxjs"], "import-blacklist": [
true,
"rxjs",
"rxjs/Rx"
],
"import-spacing": true, "import-spacing": true,
"indent": [ "indent": [
true, true,
@@ -27,8 +35,14 @@
"member-access": false, "member-access": false,
"member-ordering": [ "member-ordering": [
true, true,
"static-before-instance", {
"variables-before-functions" "order": [
"static-field",
"instance-field",
"static-method",
"instance-method"
]
}
], ],
"no-arg": true, "no-arg": true,
"no-bitwise": true, "no-bitwise": true,
@@ -42,16 +56,22 @@
], ],
"no-construct": true, "no-construct": true,
"no-debugger": true, "no-debugger": true,
"no-duplicate-variable": true, "no-duplicate-super": true,
"no-empty": false, "no-empty": false,
"no-empty-interface": true, "no-empty-interface": true,
"no-eval": true, "no-eval": true,
"no-inferrable-types": [true, "ignore-params"], "no-inferrable-types": [
true,
"ignore-params"
],
"no-misused-new": true,
"no-non-null-assertion": true,
"no-shadowed-variable": true, "no-shadowed-variable": true,
"no-string-literal": false, "no-string-literal": false,
"no-string-throw": true, "no-string-throw": true,
"no-switch-case-fall-through": true, "no-switch-case-fall-through": true,
"no-trailing-whitespace": true, "no-trailing-whitespace": true,
"no-unnecessary-initializer": true,
"no-unused-expression": true, "no-unused-expression": true,
"no-use-before-declare": true, "no-use-before-declare": true,
"no-var-keyword": true, "no-var-keyword": true,
@@ -70,6 +90,7 @@
], ],
"radix": true, "radix": true,
"semicolon": [ "semicolon": [
true,
"always" "always"
], ],
"triple-equals": [ "triple-equals": [
@@ -86,7 +107,6 @@
"variable-declaration": "nospace" "variable-declaration": "nospace"
} }
], ],
"typeof-compare": true,
"unified-signatures": true, "unified-signatures": true,
"variable-name": false, "variable-name": false,
"whitespace": [ "whitespace": [
@@ -97,9 +117,19 @@
"check-separator", "check-separator",
"check-type" "check-type"
], ],
"directive-selector": [
"directive-selector": [true, "attribute", "app", "camelCase"], true,
"component-selector": [true, "element", "app", "kebab-case"], "attribute",
"app",
"camelCase"
],
"component-selector": [
true,
"element",
"app",
"kebab-case"
],
"no-output-on-prefix": true,
"use-input-property-decorator": true, "use-input-property-decorator": true,
"use-output-property-decorator": true, "use-output-property-decorator": true,
"use-host-property-decorator": true, "use-host-property-decorator": true,
@@ -108,9 +138,6 @@
"use-life-cycle-interface": true, "use-life-cycle-interface": true,
"use-pipe-transform-interface": true, "use-pipe-transform-interface": true,
"component-class-suffix": true, "component-class-suffix": true,
"directive-class-suffix": true, "directive-class-suffix": true
"no-access-missing-member": true,
"templates-use-public": true,
"invoke-injectable": true
} }
} }