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

[test runner] code coverage does not include untested files #1880

Open
jmcgavin opened this issue Feb 20, 2022 · 6 comments
Open

[test runner] code coverage does not include untested files #1880

jmcgavin opened this issue Feb 20, 2022 · 6 comments

Comments

@jmcgavin
Copy link

jmcgavin commented Feb 20, 2022

The includes property of the coverageConfig object does not include untested files in the code coverage. Only files visited during tests are included in the coverage.

I think having the option to include the entire codebase in the code coverage output is a good idea. Either through the includes property or the addition of an all property like the --all flag that can be used with istanbul/nyc or c8.

@jmcgavin jmcgavin changed the title [test runner] coverageConfig includes does not include untested files [test runner] code coverage does not include untested files Feb 21, 2022
@jmcgavin
Copy link
Author

jmcgavin commented Feb 21, 2022

@jmcgavin
Copy link
Author

jmcgavin commented Feb 21, 2022

Relates to #1873

@u-b-i-p-i-x-e-l-s
Copy link

@LarsDenBakker would love to have your feedback on this. 😃

@LarsDenBakker
Copy link
Member

I'm not sure the "all" flag would change anything here. Did anyone test this? I think we need to see all the files in the browser to make them show up in the coverage.

@electrovir
Copy link

electrovir commented Dec 12, 2022

This may be overkill but here's a workaround:

  1. before running web-test-runner, run a new script that finds all your files
  2. using that script, generate a new TS/JS file that imports all the found file paths from step 1
  3. include that new file in the test files that web-test-runner executes
  4. now all your files are included in the coverage report because the browser imported them all!

@mohamedmansour
Copy link

This may be overkill but here's a workaround:

  1. before running web-test-runner, run a new script that finds all your files

  2. using that script, generate a new TS/JS file that imports all the found file paths from step 1

  3. include that new file in the test files that web-test-runner executes

  4. now all your files are included in the coverage report because the browser imported them all!

Another approach instead of creating a new test file is to add it to Istanbul reporter as 0 coverage for all files found then merge the coverage data found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants