cenfun / monocart-coverage-reports

A code coverage tool to generate native V8 reports or Istanbul reports.
MIT License
69 stars 6 forks source link

[Bug] Uncovered branches before closing <script> tag in Vue files #20

Closed azamat-sharapov closed 2 months ago

azamat-sharapov commented 6 months ago

Describe the bug

In our codebase, some Vue files have uncovered "branch" in some cases. I noticed that it always falls to the end of <script> block (whatever line it could be there). Unfortunately I cannot create reproduction, because it's a big project and this is happening only with some files. Other files with similar code have 100% coverage. Please see screenshot. Can you suggest what I could try to solve this issue? Maybe you could help debugging this? My current workaround is to use ignore comments.

Screenshot (insufficient branch coverage is highlighted in red) ![image](https://github.com/cenfun/monocart-coverage-reports/assets/3023661/a72b3a48-8b32-41f6-9880-9e47885308e4) ---

Thanks!

cenfun commented 6 months ago

Could you please tell us more infomation? 1, build tool and version, for example, webpack@5? 2, if minify disabled? for example: webpack config: mode = development 3, provide a small source file

azamat-sharapov commented 6 months ago

We are using Vite version 5.0.12 and it has build.minify = false.

Here is source of one of those files -removed-
cenfun commented 6 months ago

Sorry I can't reproduce the issue. see repo: https://github.com/cenfun/vite-vue-coverage image image

azamat-sharapov commented 6 months ago

That's the problem - I can't create isolated reproduction as well. But I noticed another thing: when there are multiple tests (multiple test files) that are testing same Vue file, sometimes end result is uncovered lines. When I disable one of them and just run one test file - it shows as fully covered. It seems like there is conflict sometimes. I will try to create reproduction with such case, but I cannot promise that I'll be able to do that, because I see this happening in our big project.

cenfun commented 2 months ago

closed because it's long time no activity. Please open a new issue if the issue is still relevant