> 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.md).

# Node.js Agent

Use the Node.js Agent to collect coverage and test data from JavaScript and TypeScript applications.

It supports:

* Frontend apps such as Angular, React, and Vue
* Backend Node.js services
* In-process test coverage uploads
* Out-of-process functional test coverage

{% hint style="info" %}
This page helps you choose the right setup. Use the stepper to pick the application path and test flow that match your use case.
{% endhint %}

{% stepper %}
{% step %}

### Start here

Follow these pages in order:

1. [Download the agent](/knowledgebase/setup-and-configuration/sealights-agents-and-plugins/node.js-agent/downloading-the-node.js-agent.md)
2. [Generate a session ID](/knowledgebase/setup-and-configuration/sealights-agents-and-plugins/node.js-agent/generating-a-session-id.md)
3. [Scan your application](/knowledgebase/setup-and-configuration/sealights-agents-and-plugins/node.js-agent/scanning-your-application.md)

After the scan, choose your application path and test flow.

{% hint style="warning" %}
Do not choose the test flow until the scan is complete. Both in-process and out-of-process coverage depend on the scanned build map.
{% endhint %}
{% endstep %}

{% step %}

### Choose your application path

Choose the application path that matches your build and deployment model.

{% tabs %}
{% tab title="🌐 Frontend app" %}
Use this path for bundled browser apps.

* Scan the built output
* Instrument the files with `instrument` before deployment
* Run out-of-process functional tests against the instrumented app

Next pages:

* [Capturing Runtime Coverage](/knowledgebase/setup-and-configuration/sealights-agents-and-plugins/node.js-agent/capturing-runtime-coverage.md)
* [Frontend Instrumentation (static)](/knowledgebase/setup-and-configuration/sealights-agents-and-plugins/node.js-agent/capturing-runtime-coverage/frontend-instrumentation-static.md)
* [Capturing Tests](/knowledgebase/setup-and-configuration/sealights-agents-and-plugins/node.js-agent/capturing-tests.md)
  {% endtab %}

{% tab title="🖥️ Backend service" %}
Use this path for Node.js APIs, workers, and server processes.

* Scan the service code
* Start the app with `run`
* Run out-of-process functional tests against the live service

Next pages:

* [Capturing Runtime Coverage](/knowledgebase/setup-and-configuration/sealights-agents-and-plugins/node.js-agent/capturing-runtime-coverage.md)
* [Backend Instrumentation (dynamic)](/knowledgebase/setup-and-configuration/sealights-agents-and-plugins/node.js-agent/capturing-runtime-coverage/backend-instrumentation-dynamic.md)
* [Capturing Tests](/knowledgebase/setup-and-configuration/sealights-agents-and-plugins/node.js-agent/capturing-tests.md)
  {% endtab %}
  {% endtabs %}
  {% endstep %}

{% step %}

### Choose your test flow

Choose the test flow that matches how your tests run and where coverage comes from.

{% tabs %}
{% tab title="🧪 In-process tests (Unit Tests)" %}
Use this flow when the test runner executes the application code in the same process.

Typical examples:

* Unit tests
* In-process integration tests
* Mocha, Karma, or AVA runs that produce NYC coverage

How it works:

* Open a test stage
* Run the tests
* Upload JUnit results
* Upload the NYC coverage file with `nycReport`

{% hint style="info" %}
This flow uses the test runner output as the coverage source. It does not rely on a separately running application.
{% endhint %}

Framework pages:

* [Unit Tests](/knowledgebase/setup-and-configuration/sealights-agents-and-plugins/node.js-agent/capturing-tests/unit-tests.md)
* [Mocha Tests framework](/knowledgebase/setup-and-configuration/sealights-agents-and-plugins/node.js-agent/capturing-tests/mocha-tests-framework.md)
* [Karma Test Framework](/knowledgebase/setup-and-configuration/sealights-agents-and-plugins/node.js-agent/capturing-tests/karma-test-framework.md)
* [AVA framework](/knowledgebase/setup-and-configuration/sealights-agents-and-plugins/node.js-agent/capturing-tests/ava-framework.md)
  {% endtab %}

{% tab title="🔗 Out-of-process tests (Functional Tests)" %}
Use this flow when tests run against a separate application process.

Typical examples:

* Functional tests
* End-to-end tests
* Browser or API tests that target a running app

How it works:

* Scan the app
* Instrument the frontend build or start the backend with `run`
* Open a test stage for the external test runner
* Run the tests against the live app
* Upload JUnit results while the app reports footprints

{% hint style="warning" %}
This flow uses the running application as the coverage source. It usually relies on a **Lab ID** to connect the test runner with the instrumented app.
{% endhint %}

{% hint style="info" %}
Choose this flow for functional, API, browser, and end-to-end tests that target a live application.
{% endhint %}

Mocha can also be used here when it drives a separate running application. Other common frameworks include Playwright and similar functional test runners.

Next pages:

* [Capturing Runtime Coverage](/knowledgebase/setup-and-configuration/sealights-agents-and-plugins/node.js-agent/capturing-runtime-coverage.md)
* [Capturing Tests](/knowledgebase/setup-and-configuration/sealights-agents-and-plugins/node.js-agent/capturing-tests.md)
  {% endtab %}
  {% endtabs %}
  {% endstep %}
  {% endstepper %}

### Common next pages

* [Advanced Features](/knowledgebase/setup-and-configuration/sealights-agents-and-plugins/node.js-agent/advanced-features.md)
* [Legacy Commands (Deprecated)](/knowledgebase/setup-and-configuration/sealights-agents-and-plugins/node.js-agent/legacy-commands-deprecated.md)
* [Command Reference](/knowledgebase/setup-and-configuration/sealights-agents-and-plugins/node.js-agent/command-reference.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.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.
