Skip to content

Commit 24045bc

Browse files
authored
chore: Bump example project to Angular 8 (#311)
* remove e2e and linting from example project * make `core-js` a direct dependency instead of peer dependency * update configuration files as they are in a newly generated angular project
1 parent 03f14f2 commit 24045bc

20 files changed

+2449
-1930
lines changed

CHANGELOG.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
## Changelog (master)
22

3+
#### Features
34
* (**BREAKING**): Refine ast-transformer behavior: only transform `styles`-assignments inside @Component ([#261](https://github.com/thymikee/jest-preset-angular/pull/261)) and TypeScript v2.9 `createStringLiteral` is polyfilled if an older version is used ([#272](https://github.com/thymikee/jest-preset-angular/issues/272)).
4-
55
* (**BREAKING**): Restructure project with `src` and `build` folder ([#307](https://github.com/thymikee/jest-preset-angular/pull/307)).
6-
76
* (**BREAKING**): Support `tsconfig.spec.json` in root folder by default ([#309](https://github.com/thymikee/jest-preset-angular/pull/309)).
7+
* (**BREAKING**): Remove `core-js` peer dependency and instead add it as direct dependency ([#311](https://github.com/thymikee/jest-preset-angular/pull/309)).
8+
9+
#### Chore && Maintenance
10+
* Update example app to match Angular 8 Boilerplate ([#311](https://github.com/thymikee/jest-preset-angular/pull/309)).
811

912
#### Migration Guide
1013
* If the `astTransformers` are referenced in a custom `jest` config, `[ 'jest-preset-angular/build/InlineFilesTransformer', 'jest-preset-angular/build/StripStylesTransformer']` have to be set instead.
1114
* Serializers, transformers and `setupJest` have to be referenced from the `jest-preset-angular/build/`-folder in a custom config. Existing references have to be aligned.
1215
* If your `tsconfig.spec.json` is located in `src`, move it to your root folder and adjust the referenced files and paths inside, or align your jest configuration as discussed in the [README.md](https://github.com/thymikee/jest-preset-angular/blob/master/README.md#custom-tsconfig).
16+
* In an Angular 8 project or higher, `core-js` should no longer be a dependency declared in `package.json`, unless it's imported manually in the code.
1317

1418
### v7.1.0
1519

example/README.md

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,34 @@
11
# Example
22

3-
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 1.0.0.
3+
This is an example app using `jest-preset-angular`. It is not supposed to be a boilerplate for an Angular app tested with jest, but could be used as a rough reference for configuration.
44

5-
## Development server
5+
The jest configuration itself is located in the `package.json`.
66

7-
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
7+
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 8.3.4.
88

9-
## Code scaffolding
9+
## Running unit tests
1010

11-
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive/pipe/service/class/module`.
11+
Run `yarn test` or `npm test` to execute the unit tests via [Jest](https://jestjs.io).
1212

13-
## Build
13+
## Running end-to-end tests
1414

15-
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `-prod` flag for a production build.
15+
End-to-end are not setup in this project.
1616

17-
## Running unit tests
17+
## Development server
18+
19+
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
1820

19-
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
21+
## Development server
2022

21-
## Running end-to-end tests
23+
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
24+
25+
## Code scaffolding
26+
27+
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
28+
29+
## Build
2230

23-
Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
24-
Before running the tests make sure you are serving the app via `ng serve`.
31+
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build.
2532

2633
## Further help
2734

example/angular.json

Lines changed: 13 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,19 @@
4343
"aot": true,
4444
"extractLicenses": true,
4545
"vendorChunk": false,
46-
"buildOptimizer": true
46+
"buildOptimizer": true,
47+
"budgets": [
48+
{
49+
"type": "initial",
50+
"maximumWarning": "2mb",
51+
"maximumError": "5mb"
52+
},
53+
{
54+
"type": "anyComponentStyle",
55+
"maximumWarning": "6kb",
56+
"maximumError": "10kb"
57+
}
58+
]
4759
}
4860
}
4961
},
@@ -63,57 +75,6 @@
6375
"options": {
6476
"browserTarget": "example:build"
6577
}
66-
},
67-
"test": {
68-
"builder": "@angular-devkit/build-angular:karma",
69-
"options": {
70-
"main": "src/karmaTest.ts",
71-
"polyfills": "src/polyfills.ts",
72-
"tsConfig": "tsconfig.spec.json",
73-
"karmaConfig": "src/karma.conf.js",
74-
"styles": [
75-
"styles.css"
76-
],
77-
"scripts": [],
78-
"assets": [
79-
"src/favicon.ico",
80-
"src/assets"
81-
]
82-
}
83-
},
84-
"lint": {
85-
"builder": "@angular-devkit/build-angular:tslint",
86-
"options": {
87-
"tsConfig": [
88-
"tsconfig.app.json",
89-
"tsconfig.spec.json"
90-
],
91-
"exclude": [
92-
"**/node_modules/**"
93-
]
94-
}
95-
}
96-
}
97-
},
98-
"example-e2e": {
99-
"root": "e2e/",
100-
"projectType": "application",
101-
"architect": {
102-
"e2e": {
103-
"builder": "@angular-devkit/build-angular:protractor",
104-
"options": {
105-
"protractorConfig": "e2e/protractor.conf.js",
106-
"devServerTarget": "example:serve"
107-
}
108-
},
109-
"lint": {
110-
"builder": "@angular-devkit/build-angular:tslint",
111-
"options": {
112-
"tsConfig": "e2e/tsconfig.e2e.json",
113-
"exclude": [
114-
"**/node_modules/**"
115-
]
116-
}
11778
}
11879
}
11980
}

example/e2e/app.e2e-spec.ts

Lines changed: 0 additions & 14 deletions
This file was deleted.

example/e2e/app.po.ts

Lines changed: 0 additions & 11 deletions
This file was deleted.

example/e2e/tsconfig.e2e.json

Lines changed: 0 additions & 12 deletions
This file was deleted.

example/package.json

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,32 +15,30 @@
1515
},
1616
"private": true,
1717
"dependencies": {
18-
"@angular/animations": "7.2.8",
19-
"@angular/common": "7.2.8",
20-
"@angular/compiler": "7.2.8",
21-
"@angular/core": "7.2.8",
22-
"@angular/forms": "7.2.8",
23-
"@angular/http": "7.2.8",
24-
"@angular/platform-browser": "7.2.8",
25-
"@angular/platform-browser-dynamic": "7.2.8",
26-
"@angular/router": "7.2.8",
27-
"core-js": "^2.0.0",
28-
"rxjs": "6.4.0",
29-
"zone.js": "0.8.29"
18+
"@angular/animations": "~8.2.5",
19+
"@angular/common": "~8.2.5",
20+
"@angular/compiler": "~8.2.5",
21+
"@angular/core": "~8.2.5",
22+
"@angular/forms": "~8.2.5",
23+
"@angular/platform-browser": "~8.2.5",
24+
"@angular/platform-browser-dynamic": "~8.2.5",
25+
"@angular/router": "~8.2.5",
26+
"rxjs": "~6.4.0",
27+
"tslib": "^1.10.0",
28+
"zone.js": "~0.9.1"
3029
},
3130
"devDependencies": {
32-
"@angular-devkit/build-angular": "^0.13.5",
33-
"@angular/cli": "^7.3.5",
34-
"@angular/compiler-cli": "7.2.8",
31+
"@angular-devkit/build-angular": "~0.803.4",
32+
"@angular/cli": "~8.3.4",
33+
"@angular/compiler-cli": "~8.2.5",
34+
"@angular/language-service": "~8.2.5",
3535
"@types/jest": "^24.0.0",
3636
"@types/node": "^11.0.0",
37-
"codelyzer": "^4.4.3",
37+
"codelyzer": "^5.0.0",
3838
"jest": "^24.0.0",
3939
"jest-preset-angular": "file:../",
40-
"protractor": "^5.4.0",
4140
"ts-node": "^8.0.3",
42-
"tslint": "^5.11.0",
43-
"typescript": "3.3.3333"
41+
"typescript": "~3.5.3"
4442
},
4543
"jest": {
4644
"preset": "jest-preset-angular",

example/protractor.conf.js

Lines changed: 0 additions & 30 deletions
This file was deleted.

example/src/app/app.module.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { BrowserModule } from '@angular/platform-browser';
22
import { NgModule } from '@angular/core';
33
import { FormsModule } from '@angular/forms';
4-
import { HttpModule } from '@angular/http';
4+
import { HttpClientModule } from '@angular/common/http';
55
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
66
import { AppComponent } from './app.component';
77
import { CalcComponent } from './calc/calc.component';
@@ -10,6 +10,8 @@ import { OnPushComponent } from './on-push/on-push.component';
1010
import { HeroesComponent } from './heroes/heroes.component';
1111
import { SimpleWithStylesComponent } from './simple-with-styles/simple-with-styles.component';
1212
import { ChildComponent } from './medium/child.component';
13+
import { MediumComponent } from './medium/medium.component';
14+
import { NgReflectAsTextComponent } from './ng-reflect-as-text/ng-reflect-as-text.component';
1315

1416
@NgModule({
1517
declarations: [
@@ -19,13 +21,15 @@ import { ChildComponent } from './medium/child.component';
1921
OnPushComponent,
2022
HeroesComponent,
2123
SimpleWithStylesComponent,
22-
ChildComponent
24+
ChildComponent,
25+
MediumComponent,
26+
NgReflectAsTextComponent,
2327
],
2428
imports: [
2529
BrowserModule,
2630
BrowserAnimationsModule,
2731
FormsModule,
28-
HttpModule
32+
HttpClientModule,
2933
],
3034
providers: [],
3135
bootstrap: [AppComponent]

example/src/app/calc/calc.component.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
22

33
import { configureTests, ConfigureFn } from '@lib/testing';
44

5-
import { CalcComponent } from 'app/calc/calc.component';
5+
import { CalcComponent } from 'src/app/calc/calc.component';
66

77
describe('CalcComponent', () => {
88
let component: CalcComponent;

0 commit comments

Comments
 (0)