From 89cd9f0418098846e78b8478319560c527211b31 Mon Sep 17 00:00:00 2001 From: Alexandr Yepishev Date: Wed, 18 Oct 2023 16:30:50 +0100 Subject: [PATCH 1/2] Add Sonar duplication exclussions --- jest.config.js | 2 +- package.json | 2 +- sonar-project.properties | 2 ++ test/integration/integration.test.ts | 2 ++ 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/jest.config.js b/jest.config.js index 9839ee8..45e074f 100644 --- a/jest.config.js +++ b/jest.config.js @@ -6,7 +6,7 @@ module.exports = { testTimeout: 5 * 60 * 1000, coverageReporters: ['html', 'lcov'], - collectCoverageFrom: ['src/**/*.ts', '!src/test/*.ts', '!src/simulateScript/deno-sandbox/*.ts'], + collectCoverageFrom: ['src/**/*.ts', '!src/simulateScript/deno-sandbox/*.ts'], coverageThreshold: { global: { branches: 95, diff --git a/package.json b/package.json index c4f5c96..4db5414 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "build": "rimraf dist && tsc -P tsconfig.build.json && cpy src/simulateScript/deno-sandbox/**/* dist/simulateScript/deno-sandbox", "build:browser": "webpack && browserify dist/simulateScript.bundle.js -o dist/simulateScript.browser.js -p esmify --standalone simulateScript && rm dist/simulateScript.bundle.js", "test": "jest", - "test:ci": "jest --silent --coverage --ci", + "test:ci": "jest --silent --ci --coverage", "test:package": "jest --config jest.config.package.js", "lint:check": "eslint '{src,test}/**/*.ts'", "lint:fix": "eslint '{src,test}/**/*.ts' --fix", diff --git a/sonar-project.properties b/sonar-project.properties index 1088fa4..1f5ede3 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -5,6 +5,8 @@ sonar.sources=. sonar.exclusions=**/node_modules/**/*, **/mocks/**/*, **/testdata/**/*, **/demo/**/*, **/contracts/**/*, **/generated/**/*, **/fixtures/**/*, **/docs/**/*, **/tools/**/*, **/*.fixtures.ts, **/apiFixture.ts, **/*report.xml, **/*.config.ts, **/*.config.js, **/*.config.package.js, **/*.txt, **/*.abi, **/*.bin # Coverage exclusions sonar.coverage.exclusions=**/*.test.ts, **/test/**/*, **/src/simulateScript/deno-sandbox/**/*, **/index.ts +# Duplications exclusions +sonar.cpd.exclusions=**/src/v1_contract_sources/**/* # Tests' root folder, inclusions (tests to check and count) and exclusions sonar.tests=. diff --git a/test/integration/integration.test.ts b/test/integration/integration.test.ts index 10f08ae..d395994 100644 --- a/test/integration/integration.test.ts +++ b/test/integration/integration.test.ts @@ -11,6 +11,8 @@ import { setupLocalTestnetFixture } from '../utils' import { BigNumber, Contract, Wallet, utils } from 'ethers' +jest.retryTimes(2, { logErrorsBeforeRetry: true }) + describe('Functions toolkit classes', () => { let donId = simulatedDonId let linkTokenContract: Contract From 373510a6e28f22c08ff53171dc010424affc95ca Mon Sep 17 00:00:00 2001 From: Alexandr Yepishev Date: Wed, 18 Oct 2023 17:50:01 +0100 Subject: [PATCH 2/2] Fix Sonar workflow to download test report from the corresponding workflow --- .github/workflows/sonar-scan.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sonar-scan.yaml b/.github/workflows/sonar-scan.yaml index 398dfb3..edc8ab2 100644 --- a/.github/workflows/sonar-scan.yaml +++ b/.github/workflows/sonar-scan.yaml @@ -50,7 +50,7 @@ jobs: - name: Download tests report uses: dawidd6/action-download-artifact@v2.28.0 with: - workflow: unit-test.yaml + workflow: test.yaml workflow_conclusion: '' name: unit-tests-coverage if_no_artifact_found: warn