Coder Social home page Coder Social logo

Comments (6)

ryanluker avatar ryanluker commented on August 18, 2024

@Foshkey Thanks for submitting an issue!

You might want to look into using the multi-root workspace functionality (see link from the example project or this link to vscode's docs).

This will allow you to have multiple "folders" or projects open at one time and have the coverage be accessible across different projects.

We can triage and investigate further if it is still an issue for you afterwords.

from vscode-coverage-gutters.

Foshkey avatar Foshkey commented on August 18, 2024

Thanks for the response!

Looks like it's still an issue. To be clear, our github repo is structured like so:

root
|- src
  |- Project1
    |- Project1.csproj
  |- Project2
    |- Project2.csproj
  |- Project3
    |- Project3.csproj
  |- Project4
    |- Project4.csproj
|- tests
  |- unit
    |- Project1.Tests
      |- Project1.Tests.csproj
    |- Project2.Tests
      |- Project2.Tests.csproj
    |- Project3.Tests
      |- Project3.Tests.csproj
    |- Project4.Tests
      |- Project4.Tests.csproj

And opening the root github folder is how most devs operate their workspace.

But, I tried adding all of the src project folders and test project folders to the workspace as separate folders like you suggested, but still the same issue that code gutters indicate no code coverage when all test projects are configured to output code coverage (but still works with just one project)

from vscode-coverage-gutters.

Foshkey avatar Foshkey commented on August 18, 2024

A coworker of mine came up with the suggestion to merge the coverage results with the following test runner arguments:

/p:CollectCoverage=true /p:CoverletOutputFormat=lcov%2cjson /p:CoverletOutput=../CoverageResults/ /p:MergeWith=../CoverageResults/coverage.json -m:1

And then add the setting for coverage gutters to pick up this file:

"coverage-gutters.coverageFileNames": [
    "coverage.info",
    "lcov.info",
    "cov.xml",
    "coverage.xml",
    "jacoco.xml",
    "coverage.cobertura.xml"
  ]

And this worked for me! Might be worth adding this to the docs for when people use multiple test projects. I didn't know that merging coverage results into one file was a thing!

from vscode-coverage-gutters.

ryanluker avatar ryanluker commented on August 18, 2024

A coworker of mine came up with the suggestion to merge the coverage results with the following test runner arguments:

/p:CollectCoverage=true /p:CoverletOutputFormat=lcov%2cjson /p:CoverletOutput=../CoverageResults/ /p:MergeWith=../CoverageResults/coverage.json -m:1

And then add the setting for coverage gutters to pick up this file:

"coverage-gutters.coverageFileNames": [
    "coverage.info",
    "lcov.info",
    "cov.xml",
    "coverage.xml",
    "jacoco.xml",
    "coverage.cobertura.xml"
  ]

And this worked for me! Might be worth adding this to the docs for when people use multiple test projects. I didn't know that merging coverage results into one file was a thing!

Excellent, thanks for finding that fix! Definitely we should add that to the readme / docs as folks with larger projects probably run into this all the time.

from vscode-coverage-gutters.

pabloandrade-ah avatar pabloandrade-ah commented on August 18, 2024

A coworker of mine came up with the suggestion to merge the coverage results with the following test runner arguments:

/p:CollectCoverage=true /p:CoverletOutputFormat=lcov%2cjson /p:CoverletOutput=../CoverageResults/ /p:MergeWith=../CoverageResults/coverage.json -m:1

And then add the setting for coverage gutters to pick up this file:

"coverage-gutters.coverageFileNames": [
    "coverage.info",
    "lcov.info",
    "cov.xml",
    "coverage.xml",
    "jacoco.xml",
    "coverage.cobertura.xml"
  ]

And this worked for me! Might be worth adding this to the docs for when people use multiple test projects. I didn't know that merging coverage results into one file was a thing!

what is the -m:1 for?

from vscode-coverage-gutters.

ryanluker avatar ryanluker commented on August 18, 2024

what is the -m:1 for?

Probably related to the merging and keeping things in sequential order (based on the docs I found below).

https://github.com/coverlet-coverage/coverlet/blob/cae57328fcf29e3f8db9c3b2b46f07af09b6e216/Documentation/Examples/MSBuild/MergeWith/HowTo.md?plain=1#L12-L20

from vscode-coverage-gutters.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.