feat: setup Jest backend — config + deps + scripts test/watch/cov

This commit is contained in:
2026-04-05 07:25:46 +02:00
parent 108f021bd8
commit 2504c3756d
3 changed files with 3503 additions and 1 deletions

15
backend/jest.config.ts Normal file
View File

@@ -0,0 +1,15 @@
import type { Config } from 'jest';
const config: Config = {
moduleFileExtensions: ['js', 'json', 'ts'],
rootDir: 'src',
testRegex: '.*\\.spec\\.ts$',
transform: {
'^.+\\.(t|j)s$': 'ts-jest',
},
collectCoverageFrom: ['**/*.(t|j)s'],
coverageDirectory: '../coverage',
testEnvironment: 'node',
};
export default config;

3480
backend/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -11,7 +11,10 @@
"typeorm": "ts-node -r tsconfig-paths/register ./node_modules/typeorm/cli.js",
"migration:generate": "npm run typeorm -- migration:generate src/migrations/$npm_config_name -d src/config/data-source.ts",
"migration:run": "npm run typeorm -- migration:run -d src/config/data-source.ts",
"migration:revert": "npm run typeorm -- migration:revert -d src/config/data-source.ts"
"migration:revert": "npm run typeorm -- migration:revert -d src/config/data-source.ts",
"test": "jest",
"test:watch": "jest --watch",
"test:cov": "jest --coverage"
},
"dependencies": {
"@nestjs/common": "^11.1.17",
@@ -30,9 +33,13 @@
"devDependencies": {
"@nestjs/cli": "^11.0.16",
"@nestjs/schematics": "^11.0.9",
"@nestjs/testing": "^11.1.18",
"@types/cookie-parser": "^1.4.10",
"@types/express": "^5.0.6",
"@types/jest": "^30.0.0",
"@types/node": "^25.5.0",
"jest": "^30.3.0",
"ts-jest": "^29.4.9",
"ts-node": "^10.9.2",
"tsconfig-paths": "^4.2.0",
"typescript": "^6.0.2"