/
Using Node.js Agents - Scanning a build

Using Node.js Agents - Scanning a build

To collect coverage information, SeaLights agents must scan the javascript files for the build information.

Scanning a build

Scanning a build in Node.js is done using the Node.js Build scanner with the build flag.

npx slnodejs scan --tokenfile ./sltoken.txt --buildsessionidfile buildSessionId --workspacepath "." --scm git --es6Modules

For React applications, you should add the flag: --babylonPlugin jsx. To scan both .ts and .tsx files, you should add the flag: --babylonPlugins typescript,jsx

See 'Node.js Command Reference - Scanning a build' for full parameter details

Scanning multi modules

If you want to report separate parts of the application as separate modules, you can do so by scanning each part with the --uniqueModuleId option.

When you finish reporting all the modules, you need to send the event with the buildend command and either the --ok or --failed depending on the result of your build process.

npx slnodejs scan --tokenfile ./path/to/sltoken.txt --buildsessionidfile buildSessionId --workspacepath "." --scm git --es6Modules --uniqueModuleId module-name-one npx slnodejs scan --tokenfile ./path/to/sltoken.txt --buildsessionidfile buildSessionId --workspacepath "." --scm git --es6Modules --uniqueModuleId module-name-two npx slnodejs buildend --tokenfile ./path/to/sltoken.txt --buildsessionidfile buildSessionId --ok

Related content

Using Node.js Agents - Scanning and running a ts-node project
Using Node.js Agents - Scanning and running a ts-node project
More like this
Using Node.js Agent - Generating a session ID
Using Node.js Agent - Generating a session ID
More like this
Using Node.js Agent - Running Tests
Using Node.js Agent - Running Tests
More like this
SeaLights Node.js agent - Scanning and Instrumentation of a Front-End app
SeaLights Node.js agent - Scanning and Instrumentation of a Front-End app
More like this
Running Tests using Mocha test framework
Running Tests using Mocha test framework
More like this
Using Node.js Agents - Running backend server using SeaLights agent
Using Node.js Agents - Running backend server using SeaLights agent
Read with this