Flags Guide
The slnodejs flags and settings you decide on: what each does, the problem it solves, how to tell whether you need it, and an example.
This page explains the slnodejs flags and environment settings that you choose per setup: what each one does, which problem it solves, how to tell whether you need it, and an example. Browser instrumentation flags have their own guide: Browser Agent → Flags and Settings Guide. For the complete list with aliases and defaults, see the Command Reference.
Quick reference
Commands do not know which build they belong to
Always after config
Certificates not verified, or rejected behind TLS inspection
Security requires verification, or a TLS-inspecting proxy is in place
Commands must talk to another server than the token's
A Collector or gateway sits in front of SeaLights
Wrong or missing links to source
No origin remote, non-GitHub SCM, or no Git checkout
No view of a release made of services
You test several services together as one release
Lightweight V8 coverage cannot be processed
You use lightweight V8 mode or raw Lambda coverage
Back-end coverage not per test
Functional tests send test headers and you want per-test coverage
Downstream services lose the test identity
The service calls other instrumented services
No coverage from an unsupported test runner
You run a test framework through run
Only one report uploaded; test stage closed early
Several report files, or several upload steps
Memory or start-up overhead
Large services where per-test-stage coverage is enough
Worker processes not covered
The program forks processes that run your code
Need to turn SeaLights off without changing commands
Environments where coverage must stop temporarily
Authentication and connectivity
--tokenFile (vs --token)
What it does: reads the agent token from a file (default
sltoken.txt).Problem it solves: a token passed with
--tokenis visible in the process list, shell history and CI logs.You need it if: always. Use
--tokenonly where you cannot write a file.Example:
printf '%s' "$SEALIGHTS_AGENT_TOKEN" > sltoken.txtthen--tokenFile sltoken.txt.
--buildSessionIdFile / --buildSessionId
What it does: tells the command which build session (build) it belongs to.
Problem it solves: without the right build session, coverage and test results attach to another build or are rejected.
You need it if: always after
config. Use the file within a job (and as a CI artifact between jobs); use the value when you pass the ID as a pipeline variable.runandnycReportalways need one, even with--labId.How to tell:
runprintsSealights is disabled, running command without sealights, or results appear on another build.Example:
--buildSessionIdFile buildSessionIdor--buildSessionId "$SL_BSID".
--failOnError
What it does:
truemakes the command exit with status code 1 when it fails. By default, failures exit with 0.Problem it solves: a failed
configorscanpasses silently, and every later step reports to nothing.You need it if: the team must notice when SeaLights is not set up for a build. Typically on
configandscan; leave it off on test steps so tests never fail because of SeaLights.Example:
npx slnodejs scan ... --failOnError true
--proxy
What it does: sends traffic to SeaLights through an HTTP proxy. The preload script and test listener use
SL_proxy.You need it if: the build agents or test environment reach the internet only through a proxy.
How to tell:
curl https://<your-domain>.sealights.cofails without--proxy/HTTPS_PROXY; the log shows connection timeouts.Example:
--proxy http://proxy.example.com:3128
SL_TLS_VERIFY and SL_CA_FILE
What they do:
SL_TLS_VERIFY=trueverifies TLS certificates of all SeaLights connections, including through a proxy.SL_CA_FILEadds a corporate CA (PEM) on top of the defaults.Problem they solve: by default, connections through a proxy are not verified; with verification on, a TLS-inspecting proxy's certificate is rejected unless its CA is trusted.
You need them if: your security policy requires certificate verification, or your proxy inspects TLS.
How to tell: the log shows
enabling SL_TLS_VERIFY would currently fail for <server>(verification would fail; you needSL_CA_FILE), orTLS certificate verification for <server> failed.Example:
export SL_TLS_VERIFY=true SL_CA_FILE=/etc/ssl/certs/corporate-ca.pem. Details: Troubleshooting → TLS and proxy.
--overrideServer
What it does: sends the command's traffic to this server instead of the server named in the token.
You need it if: a SeaLights Collector or an internal gateway must relay CLI traffic.
Example:
--overrideServer https://collector.example.com:16500/api. Remote configuration takes precedence over this flag.
Build session
--appName, --branchName, --buildName (config)
What they do: identify the application, branch and build.
Problem they solve: SeaLights compares builds of the same application and branch; reused or unstable names break that history.
You need them if: always on
config. Keep--appNamestable; make--buildNameunique per build (CI build number, run ID plus attempt).How to tell:
Module already existserrors mean a--buildNamewas reused.
prConfig flags
What they do:
--targetBranch,--latestCommit,--pullRequestNumber,--repositoryUrlcreate a pull request build session compared against its target branch.You need them if: the pipeline runs for pull requests and you want pull-request-level analysis. Use
prConfiginstead ofconfig.
--beControlledVersions
What it does: before creating the session, installs the
slnodejsversion that SeaLights recommends for your account.You need it if: you want SeaLights (the dashboard) to control the agent version without changing your pipeline.
Scanning
--scanDir
What it does: the folder whose code is scanned.
Problem it solves: coverage is matched to scanned files by path and position; scanning other files than those that run means no match.
You need it if: always (except integration builds). Scan the build output for transpiled or bundled code, the source folder for plain JavaScript.
How to tell:
dryRun --scanDir <dir>→included-files.jsonlists exactly the files that run.Example:
--scanDir dist
--projectRoot
What it does: the root that file paths are reported relative to (default: the working directory). Accepted by
scan,run,mocha,nycReport.Problem it solves: if
scanand the running application use different roots, their file paths differ and coverage does not match.You need it if: the scan runs in one directory and the application or tests in another (a container's
/app, a sub-folder, a different CI workspace), or an NYC report contains absolute paths from another machine.How to tell: the agent sends data but coverage stays at 0%;
dryRun --hasNycReportreportsNyc Pathsproblems.Example:
npx slnodejs run --projectRoot /app ...with the scan run from the repository root that contains the same layout.
--scmType git
What it does: reports commits and contributors from the local Git repository.
Problem it solves: without it, SeaLights cannot show who changed what, or which changes are untested.
You need it if: the scan runs in a Git checkout. In CI, use a full clone (shallow clones have no history).
How to tell: the build in SeaLights has no commits; in CI,
git log --oneline | wc -lreturns 1.Example:
--scmType git(GitHub Actions:fetch-depth: 0).
--repositoryUrl, --scmProvider, --scmVersion, --commit
What they do: override the repository URL (default: the
originremote), the SCM type (Githubdefault,Bitbucket,Gitlab), the on-premises SCM version, and the commit ID.You need them if: the checkout has no
origin(or it points to a mirror), you use Bitbucket or GitLab, an on-premises SCM server, or the scan runs outside a Git checkout.How to tell: links from SeaLights to your code are missing or point to the wrong host.
--es6Modules
What it does: on
scan, parses files as ES modules; onrunandmocha, loads the ES module hook so NYC covers ES module code.Problem it solves: ES module code is not parsed correctly as classic scripts, and without the hook it is not covered at runtime.
You need it if:
package.jsonhas"type": "module", the code uses.mjs, or the files contain top-levelimport/export.How to tell: the dashboard shows
parsed to AST with the following error(s)warnings; orruncollects no coverage from an ES module service.Example:
npx slnodejs run --es6Modules ... -- server.mjs. The preload script cannot do this; userun.
--babylonPlugins
What it does: extra parser plugins:
jsx,decorators-legacy.You need it if: you scan code that still contains JSX or decorators (not needed for compiled output).
How to tell: parse-error warnings for
.jsxfiles or decorator lines.Example:
--babylonPlugins jsx,decorators-legacy
.slignore and --excludeFiles
What they do: exclude files from the scan (
.gitignoresyntax).Problem they solve: tests, mocks, generated code and build tooling distort coverage percentages and slow the scan.
You need them if: almost always. Prefer
.slignore;--excludeFileshas a known issue (see Configuration → Ignore files).How to tell:
dryRun→included-files.jsoncontains test or generated files.Example:
.slignorewithtest/,**/*.spec.js,coverage/.
--moduleName
What it does: names a module, so several scans can report parts of one build session.
Problem it solves: a build session can be scanned only once; a second scan fails.
You need it if: one build is made of several folders: a monorepo, client and server of an SSR app, several services released as one.
How to tell: the second
scanof the same build session fails.Example:
--scanDir packages/api/dist --moduleName api, then--scanDir packages/web/dist --moduleName web, thencompleteScan --ok.
--useModulePrefix
What it does: prefixes file paths and method IDs with the module name.
You need it if: two modules contain files with the same relative path (for example both have
src/index.js), and their coverage collides.
--dependency / --dependenciesFile
What they do: create an integration build made of other builds (
appName@branch@buildor build session IDs).You need them if: you test several separately built services together and want one view of the release. See Integration Build.
Example:
--dependency "billing@main@2.3.1;orders@main@5.0.0"
--partialBuildMapping
What it does: uploads the build map in chunks of the given number of files.
You need it if: very large builds fail or time out while uploading the build map.
Example:
--partialBuildMapping 500
--rawCoverage
What it does: sends the metadata SeaLights needs to process V8 coverage.
You need it if: you use Lightweight V8 Coverage Mode, or raw V8 coverage from the Lambda layer. Without it, lightweight coverage cannot be matched.
Example:
npx slnodejs scan ... --rawCoverage
--awsConfigure and --awsConfigKeysToIgnore
What they do: write an
sl-config.jsoninto each subdirectory of--scanDirfor the Lambda layer; leave keys out of it.Problem they solve: the Lambda layer needs the build session (and optionally lab, Collector, proxy) without you setting every variable on every function.
You need them if: you deploy Node.js Lambda functions. Always add
--awsConfigKeysToIgnore token, so the token is not packaged in plain text, and setSL_TOKENon the function.Example:
--awsConfigure --awsConfigKeysToIgnore token
--useBranchCoverage
What it does: collects branch coverage in addition to method coverage.
You need it if: your reports or quality gates use branch coverage. SeaLights remote configuration takes precedence.
Method mapping flags
--es6Classes, --enrichPrivateMethods, --hashIncludeNestedMethods, --excludeNestedMethods, --sourceHash, --enrichByLinesMatch, --enrichByMethodRange, --recognizeBabelCreateClass, --experimentalDeduplicateEnrichedMethodsWithOriginals, --autoResolveProjectRoot.
What they do: change how methods are identified and matched to your sources.
You need them if: SeaLights support asks you to, after looking at your build. Signals that lead there: methods reported with wrong names or duplicated, many methods shown as modified although the code did not change, or classes compiled by Babel or TypeScript not matched.
Important: several of them change method IDs. Turning one on or off makes SeaLights report many methods as modified once. Keep them the same for every build.
Running the application or tests (run, mocha, preload)
--labId
What it does: the lab (test environment) the agent reports coverage for. Coverage goes to the test stage open on that lab.
Problem it solves: without it, the lab is the build session ID. Two environments of the same build, or a test runner that opens its test stage on a named lab, do not match.
You need it if: the application runs in a shared or named test environment, more than one environment runs the build, or the tests run on another machine and open their test stage on a lab.
How to tell: the agent appears in the Agent Monitor, but the test stage gets no coverage; the test runner uses a lab ID the agent does not.
Example:
npx slnodejs run --labId qa-env ...(preload:SL_labId=qa-env). Use the same lab ID for all services and replicas of one environment.
--forwardSignals and --signalForwardingTimeout
What they do: forward
SIGTERM/SIGINTfromslnodejsto your program, and wait up to the timeout (default 10 seconds) beforeSIGKILL.Problem they solve: without forwarding, stopping the container stops
slnodejsbut your program gets no signal: no graceful shutdown.You need them if: the service runs in a container, Kubernetes, or a process manager that stops it with signals.
How to tell: the service does not log its shutdown when the container stops, or stops only after the platform's kill timeout.
Example:
npx slnodejs run --forwardSignals ... -- server.js. The preload script does not forward signals.
--httpServerColoring
What it does: reads the test identity from incoming HTTP request headers and attributes the coverage of each request to that test.
Problem it solves: without it, the coverage of a service under functional tests is attributed to the test stage only, not to individual tests, which limits Test Impact Analysis for those tests.
You need it if: functional tests (with a SeaLights plugin, or a browser front end with context propagation) call this service, and you want per-test coverage.
How to tell: test stage coverage exists, but per-test coverage for API or E2E tests is empty.
Example:
npx slnodejs run --httpServerColoring --labId qa-env ... -- server.js. Only withrunormocha; the preload script cannot turn it on. Not available in lightweight V8 mode.
--httpClientColoring
What it does: adds the current test identity to outgoing HTTP requests.
You need it if: this service calls other instrumented services during tests, and they should attribute their coverage to the same test.
Example:
npx slnodejs run --httpServerColoring --httpClientColoring ... -- gateway.js
--useinitialcolor true
What it does: reports coverage that is not attributed to an individual test.
Problem it solves: a test runner started with
runhas no SeaLights integration, so no test is identified and its coverage is otherwise not reported.You need it if: you run a test framework (Jasmine, a custom runner) through
slnodejs run. Not for application servers.Example:
npx slnodejs run --useinitialcolor true ... -- node_modules/jasmine/bin/jasmine.js. The flag takes a value.
--libraries
What it does: includes the listed packages from
node_modulesin coverage.Problem it solves: code under
node_modulesis not covered by default; internal packages installed there (monorepo workspaces, shared company packages) get no coverage.You need it if: part of your own code is consumed from
node_modules, and you scanned it.Example:
--libraries @my-org/shared,@my-org/billing-core
--collectorUrl
What it does: sends coverage to a SeaLights Collector instead of directly to SeaLights (preload:
SL_collectorUrl).You need it if: the test environment cannot reach SeaLights directly.
--es6Modules, --projectRoot
See --es6Modules and --projectRoot above; the same reasoning applies at runtime.
--omitFootprintsLeadingSlash
Removes a leading / from reported file paths. Use it only when SeaLights support identifies a leading-slash path mismatch.
Test stages and reports
--testStage
What it does: names the test stage (
Unit Testsby default onmocha,openTestStage).Problem it solves: with the default, different kinds of tests mix in one test stage.
You need it if: always: name each test stage after the kind of tests (
Unit Tests,API Tests,E2E Tests). OncloseTestStage, pass it when several test stages can be open on the same lab.
--disableTia (mocha)
What it does: runs all tests, ignoring Test Impact Analysis recommendations.
You need it if: a run must be complete, for example nightly or release regression, or to establish a baseline.
How to tell: fewer tests ran than exist, and that is not wanted for this run.
--testProjectId and --prID (mocha)
What they do:
--testProjectIdseparates test stages with the same name from different teams or products;--prIDseparates pull request runs from other runs of the same test stage.You need them if: several teams use the same test stage name for the same application, or pull request pipelines run the same test stage as the main branch.
uploadReports flags
--file/--filesFolder: pass several files or folders as one comma-separated list; a repeated flag keeps only its last value.--testStage: opens and closes a test stage just for this upload. Leave it out when the test stage is already open.--hasMoreRequests false: closes the test stage after the upload. Leave the default (true) when more uploads follow.--type,--source: describe the report (default JUnit, Mocha). Change--typeonly for other report types, for examplecommitLog.
nycReport --projectRoot
You need it if: the NYC report was created in another directory or machine than the scan, so its absolute paths do not resolve.
How to tell:
dryRun --hasNycReport --report coverage/coverage-final.jsonreportsNyc Pathsproblems.
Environment settings
SL_useLeanCoverageListener
What it does: collects coverage from Node.js V8 coverage instead of NYC instrumentation.
Problem it solves: NYC instruments code in memory; large services can run out of memory, start slowly or run tests slower.
You need it if: the service shows memory or start-up problems with the agent, runs on Node.js later than 20.6.0, and coverage per test stage is enough.
How to tell: memory or start time increase noticeably when the agent is added;
JavaScript heap out of memorywith the agent only.Example: scan with
--rawCoverage, thenSL_useLeanCoverageListener=true npx slnodejs run .... See Lightweight V8 Coverage Mode.
SL_enableChildProcessPatcher
What it does: starts the agent in Node.js child processes the program spawns. In lightweight V8 mode, makes child processes write coverage at the interval.
You need it if: the program forks workers that run your code (
cluster,child_process.fork, test runners with worker processes such as Jest).How to tell: coverage covers only the parent process's code; worker code shows 0%.
Example:
SL_enableChildProcessPatcher=true npx slnodejs run ...
SL_useIstanbul
Uses the Istanbul engine instead of NYC. Use it only when SeaLights support asks you to.
SL_enabled
What it does:
falsemakes the test listener collect and send nothing, while the program runs normally.You need it if: you want to turn SeaLights off in an environment without changing the start command or image.
SL_newUniqueId
Uses the newer method ID format. Use it only when SeaLights support asks you to, and set the same value for the scan and the test listener.
SL_httpTimeout, SL_httpMaxAttempts, SL_httpAttemptInterval
You need them if: connections to SeaLights are slow or flaky (timeouts in the log), for example over a congested proxy.
Example:
SL_httpTimeout=60000 SL_httpMaxAttempts=5
SL_acceptAllRemoteParams
What it does:
falseapplies SeaLights remote configuration only to the settings it configures by design.You need it if: a flag you pass is overridden by remote configuration and you need your value to win. Talk to SeaLights support first.
Logging
NODE_DEBUG=sl,sl-file and SL_LOG_LEVEL=debug when you troubleshoot. See Troubleshooting → Turn on logs.
Remaining flags
These rarely need a decision:
--compressSlMapping
The build map upload is large and slow. SeaLights can also set it remotely.
--scanDotFolders
Code you want scanned lives in a folder whose name starts with a dot (skipped by default).
--recursive
Leave the default (true).
--sendContributors false
Contributor details must not be sent.
--jobName, --logsUrl
You want the CI job name and a link to the CI logs shown with the build.
--testGroupId
SeaLights support asks you to group test runs.
--skipUpgrade
The agent must not try to upgrade itself.
--newInstrumenter, --resolveWithoutHash, --useBabylon
Leave the defaults.
--useSlNode2, --enforceFullRun
Deprecated. Remove --useSlNode2; use --disableTia instead of --enforceFullRun.
Last updated
Was this helpful?

