Closed Aghassi closed 2 months ago
This path issue could be a sourcemap issue. The sourcemap of the file didn't provide the full path of the file.
{"version":3,"sources":["file.js"],"sourcesContent":[ ...
It is supposed to be:
{"version":3,"sources":["path/to/file.js"],"sourcesContent":[ ...
Please try to normalize the sourcePath
with option sourcePath
.
Possible solutions:
const path = require("path")
// MCR coverage options
{
sourcePath: (filePath, info)=> {
if (!filePath.includes('/') && info.distFile) {
return `${path.dirname(info.distFile)}/${filePath}`;
}
return filePath;
},
}
Thanks I believe that did it! That's definitely worth documenting in the README. Should it go in this repo or the monocart main one?
Thank you for the reminder, I have updated the document for both jest-monocart-coverage
and monocart-coverage-reports
repo.
I followed the example provided in the README, but the issue I'm seeing with my system is that the v8 data strips out the sourcePath from the file. This does not happen if the jest config does not have
coverageProvider: 'v8'
. The thing is, I'm not sure why this is happening. I'm opening this issue more to discuss. I have not made a way to publicly reproduce because this is on our internal monorepo with Bazel.Basically, the lcov file generate is missing
path/to/file.ts
with that option on. It just returnsfile.ts
.I have some theories, but nothing concrete. Any ideas?