To capture code coverage on your backend server, you need to run it using our Node.js test listener agent.
Unix: ./node_modules/.bin/slnodejs run --tokenfile /path/to/sltoken.txt --buildsessionidfile buildSessionId [--labid <Lab ID>] --workspacepath "." --useinitialcolor true -- /your/backend/server/command Windows: call .\node_modules\.bin\slnodejs run --tokenfile \path\to\sltoken.txt --buildsessionidfile buildSessionId [--labid <Lab ID>] --workspacepath "." --useinitialcolor true -- \your\backend\server\command
Note the /your/backend/server/command
from above refers to "./server/app.js"
in the example of command below:
./node_modules/.bin/slnodejs run --tokenfile ./sltoken.txt --buildsessionidfile buildSessionId --labid "LAB_ID_2" --workspacepath "./server" --useinitialcolor true --useslnode2 -- "./server/app.js"
When the application is up and running and the Sealights Listener agent configured, you can see it properly running as a new entry in the Cockpit -> Live Agents Monitor screen.
You also have the ability to validate the startup parameters in use with your application via the following commands
Linux:
ps -ef | grep slnodejs
Windows:
C:\\Windows\\System32\\wbem\\WMIC.exe process where "name like '%slnodejs%'" get commandline,processid
(CMD prompt)
For distributed Test Runner & Test Listener, we recommend using the Lab ID parameter in order to link between the two.
If the lab ID is not provided, the session ID will be used as a Lab ID
See 'Node.js Command Reference - Running backend server' for full parameter details