Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

AVA framework

AVA doesn't emit JUnit XML or coverage directly, so the integration uses nyc for coverage (--reporter=json) and pipes AVA's TAP output through tap-xunit to produce JUnit XML. You then drive the standard test-stage lifecycle.

Prerequisites

  • nyc and tap-xunit installed (npm install --save-dev nyc tap-xunit).

  • The build has been scanned.

Lifecycle commands

npx slnodejs openTestStage \
  --tokenFile ./sltoken.txt --buildSessionIdFile buildSessionId \
  --testStage "Unit Tests"

# Run AVA with nyc coverage, converting TAP output to JUnit XML
ENV=test npx nyc --reporter=json ./node_modules/.bin/ava --tap | npx tap-xunit > junit.xml

npx slnodejs nycReport \
  --tokenFile ./sltoken.txt --buildSessionIdFile buildSessionId \
  --report ./coverage/coverage-final.json

npx slnodejs uploadReports \
  --tokenFile ./sltoken.txt --buildSessionIdFile buildSessionId \
  --file junit.xml

npx slnodejs closeTestStage \
  --tokenFile ./sltoken.txt --buildSessionIdFile buildSessionId \
  --testStage "Unit Tests"
- name: AVA tests with SeaLights
  env:
    SL_TOKEN: ${{ secrets.SL_TOKEN }}
    ENV: test
  run: |
    npx slnodejs openTestStage        --token "$SL_TOKEN" --buildSessionIdFile buildSessionId --testStage "Unit Tests"
    npx nyc --reporter=json ./node_modules/.bin/ava --tap | npx tap-xunit > junit.xml
    npx slnodejs nycReport    --token "$SL_TOKEN" --buildSessionIdFile buildSessionId --report ./coverage/coverage-final.json
    npx slnodejs uploadReports --token "$SL_TOKEN" --buildSessionIdFile buildSessionId --file junit.xml
    npx slnodejs closeTestStage          --token "$SL_TOKEN" --buildSessionIdFile buildSessionId --testStage "Unit Tests"

Parameters

Parameter
Purpose

--tokenFile / --token

SeaLights authentication

--buildSessionIdFile / --buildSessionId

Build session identifier

--testStage

Stage name (e.g. "Unit Tests")

--report

Path to the nyc coverage file, coverage-final.json (nycReport)

--file

Path to the generated JUnit XML (uploadReports)

--projectRoot for nycReport: if SeaLights fails to match coverage to source files (common in CI/Docker environments where workspace paths differ from build paths), add --projectRoot <path> to the nycReport call. See Unit Tests → Flags for details.


Back to → Capturing Tests

Last updated

Was this helpful?