# Command Reference

## Configure a session and create a session ID <a href="#configure-a-session-and-create-session-id" id="configure-a-session-and-create-session-id"></a>

{% code overflow="wrap" lineNumbers="true" %}

```
npx slnodejs config {--token <token> | --tokenfile <file>} --appname <appname> --branch <branch> --build <build> [--buildsessionid <buildsessionid>] [--proxy <proxy>] [--failbuild {true|false}]
```

{% endcode %}

<table><thead><tr><th width="167.83203125">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>token</code></td><td>Access token generated from the Sealights server</td></tr><tr><td><code>tokenfile</code></td><td>Path to file containing access token generated from the SeaLights server</td></tr><tr><td><code>appname</code></td><td>Name of the application</td></tr><tr><td><code>branch</code></td><td>The source branch of the application</td></tr><tr><td><code>build</code></td><td>The build label of the current build</td></tr><tr><td><code>buildsessionid</code></td><td>(Optional) A user provided session ID</td></tr><tr><td><code>proxy</code></td><td>Address of proxy to run connection through</td></tr><tr><td><code>failbuild</code></td><td>Exit with an error code if an error is encountered (Default: <code>false</code>)</td></tr><tr><td><code>quiet</code></td><td>Suppresses console feedback messages only. Does not suppress log output when logging is configured to print to the console. The default value is <code>false</code>.</td></tr></tbody></table>

## Scanning a build <a href="#scanning-a-build" id="scanning-a-build"></a>

{% code overflow="wrap" lineNumbers="true" %}

```
npx slnodejs scan {--token <token> | --tokenfile <file>} {--buildsessionid <id> | --buildsessionidfile <file>} --workspacepath <workspacepath> --scm {git|none} [--projectRoot <folder>] [--excludedpaths <excludedpaths>] [--uniqueModuleId <id>] [--es-modules] [--jobName <jobName>] [--logsUrl <logsUrl>] [--dependenciesFile <dependenciesFile>] [--instrumentForBrowsers --outputpath <folder> [--downloadAgent {true|false}] [--instrumentationOnly] [--labid <labid>] [--excludeSourceMapFiles {none|skipCopy|skipAndDelete}]] [--proxy <proxy>] [--failbuild {true|false}] [--scmBaseUrl <url> --scmProvider {github|gitlab|bitbucket} --scmVersion <arg>] [--es6Modules] [--babylonPlugins decorators-legacy|jsx] [--collectorUrl <url>] [--splitPreambleIntoFile --preambleFileUrl <url> --preambleFileName <fileName>] [--embedCorrectUniqueId]
```

{% endcode %}

