Closed cedric-talbot closed 3 months ago
You may try option sourcePath
to normalize the full path of the source file:
const path = require("path")
const coverageOptions = {
sourcePath: (filePath, info)=> {
if (info.distFile) {
return `${path.dirname(info.distFile)}/${filePath}`;
}
return filePath;
}
}
Thanks a lot ! I had tried playing with sourcePath
but did not notice I could get the distFile
here.
Hello,
I currently have the following repository architecture for 3 separate applications.
These 3 applications are launched separately, meaning the build files are not aware of the application they belong to. I need to test how the applications interact with each other, meaning I need to have playwright test suites that will go through all 3 applications, and I can't have separate playwright runs. However, I need the final coverage results to have the correct file structure, with the files labeled depending on their application (for example I need the index.tsx file in app1 to have
apps/app1/index.tsx
as its url in my json report).I tried rewriting the url from the coverage data returned by playwright's
stopJsCoverage
, however the coverage returned by MCR has all files prefixed by_N_E
and has lost theapps/appX
information I added.I dug a bit and noticed that it's coming from the
unpackDistFile
function that adds anoriginalList
argument that is then used while ignoring the data initially provided. Do you have any idea if there's a way to avoid this behaviour ? If not, do you know of a way to solve my issue otherwise ?mcr.config.ts
playwright.config.ts, global-teardown.ts & global.setup.ts were build following https://github.com/cenfun/playwright-coverage