> For the complete documentation index, see [llms.txt](https://docs.sealights.io/knowledgebase/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sealights.io/knowledgebase/setup-and-configuration/sealights-agents-and-plugins/node.js-agent/capturing-tests/ava-framework.md).

# 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 <a href="#prerequisites" id="prerequisites"></a>

* `nyc` and `tap-xunit` installed (`npm install --save-dev nyc tap-xunit`).
* The build has been [scanned](https://file+.vscode-resource.vscode-cdn.net/c%3A/Work/Customers/GEVernova/ADO/qTestUpdate/sealights-nodejs-docs/scanning-your-application.md).

### Lifecycle commands <a href="#lifecycle-commands" id="lifecycle-commands"></a>

{% tabs %}
{% tab title="Bash" %}

```sh
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
```

{% endtab %}

{% tab title="GitHub Actions" %}

```yaml
- 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 buildSessionId
```

{% endtab %}

{% tab title="PowerShell" %}

```powershell
$env:ENV = "test"
npx slnodejs start --tokenFile .\sltoken.txt --buildSessionIdFile buildSessionId --testStage "Unit Tests"
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
```

{% endtab %}

{% tab title="Azure DevOps" %}

```yaml
- script: |
    npx slnodejs start        --token "$(SL_TOKEN)" --buildSessionIdFile buildSessionId --testStage "Unit Tests"
    ENV=test 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 buildSessionId
  displayName: AVA tests with SeaLights
```

{% endtab %}
{% endtabs %}

### Parameters <a href="#parameters" id="parameters"></a>

| 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`)                  |

{% hint style="info" %}
&#x20;**`--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 → Parameters](https://file+.vscode-resource.vscode-cdn.net/c%3A/Work/Customers/GEVernova/ADO/qTestUpdate/sealights-nodejs-docs/unit-tests.md#parameters) for details
{% endhint %}

***

**Back to →** [Capturing Tests](https://file+.vscode-resource.vscode-cdn.net/c%3A/Work/Customers/GEVernova/ADO/qTestUpdate/sealights-nodejs-docs/capturing-tests.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.sealights.io/knowledgebase/setup-and-configuration/sealights-agents-and-plugins/node.js-agent/capturing-tests/ava-framework.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
