Skip to content

Commit 29a77ab

Browse files
committed
ci: implement DeepSource test coverage tracking
1 parent 973a5eb commit 29a77ab

File tree

3 files changed

+18
-5
lines changed

3 files changed

+18
-5
lines changed

.deepsource.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,7 @@ name = "javascript"
77
environment = [
88
"nodejs",
99
"mocha"
10-
]
10+
]
11+
12+
[[analyzers]]
13+
name = "test-coverage"

.github/workflows/node.js.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,22 @@ jobs:
2121
steps:
2222
- name: Install dependancies
2323
run: sudo apt-get update && sudo apt-get install libavahi-compat-libdnssd-dev python3-guessit
24-
- uses: actions/checkout@v2
24+
- uses: actions/checkout@v3
25+
with:
26+
ref: ${{ github.event.pull_request.head.sha }}
2527
- name: Checkout submodules
2628
run: git submodule update --init --recursive
2729
- name: Use Node.js ${{ matrix.node-version }}
28-
uses: actions/setup-node@v1
30+
uses: actions/setup-node@v3
2931
with:
3032
node-version: ${{ matrix.node-version }}
3133
- run: npm ci
32-
- run: npm test
34+
- run: npm run test:coverage
35+
- name: Report coverage to DeepSource
36+
if: matrix.node-version == '25.x'
37+
run: |
38+
curl -sL https://github.com/deepsource/cli/releases/latest/download/ds -o ds
39+
chmod +x ds
40+
./ds report --analyzer test-coverage --key javascript --value-file ./coverage/lcov.info
41+
env:
42+
DEEPSOURCE_DSN: ${{ secrets.DEEPSOURCE_DSN }}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"oblecto:dev": "tsx src/bin/oblecto.ts",
2828
"debug": "node --inspect=0.0.0.0 --loader tsx src/index.ts",
2929
"test:mocha": "mocha --extension ts --require tsx tests/mocha",
30-
"test:coverage": "c8 npm run test:mocha",
30+
"test:coverage": "c8 --reporter=lcov --reporter=text npm run test:mocha",
3131
"test:startup": "scripts/test.sh",
3232
"test": "npm run test:mocha",
3333
"lint": "eslint .",

0 commit comments

Comments
 (0)