Skip to content

Commit 90a1b7b

Browse files
committed
added jest tests
1 parent 3c289c5 commit 90a1b7b

File tree

4 files changed

+25
-16
lines changed

4 files changed

+25
-16
lines changed

client/jest.config.js

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module.exports = {
2+
preset: 'jest-preset-angular',
3+
setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],
4+
testMatch: ['**/+(*.)+(spec).+(ts)?(x)'], // Matches .spec.ts files
5+
collectCoverage: true,
6+
coverageDirectory: 'coverage',
7+
moduleFileExtensions: ['ts', 'js', 'html'],
8+
};
9+

client/package.json

+6-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
"version": "1.0.0",
44
"scripts": {
55
"start": "ng serve -o --proxy-config proxy.conf.json",
6-
"build": "ng build --configuration production"
6+
"build": "ng build --configuration production",
7+
"test": "jest",
8+
"test:watch": "jest --watch"
79
},
810
"private": true,
911
"dependencies": {
@@ -37,11 +39,14 @@
3739
"@angular/cli": "~19.1.5",
3840
"@angular/compiler-cli": "^19.1.4",
3941
"@types/jasmine": "~4.3.0",
42+
"@types/jest": "^29.5.14",
4043
"@typescript-eslint/eslint-plugin": "^7.2.0",
4144
"@typescript-eslint/parser": "^7.2.0",
4245
"eslint": "^8.57.0",
4346
"eslint-config-prettier": "^8.5.0",
4447
"eslint-plugin-prettier": "^4.2.1",
48+
"jest": "^29.7.0",
49+
"jest-preset-angular": "^14.5.1",
4550
"prettier": "^2.7.1",
4651
"prettier-eslint-cli": "^7.1.0",
4752
"typescript": "~5.6.3"

client/setup-jest.ts

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
import 'jest-preset-angular/setup-jest';
3+

client/tsconfig.spec.json

+7-15
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,10 @@
11
/* To learn more about this file see: https://angular.io/config/tsconfig. */
22
{
3-
"extends": "./tsconfig.json",
4-
"compilerOptions": {
5-
"outDir": "./out-tsc/spec",
6-
"types": [
7-
"jasmine"
8-
]
9-
},
10-
"files": [
11-
"src/test.ts",
12-
"src/polyfills.ts"
13-
],
14-
"include": [
15-
"src/**/*.spec.ts",
16-
"src/**/*.d.ts"
17-
]
3+
"extends": "./tsconfig.json",
4+
"compilerOptions": {
5+
"outDir": "./out-tsc/spec",
6+
"types": ["jasmine"]
7+
},
8+
"files": ["setup-jest.ts", "src/polyfills.ts"],
9+
"include": ["src/**/*.spec.ts", "src/**/*.d.ts"]
1810
}

0 commit comments

Comments
 (0)