You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
is there a good solution to filter out files that have have no or no valid source maps?
The scenario
I have the sourceFilter set in the following way:
sourceFilter: {'**/src/**': true,}
My original expectation was that the resulting report should only include files in the src directory, but instead it also has files under the domain:
I understand now that sourceFilter and sourcePath only trigger on actual source maps. In our case the additional 'files' are script and style blocks in HTML files, CSS files (because Vite does not support CSS source maps), and files that have invalid source maps (because they are created from non JS-files). The first two aren't really an issue, because I can clearly identify those in the entryFilter or onEntry hooks.
The problem is the third kind of file. The source maps for these files look something like this:
I was trying to identify those files in the entryFilter but sadly the entries don't give me a clear differentiator compared to files with valid source maps.
The above example is against the build of our app. When running against dev (with Nuxt), there are also a lot of Hot Module files under the domain.
Potential solution
When I originally started to play around with MCR, I generated a V8 report for everything and then checked what the filters are doing. I figured out that the sourceFilter is way to filter out, what appear in the final report, but I was surprised that not all files would trigger the sourceFilter hook.
Would it make sense to include all files in sourceFilter and sourcePath, even if they have no or no valid source maps? If not, would it be feasable to include a outputFilter which could be used to filter all files that would end up in the report?
This would also be useful when using CoverageReport with raw reports, because in this case onEntry and filterEntries does not trigger
The text was updated successfully, but these errors were encountered:
entryFilter is used to filter the files that provide coverage data, maybe sourcemap too
sourceFilter is used to filter the files that extracted from the sourcemap
so we should use entryFilter to check whether the sourcemap is valid
entryFilter: (entry) => {
// skip files without sourcemap
if (entry.source?.includes("sourceMappingURL") === false) {
return false;
}
see cenfun/monocart-reporter#161 (comment)
but i don't think there is a good way to check the sourcemap content. it requires to read sourcemap file content but entryFilter is does not support asynchronous operations.
Hello,
is there a good solution to filter out files that have have no or no valid source maps?
The scenario
I have the
sourceFilter
set in the following way:My original expectation was that the resulting report should only include files in the
src
directory, but instead it also has files under the domain:I understand now that
sourceFilter
andsourcePath
only trigger on actual source maps. In our case the additional 'files' arescript
andstyle
blocks in HTML files, CSS files (because Vite does not support CSS source maps), and files that have invalid source maps (because they are created from non JS-files). The first two aren't really an issue, because I can clearly identify those in theentryFilter
oronEntry
hooks.The problem is the third kind of file. The source maps for these files look something like this:
I was trying to identify those files in the
entryFilter
but sadly the entries don't give me a clear differentiator compared to files with valid source maps.The above example is against the build of our app. When running against dev (with Nuxt), there are also a lot of Hot Module files under the domain.
Potential solution
When I originally started to play around with MCR, I generated a V8 report for everything and then checked what the filters are doing. I figured out that the
sourceFilter
is way to filter out, what appear in the final report, but I was surprised that not all files would trigger thesourceFilter
hook.Would it make sense to include all files in
sourceFilter
andsourcePath
, even if they have no or no valid source maps? If not, would it be feasable to include aoutputFilter
which could be used to filter all files that would end up in the report?This would also be useful when using
CoverageReport
withraw
reports, because in this caseonEntry
andfilterEntries
does not triggerThe text was updated successfully, but these errors were encountered: