Scenario
I am running jest (or a React project) to test my files.
Goal
I would like to see the coverage report for all my source files and then by running jest in --watch mode see only the changed files report change (hopefully improve) while leaving the untested files report untouched.
Problem
Right now, while running jest --config=config/jest/config.json --watch --coverage, and using the configuration "collectCoverageFrom": ["src/**/*.{tsx,ts}"] the coverage related with the modified file are updated properly BUT the coverage for the UNTESTED files goes back to 0% (since no test where run for those files and any previous test run got forgotten)
Question
Is there a way to retain the old tests coverage reports for the untested files?
Why?
Imagine us having 100 files in the src folder. At the beginning all the coverage is 0%. Then you start jest in watch mode and you fix 1 file. The coverage shows 100% for that file, 0% for the other files. Total coverage of 1%.
Then you change a second file (the day after). Your total coverage should be 2%, instead since TODAY you changed only 1 file, the overall coverage is reported as 1%.
The correct total coverage is reported only when you run a full test+report without using the watch mode, but this makes the process non-practical since I would like to fix progressively my tests, watch for file changes and see the coverage grow as I fix.
Similar reported issues
https://github.com/facebook/jest/issues/2256 it was closed by I still don't understand how it would fix the problem
Ideas
I don't mind if to have this report I need to adapt jest/istanbul to do some magic merge of reports. I tried to follow some comments on github but couldn't come up with something that works
Related
I'm using Cypress for client e2e testing and #cypress/code-coverage for reports. I have a monorepo, client and server folders. Each one generates its own coverage report (lcov.info). I am using CodeClimate for keeping track o total coverage. It provides a tool to merge multiple reports into one, and then upload it
The problem is that both reports have relative paths (regarding the tested files) to is service, so /client/coverage/lcov.info does not build path as 'client/component/index.ts' but /component/index.ts so report merging fails
I can fix this on the server side passing some options to jest-conf, but I didnt fine nothing related to cypress. I can generate the report folder/files in the root level passing an option to nyc (which is used under to hood by #cypress/code-coverage), but the paths are still relatives to the client folder.
Has anyone experienced this issue? Help much appreciated
I am working on a project in Xcode for iOS app and I enabled "Gather coverage data" in the "Edit scheme -> Test".
I also created a test target with an empty unit test, the only one in the whole project so far and now when I run the test I can see that around 12% of code has been covered (The project has around 500 files in the project and there are many classes in the coverage report that are displayed as covered).
How is this possible? Did I miss something?
In wiki there is "In computer science, code coverage is a measure used to describe the degree to which the source code of a program is tested by a particular test suite." We have only one test suite and it is empty.
As of Xcode 8, running the tests actually instantiates the app. That means that all the initialization code is executed. This will show as covered code in the test coverage report.
Using the Microsoft.TeamFoundation.Build.Activities.RunAgileTestRunner activity that shipped with VS2013RTM, I have unit tests set up like this:
When I run these builds, the tests run fine, however there are different results in the count being reported every time. Not only are the counts different between builds, but the Build Summary page for a given build run will also consistently shows different counts of tests than the actual test results (.trx) file.
I also tried the Microsoft.TeamFoundation.Build.Workflow.Activities.RunTests activity, and I get the same issues with the test results described above. However, I am able to use its RunTestsTestCompletedEventArgs to write a build message of the name of the test followed by the result, and when I do this I see the same number of tests run each time, which means something is wrong with the summary report and/or the published results (right? RIGHT???):
Also, I have two assemblies with 'tests' in the name which get picked up by the filter, I know that this aspect is working because the bin folder on the build box will have same size on disk among all of the different runs which produce different results.
So, what is going on with these numbers? What am I doing wrong in my build definition or on the build box that is causing this?
we try to use gcovr to generate coverage report for our c++ project in Jenkins.
I was able to get it worked, but I'm stuck with one problem. gcovr doesn't show any statistics for files with zero coverage - they have only .gcno files, no .gcda files are produced and gcovr don't show it in results.
So I have 80% coverage for the whole project, but only 2 tests were written and it's actually 80% coverage only for source files involved in tests.
For large project it makes of course no sense to use such statistic.
I have found https://software.sandia.gov/trac/fast/changeset/2766 this changeset as solution for this ticket https://software.sandia.gov/trac/fast/ticket/3887, but it seems not to be working.
Did I miss something?
p.s. I use gcovr 3.1-prerelease
When I first put my rails project in Jenkins, my settings were off and I generated reports for all code in vendor/. I've fixed my settings so new reports don't include that code, but even after wiping out my Jenkins workspace it still includes the vendor/ code in every report.
How can I erase the old rcov statistics and track just my own code?
The coverage statistics will fix themselves when all old builds that included them go away.