image: node:latest

include:
  - project: 'general/templates'
    file: '/cicd/npm-audit.gitlab-ci.yml'
  - project: 'general/templates'
    file: '/cicd/sonarqube.gitlab-ci.yml'


cache:
  paths:
    - node_modules/

stages:
  - build
  - test

build:
  stage: build
  script:
    - npm install --production

test:
  stage: test
  before_script:
    - npm install -g jest
  script:
    - jest
  artifacts:
    paths:
      - docs/test-report.html
      - docs/junit.xml
    reports:
      junit: docs/junit.xml