Skip to content

Coverage Report Path in Browser Mode Does Not Consider "reportsDirectory" #5013

@oscarmarina

Description

@oscarmarina

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/,

reportsDirectory

==

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

npm i && npm run test

System Info

System:
    OS: macOS 12.7.2
    CPU: (4) x64 Intel(R) Core(TM) i5-5287U CPU @ 2.90GHz
    Memory: 17.82 MB / 16.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 20.10.0 - ~/.nvm/versions/node/v20.10.0/bin/node
    Yarn: 1.22.19 - ~/.nvm/versions/node/v20.10.0/bin/yarn
    npm: 10.3.0 - ~/.nvm/versions/node/v20.10.0/bin/npm
    pnpm: 8.6.5 - ~/.nvm/versions/node/v20.10.0/bin/pnpm
  Browsers:
    Chrome Canary: 122.0.6257.0
    Safari: 17.2.1

Used Package Manager

npm

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    feat: browserIssues and PRs related to the browser runner

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions