0

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:

enter image description here

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:

enter image description here

1 Answer 1

0

I just needed a relative path (not explained in Gitlab documentation):

artifacts:
    paths:
      - $CI_PROJECT_DIR/coverage
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.