Skip to content
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

Text reporter still creates an empty coverage folder #5722

Closed
6 tasks done
xixixao opened this issue May 14, 2024 · 3 comments · Fixed by #5731
Closed
6 tasks done

Text reporter still creates an empty coverage folder #5722

xixixao opened this issue May 14, 2024 · 3 comments · Fixed by #5731
Labels
feat: coverage Issues and PRs related to the coverage feature p2-nice-to-have Not breaking anything but nice to have (priority)

Comments

@xixixao
Copy link

xixixao commented May 14, 2024

Describe the bug

Run

npx vitest run --coverage --coverage.reporter=text

You will get an empty coverage folder

Reproduction

  1. Use the default playground: https://stackblitz.com/fork/github/vitest-dev/vitest/tree/main/examples/basic?initialPath=__vitest__/
  2. Quit the watcher
  3. Run the command
  4. Observer the folder

System Info

System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 18.18.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.2.3 - /usr/local/bin/npm
    pnpm: 8.15.6 - /usr/local/bin/pnpm
  npmPackages:
    @vitest/coverage-v8: ^1.6.0 => 1.6.0 
    @vitest/ui: latest => 1.6.0 
    vite: latest => 5.2.11 
    vitest: latest => 1.6.0 

(it reproes on my mac too)

Used Package Manager

npm

Validations

@AriPerkkio
Copy link
Member

During test run Vitest needs to create coverage/.tmp where raw coverage results from tests are stored. After the coverage report has been generated it removes the .tmp directory.

I think we could check if coverage directory is completely empty after that, and then delete that one as well.

@AriPerkkio AriPerkkio added feat: coverage Issues and PRs related to the coverage feature p2-nice-to-have Not breaking anything but nice to have (priority) and removed pending triage labels May 14, 2024
@xixixao
Copy link
Author

xixixao commented May 14, 2024

That's a good solution. It might be even better to store the .tmp in node_modules so the coverage folder doesn't pop into and out of existence in people's editors.

@AriPerkkio
Copy link
Member

I think we would like to keep these results close to coverage report directory so using node_modules by default might not work.

Though that's already possible from userland with npx vitest run --coverage --coverage.reporter=text --coverage.reportsDirectory=node_modules/.vitest-coverage for example.

@github-actions github-actions bot locked and limited conversation to collaborators Jun 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feat: coverage Issues and PRs related to the coverage feature p2-nice-to-have Not breaking anything but nice to have (priority)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants