Skip to content

Commit

Permalink
Upgrade example app to Angular 6 and repository's dependencies (#150)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahnpnl authored and thymikee committed May 6, 2018
1 parent 4a333af commit 7b91516
Show file tree
Hide file tree
Showing 11 changed files with 2,046 additions and 1,361 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## Changelog (master)

* Chore: Upgrade example app to Angular 6 ([#150](https://github.com/thymikee/jest-preset-angular/pull/150))
* Chore: Upgrade dependencies for the repository ([#150](https://github.com/thymikee/jest-preset-angular/pull/150))

### v5.2.2

* Fix: specify angular modules as peerDependancies ([#141](https://github.com/thymikee/jest-preset-angular/pull/141))
Expand Down
57 changes: 0 additions & 57 deletions example/.angular-cli.json

This file was deleted.

122 changes: 122 additions & 0 deletions example/angular.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"example": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"prefix": "app",
"schematics": {},
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/example",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.app.json",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.css"
],
"scripts": []
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "example:build"
},
"configurations": {
"production": {
"browserTarget": "example:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "example:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.spec.json",
"karmaConfig": "src/karma.conf.js",
"styles": [
"styles.css"
],
"scripts": [],
"assets": [
"src/favicon.ico",
"src/assets"
]
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"src/tsconfig.app.json",
"src/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
},
"example-e2e": {
"root": "e2e/",
"projectType": "application",
"architect": {
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "example:serve"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": "e2e/tsconfig.e2e.json",
"exclude": [
"**/node_modules/**"
]
}
}
}
}
},
"defaultProject": "example"
}
42 changes: 22 additions & 20 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,30 +15,32 @@
},
"private": true,
"dependencies": {
"@angular/animations": "^5.2.8",
"@angular/common": "^5.2.8",
"@angular/compiler": "^5.2.8",
"@angular/core": "^5.2.8",
"@angular/forms": "^5.2.8",
"@angular/http": "^5.2.8",
"@angular/platform-browser": "^5.2.8",
"@angular/platform-browser-dynamic": "^5.2.8",
"@angular/router": "^5.2.8",
"core-js": "^2.5.3",
"rxjs": "^5.5.6",
"zone.js": "^0.8.20"
"@angular/animations": "6.0.0",
"@angular/common": "6.0.0",
"@angular/compiler": "6.0.0",
"@angular/core": "6.0.0",
"@angular/forms": "6.0.0",
"@angular/http": "6.0.0",
"@angular/platform-browser": "6.0.0",
"@angular/platform-browser-dynamic": "6.0.0",
"@angular/router": "6.0.0",
"core-js": "^2.5.5",
"rxjs": "6.1.0",
"rxjs-compat": "^6.1.0",
"zone.js": "0.8.26"
},
"devDependencies": {
"@angular/cli": "^1.7.3",
"@angular/compiler-cli": "^5.2.8",
"@angular-devkit/build-angular": "^0.6.0",
"@angular/cli": "^6.0.0",
"@angular/compiler-cli": "6.0.0",
"@types/node": "~6.0.60",
"codelyzer": "^4.2.1",
"jest": "^22.4.2",
"jest-preset-angular": "^5.2.1",
"codelyzer": "^4.3.0",
"jest": "^22.4.3",
"jest-preset-angular": "^5.2.2",
"protractor": "~5.1.2",
"ts-node": "~4.1.0",
"tslint": "~5.9.1",
"typescript": "2.6.2"
"ts-node": "^6.0.2",
"tslint": "^5.10.0",
"typescript": "2.7.2"
},
"jest": {
"preset": "jest-preset-angular",
Expand Down
3 changes: 2 additions & 1 deletion example/src/app/calc/calc.component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Component, OnInit, Input } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { Observable } from 'rxjs';

const image = require('assets/its_something.png');

@Component({
Expand Down
8 changes: 4 additions & 4 deletions example/src/app/service/hero.service.spec.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { inject, TestBed } from '@angular/core/testing'
import { HttpClientModule, HttpErrorResponse, HttpRequest } from '@angular/common/http'
import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'

import { heroesUrl, HeroService } from './hero.service'
import { of } from 'rxjs/observable/of'

describe('Service: GoogleBooks', () => {
let service: HeroService
let backend: HttpTestingController

const expectedData = {
id: 1,
name: 'Test hero'
name: 'Test hero',
}

beforeEach(() => {
Expand Down Expand Up @@ -70,10 +70,10 @@ describe('Service: GoogleBooks', () => {
expect(console.error).toHaveBeenCalled()
})

it('should return an observable of null and print error to console', () => {
it('should return an observable of undefined and print error to console', () => {
const result = service.handleError(new HttpErrorResponse({ error: 'Error occurs' }), 'test method')

expect(console.error).toHaveBeenCalled()
expect(result).toEqual(of(undefined))
result.subscribe(value => expect(value).toBeUndefined())
})
})
6 changes: 3 additions & 3 deletions example/src/app/service/hero.service.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Injectable } from '@angular/core'
import { HttpClient, HttpErrorResponse, HttpParams } from '@angular/common/http'

import { Observable } from 'rxjs/Observable'
import { of } from 'rxjs/observable/of'
import { Observable } from 'rxjs'
import { of } from 'rxjs'
import { catchError } from 'rxjs/operators'

import { Hero } from './hero'

export const heroesUrl = 'api/heroes' // URL to web api
Expand Down
15 changes: 11 additions & 4 deletions example/src/environments/environment.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
// The file contents for the current environment will overwrite these during build.
// The build system defaults to the dev environment which uses `environment.ts`, but if you do
// `ng build --env=prod` then `environment.prod.ts` will be used instead.
// The list of which env maps to which file can be found in `.angular-cli.json`.
// This file can be replaced during build by using the `fileReplacements` array.
// `ng build ---prod` replaces `environment.ts` with `environment.prod.ts`.
// The list of file replacements can be found in `angular.json`.

export const environment = {
production: false
};

/*
* In development mode, to ignore zone related error stack frames such as
* `zone.run`, `zoneDelegate.invokeTask` for easier debugging, you can
* import the following file, but please comment it out in production mode
* because it will have performance impact when throw error
*/
// import 'zone.js/dist/zone-error'; // Included with Angular CLI.
Loading

0 comments on commit 7b91516

Please sign in to comment.