Adding jest unit testing framework and required sonar config
This commit is contained in:
parent
a9ad5e8f87
commit
137428ffa7
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -8,3 +8,5 @@ dist/
|
|||
logs/
|
||||
node_modules/
|
||||
public/
|
||||
coverage/
|
||||
testResults/
|
||||
|
|
5
jest.config.js
Normal file
5
jest.config.js
Normal file
|
@ -0,0 +1,5 @@
|
|||
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
|
||||
module.exports = {
|
||||
preset: 'ts-jest',
|
||||
testEnvironment: 'node',
|
||||
};
|
8951
package-lock.json
generated
8951
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
12
package.json
12
package.json
|
@ -7,7 +7,7 @@
|
|||
"start": "tsc && node ./dist/app.js",
|
||||
"build": "tsc",
|
||||
"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": [],
|
||||
"author": "",
|
||||
|
@ -32,12 +32,22 @@
|
|||
"@types/bcrypt": "^3.0.1",
|
||||
"@types/debug": "^4.1.5",
|
||||
"@types/express": "^4.17.11",
|
||||
"@types/jest": "^28.1.3",
|
||||
"@types/random-words": "^1.1.2",
|
||||
"@types/swagger-jsdoc": "^6.0.1",
|
||||
"@types/swagger-ui-express": "^4.1.3",
|
||||
"@types/winston": "^2.4.4",
|
||||
"jest": "^28.1.1",
|
||||
"jest-sonar-reporter": "^2.0.0",
|
||||
"source-map-support": "^0.5.19",
|
||||
"ts-jest": "^28.0.5",
|
||||
"tslint": "^6.1.3",
|
||||
"typescript": "^4.1.5"
|
||||
},
|
||||
"jestSonar": {
|
||||
"sonar56x": true,
|
||||
"reportPath": "testResults",
|
||||
"reportFile": "sonar-report.xml",
|
||||
"indent": 4
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1 +1,6 @@
|
|||
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
test/template.test.ts
Normal file
3
test/template.test.ts
Normal file
|
@ -0,0 +1,3 @@
|
|||
test('Test template', async () => {
|
||||
expect(true).toBe(true);
|
||||
});
|
Loading…
Reference in New Issue
Block a user