name: Run tests

on:
    push:
    pull_request:

permissions:
    contents: read

jobs:
    syntax-compat:
        runs-on: ubuntu-latest
        steps:
            - uses: actions/checkout@v5
            - name: Verify Node.js 6 syntax compatibility
              run: docker run --rm -v "$PWD:/app:ro" -w /app node:6-alpine node test/syntax-compat.js

    test:
        strategy:
            matrix:
                node: [18.x, 20.x, 22.x, 24.x]
                os: [ubuntu-latest]
        runs-on: ${{ matrix.os }}
        steps:
            - uses: actions/checkout@v5
            - name: Use Node.js ${{ matrix.node }}
              uses: actions/setup-node@v5
              with:
                  node-version: ${{ matrix.node }}
            - run: npm install
            - run: npm run lint
            - run: npm run test:coverage
