8000 Add File Coverage to coverage data by JamesWTruher · Pull Request #4556 · PowerShell/PowerShell · GitHub
[go: up one dir, main page]

Skip to content

Add File Coverage to coverage data #4556

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 8000 ”, 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

Merged

Conversation

JamesWTruher
Copy link
Collaborator

It is now possible to see the coverage based on the file and then format
the data so a report generator is not needed. You can map the files from
one location to another, so if you have a copy of the repo, but in a different
location, you can still format the output in a way so it may be studied

Also, help is available for Format-FileCoverage!

@JamesWTruher
Copy link
Collaborator Author

the test failures seem to be flaky tests

@TravisEz13
Copy link
Member

I've triggered AppVeyor to run again

{
param (
[Parameter(Position=0,Mandatory=$true,ValueFromPipeline=$true)]$FileCoverageData,
[Parameter()][string]$oldBase = "",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be have a default value for this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

under most circumstances (for example, when running on the system where the data was collected), it's not needed at all, so I don't want to do any substitution. By setting it to default of "" and "" (for old and new) no substitution takes place and everything works as expected.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is precedence here with Invoke-OpenCover, we try to find powershell root directory and build path.

Copy link
Collaborator Author
@JamesWTruher JamesWTruher Aug 15, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe it's the wrong thing to do. This may be used completely outside of a repo unlike invoke-opencover. consider the scenario inspecting coverage on a remote machine where the paths are not the same as what is in the file. so I can say -oldbase f:/github/blah -newwbase \\system\share\blah If you're on the system where you collected the data, you don't to substitute anything, doing a replacement is unneeded. In this scenario (which is quite real, since I work on mac). The path in the log is wrong for me, and my repo may not be the same as where the coverage was gathered. I don't need a lot of complicated, fragile logic when I can just supply it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Closed.

param (
[Parameter(Position=0,Mandatory=$true,ValueFromPipeline=$true)]$FileCoverageData,
[Parameter()][string]$oldBase = "",
[Parameter()][string]$newBase = "",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe use git to find project root for the default value?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see above - generally don't want to change the path, but sometimes I do. setting this to "" makes it work nearly all the time, but when I'm working on my mac which has different path structure, I can still look at the coverage data. In this case I may not be in a repo at all.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above about precedence in Invoke-OpenCover.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Closed.

)

$files = @($fileCoverageData.Keys) | Where-Object { $_ -match $filter }
write-verbose -verbose $files
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we always want a verbose message or a Write-Host -Fore Yellow?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably not - removed

@JamesWTruher JamesWTruher force-pushed the jameswtruher/FileCoverage1 branch from f96d5e4 to 889551a Compare August 14, 2017 19:59
@JamesWTruher
Copy link
Collaborator Author

@adityapatwardhan updated and pushed

@TravisEz13
Copy link
Member

restarted appveyor due to a myget failure

Copy link
Member
@adityapatwardhan adityapatwardhan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@adityapatwardhan
Copy link
Member

@TravisEz13 would you be having a look at this?

@@ -134,7 +299,8 @@ function Get-CoverageData($xmlPath)
CoverageLogFile = $xmlPath
CoverageSummary = (Get-CoverageSummary -element $CoverageXml.CoverageSession.Summary)
Assembly = $assemblies
}
FileCoverage = Get-FileCoverageData $CoverageXml
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please fix this indentation?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

certainly - commit amended and pushed

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@daxian-dbw Can you take a quick look?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. #Closed

It is now possible to see the coverage based on the file and then format
the data so a report generator is not needed. You can map the files from
one location to another, so if you have a copy of the repo, but in a different
location, you can still format the output in a way so it may be studied
@JamesWTruher JamesWTruher force-pushed the jameswtruher/FileCoverage1 branch from 889551a to 6913de8 Compare August 17, 2017 19:14
@adityapatwardhan adityapatwardhan merged commit f6208f3 into PowerShell:master Aug 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
41D2
Development

Successfully merging this pull request may close these issues.

5 participants
0