name: Frontend-tester

on:
  push:
    branches: [master]
    paths:
      - "frontend/lib/**"
      - "frontend/package.json"
      - "frontend/pnpm-lock.yaml"
      - "frontend/pnpm-workspace.yaml"
      - "frontend/vitest.config.mts"
      - ".forgejo/workflows/frontend-tests.yml"

jobs:
  test:
    runs-on: docker
    defaults:
      run:
        working-directory: frontend
    steps:
      - uses: actions/checkout@v4

      - uses: actions/setup-node@v4
        with:
          node-version: "22"

      - name: Installer pnpm (corepack)
        run: corepack enable

      - name: Installer avhengigheter
        run: pnpm install --frozen-lockfile

      - name: Kjør testsuiten
        run: pnpm test