<table><thead><tr><th width="208.15625">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>token</code></td><td>Access token generated from the SeaLights server</td></tr><tr><td><code>tokenfile</code></td><td>Path to file containing access token generated from the SeaLights server</td></tr><tr><td><code>buildsessionid</code></td><td>Session ID of configuration created</td></tr><tr><td><code>buildsessionidfile</code></td><td>Path to file containing the Session ID of configuration created</td></tr><tr><td><code>workspacepath</code></td><td>Path to the source workspace</td></tr><tr><td><code>excludedpaths</code></td><td><p>Comma-separated list of files to exclude from scan</p><p>Supports wildcards (* = any string, ? = any character). For example: <code>'*-with-dependencies.jar , bad-bad?.war, *-source.jar'</code></p></td></tr><tr><td><code>projectRoot</code></td><td>Path to the root of the project. Usually where the src folder resides</td></tr><tr><td><code>uniqueModuleId</code></td><td>Unique name when providing more than one build scan per build</td></tr><tr><td><code>es6Modules</code></td><td>Indicates that you use es6 modules</td></tr><tr><td><code>jobName</code></td><td>Name of Jenkins job</td></tr><tr><td><code>logsUrl</code></td><td>Path to Jenkins log folder</td></tr><tr><td><code>scm</code></td><td>Source control used. Current options are: <code>git</code>, <code>none</code></td></tr><tr><td><code>dependenciesFile</code></td><td>A path to a JSON file that is in the following format:<br><code>[{"appName":"","branch":"","build":""}, {...}]</code></td></tr><tr><td><code>instrumentForBrowsers</code></td><td>Instrument the JS files for providing browser front-end coverage information. Must be used with the <code>outputpath</code> parameter.</td></tr><tr><td><code>downloadAgent</code></td><td>Set this value to '<code>false</code>' in order to prevent the instrumented javascript to try and download the browser test listener (for example, when using 'Karma').</td></tr><tr><td><code>instrumentationOnly</code></td><td>Only instrument the javascript files, without sending the build information to the SeaLights server (i.e. skip the build scan).<br>This parameter must be used in addition to the <code>instrumentForBrowsers</code> parameter.</td></tr><tr><td><code>outputpath</code></td><td>Folder to generate the instrumented JS files in when using the <code>instrumentForBrowsers</code> parameter</td></tr><tr><td><code>labid</code></td><td>Unique ID for a set of test labs in case multiple labs are running simultaneously or for an integration build.<br>This needs to be done during the instrumentation process when using the <code>instrumentForBrowsers</code> option</td></tr><tr><td><code>proxy</code></td><td>Address of proxy to run connection through</td></tr><tr><td><code>failbuild</code></td><td>Exit with an error code if an error is encountered (Default: <code>false</code>)</td></tr><tr><td><code>scmProvider</code></td><td>The provider name of your Source Control Management (SCM) tool.<br>Values: Github, Bitbucket and Gitlab (Default is <code>Github</code>)</td></tr><tr><td><code>scmBaseUrl</code></td><td><p>The URL to the repository which contains the code. If not provided, the URL of the remote GIT origin will be used</p><p>Example: <code>https://my.bitbucket.com/projects/ABCD/repos/XYZ/browse/A1</code></p></td></tr><tr><td><code>scmVersion</code></td><td>The version of your Source Control Management (SCM) tool. If not provided, Cloud version is assumed</td></tr><tr><td><code>babylonPlugins</code></td><td><p>Values:</p><ul><li><code>decorators-legacy</code> - When there are decorators in the code, you should use this flag with the "decorators-legacy" value</li><li><code>jsx</code> - For React applications</li></ul></td></tr><tr><td><code>collectorUrl</code></td><td>The URL for the <a href="https://hub.docker.com/r/sealights/on-prem-collector">Collector</a> service. Format: “https://&#x3C;collectorIP>:&#x3C;collectorPort>/api”</td></tr><tr><td><code>excludeSourceMapFiles</code></td><td><p>(Optional) During files instrumentation step, this option explicits what to do with <code>*.js.map</code> files in the <code>workspacepath</code> and <code>outputpath</code> folders:</p><ul><li><code>none</code> - Do nothing and copy <code>*.js.map</code> files as is to the <code>outputpath</code> folder</li><li><code>skipCopy</code> - Do not copy the <code>*.js.map</code> files from <code>workspacepath</code> into <code>outputpath</code> folder</li><li><code>skipAndDelete</code> - Skip copy of <code>*.js.map</code> files and delete them from the <code>worspacepath</code></li></ul></td></tr><tr><td><code>splitPreambleIntoFile</code></td><td><p>Split the preamble used for browser application into a separate file.</p><ul><li>Important: customer is responsible to make this file non-cacheable and accessible from the browser</li></ul><p>Usage is <code>--splitPreambleIntoFile</code> to use (not <code>--splitPreambleIntoFile true</code>)</p></td></tr><tr><td><code>preambleFileUrl</code></td><td><p>Used together with <code>preambleFileName</code> to define a custom url (default: "" which equals to root, you can pass like <a href="https://example.com/a/b/c">https://example.com/a/b/c</a> or relative like a/b/c).</p><ul><li>Important: Only use this if you need a different server than the one used for the instrumented files</li><li>Important: actual url will be {preambleFileUrl}/{preambleFileName}</li></ul></td></tr><tr><td><code>preambleFileName</code></td><td>Used together with <code>splitPreambleIntoFile</code> to define a custom name</td></tr><tr><td><code>enableOpenTelemetry</code></td><td><p>Used to enable context propagation on the Node application. Used with the <code>slnodejs scan</code> command.</p><p>See also:</p><p><a data-mention href="../../integrations/testing-frameworks-integration/improve-test-optimization-with-context-propagation">improve-test-optimization-with-context-propagation</a></p><p><a data-mention href="broken-reference">Broken link</a></p></td></tr><tr><td><code>quiet</code></td><td>Suppresses console feedback messages only. Does not suppress log output when logging is configured to print to the console. The default value is <code>false</code>.</td></tr></tbody></table>

