Add Jest configuration and dummy test

This commit is contained in:
faris Aljohari
2024-07-08 15:28:04 +03:00
parent d094536fad
commit 2b8ba755b1
4 changed files with 37 additions and 27 deletions

24
jest.config.js Normal file
View File

@ -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: [
"<rootDir>/src/",
"<rootDir>/libs/"
],
moduleNameMapper: {
"^@app/common(|/.*)$": "<rootDir>/libs/common/src/$1"
}
};

View File

@ -0,0 +1,5 @@
describe('Dummy Test', () => {
it('should pass', () => {
expect(true).toBe(true);
});
});

View File

@ -13,9 +13,9 @@
"start:debug": "npx nest start --debug --watch", "start:debug": "npx nest start --debug --watch",
"start:prod": "node dist/main", "start:prod": "node dist/main",
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix", "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
"test": "jest", "test": "jest --config jest.config.js",
"test:watch": "jest --watch", "test:watch": "jest --watch --config jest.config.js",
"test:cov": "jest --coverage", "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: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" "test:e2e": "jest --config ./apps/backend/test/jest-e2e.json"
}, },
@ -72,29 +72,5 @@
"ts-node": "^10.9.1", "ts-node": "^10.9.1",
"tsconfig-paths": "^4.2.0", "tsconfig-paths": "^4.2.0",
"typescript": "^5.1.3" "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": [
"<rootDir>/apps/",
"<rootDir>/libs/"
],
"moduleNameMapper": {
"^@app/common(|/.*)$": "<rootDir>/libs/common/src/$1"
}
} }
} }

5
src/dummy.spec.ts Normal file
View File

@ -0,0 +1,5 @@
describe('Dummy Test', () => {
it('should pass', () => {
expect(true).toBe(true);
});
});