Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Travis CI build, switch to Jest #122

Merged
merged 1 commit into from
Feb 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ before_script:

script:
- npm run lint
- npm run test
- npm run build
- npm run test
12 changes: 12 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = {
preset: 'jest-preset-angular',
setupFilesAfterEnv: ['./projects/mobx-angular/setup-tests.ts'],
globals: {
'ts-jest': {
tsConfig: './projects/mobx-angular/tsconfig.spec.json',
diagnostics: false
}
},
testRegex: '/.*\\.spec\\.ts$',
moduleFileExtensions: ['ts', 'js', 'node']
};
4,521 changes: 4,017 additions & 504 deletions package-lock.json

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"test": "jest",
"lint": "ng lint",
"e2e": "ng e2e"
},
Expand All @@ -21,6 +21,9 @@
"@angular/platform-browser": "~9.0.0",
"@angular/platform-browser-dynamic": "~9.0.0",
"@angular/router": "~9.0.0",
"@types/jest": "^25.1.3",
"jest": "^24.9.0",
"jest-preset-angular": "^8.0.0",
"mobx-remotedev": "^0.3.6",
"rxjs": "~6.5.4",
"todomvc-app-css": "^2.3.0",
Expand Down
3 changes: 3 additions & 0 deletions projects/bank/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "./tsconfig.app.json"
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file fixes an issue with lint tool:

> [email protected] lint /var/www/mobx-angular
> ng lint

Linting "mobx-angular"...
All files pass linting.
Linting "todo"...
An unhandled exception occurred: error TS5012: Cannot read file '/var/www/mobx-angular/projects/todo/tsconfig.json': ENOENT: no such file or directory, open '/var/www/mobx-angular/projects/todo/tsconfig.json'.

See "/tmp/ng-PC9hRB/angular-errors.log" for further details.

1 change: 1 addition & 0 deletions projects/mobx-angular/setup-tests.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import 'jest-preset-angular';
1 change: 1 addition & 0 deletions projects/mobx-angular/tsconfig.spec.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"emitDecoratorMetadata": true,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It fixes this issue: thymikee/jest-preset-angular#288

"outDir": "../../out-tsc/spec",
"types": ["jasmine", "node"]
},
Expand Down
3 changes: 3 additions & 0 deletions projects/tictactoe/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "./tsconfig.app.json"
}
3 changes: 3 additions & 0 deletions projects/todo/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "./tsconfig.app.json"
}