To run the test locally, I use this:
"test-ci": "jest --runInBand webapp/test/ivw --config ./jest.config.js --watchAll=false",
In the terminal, I have the coverage report fine, and this also generates de Cobertura page:
I have 2 stages in my pipeline, one for the unit testing and another one to publish this coverage page:
unit:
script:
- npm run test-ci
coverage: /All files[^|]*\|[^|]*\s+([\d\.]+)/
cache:
paths:
- coverage/
artifacts:
paths:
- coverage/
when: always
reports:
junit:
- junit.xml
coverage_report:
coverage_format: cobertura
path: coverage/cobertura-coverage.xml
pages:
stage: coverage
dependencies:
- unit
script:
- mv coverage/ public/
artifacts:
paths:
- public/
This is taken from here:
https://gist.github.com/rishitells/3c4536131819cff4eba2c8ab5bbb4570
The thing is that it publishes the page but this has an unknown coverage: