# `!reference` is a GitLab-specific YAML tag. A generic YAML 1.2 loader has no resolver for it and
# raises "could not determine a constructor for the tag '!reference'" unless one is registered;
# GitLab's own loader resolves it to the value at the given key path. This fixture exists to check
# which side of that line a parser falls on.
.setup:
  script:
    - echo "install toolchain"
    - npm ci
  after_script:
    - echo "collect logs"

.rules_mr:
  rules:
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
      when: always

stages: [test]

unit:
  stage: test
  script:
    - !reference [.setup, script]
    - npm run test:unit
  after_script: !reference [.setup, after_script]
  rules: !reference [.rules_mr, rules]
