Skip to content

Commit e5d4d48

Browse files
Add jest-coverage-report-action
1 parent 4342874 commit e5d4d48

File tree

4 files changed

+24
-4
lines changed

4 files changed

+24
-4
lines changed

.dockerignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
node_modules/
1+
node_modules/
2+
report.json

.github/workflows/test.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,18 @@ jobs:
1313
- uses: actions/checkout@v4
1414

1515
- name: Start containers
16-
run: docker compose up -d
16+
run: docker compose -f docker-compose.ci.yml up -d
17+
18+
# install any dependencies since this is a fresh checkout
19+
- name: Install dependencies
20+
run: docker compose -f docker-compose.ci.yml run -v ${GITHUB_WORKSPACE}:${GITHUB_WORKSPACE} --workdir ${GITHUB_WORKSPACE} tests yarn install
1721

1822
- name: Run tests
19-
run: docker compose run tests jest --coverage
23+
run: docker compose -f docker-compose-ci.yml run -v ${GITHUB_WORKSPACE}:${GITHUB_WORKSPACE} --workdir ${GITHUB_WORKSPACE} tests jest --coverage --ci --json --testLocationInResults --outputFile=report.json"
24+
25+
- name: Collect test coverage
26+
uses: ArtiomTr/jest-coverage-report-action@v2
27+
if: always() # we should still try to run this even if there are test failures
28+
with:
29+
coverage-file: ./report.json
30+
base-coverage-file: ./report.json

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
node_modules/
1+
node_modules/
2+
report.json

docker-compose.ci.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
services:
2+
tests:
3+
extends:
4+
file: "docker-compose.yml"
5+
service: tests
6+
build:
7+
target: base # do not install dependencies because we will mount a fresh checkout

0 commit comments

Comments
 (0)