## Ending a multi-module build <a href="#ending-a-multi-module-build" id="ending-a-multi-module-build"></a>

{% code overflow="wrap" lineNumbers="true" %}

```
npx slnodejs buildend {--token <token> | --tokenfile <file>} {--buildsessionid <id> | --buildsessionidfile <file>} [--proxy <proxy>] [--failbuild {true|false}] [--skipUpgrade {true|false}] --ok | --failed
```

{% endcode %}

<table><thead><tr><th width="196.609375">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>token</code></td><td>Access token generated from the SeaLights server</td></tr><tr><td><code>tokenfile</code></td><td>Path to file containing access token generated from the SeaLights server</td></tr><tr><td><code>buildsessionid</code></td><td>Session ID of configuration created</td></tr><tr><td><code>buildsessionidfile</code></td><td>Path to file containing the Session ID of configuration created</td></tr><tr><td><code>proxy</code></td><td>Address of proxy to run connection through</td></tr><tr><td><code>failbuild</code></td><td>Exit with an error code if an error is encountered (Default: <code>false</code>)</td></tr><tr><td><code>skipUpgrade</code></td><td>Should not try to upgrade agent (Default: <code>false</code>)</td></tr><tr><td><code>ok</code></td><td>build finished successfully</td></tr><tr><td><code>failed</code></td><td>build not finished successfully</td></tr></tbody></table>

## Instrumenting a front-end build <a href="#instrumenting-a-front-end-build" id="instrumenting-a-front-end-build"></a>

{% code overflow="wrap" lineNumbers="true" %}

```
npx slnodejs instrument {--token <token> | --tokenfile <file>} {--buildsessionid <id> | --buildsessionidfile <file>} --workspacepath <workspacepath> [--projectRoot <folder>] [--excludedpaths <excludedpaths>] --outputpath <folder> [--downloadAgent {true|false}] [--labid <labid>] [--excludeSourceMapFiles {none|skipCopy|skipAndDelete}]] [--proxy <proxy>] [--failbuild {true|false}] [--collectorUrl <url>] [--splitPreambleIntoFile --preambleFileUrl <url> --preambleFileName <fileName>] [--embedCorrectUniqueId]
```

{% endcode %}

