Adding jest unit testing framework and required sonar config

This commit is contained in:
2022-06-25 12:21:48 +02:00
parent a9ad5e8f87
commit 137428ffa7
6 changed files with 8900 additions and 78 deletions
+2
View File
@@ -8,3 +8,5 @@ dist/
logs/ logs/
node_modules/ node_modules/
public/ public/
coverage/
testResults/
+5
View File
@@ -0,0 +1,5 @@
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
};
+8874 -77
View File
File diff suppressed because it is too large Load Diff
+11 -1
View File
@@ -7,7 +7,7 @@
"start": "tsc && node ./dist/app.js", "start": "tsc && node ./dist/app.js",
"build": "tsc", "build": "tsc",
"debug": "export DEBUG=* && npm run start", "debug": "export DEBUG=* && npm run start",
"test": "echo \"Error: no test specified\" && exit 1" "test": "jest --coverage --testResultsProcessor ./node_modules/jest-sonar-reporter/index.js"
}, },
"keywords": [], "keywords": [],
"author": "", "author": "",
@@ -32,12 +32,22 @@
"@types/bcrypt": "^3.0.1", "@types/bcrypt": "^3.0.1",
"@types/debug": "^4.1.5", "@types/debug": "^4.1.5",
"@types/express": "^4.17.11", "@types/express": "^4.17.11",
"@types/jest": "^28.1.3",
"@types/random-words": "^1.1.2", "@types/random-words": "^1.1.2",
"@types/swagger-jsdoc": "^6.0.1", "@types/swagger-jsdoc": "^6.0.1",
"@types/swagger-ui-express": "^4.1.3", "@types/swagger-ui-express": "^4.1.3",
"@types/winston": "^2.4.4", "@types/winston": "^2.4.4",
"jest": "^28.1.1",
"jest-sonar-reporter": "^2.0.0",
"source-map-support": "^0.5.19", "source-map-support": "^0.5.19",
"ts-jest": "^28.0.5",
"tslint": "^6.1.3", "tslint": "^6.1.3",
"typescript": "^4.1.5" "typescript": "^4.1.5"
},
"jestSonar": {
"sonar56x": true,
"reportPath": "testResults",
"reportFile": "sonar-report.xml",
"indent": 4
} }
} }
+5
View File
@@ -1 +1,6 @@
sonar.projectKey=pd-api sonar.projectKey=pd-api
sonar.sources=src
sonar.tests=test
sonar.language=ts
sonar.javascript.lcov.reportPaths=coverage/lcov.info
sonar.testExecutionReportPaths=testResults/sonar-report.xml
+3
View File
@@ -0,0 +1,3 @@
test('Test template', async () => {
expect(true).toBe(true);
});