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

Coverage is not being reported when there are no test files #3041

Closed
6 tasks done
odockal opened this issue Mar 20, 2023 · 1 comment · Fixed by #3091
Closed
6 tasks done

Coverage is not being reported when there are no test files #3041

odockal opened this issue Mar 20, 2023 · 1 comment · Fixed by #3091
Labels
feat: coverage Issues and PRs related to the coverage feature

Comments

@odockal
Copy link

odockal commented Mar 20, 2023

Describe the bug

I would expect that code coverage is calculated/reported even though there are not test files present. Then it would mean that coverage is zero. Instead, No test files found, exiting with code 0 warning is printed out.

Reproduction

Checkout https://github.com/odockal/zero-coverage-project
Run npm run build
Run npm run test
ASSERT: no code coverage is provided
Rename src/test.ts to src/test.spec.ts
Run npm run test
ASSERT: Now the coverage is provided (zero).

System Info

System:
    OS: Linux 6.1 Fedora Linux 37 (Workstation Edition)
    CPU: (12) x64 Intel(R) Core(TM) i7-10850H CPU @ 2.70GHz
    Memory: 20.42 GB / 31.11 GB
    Container: Yes
    Shell: 5.2.15 - /bin/bash
  Binaries:
    Node: 16.16.0 - ~/.nvm/versions/node/v16.16.0/bin/node
    Yarn: 1.22.19 - ~/.yarn/bin/yarn
    npm: 8.11.0 - ~/.nvm/versions/node/v16.16.0/bin/npm
  Browsers:
    Chrome: 110.0.5481.177
    Firefox: 110.0
  npmPackages:
    @vitest/coverage-c8: ^0.29.5 => 0.29.5 
    vitest: ^0.29.5 => 0.29.5

Used Package Manager

npm

Validations

@AriPerkkio
Copy link
Member

This request makes sense - especially when passWithNoTests: true is used. Other JS test runners seem to behave similarly. Let's add support for this.

@github-actions github-actions bot locked and limited conversation to collaborators Jun 4, 2023
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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants