diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 14d08e38..43e120c2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,6 +3,7 @@ on: push: branches: - main + - teste/sonar pull_request: types: [opened, synchronize, reopened] jobs: @@ -25,3 +26,12 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + + - name: Sincroniza cobertura de testes com o Codecov + uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + fail_ci_if_error: true + flags: jest + name: 2023-2-GEROcuidado-Front + verbose: true diff --git a/package.json b/package.json index 2ce765c2..c921521b 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,9 @@ "android": "expo start --android", "ios": "expo start --ios", "web": "expo start --web", - "test": "jest --detectOpenHandles --colors --coverage", + "test": "jest --passWithNoTests --no-cache --runInBand --detectOpenHandles --coverage --colors", + "test:all": "CI=true npm run test -- --coverage", + "lint": "eslint . --fix" }, "dependencies": { @@ -26,6 +28,10 @@ "expo-updates": "~0.18.17", "jest": "^29.2.1", "jest-expo": "^49.0.0", + "jest-sonar": "^0.2.16", + "jest-mock-extended": "^3.0.5", + "jest-sonar-reporter": "^2.0.0", + "ts-jest": "^29.1.1", "react": "18.2.0", "react-dom": "18.2.0", "react-native": "0.72.6", @@ -46,6 +52,7 @@ "@types/react-native-vector-icons": "^6.4.16", "eslint": "^8.52.0", "eslint-config-universe": "^12.0.0", + "jest-sonar-reporter": "^2.0.0", "prettier": "^3.0.3", "typescript": "^5.1.3" }, @@ -67,6 +74,17 @@ "!**/babel.config.js", "!**/jest.setup.js", "!**/__tests__/**" + ], + "reporters": [ + "default", + [ + "jest-sonar", + { + "outputDirectory": "reports", + "outputName": "sonar-report.xml", + "sonarQubeVersion": "LATEST" + } + ] ] } -} \ No newline at end of file +} diff --git a/reports/sonar-report.xml b/reports/sonar-report.xml new file mode 100644 index 00000000..67262e2e --- /dev/null +++ b/reports/sonar-report.xml @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file