Skip to content

Commit

Permalink
Merge pull request #12 from santoshshinde2012/dev
Browse files Browse the repository at this point in the history
Added jest-to-sonar
  • Loading branch information
santoshshinde2012 authored May 14, 2024
2 parents b7f1340 + f58c1f5 commit 5131cf5
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 47 deletions.
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ module.exports = {
],
collectCoverage: true,
testEnvironment: 'node',
testResultsProcessor: "jest-sonar-reporter",
reporters: ['default', 'jest-to-sonar'],
setupFiles: ['dotenv/config'],
};
8 changes: 7 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"eslint-plugin-prettier": "^5.1.3",
"husky": "^9.0.11",
"jest": "^29.7.0",
"jest-sonar-reporter": "^2.0.0",
"jest-to-sonar": "^1.0.0",
"nodemon": "^3.1.0",
"prettier": "^3.2.5",
"supertest": "^7.0.0",
Expand Down
2 changes: 1 addition & 1 deletion sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ sonar.language=ts
sonar.tests=./tests

sonar.javascript.lcov.reportPaths=./coverage/lcov.info
sonar.testExecutionReportPaths=./test-report.xml
sonar.testExecutionReportPaths=./sonar-report.xml

# Encoding of the source code. Default is default system encoding
sonar.sourceEncoding=UTF-8
123 changes: 80 additions & 43 deletions test-report.xml → sonar-report.xml
Original file line number Diff line number Diff line change
@@ -1,52 +1,89 @@
<?xml version="1.0" encoding="UTF-8"?>
<testExecutions version="1">
<file path="/Users/santosh/Documents/workspace/github/node-ts-sequelize-pg-boilerplate/tests/unit-tests/components/system-status/SystemStatusController.spec.ts">
<testCase name="System Status Controller test getError method" duration="2"/>
<testCase name="System Status Controller test getSystemInfo method" duration="3"/>
<testCase name="System Status Controller test getServerTime method" duration="0"/>
<testCase name="System Status Controller test getResourceUsage method" duration="0"/>
<testCase name="System Status Controller test getProcessInfo method" duration="0"/>
<file path="/tests/unit-tests/lib/logger.spec.ts">
<testCase name="Logger Lib should create a new log directory if one doesn't already exist" duration="0.01">
</testCase>
</file>
<file path="/Users/santosh/Documents/workspace/github/node-ts-sequelize-pg-boilerplate/tests/unit-tests/lib/logger.spec.ts">
<testCase name="Logger Lib should create a new log directory if one doesn&apos;t already exist" duration="8"/>
<file path="/tests/unit-tests/components/system-status/SystemStatusController.spec.ts">
<testCase name="System Status Controller test getError method" duration="0.002">
</testCase>
<testCase name="System Status Controller test getSystemInfo method" duration="0.007">
</testCase>
<testCase name="System Status Controller test getServerTime method" duration="0.003">
</testCase>
<testCase name="System Status Controller test getResourceUsage method" duration="0.002">
</testCase>
<testCase name="System Status Controller test getProcessInfo method" duration="0.001">
</testCase>
</file>
<file path="/Users/santosh/Documents/workspace/github/node-ts-sequelize-pg-boilerplate/tests/unit-tests/middleware/error-handler.spec.ts">
<testCase name="ErrorHandler middleware with 0 status code" duration="4"/>
<testCase name="ErrorHandler middleware with 200 status code" duration="0"/>
<testCase name="ErrorHandler middleware with 200 status code" duration="1"/>
<testCase name="ErrorHandler middleware with 200 status code and updated env variables" duration="0"/>
<file path="/tests/unit-tests/middleware/error-handler.spec.ts">
<testCase name="ErrorHandler middleware with 0 status code" duration="0.021">
</testCase>
<testCase name="ErrorHandler middleware with 200 status code" duration="0.002">
</testCase>
<testCase name="ErrorHandler middleware with 200 status code" duration="0.006">
</testCase>
<testCase name="ErrorHandler middleware with 200 status code and updated env variables" duration="0.001">
</testCase>
</file>
<file path="/Users/santosh/Documents/workspace/github/node-ts-sequelize-pg-boilerplate/tests/unit-tests/components/enquiry/EnquiryController.spec.ts">
<testCase name="Enquiry Controller should defined routes and return array of route definition" duration="3"/>
<testCase name="Enquiry Controller should get all enquiries" duration="0"/>
<testCase name="Enquiry Controller should handle errors to get all enquiries" duration="0"/>
<testCase name="Enquiry Controller should get details of a specific enquiry" duration="1"/>
<testCase name="Enquiry Controller should handle errors to get all enquiries" duration="0"/>
<testCase name="Enquiry Controller should create enquiry" duration="1"/>
<testCase name="Enquiry Controller should throw BAD_REQUEST error if name and country are not provided" duration="0"/>
<testCase name="Enquiry Controller should handle errors in create enquiry" duration="0"/>
<testCase name="Enquiry Controller should update enquiry" duration="0"/>
<testCase name="Enquiry Controller should handle errors in update enquiry" duration="0"/>
<testCase name="Enquiry Controller should delete enquiry" duration="0"/>
<testCase name="Enquiry Controller should handle errors in delete enquiry" duration="0"/>
<file path="/tests/unit-tests/components/enquiry/EnquiryController.spec.ts">
<testCase name="Enquiry Controller should defined routes and return array of route definition" duration="0.002">
</testCase>
<testCase name="Enquiry Controller should get all enquiries" duration="0.001">
</testCase>
<testCase name="Enquiry Controller should handle errors to get all enquiries" duration="0">
</testCase>
<testCase name="Enquiry Controller should get details of a specific enquiry" duration="0">
</testCase>
<testCase name="Enquiry Controller should handle errors to get all enquiries" duration="0.001">
</testCase>
<testCase name="Enquiry Controller should create enquiry" duration="0">
</testCase>
<testCase name="Enquiry Controller should throw BAD_REQUEST error if name and country are not provided" duration="0">
</testCase>
<testCase name="Enquiry Controller should handle errors in create enquiry" duration="0.001">
</testCase>
<testCase name="Enquiry Controller should update enquiry" duration="0">
</testCase>
<testCase name="Enquiry Controller should handle errors in update enquiry" duration="0">
</testCase>
<testCase name="Enquiry Controller should delete enquiry" duration="0.001">
</testCase>
<testCase name="Enquiry Controller should handle errors in delete enquiry" duration="0">
</testCase>
</file>
<file path="/Users/santosh/Documents/workspace/github/node-ts-sequelize-pg-boilerplate/tests/unit-tests/components/enquiry/EnquiryService.spec.ts">
<testCase name="EnquiryService should return all enquiries" duration="4"/>
<testCase name="EnquiryService should throw error if failed to fetch enquiries" duration="7"/>
<testCase name="EnquiryService should return particular enquiry by id" duration="0"/>
<testCase name="EnquiryService should throw error if failed to fetch empty enquiry by id" duration="3"/>
<testCase name="EnquiryService should throw error if failed to fetch enquiry by id" duration="0"/>
<testCase name="EnquiryService should update enquiry with valid input" duration="1"/>
<testCase name="EnquiryService should throw an error if it fails to update as it failed to find the enquiry by id" duration="0"/>
<testCase name="EnquiryService should throw an error if it fails to update" duration="1"/>
<testCase name="EnquiryService should create a new enquiry with valid input" duration="0"/>
<testCase name="EnquiryService should throw error if failed to create enquiry" duration="0"/>
<testCase name="EnquiryService should return true if enquiry is deleted successfully" duration="1"/>
<testCase name="EnquiryService should return false if no enquiry is deleted" duration="0"/>
<testCase name="EnquiryService should throw error if failed to delete enquiry" duration="0"/>
<file path="/tests/unit-tests/components/enquiry/EnquiryService.spec.ts">
<testCase name="EnquiryService should return all enquiries" duration="0.004">
</testCase>
<testCase name="EnquiryService should throw error if failed to fetch enquiries" duration="0.005">
</testCase>
<testCase name="EnquiryService should return particular enquiry by id" duration="0">
</testCase>
<testCase name="EnquiryService should throw error if failed to fetch empty enquiry by id" duration="0.001">
</testCase>
<testCase name="EnquiryService should throw error if failed to fetch enquiry by id" duration="0.001">
</testCase>
<testCase name="EnquiryService should update enquiry with valid input" duration="0">
</testCase>
<testCase name="EnquiryService should throw an error if it fails to update as it failed to find the enquiry by id" duration="0">
</testCase>
<testCase name="EnquiryService should throw an error if it fails to update" duration="0.001">
</testCase>
<testCase name="EnquiryService should create a new enquiry with valid input" duration="0">
</testCase>
<testCase name="EnquiryService should throw error if failed to create enquiry" duration="0">
</testCase>
<testCase name="EnquiryService should return true if enquiry is deleted successfully" duration="0.001">
</testCase>
<testCase name="EnquiryService should return false if no enquiry is deleted" duration="0.003">
</testCase>
<testCase name="EnquiryService should throw error if failed to delete enquiry" duration="0.001">
</testCase>
</file>
<file path="/Users/santosh/Documents/workspace/github/node-ts-sequelize-pg-boilerplate/tests/integration-tests/app.integration.spec.ts">
<testCase name="status integration tests can get default route success" duration="12"/>
<testCase name="status integration tests can get default web route success" duration="4"/>
<file path="/tests/integration-tests/app.integration.spec.ts">
<testCase name="status integration tests can get default route success" duration="0.012">
</testCase>
<testCase name="status integration tests can get default web route success" duration="0.002">
</testCase>
</file>
</testExecutions>

0 comments on commit 5131cf5

Please sign in to comment.