<table data-header-hidden><thead><tr><th width="212.70703125">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>token</code></td><td>Access token generated from the SeaLights server</td></tr><tr><td><code>tokenfile</code></td><td>Path to file containing access token generated from the SeaLights server</td></tr><tr><td><code>buildsessionid</code></td><td>Session ID of configuration created</td></tr><tr><td><code>buildsessionidfile</code></td><td>Path to file containing the Session ID of configuration created</td></tr><tr><td><code>workspacepath</code></td><td>Path to the source workspace</td></tr><tr><td><code>excludedpaths</code></td><td><p>Comma-separated list of files to exclude from scan</p><p>Supports wildcards (* = any string, ? = any character). For example: <code>'*-with-dependencies.jar , bad-bad?.war, *-source.jar'</code></p></td></tr><tr><td><code>downloadAgent</code></td><td>Set this value to '<code>false</code>' in order to prevent the instrumented javascript to try and download the browser test listener (for example, when using 'Karma').</td></tr><tr><td><code>outputpath</code></td><td>Folder to generate the instrumented JS files in when using the <code>instrumentForBrowsers</code> parameter</td></tr><tr><td><code>labid</code></td><td>Unique ID for a set of test labs in case multiple labs are running simultaneously or for an integration build.<br>This needs to be done during the instrumentation process when using the <code>instrumentForBrowsers</code> option</td></tr><tr><td><code>proxy</code></td><td>Address of proxy to run connection through</td></tr><tr><td><code>failbuild</code></td><td>Exit with an error code if an error is encountered (Default: <code>false</code>)</td></tr><tr><td><code>collectorUrl</code></td><td>The URL for the <a href="https://hub.docker.com/r/sealights/on-prem-collector">Collector</a> service. Format: “https://&#x3C;collectorIP>:&#x3C;collectorPort>/api”</td></tr><tr><td><code>excludeSourceMapFiles</code></td><td><p>(Optional) During files instrumentation step, this option explicits what to do with <code>*.js.map</code> files in the <code>workspacepath</code> and <code>outputpath</code> folders:</p><ul><li><code>none</code> - Do nothing and copy <code>*.js.map</code> files as is to the <code>outputpath</code> folder</li><li><code>skipCopy</code> - Do not copy the <code>*.js.map</code> files from <code>workspacepath</code> into <code>outputpath</code> folder</li><li><code>skipAndDelete</code> - Skip copy of <code>*.js.map</code> files and delete them from the <code>worspacepath</code></li></ul></td></tr><tr><td><code>splitPreambleIntoFile</code></td><td><p>Split the preamble used for browser application into a separate file.</p><ul><li>Important: customer is responsible to make this file non-cacheable and accessible from the browser</li></ul><p>Usage is <code>--splitPreambleIntoFile</code> to use (not <code>--splitPreambleIntoFile true</code>)</p></td></tr><tr><td><code>preambleFileUrl</code></td><td><p>Used together with <code>preambleFileName</code> to define a custom url (default: "" which equals to root, you can pass like <a href="https://example.com/a/b/c">https://example.com/a/b/c</a> or relative like a/b/c).</p><ul><li>Important: Only use this if you need a different server than the one used for the instrumented files</li><li>Important: actual url will be {preambleFileUrl}/{preambleFileName}</li></ul></td></tr><tr><td><code>preambleFileName</code></td><td>Used together with <code>splitPreambleIntoFile</code> to define a custom name</td></tr><tr><td><code>enableOpenTelemetry</code></td><td><p>Used to enable context propagation on the Node application. Used with the <code>slnodejs scan</code> command.</p><p>See also:</p><p><a data-mention href="../../integrations/testing-frameworks-integration/improve-test-optimization-with-context-propagation">improve-test-optimization-with-context-propagation</a></p><p><a data-mention href="broken-reference">Broken link</a></p></td></tr></tbody></table>

## Running a backend server <a href="#running-backend-server" id="running-backend-server"></a>

{% code overflow="wrap" lineNumbers="true" %}

```
npx slnodejs run {--token <token> | --tokenfile <file>} {--buildsessionid <id> | --buildsessionidfile <file>} [--workspacepath <path>] [--useinitialcolor {true|false}] [--teststage <teststage>] [--labid <labid>] [--proxy <proxy>] [--failbuild {true|false}] args...
```

{% endcode %}

{% hint style="info" %}
Example of command:

{% code overflow="wrap" %}

```
npx slnodejs run --tokenfile ./sltoken.txt --buildsessionidfile buildSessionId --labid "LAB_ID_2" --workspacepath "./server" --useinitialcolor true --useslnode2 -- "./server/app.js"
```

{% endcode %}

Note the `/your/backend/server/command` refers to `"./server/app.js"` in the above example.
{% endhint %}

<table><thead><tr><th width="196.27734375">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>token</code></td><td>Access token generated from the SeaLights server</td></tr><tr><td><code>tokenfile</code></td><td>Path to file containing access token generated from the SeaLights server</td></tr><tr><td><code>buildsessionid</code></td><td>Session ID of configuration created</td></tr><tr><td><code>buildsessionidfile</code></td><td>Path to file containing the Session ID of configuration created</td></tr><tr><td><code>workspacepath</code></td><td>Path to the source workspace</td></tr><tr><td><code>useinitialcolor</code></td><td>When reporting tests manually this should be set to false (Default: false)</td></tr><tr><td><code>teststage</code></td><td>Name of the test stage</td></tr><tr><td><code>labid</code></td><td>Unique ID for a set of test labs in case multiple labs are running simultaneously</td></tr><tr><td><code>proxy</code></td><td>Address of proxy to run connection through</td></tr><tr><td><code>failbuild</code></td><td>Exit with an error code if an error is encountered (Default: false)</td></tr><tr><td><code>args...</code></td><td>Extra arguments for running mocha framework tests</td></tr><tr><td><code>quiet</code></td><td>Suppresses console feedback messages only. Does not suppress log output when logging is configured to print to the console. The default value is <code>false</code>.</td></tr></tbody></table>

