I wonder if there are extensions available for adding code coverage with C# in Visual Studio Code in Linux... I have already searched the extensions but I'm not able to find some.
Kind regards
On the Test menu, choose Analyze Code Coverage. On the Test menu, select Analyze Code Coverage for All Tests. You can also run code coverage from the Test Explorer tool window.
For launching tests of VSCode extension, VSCode itself provides test runner that does a lot of boilerplate and launches testing framework (Mocha by default). In order to have code coverage in your extension, we need to reimplement this test runner a bit, injecting additional instructions there.
From the command prompt, change directories to the XUnit.Coverlet.Collector project, and run the dotnet test command: The "XPlat Code Coverage" argument is a friendly name that corresponds to the data collectors from Coverlet. This name is required but is case insensitive.
Analyze Code Coverage on Unit Tests in Test Explorer 1 On the Test menu, choose Analyze Code Coverage. 2 To see which lines have been run, choose Show Code Coverage Coloring. 3 To alter the colors, or to use bold face, choose Tools > Options > Environment > Fonts and Colors > Show settings for: Text Editor ... See More....
This is an old question, but it's a top search engine result for this issue. Here's a blog article by Alberto Bar-Noy that I found which may help.
Alberto recommends using the following three VSCode Extensions to achieve code coverage statistics.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With