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 --es6ModulesFor React applications, you should add the flag: --babylonPlugin jsx. To scan both .ts and .tsx files, you should add the flag: --babylonPlugins typescript,jsx
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 (
.tsand/or.tsx) in a dedicated environment variableSL_fileExtensionsscan the application files with the
workspacepathparameter 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 export SL_fileExtensions=".ts,.tsx"
call 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.
It is important to always use the exact same module names each time you report a new build.
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 --okLast updated
Was this helpful?

