diff --git a/.github/workflows/front.yml b/.github/workflows/front.yml index dae2463934f..03b1fa5b74c 100644 --- a/.github/workflows/front.yml +++ b/.github/workflows/front.yml @@ -21,8 +21,28 @@ jobs: node-version: 16 cache: "yarn" cache-dependency-path: front/yarn.lock - - run: yarn --cwd front install - - run: yarn --cwd front build + + - name: install dependencies + run: yarn --cwd front install + + - name: run front test suite + run: yarn --cwd front test-coverage + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v3 + with: + # github runs PR workflows on the result of a merge commit. + # tell codecov the sha of the unmerged PR https://github.com/codecov/uploader/issues/525 + override_commit: "${{ github.event.pull_request.head.sha }}" + name: codecov + flags: front + directory: ./front/test + files: cobertura-coverage.xml + token: ${{ secrets.CODECOV_TOKEN }} + fail_ci_if_error: true + verbose: true + + - name: build project + run: yarn --cwd front build env: CI: false - - run: yarn --cwd front --passWithNoTests test diff --git a/front/package.json b/front/package.json index 33a2dd575a6..9a40e8f095b 100644 --- a/front/package.json +++ b/front/package.json @@ -122,6 +122,7 @@ "start": "react-scripts start", "build": "react-scripts --max_old_space_size=4096 build", "test": "react-scripts test", + "test-coverage": "react-scripts test --watchAll=false --coverage --coverageDirectory=test", "eject": "react-scripts eject", "lint-ts": "eslint --ext .ts,.tsx src", "generate-types": "npx @rtk-query/codegen-openapi src/common/api/openapi-config.js", @@ -151,5 +152,11 @@ } } ] + }, + "jest": { + "coverageReporters": [ + "text", + "cobertura" + ] } } diff --git a/front/src/applications/editor/components/LinearMetadata/data.test.ts b/front/src/applications/editor/components/LinearMetadata/data.test.ts index 0d8a8ab35f0..574d118c02e 100644 --- a/front/src/applications/editor/components/LinearMetadata/data.test.ts +++ b/front/src/applications/editor/components/LinearMetadata/data.test.ts @@ -89,7 +89,7 @@ function checkWrapperValidity( if (newLine) assert.equal( Math.round(last(result)?.end || 0), - Math.round(getLineStringDistance(newLine) * 1000), + Math.round(getLineStringDistance(newLine)), message ); // Checking the continuity