Text reporter still creates an empty coverage folder
xixixao opened this issue · comments
Describe the bug
Run
npx vitest run --coverage --coverage.reporter=text
You will get an empty coverage
folder
Reproduction
- Use the default playground: https://stackblitz.com/fork/github/vitest-dev/vitest/tree/main/examples/basic?initialPath=__vitest__/
- Quit the watcher
- Run the command
- 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
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
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.
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.
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.