-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Coverage Report Path in Browser Mode Does Not Consider "reportsDirectory" #5013
Comments
Has this been working with earlier versions of Vitest? I think this part of the UI is the root cause. For some reason the vitest/packages/ui/client/composables/navigation.ts Lines 15 to 30 in 7314857
These built-in reporters are provided by Istanbul. Changes for them should be requested at https://github.com/istanbuljs/istanbuljs. But it sounds like you should rather use
|
Hi @AriPerkkio, this is the first time I use vitest, I don't know if it worked before, sorry.
|
I think currently there's a difference between "vitest:browser" middleware plugin and "vitest:ui" plugin. "vitest:browser" only serves its own html/js assets but "vitest:ui" also serves generated coverage html: vitest/packages/browser/src/node/index.ts Lines 25 to 28 in d53b858
vitest/packages/ui/node/index.ts Line 20 in d53b858
This "server side" code might also need to be adjusted for coverage preview on (headed) browser mode. |
Hi, I've set up a branch using |
The problem seems to be here: https://github.com/oscarmarina/lit-vitest-testing-comparison/blob/main/index.html#L8 If I change previous line using absolute path |
|
hi @userquin ==== |
It works (when removing the directory option) because it is on the root, once you include the report directory the client will request IIRC I did the original PR to include coverage in the ui 😅 |
Describe the bug
Hello,
I am experiencing an issue with the coverage report in Vitest when using Browser Mode with a web component built with Lit. When I run the tests and try to view the coverage, the page is blank. It seems that the coverage report is looking for the folder at the root of the project, not taking into account the reportsDirectory setting in my vite.config.js file.
reportsDirectory:
./test/coverage/,
==
I would like to suggest an improvement for the LCOV reporter. Currently, the LCOV reporter generates the same files as the HTML reporter. However, I believe the LCOV reporter could be improved by creating a separate folder for its output. This would keep everything more organized, instead of leaving all the files in the root of the /coverage folder. Furthermore, when the Vitest UI is activated, the LCOV reporter is "equated" to the HTML reporter for generating the report view.
Reproduction
You can reproduce this issue by downloading the repository from my GitHub or viewing it on Stackblitz.
https://github.com/oscarmarina/lit-vitest-testing-comparison
https://stackblitz.com/github/oscarmarina/lit-vitest-testing-comparison
System Info
Used Package Manager
npm
Validations
The text was updated successfully, but these errors were encountered: