Skip to content

CI Integration

Aver tests run in any CI system that supports Node.js. This guide covers GitHub Actions with JUnit reporting and Playwright browser testing.

Aver tests are Vitest tests, so standard Vitest CI configuration works:

.github/workflows/ci.yml
name: CI
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- run: npm ci
- run: npx aver run

aver run wraps vitest run and adds adapter/domain filtering via --adapter and --domain flags. For Vitest-specific options like --reporter or --outputFile, use npx vitest run directly.

Use Vitest’s built-in JUnit reporter for CI-friendly test output:

- run: npx vitest run --reporter=junit --reporter=default --outputFile.junit=test-results.xml

The --reporter=default keeps console output alongside the XML report.

If your adapters use @averspec/protocol-playwright, install browsers:

- run: npx playwright install --with-deps chromium

Cache browsers for faster runs:

- name: Get Playwright version
id: pw-version
run: echo "version=$(npx playwright --version)" >> $GITHUB_OUTPUT
- name: Cache Playwright browsers
uses: actions/cache@v4
with:
path: ~/.cache/ms-playwright
key: playwright-${{ runner.os }}-${{ steps.pw-version.outputs.version }}
restore-keys: playwright-${{ runner.os }}-
- name: Install Playwright
run: npx playwright install --with-deps chromium

Add the github-actions reporter for inline failure annotations on PRs:

- run: >
npx vitest run
--reporter=junit
--reporter=github-actions
--reporter=default
--outputFile.junit=test-results.xml

If your adapters import from built packages (common in monorepos), build first:

- name: Build
run: pnpm --filter @averspec/core run build
- name: Test
run: npx aver run

For monorepos, run each package separately with if: !cancelled() so all suites run even if one fails:

- name: Test core
run: npx aver run
working-directory: packages/core
- name: Test API adapter
if: ${{ !cancelled() }}
run: npx aver run
working-directory: packages/my-api
- name: Test browser adapter
if: ${{ !cancelled() }}
run: npx aver run
working-directory: packages/my-browser
name: CI
on:
push:
branches: [main]
pull_request:
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- run: npm ci
- name: Get Playwright version
id: pw-version
run: echo "version=$(npx playwright --version)" >> $GITHUB_OUTPUT
- name: Cache Playwright browsers
uses: actions/cache@v4
with:
path: ~/.cache/ms-playwright
key: playwright-${{ runner.os }}-${{ steps.pw-version.outputs.version }}
restore-keys: playwright-${{ runner.os }}-
- name: Install Playwright
run: npx playwright install --with-deps chromium
- name: Build
run: npm run build
- name: Test
run: >
npx vitest run
--reporter=junit
--reporter=github-actions
--reporter=default
--outputFile.junit=test-results.xml