Skip to content

Commit 10d330c

Browse files
committed
Fix broken Code Climate publish job
Signed-off-by: Jeremy Ho <jujaga@gmail.com>
1 parent bdb3bec commit 10d330c

File tree

5 files changed

+22
-3
lines changed

5 files changed

+22
-3
lines changed

.github/CODEOWNERS

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# These users will be the default owners for everything in the repo.
22
# Unless a later match takes precedence, the following users will be
33
# requested for review when someone opens a pull request.
4-
* @jujaga @norrisng-bc @TimCsaky @jatindersingh93 @kyle1morel @wilwong89
4+
* @norrisng-bc @TimCsaky @jatindersingh93 @kyle1morel @wilwong89

.github/workflows/unit-tests.yaml

+3-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,9 @@ jobs:
137137

138138
test-coverage:
139139
name: Publish to Code Climate
140-
needs: test-frontend
140+
needs:
141+
- test-app
142+
- test-frontend
141143
if: needs.test-app.outputs.HAS_CC_SECRETS == 'true'
142144
runs-on: ubuntu-latest
143145
timeout-minutes: 10

app/lcov-fix.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ fs.readFile(file, 'utf8', (err, data) => {
88
if (err) {
99
return console.error(err); // eslint-disable-line no-console
1010
}
11-
const result = data.replace(/src/g, `${process.cwd()}/src`);
11+
const result = data.replace(/SF:/g, `SF:${process.cwd()}/`);
1212

1313
fs.writeFile(file, result, 'utf8', err => {
1414
if (err) return console.error(err); // eslint-disable-line no-console

frontend/lcov-fix.mjs

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Jest 25.x onwards emits coverage reports on a different source path
2+
// https://stackoverflow.com/q/60323177
3+
import fs from 'fs';
4+
import process from 'process';
5+
const file = './coverage/lcov.info';
6+
7+
fs.readFile(file, 'utf8', (err, data) => {
8+
if (err) {
9+
return console.error(err); // eslint-disable-line no-console
10+
}
11+
const result = data.replace(/SF:/g, `SF:${process.cwd()}/`);
12+
13+
fs.writeFile(file, result, 'utf8', err => {
14+
if (err) return console.error(err); // eslint-disable-line no-console
15+
});
16+
});

frontend/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"prebuild": "npm run lint",
1717
"prelint": "npm run typecheck",
1818
"pretest": "npm run lint",
19+
"posttest": "node ./lcov-fix.mjs",
1920
"purge": "rimraf node_modules",
2021
"rebuild": "npm run clean && npm run build",
2122
"reinstall": "npm run purge && npm install",

0 commit comments

Comments
 (0)