You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
and running a test that will go through that piece of code, the file will not be properly presented in the Testing Sidebar TEST COVERAGE view. The file will show like this:
v TEST COVERAGE
v src
> myTest.ts
but when clicking on the right arrow expansion button nothing will show
v TEST COVERAGE
v src
v myTest.ts
Also, the myTest.ts file does not show any coverage overlay in the Text Editor
The expected result should have been something like this
v TEST COVERAGE
v src
v myTest.ts
chainedElses
chainedElses2
And the myTest.ts file would have shown the coverage overlay in the Text Editor
However, when running coverage reports through the vscode-test-cli like this:
vscode-test --coverage
That generates and HTML report, coverage is properly displayed in the report. For example:
(I am fully aware that this is a code smell, and it could have been re-written with a switch/case. This is being provided for reference only)
Trying to use /* c8 ignore start */ and /c8 ignore stop/ at the beginning and end of the if/else if/else if/else section correctly removes the code from being covered (code reports to 100% coverage), but it is still not displayed in the TEST COVERAGE view
I moticed that when generating the report using
vscode-test --coverage --coverage-reporter json
While troubleshooting the Coverage Disappearance in the original much larger project I noticed the Json file generated had negative columns in the branchMap section, which coincided with the location of the chained elses. It was these negative columns that lead me to single out the chained elses as the source of the lack of coverage when I was running tests. If I remove the chained elses, coverage will show just right.
When presented with a code that contains chained elses, or else if like this:
File src/myTest.ts
or
and running a test that will go through that piece of code, the file will not be properly presented in the Testing Sidebar TEST COVERAGE view. The file will show like this:
but when clicking on the right arrow expansion button nothing will show
Also, the myTest.ts file does not show any coverage overlay in the Text Editor
The expected result should have been something like this
And the myTest.ts file would have shown the coverage overlay in the Text Editor
However, when running coverage reports through the vscode-test-cli like this:
vscode-test --coverage
That generates and HTML report, coverage is properly displayed in the report. For example:
(I am fully aware that this is a code smell, and it could have been re-written with a switch/case. This is being provided for reference only)
Trying to use
/* c8 ignore start */
and/c8 ignore stop
/ at the beginning and end of the if/else if/else if/else section correctly removes the code from being covered (code reports to 100% coverage), but it is still not displayed in the TEST COVERAGE viewI moticed that when generating the report using
vscode-test --coverage --coverage-reporter json
While troubleshooting the Coverage Disappearance in the original much larger project I noticed the Json file generated had negative columns in the branchMap section, which coincided with the location of the chained elses. It was these negative columns that lead me to single out the chained elses as the source of the lack of coverage when I was running tests. If I remove the chained elses, coverage will show just right.
The text was updated successfully, but these errors were encountered: