Skip to content
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”, 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

Track Code Coverage (Coveralls.io) #416

Closed
dahlbyk opened this issue Feb 14, 2017 · 5 comments · Fixed by #461
Closed

Track Code Coverage (Coveralls.io) #416

dahlbyk opened this issue Feb 14, 2017 · 5 comments · Fixed by #461
Milestone

Comments

@dahlbyk
Copy link
Owner

dahlbyk commented Feb 14, 2017

To get coverage data from Pester:

cd test
Invoke-Pester -CodeCoverage (gci ..\src\* -include *.ps1,*.psm1)

For starters, here's the PowerShell script that pushes to Coveralls.io for PowerShell/PowerShell:
https://github.com/PowerShell/PowerShell/tree/a042dc1ff1db71e4baede19d9eedf47e0004587c/test/tools/CodeCoverageAutomation

@dahlbyk dahlbyk added this to the Ideas milestone Feb 14, 2017
@JanDeDobbeleer
Copy link
Contributor

I managed to do this for my own repo, I just need to make a module from that code and it's good to go. You can see the result here

The PS script used by PowerShell/PowerShell isn't useable as it works with OpenCover to check the powershell.exe coverage and not powershell written file coverage.

Can I assume you want to use the wildcard gci ..\src\* -include *.ps1,*.psm1 to fetch the files which need to be included in the coverage results?

Expect a PR this week to tackle this one.

@dahlbyk
Copy link
Owner Author

dahlbyk commented Mar 14, 2017

Yeah, those are the right files.

Expect a PR this week to tackle this one.

Awesome!

@JanDeDobbeleer
Copy link
Contributor

@dahlbyk I've used my module on posh-git using the info you provided which results in this on Coveralls. Can you let me know if this feels allright? If so, I'll create a PR (it's super easy, really)

@JanDeDobbeleer
Copy link
Contributor

JanDeDobbeleer commented Mar 15, 2017

I found an issue with my module when Pester is ran outside of the repository's root folder. In that case the paths come out wrong and Coveralls can't link the files. A fix is currently building, I'll push new data to Coveralls as soon as it's live.

@JanDeDobbeleer
Copy link
Contributor

The second "build run" now has the links to the files. I'll be waiting for your review.

JanDeDobbeleer added a commit to JanDeDobbeleer/posh-git that referenced this issue Mar 15, 2017
dahlbyk added a commit that referenced this issue Mar 16, 2017
Closes #416 - Add code coverage to Coveralls.io
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants