For the complete documentation index, see llms.txt. This page is also available as Markdown.

Mocha Tests framework

Mocha test framework

SeaLights integrates with Mocha through the slnodejs mocha wrapper, which runs SeaLights as a Mocha reporter and reports test results to the server.

Basic command

Everything after -- is passed straight to Mocha.

npx slnodejs mocha \
  --tokenFile ./sltoken.txt \
  --buildSessionIdFile buildSessionId \
  --testStage "Unit Tests" \
  --useSlNode2 \
  -- --recursive test

Replace --recursive test with your actual Mocha arguments.

Parameters

Parameter
Purpose

--tokenFile / --token

SeaLights authentication

--buildSessionIdFile / --buildSessionId

Build session identifier

--testStage

Stage name (e.g. "Unit Tests")

--useSlNode2

Use the v2 Node agent runtime

--

Separates SeaLights options from Mocha arguments

Multiple reporters

To run SeaLights alongside other reporters (e.g. Allure, JUnit), install mocha-multi-reporters and create a config.json:

Then run:

Suite mapping

To map functional tests to Mocha suites instead of individual tests:


Back to → Capturing Tests

Last updated

Was this helpful?