mardi 5 février 2019

Force coverage increase in gitlab PRs

In an effort to increase test coverage by requiring unit tests for every pull request on my EmberJS project hosted on gitlab, I want pipelines to fail if the coverage doesn't increase.

I can get the coverage output using istanbul and get the coverage badge displaying correctly using the following regex:

Gitlab CI screenshot

And using this gitlab-ci.yml:

image: sergiolepore/ember-cli

before_script:
  - yarn --ignore-engines
  - bower --allow-root install

"Ember Unit Tests":
  script:
    - COVERAGE=true npm test -- --filter=Unit
    - grep -o '"pct":\d*\.\d*' coverage/coverage-summary.json | head -1

How can I get the next pipeline to fail if the coverage is decreased in a PR?




Aucun commentaire:

Enregistrer un commentaire