## Updating/Deleting a component from an Integration build <a href="#updating-deleting-a-component-from-an-integration-build" id="updating-deleting-a-component-from-an-integration-build"></a>

{% code overflow="wrap" lineNumbers="true" %}

```
npx slnodejs {componentUpdate | componentDelete} {-token <arg> | -tokenfile <arg>} {-buildsessionid <arg> | -buildsessionidfile <arg>} [--proxy <proxy>] {-componentIds <arg> | -componentFile <file>}
```

{% endcode %}

<table><thead><tr><th width="191.0625">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>token</code></td><td>Access token generated from the SeaLights server</td></tr><tr><td><code>tokenfile</code></td><td>Path to file containing access token generated from the SeaLights server</td></tr><tr><td><code>buildsessionid</code></td><td>Session ID of configuration created</td></tr><tr><td><code>buildsessionidfile</code></td><td>Path to file containing the Session ID of configuration created</td></tr><tr><td><code>componentIds</code></td><td>One or several build session ID's (comma separated) of the component(s) to be updated or deleted</td></tr><tr><td><code>componentFile</code></td><td>A path to a JSON file that is in the following format:<br><code>[{"appName":"","branch":"","build":""}, {...}]</code><br>or<br><code>[{"buildSessionId":"", {...}]</code></td></tr><tr><td><code>proxy</code></td><td>Address of proxy to run connection through</td></tr></tbody></table>

## Test Listener <a href="#test-listener" id="test-listener"></a>

{% hint style="warning" %}
The `buildsessionid` and `buildsessionidfile` parameters are **deprecated** for test-runner commands. Use `labid` instead. These parameters remain supported only for unit-test runners that execute the build's code directly (e.g. Mocha, Karma, AVA).
{% endhint %}

### Starting a test stage <a href="#starting-a-test-stage" id="starting-a-test-stage"></a>

{% code overflow="wrap" lineNumbers="true" %}

```
npx slnodejs start {--token <token> | --tokenfile <file>} {--buildsessionid <id> | --buildsessionidfile <file>} --teststage <teststage> [--labid <labid>] [--proxy <proxy>] [--failbuild {true|false}]
```

{% endcode %}

<table><thead><tr><th width="197.1484375">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>token</code></td><td>Access token generated from the SeaLights server</td></tr><tr><td><code>tokenfile</code></td><td>Path to file containing access token generated from the SeaLights server</td></tr><tr><td><code>buildsessionid</code></td><td>Session ID of configuration created</td></tr><tr><td><code>buildsessionidfile</code></td><td>Path to file containing the Session ID of configuration created</td></tr><tr><td><code>teststage</code></td><td>Name of the test stage</td></tr><tr><td><code>labid</code></td><td>Unique ID for a set of test labs in case multiple labs are running simultaneously</td></tr><tr><td><code>proxy</code></td><td>Address of proxy to run connection through</td></tr><tr><td><code>failbuild</code></td><td>Exit with an error code if an error is encountered (Default: false)</td></tr></tbody></table>

### Upload report files <a href="#upload-report-files" id="upload-report-files"></a>

Report files must be JUnit style XML reports

{% code overflow="wrap" lineNumbers="true" %}

```
npx slnodejs uploadReports {--token <token> | --tokenfile <file>} {--buildsessionid <id> | --buildsessionidfile <file>} {--reportFile <reportFile> | --reportFilesFolder <reportFilesFolder>} [--labid <labid>] [--source <source>] [--type <type>] [--proxy <proxy>] [--failbuild {true|false}]
```

{% endcode %}

