Skip to content

Commit

Permalink
example clean-up: get rid of karma, extract jest config, fix bui… (#316)
Browse files Browse the repository at this point in the history
* Get rid of karma, extract jest config, fix pathes

* update CHANGELOG
  • Loading branch information
artemrudenko authored and thymikee committed Oct 7, 2019
1 parent 24045bc commit 20ba6fd
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 485 deletions.
7 changes: 4 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

#### Features
* (**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)).
* (**BREAKING**): Restructure project with `src` and `build` folder ([#307](https://github.com/thymikee/jest-preset-angular/pull/307)).
* (**BREAKING**): Support `tsconfig.spec.json` in root folder by default ([#309](https://github.com/thymikee/jest-preset-angular/pull/309)).
* (**BREAKING**): Remove `core-js` peer dependency and instead add it as direct dependency ([#311](https://github.com/thymikee/jest-preset-angular/pull/309)).
* (**BREAKING**): Restructure project with `src` and `build` folder ([#307](https://github.com/thymikee/jest-preset-angular/pull/307)).
* (**BREAKING**): Support `tsconfig.spec.json` in root folder by default ([#309](https://github.com/thymikee/jest-preset-angular/pull/309)).
* (**BREAKING**): Remove `core-js` peer dependency and instead add it as direct dependency ([#311](https://github.com/thymikee/jest-preset-angular/pull/309)).

#### Chore && Maintenance
* Update example app to match Angular 8 Boilerplate ([#311](https://github.com/thymikee/jest-preset-angular/pull/309)).
* Update example app to not use karma, extract jest config, fix paths ([#316](https://github.com/thymikee/jest-preset-angular/pull/316))

#### Migration Guide
* 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.
Expand Down
15 changes: 15 additions & 0 deletions example/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module.exports = {
preset: "jest-preset-angular",
snapshotSerializers: [
"jest-preset-angular/build/AngularNoNgAttributesSnapshotSerializer.js",
"jest-preset-angular/build/AngularSnapshotSerializer.js",
"jest-preset-angular/build/HTMLCommentSerializer.js"
],
moduleNameMapper: {
"\\.(jpg|jpeg|png)$": "<rootDir>/__mocks__/image.js",
"^@lib/(.*)$": "<rootDir>/src/lib/$1"
},
setupFilesAfterEnv: [
"<rootDir>/src/setupJest.ts"
]
}
44 changes: 0 additions & 44 deletions example/karma.conf.js

This file was deleted.

20 changes: 1 addition & 19 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@
"test": "jest",
"test:watch": "jest --watch",
"test:ci": "jest --runInBand",
"test:coverage": "jest --coverage",
"lint": "ng lint",
"e2e": "ng e2e"
"test:coverage": "jest --coverage"
},
"private": true,
"dependencies": {
Expand All @@ -34,25 +32,9 @@
"@angular/language-service": "~8.2.5",
"@types/jest": "^24.0.0",
"@types/node": "^11.0.0",
"codelyzer": "^5.0.0",
"jest": "^24.0.0",
"jest-preset-angular": "file:../",
"ts-node": "^8.0.3",
"typescript": "~3.5.3"
},
"jest": {
"preset": "jest-preset-angular",
"snapshotSerializers": [
"jest-preset-angular/build/AngularNoNgAttributesSnapshotSerializer.js",
"jest-preset-angular/build/AngularSnapshotSerializer.js",
"jest-preset-angular/build/HTMLCommentSerializer.js"
],
"moduleNameMapper": {
"\\.(jpg|jpeg|png)$": "<rootDir>/__mocks__/image.js",
"^@lib/(.*)$": "<rootDir>/src/lib/$1"
},
"setupFilesAfterEnv": [
"<rootDir>/src/setupJest.ts"
]
}
}
2 changes: 1 addition & 1 deletion example/src/app/calc/calc.component.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Component, OnInit, Input } from '@angular/core';
import { Observable } from 'rxjs';

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

@Component({
selector: 'app-calc',
Expand Down
32 changes: 0 additions & 32 deletions example/src/karmaTest.ts

This file was deleted.

3 changes: 1 addition & 2 deletions example/tsconfig.app.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/app",
"types": []
"types": ["node"]
},
"files": [
"src/main.ts",
Expand All @@ -12,7 +12,6 @@
"src/**/*.ts"
],
"exclude": [
"src/karmaTest.ts",
"src/**/*.spec.ts"
]
}
3 changes: 0 additions & 3 deletions example/tsconfig.spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
"emitDecoratorMetadata": true,
"allowJs": true
},
"files": [
"src/karmaTest.ts"
],
"include": [
"src/**/*.spec.ts",
"src/**/*.d.ts"
Expand Down
Loading

0 comments on commit 20ba6fd

Please sign in to comment.