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

Scanning a ts-node build

Scanning a build in Node.js is done using the Node.js Build scanner with the scan command flag and requires:

  • explicit type of files (.ts and/or .tsx) in a dedicated environment variable SL_fileExtensions

  • scan the application files with the workspacepath parameter pointing to the source files directory (.ts)

export SL_fileExtensions=".ts,.tsx"

npx slnodejs scan --tokenfile /path/to/sltoken.txt --buildsessionidfile buildSessionId --workspacepath "./src" --scm git 

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

Last updated

Was this helpful?