name: Tests
on:
  pull_request:
  push:
    branches:
      - main
jobs:
  lint:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
      - name: Use Node.js 24.x
        uses: actions/setup-node@v6
        with:
          node-version: 24.x
      - run: node --run setup
      - run: npm run lint
  test:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node-version: [18.x, 20.x, 22.x, 24.x]
    steps:
      - uses: actions/checkout@v6
      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v6
        with:
          node-version: ${{ matrix.node-version }}
      - run: node --run setup || npm install
      - run: npm run test
  test-vlt:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
      - name: Use Node.js 24.x
        uses: actions/setup-node@v6
        with:
          node-version: 24.x
      - name: vlt install and test
        run: |
          npx -y vlt install
          npx -y vlt run test
  coverage:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
      - name: Use Node.js 24.x
        uses: actions/setup-node@v6
        with:
          node-version: 24.x
      - run: node --run setup
      - run: |
          echo "\`\`\`" >> "$GITHUB_STEP_SUMMARY"
          npm run test:cover >> "$GITHUB_STEP_SUMMARY"
          echo "\`\`\`" >> "$GITHUB_STEP_SUMMARY"
