Skip to content

Commit 6dc9241

Browse files
anisometropiealexandredamiron
authored andcommitted
front: test coverage (#2493)
* 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
1 parent 6f0fd88 commit 6dc9241

File tree

3 files changed

+31
-4
lines changed

3 files changed

+31
-4
lines changed

.github/workflows/front.yml

+23-3
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,28 @@ jobs:
2121
node-version: 16
2222
cache: "yarn"
2323
cache-dependency-path: front/yarn.lock
24-
- run: yarn --cwd front install
25-
- run: yarn --cwd front build
24+
25+
- name: install dependencies
26+
run: yarn --cwd front install
27+
28+
- name: run front test suite
29+
run: yarn --cwd front test-coverage
30+
31+
- name: Upload coverage to Codecov
32+
uses: codecov/codecov-action@v3
33+
with:
34+
# github runs PR workflows on the result of a merge commit.
35+
# tell codecov the sha of the unmerged PR https://github.com/codecov/uploader/issues/525
36+
override_commit: "${{ github.event.pull_request.head.sha }}"
37+
name: codecov
38+
flags: front
39+
directory: ./front/test
40+
files: cobertura-coverage.xml
41+
token: ${{ secrets.CODECOV_TOKEN }}
42+
fail_ci_if_error: true
43+
verbose: true
44+
45+
- name: build project
46+
run: yarn --cwd front build
2647
env:
2748
CI: false
28-
- run: yarn --cwd front --passWithNoTests test

front/package.json

+7
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@
123123
"start": "react-scripts start",
124124
"build": "react-scripts --max_old_space_size=4096 build",
125125
"test": "react-scripts test",
126+
"test-coverage": "react-scripts test --watchAll=false --coverage --coverageDirectory=test",
126127
"eject": "react-scripts eject",
127128
"lint-ts": "eslint --ext .ts,.tsx src",
128129
"generate-types": "npx @rtk-query/codegen-openapi src/config/openapi-chartos-config.ts && npx @rtk-query/codegen-openapi src/config/openapi-middleware-config.ts && npx @rtk-query/codegen-openapi src/config/openapi-editoast-config.ts",
@@ -152,5 +153,11 @@
152153
}
153154
}
154155
]
156+
},
157+
"jest": {
158+
"coverageReporters": [
159+
"text",
160+
"cobertura"
161+
]
155162
}
156163
}

front/src/applications/editor/components/LinearMetadata/data.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ function checkWrapperValidity<T = any>(
8989
if (newLine)
9090
assert.equal(
9191
Math.round(last(result)?.end || 0),
92-
Math.round(getLineStringDistance(newLine) * 1000),
92+
Math.round(getLineStringDistance(newLine)),
9393
message
9494
);
9595
// Checking the continuity

0 commit comments

Comments
 (0)