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
nycandtap-xunitinstalled (npm install --save-dev nyc tap-xunit).The build has been scanned.
Lifecycle commands
npx slnodejs start \
--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 end \
--tokenFile ./sltoken.txt --buildSessionIdFile buildSessionId- name: AVA tests with SeaLights
env:
SL_TOKEN: ${{ secrets.SL_TOKEN }}
ENV: test
run: |
npx slnodejs start --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 end --token "$SL_TOKEN" --buildSessionIdFile buildSessionIdParameters
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)
Back to → Capturing Tests
Last updated
Was this helpful?

