diff --git a/.gitignore b/.gitignore index 04b94a09..91869c6e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /.idea/ /smart-incident-reporting.iml /node_modules/ +coverage \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index eb86ccff..59b8607a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -14,6 +14,19 @@ services: networks: - default + ############################################################################################################## + # Redis commander on port 8081 + ############################################################################################################## + redis_commander: + image: rediscommander/redis-commander + ports: + - "8081:8081" + environment: + - REDIS_HOST=redis + deploy: + restart_policy: + condition: on-failure + volumes: redisdata: driver: local diff --git a/package.json b/package.json index 4d3644e1..2882e22e 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "watch:nodejs": "nodemon --delay 1000ms --signal SIGTERM -r dotenv/config index.js", "dev": "concurrently 'npm:watch:css' 'npm:watch:nodejs'", "lint": "standard", - "unit-test": "npx jest --verbose", + "unit-test": "jest --verbose", "test": "npm run unit-test", "prettier": "prettier-config-standard", "prepare": "husky install" @@ -94,5 +94,12 @@ "**/docs/**" ], "delay": 3000 + }, + "jest": { + "collectCoverage": true, + "coverageReporters": [ + "lcov", + "text" + ] } } diff --git a/sonar-project.properties b/sonar-project.properties index 6fd0e027..91c59dca 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -1,3 +1,25 @@ -sonar.javascript.exclusions=**/jest.config.js,**/__mocks__/**,**/node_modules/**,**/test/**,**/test-output/** -sonar.javascript.lcov.reportPaths=test-output/lcov.info -sonar.exclusions=/test/**,**/*.spec.js,*snyk_report.html,*snyk_report.css \ No newline at end of file +sonar.projectKey=DEFRA_smart-incident-reporting +sonar.organization=defra + +# This is the name and version displayed in the SonarCloud UI. +sonar.projectName=smart-incident-reporting +sonar.projectVersion=1.0 + +# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows. +sonar.sources=. + +# Encoding of the source code. Default is default system encoding +sonar.sourceEncoding=UTF-8 + +# Coverage stats location +sonar.javascript.lcov.reportPaths=coverage/lcov.info + +sonar.inclusions=**/src/**/*, **/azure-functions/**/*.js, **/azure-functions/**/*.mjs +sonar.exclusions=**/jest.config.js,**/__mocks__/**,**/node_modules/**,**/test/**,**/test-output/**,/test/**,**/*.spec.js,*snyk_report.html,*snyk_report.css +sonar.coverage.exclusions=**/test/**,**/__tests__/**, **/__mocks__/**, **/*.spec.*, **/*.test.*, **/test-env.js, **/jest.config.cjs, **/jest.config.js + +# Ensure sonar recognises BigInt as +sonar.javascript.globals=BigInt + +# Add code dupliciation exceptions +# sonar.cpd.exclusions=packages/eps/**/* \ No newline at end of file diff --git a/tests/samples/sample_illegal_fishing_incident.json b/test/samples/sample_illegal_fishing_incident.json similarity index 100% rename from tests/samples/sample_illegal_fishing_incident.json rename to test/samples/sample_illegal_fishing_incident.json diff --git a/tests/samples/sample_water_quality_incident.json b/test/samples/sample_water_quality_incident.json similarity index 100% rename from tests/samples/sample_water_quality_incident.json rename to test/samples/sample_water_quality_incident.json diff --git a/tests/unit/services/asb.send.spec.js b/test/unit/services/asb.send.spec.js similarity index 100% rename from tests/unit/services/asb.send.spec.js rename to test/unit/services/asb.send.spec.js diff --git a/tests/unit/services/cookie.service.spec.js b/test/unit/services/cookie.service.spec.js similarity index 100% rename from tests/unit/services/cookie.service.spec.js rename to test/unit/services/cookie.service.spec.js diff --git a/tests/unit/services/incidentLocation.spec.js b/test/unit/services/incidentLocation.spec.js similarity index 100% rename from tests/unit/services/incidentLocation.spec.js rename to test/unit/services/incidentLocation.spec.js diff --git a/tests/unit/services/redis.service.spec.js b/test/unit/services/redis.service.spec.js similarity index 100% rename from tests/unit/services/redis.service.spec.js rename to test/unit/services/redis.service.spec.js diff --git a/tests/unit/services/schema-validator.service.spec.js b/test/unit/services/schema-validator.service.spec.js similarity index 100% rename from tests/unit/services/schema-validator.service.spec.js rename to test/unit/services/schema-validator.service.spec.js diff --git a/tests/unit/utils/utils.spec.js b/test/unit/utils/utils.spec.js similarity index 100% rename from tests/unit/utils/utils.spec.js rename to test/unit/utils/utils.spec.js diff --git a/tests/unit/utils/validation.spec.js b/test/unit/utils/validation.spec.js similarity index 100% rename from tests/unit/utils/validation.spec.js rename to test/unit/utils/validation.spec.js