stages:
  - test

variables:
  APP_ENV: ci

before_script:
  - echo "" > ./local.app-v3.opentalent.fr.crt
  - echo "" > ./local.app-v3.opentalent.fr.key

cache:
  paths:
    - ./node_modules

unit:
  stage: test

  script:
    - yarn install
    - yarn test

  artifacts:
    paths:
      - ./coverage/
    when: always
    reports:
      junit: coverage/junit.xml
      coverage_report:
        coverage_format: cobertura
        path: coverage/cobertura-coverage.xml

  # Extract total coverage from job logs (https://docs.gitlab.com/15.6/ee/ci/yaml/index.html#coverage)
  coverage: '/All files\s*|\s*\d+\.\d+/'
