Overview
Generally, industry-standard dictate the Javascript files will be minified and combined when deploying them to production.
SeaLights scans the builds, and therefore, sees only the minified/combined files, making it impossible to give the proper context to the team regarding the tests and the code changes on the specific files.
The source map files are a way to link back the minified/combined files back to the source code, allowing the developer to debug the application easily and give SeaLights the possibility to link the scanned files to their original source and improving the value received.
Common Issues
No Column Information
In the SeaLights Cockpit, you may see warnings about Detected source-maps without column information. Source maps information might be incorrect and may result in inaccurate coverage
Mapping only the line information, often called “cheap-source-maps”, give the ability to the developer to easily debug the code, but, does not allow SeaLights the ability to calculate the exact coverage.
In order to calculate the correct coverage, Sealights require the column information on top of the line information. in order to achieve that, please make sure you have set the following, depending on your build tool:
Webpack
Set the devtool property to devtool: 'source-map'
or devtool: 'inline-source-map'
More details are available as part of the official Webpack documentation: https://webpack.js.org/configuration/devtool/
Typescript (tsc)
Add the relevant compiler option --sourceMap
or --inlineSourceMap
to the command line or to your tsconfig.json
More details are available as part of the official Typescript documentation: https://www.typescriptlang.org/docs/handbook/compiler-options.html#compiler-options
After the completion of Sealights scanning and/or instrumentation command, the source map files are not required anymore from Sealights' point of view. In order to avoid publishing those files in your production environments and/or optimize the size of the deployed folder, you can delete them.
For example, you can use the following Linux command to find and delete all the files before packing and deploying: find . -name "*.js.map" -exec rm {} \;