<table><thead><tr><th width="192.18359375">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>token</code></td><td>Access token generated from the SeaLights server</td></tr><tr><td><code>tokenfile</code></td><td>Path to file containing access token generated from the SeaLights server</td></tr><tr><td><code>buildsessionid</code></td><td>Session ID of configuration created</td></tr><tr><td><code>buildsessionidfile</code></td><td>Path to file containing the Session ID of configuration created</td></tr><tr><td><code>reportFile</code></td><td>Path to report file (multiple entries can be provided)</td></tr><tr><td><code>reportFilesFolder</code></td><td><p>Path to folder containing report files (multiple entries can be provided)</p><p>Note: all files in the folder will be uploaded</p></td></tr><tr><td><code>labid</code></td><td>Unique ID for a set of test labs in case multiple labs are running simultaneously</td></tr><tr><td><code>source</code></td><td>The reports provider. Default: <code>Junit xml report</code></td></tr><tr><td><code>type</code></td><td><p>Values:</p><ul><li><code>JUnitReport</code> - For uploading JUnit test report files</li><li><code>commitLog</code> - For uploading git style commit logs</li></ul></td></tr><tr><td><code>type</code></td><td>Name of testing framework type</td></tr><tr><td><code>proxy</code></td><td>Address of proxy to run connection through</td></tr><tr><td><code>failbuild</code></td><td>Exit with an error code if an error is encountered (Default: <code>false</code>)</td></tr></tbody></table>

**Optional override parameters:**

<table><thead><tr><th width="139.6640625">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>appname</code></td><td>Name of the application</td></tr><tr><td><code>branch</code></td><td>The source branch of the application</td></tr><tr><td><code>build</code></td><td>The build label of the current build</td></tr></tbody></table>

### Upload Coverage files <a href="#upload-coverage-files" id="upload-coverage-files"></a>

