An issue that I ran into with this was that I hadn’t merged the MR which adds coverage into the main branch. You probably have done this already, but if you haven’t then the MR diffs won’t show up until this job has been merged in.
Yes, I have done this already. My main branch already has the gitlab ci. I also have updated it to the following so I can see the coverage statistics in the analysis section. but it does not seem to show
# .gitlab-ci.yml
image: node:12
# Define the stages of the pipeline
stages:
- test
cache:
paths:
- node_modules/
# Define the job that will run tests
test:
stage: test
script:
- npm install
- npm run test -- --coverage --verbose
artifacts:
when: always
paths:
- junit.xml
- coverage/cobertura-coverage.xml
reports:
coverage_report:
coverage_format: cobertura
path: coverage/cobertura-coverage.xml
junit: junit.xml
# Add coverage to code coverage statistics
coverage: '/All files[^|]*\|[^|]*\s+([\d\.]+)/'
# Define when this job should be executed
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master"'