Skip to content

Commit

Permalink
front: test coverage (#2493)
Browse files Browse the repository at this point in the history
* test scripts

* front unit test pipeline

* remove CI variable

* install before tests

* fix test

* add ci false back

* code cov

* fix codeco

* fix codecov flag

* remove wachAll

* cobertura report

* uncommit coverage file
  • Loading branch information
anisometropie committed Dec 6, 2022
1 parent 6e7dc21 commit 003e01e
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 4 deletions.
26 changes: 23 additions & 3 deletions .github/workflows/front.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
7 changes: 7 additions & 0 deletions front/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -151,5 +152,11 @@
}
}
]
},
"jest": {
"coverageReporters": [
"text",
"cobertura"
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ function checkWrapperValidity<T = any>(
if (newLine)
assert.equal(
Math.round(last(result)?.end || 0),
Math.round(getLineStringDistance(newLine) * 1000),
Math.round(getLineStringDistance(newLine)),
message
);
// Checking the continuity
Expand Down

0 comments on commit 003e01e

Please sign in to comment.