Skip to content

Commit

Permalink
Fix broken Code Climate publish job
Browse files Browse the repository at this point in the history
Signed-off-by: Jeremy Ho <jujaga@gmail.com>
  • Loading branch information
jujaga committed Mar 18, 2024
1 parent bdb3bec commit 10d330c
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# These users will be the default owners for everything in the repo.
# Unless a later match takes precedence, the following users will be
# requested for review when someone opens a pull request.
* @jujaga @norrisng-bc @TimCsaky @jatindersingh93 @kyle1morel @wilwong89
* @norrisng-bc @TimCsaky @jatindersingh93 @kyle1morel @wilwong89
4 changes: 3 additions & 1 deletion .github/workflows/unit-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,9 @@ jobs:

test-coverage:
name: Publish to Code Climate
needs: test-frontend
needs:
- test-app
- test-frontend
if: needs.test-app.outputs.HAS_CC_SECRETS == 'true'
runs-on: ubuntu-latest
timeout-minutes: 10
Expand Down
2 changes: 1 addition & 1 deletion app/lcov-fix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ fs.readFile(file, 'utf8', (err, data) => {
if (err) {
return console.error(err); // eslint-disable-line no-console
}
const result = data.replace(/src/g, `${process.cwd()}/src`);
const result = data.replace(/SF:/g, `SF:${process.cwd()}/`);

fs.writeFile(file, result, 'utf8', err => {
if (err) return console.error(err); // eslint-disable-line no-console
Expand Down
16 changes: 16 additions & 0 deletions frontend/lcov-fix.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Jest 25.x onwards emits coverage reports on a different source path
// https://stackoverflow.com/q/60323177
import fs from 'fs';
import process from 'process';
const file = './coverage/lcov.info';

fs.readFile(file, 'utf8', (err, data) => {
if (err) {
return console.error(err); // eslint-disable-line no-console
}
const result = data.replace(/SF:/g, `SF:${process.cwd()}/`);

fs.writeFile(file, result, 'utf8', err => {
if (err) return console.error(err); // eslint-disable-line no-console
});
});
1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"prebuild": "npm run lint",
"prelint": "npm run typecheck",
"pretest": "npm run lint",
"posttest": "node ./lcov-fix.mjs",
"purge": "rimraf node_modules",
"rebuild": "npm run clean && npm run build",
"reinstall": "npm run purge && npm install",
Expand Down

0 comments on commit 10d330c

Please sign in to comment.