The coverage file must be in JSON format, created by the [Istanbuljs/nyc](https://istanbul.js.org/) framework

{% code overflow="wrap" lineNumbers="true" %}

```
npx slnodejs nycReport {--token <token> | --tokenfile <file>} {--buildsessionid <id> | --buildsessionidfile <file>} {--report <reportFile> | --projectRoot <project root dir>} [--labid <labid>] [--proxy <proxy>]
```

{% endcode %}

<table><thead><tr><th width="191.421875">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>token</code></td><td>Access token generated from the SeaLights server</td></tr><tr><td><code>tokenfile</code></td><td>Path to file containing access token generated from the SeaLights server</td></tr><tr><td><code>buildsessionid</code></td><td>Session ID of configuration created</td></tr><tr><td><code>buildsessionidfile</code></td><td>Path to file containing the Session ID of configuration created</td></tr><tr><td><code>report</code></td><td>Path to coverage-final.json</td></tr><tr><td><code>projectRoot</code></td><td>Path to the root of the project. Usually where the src folder resides</td></tr><tr><td><code>labid</code></td><td>Unique ID for a set of test labs in case multiple labs are running simultaneously</td></tr><tr><td><code>proxy</code></td><td>Address of proxy to run connection through</td></tr></tbody></table>

### Ending a test stage <a href="#ending-a-test-stage" id="ending-a-test-stage"></a>

{% code overflow="wrap" lineNumbers="true" %}

```
npx slnodejs end {--token <token> | --tokenfile <file>} {--buildsessionid <id> | --buildsessionidfile <file>} [--labid <labid>] [--proxy <proxy>] [--failbuild {true|false}]
```

{% endcode %}

<table><thead><tr><th width="188.5703125">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>token</code></td><td>Access token generated from the SeaLights server</td></tr><tr><td><code>tokenfile</code></td><td>Path to file containing access token generated from the SeaLights server</td></tr><tr><td><code>buildsessionid</code></td><td>Session ID of configuration created</td></tr><tr><td><code>buildsessionidfile</code></td><td>Path to file containing the Session ID of configuration created</td></tr><tr><td><code>labid</code></td><td>Unique ID for a set of test labs in case multiple labs are running simultaneously</td></tr><tr><td><code>proxy</code></td><td>Address of proxy to run connection through</td></tr><tr><td><code>failbuild</code></td><td>Exit with an error code if an error is encountered (Default: false)</td></tr></tbody></table>

### Running Tests using Mocha <a href="#running-tests-using-mocha" id="running-tests-using-mocha"></a>

{% code overflow="wrap" lineNumbers="true" %}

```
npx slnodejs mocha {--token <token> | --tokenfile <file>} {--buildsessionid <id> | --buildsessionidfile <file>} --teststage <teststage> [--labid <labid>] [--proxy <proxy>] [--failbuild {true|false}] -- args...
```

{% endcode %}

<table><thead><tr><th width="192.40234375">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>token</code></td><td>Access token generated from the SeaLights server</td></tr><tr><td><code>tokenfile</code></td><td>Path to file containing access token generated from the SeaLights server</td></tr><tr><td><code>buildsessionid</code></td><td>Session ID of configuration created</td></tr><tr><td><code>buildsessionidfile</code></td><td>Path to file containing the Session ID of configuration created</td></tr><tr><td><code>teststage</code></td><td>Name of the test stage</td></tr><tr><td><code>labid</code></td><td>Unique ID for a set of test labs in case multiple labs are running simultaneously</td></tr><tr><td><code>proxy</code></td><td>Address of proxy to run connection through</td></tr><tr><td><code>failbuild</code></td><td>Exit with an error code if an error is encountered (Default: false)</td></tr><tr><td><code>tiaDisabled</code></td><td>Set to <code>true</code> to ignore Tests Recommendations and execute all the tests. (Default: false)</td></tr><tr><td><code>reportSuites</code></td><td>Set to <code>true</code> to map Sealights Tests to Mocha Suites instead of the Mocha tests within them. This flag should be passed as a <code>--reporterOptions</code> (Default: <code>false</code>).</td></tr><tr><td><code>-- args...</code></td><td>Extra arguments for running mocha framework tests<br>Note: the double dash delimits between the SeaLights agent options and parameters passed to mocha</td></tr></tbody></table>

### Running Tests using jasmine-node <a href="#running-tests-using-jasmine-node" id="running-tests-using-jasmine-node"></a>

{% code overflow="wrap" lineNumbers="true" %}

```
npx slnodejs jasmine {--token <token> | --tokenfile <file>} {--buildsessionid <id> | --buildsessionidfile <file>} --teststage <teststage> [--labid <labid>] [--proxy <proxy>] [--failbuild {true|false}] args...
```

{% endcode %}

<table><thead><tr><th width="192.203125">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>token</code></td><td>Access token generated from the SeaLights server</td></tr><tr><td><code>tokenfile</code></td><td>Path to file containing access token generated from the SeaLights server</td></tr><tr><td><code>buildsessionid</code></td><td>Session ID of configuration created</td></tr><tr><td><code>buildsessionidfile</code></td><td>Path to file containing the Session ID of configuration created</td></tr><tr><td><code>teststage</code></td><td>Name of the test stage</td></tr><tr><td><code>labid</code></td><td>Unique ID for a set of test labs in case multiple labs are running simultaneously</td></tr><tr><td><code>proxy</code></td><td>Address of proxy to run connection through</td></tr><tr><td><code>failbuild</code></td><td>Exit with an error code if an error is encountered (Default: false)</td></tr><tr><td><code>args...</code></td><td>Extra arguments for running mocha framework tests</td></tr></tbody></table>

## Logging <a href="#logging" id="logging"></a>

To **enable logs,** you can set the `NODE_DEBUG` environment variable to a value defining the output per the table below:

| Linux                  | Powershell             |
| ---------------------- | ---------------------- |
| `export NODE_DEBUG=sl` | `$env:NODE_DEBUG="sl"` |

| Value     | Description                                                    |
| --------- | -------------------------------------------------------------- |
| `sl`      | Display log output to the console                              |
| `sl-file` | Export the log information to a log file named '`sl.node.log`' |

Furthermore, you can **set the logging level** using the `SL_LOG_LEVEL` environment variable with one of the following options: `info` (default) or `debug`.

{% code overflow="wrap" lineNumbers="true" %}

```bash
export NODE_DEBUG=sl
export SL_LOG_LEVEL=debug
```

{% endcode %}

To write the log to a specific directory, use `SL_LOG_OUTPUT_FILE` and ensure that the directory has a write permissions.

{% code overflow="wrap" lineNumbers="true" %}

```bash
export NODE_DEBUG=sl-file
export SL_LOG_LEVEL=debug
export SL_LOG_OUTPUT_FILE=/var/log/my-custom.log
```

{% endcode %}

To **disable logs**, unset the `NODE_DEBUG` variable.

{% code overflow="wrap" lineNumbers="true" %}

```
export NODE_DEBUG=
```

{% endcode %}

{% hint style="info" %}
The above examples are for Linux shells; for Windows CMD prompt, use the `set` command.
{% endhint %}
