diff --git a/jest.config.js b/jest.config.js new file mode 100644 index 0000000..14b1042 --- /dev/null +++ b/jest.config.js @@ -0,0 +1,24 @@ +module.exports = { + moduleFileExtensions: [ + "js", + "json", + "ts" + ], + rootDir: ".", + testRegex: ".*\\.spec\\.ts$", + transform: { + "^.+\\.(t|j)s$": "ts-jest" + }, + collectCoverageFrom: [ + "**/*.(t|j)s" + ], + coverageDirectory: "./coverage", + testEnvironment: "node", + roots: [ + "/src/", + "/libs/" + ], + moduleNameMapper: { + "^@app/common(|/.*)$": "/libs/common/src/$1" + } +}; diff --git a/libs/common/dummy.spec.ts b/libs/common/dummy.spec.ts new file mode 100644 index 0000000..70a64c3 --- /dev/null +++ b/libs/common/dummy.spec.ts @@ -0,0 +1,5 @@ +describe('Dummy Test', () => { + it('should pass', () => { + expect(true).toBe(true); + }); +}); diff --git a/package.json b/package.json index 0136b92..52c5cf7 100644 --- a/package.json +++ b/package.json @@ -13,9 +13,9 @@ "start:debug": "npx nest start --debug --watch", "start:prod": "node dist/main", "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix", - "test": "jest", - "test:watch": "jest --watch", - "test:cov": "jest --coverage", + "test": "jest --config jest.config.js", + "test:watch": "jest --watch --config jest.config.js", + "test:cov": "jest --coverage --config jest.config.js", "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand", "test:e2e": "jest --config ./apps/backend/test/jest-e2e.json" }, @@ -72,29 +72,5 @@ "ts-node": "^10.9.1", "tsconfig-paths": "^4.2.0", "typescript": "^5.1.3" - }, - "jest": { - "moduleFileExtensions": [ - "js", - "json", - "ts" - ], - "rootDir": ".", - "testRegex": ".*\\.spec\\.ts$", - "transform": { - "^.+\\.(t|j)s$": "ts-jest" - }, - "collectCoverageFrom": [ - "**/*.(t|j)s" - ], - "coverageDirectory": "./coverage", - "testEnvironment": "node", - "roots": [ - "/apps/", - "/libs/" - ], - "moduleNameMapper": { - "^@app/common(|/.*)$": "/libs/common/src/$1" - } } } diff --git a/src/dummy.spec.ts b/src/dummy.spec.ts new file mode 100644 index 0000000..70a64c3 --- /dev/null +++ b/src/dummy.spec.ts @@ -0,0 +1,5 @@ +describe('Dummy Test', () => { + it('should pass', () => { + expect(true).toBe(true); + }); +});