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

Add Format-Coverage -PesterResults #1

Closed
wants to merge 2 commits into from

Conversation

dahlbyk
Copy link
Contributor

@dahlbyk dahlbyk commented Mar 16, 2017

Following on from dahlbyk/posh-git#461, it would be nice if PR builds could report coverage in their build log even if it's not pushed to Coveralls. That's not currently possible because the Format-Coverage call requires -CoverallsApiToken.

My proposal is pretty simple: add a second parameter set that accepts an existing set of Pester results.

@JanDeDobbeleer
Copy link
Owner

This one was on my list as well, I just added these lines to validate whether or not the provided results contain the CodeCoverage object

if (!$PesterResults.CodeCoverage) {
    Write-Error 'Please provide pester results with code coverage using the -CodeCoverage parameter'
    exit 1;
}

Would you mind if I add them to your commit and merge it like that? Other than that, everything seems in tiptop shape.

Also, funny how a module about code coverage has 0 tests (I'll have to fix that).

}
if (!$pesterResults.CodeCoverage) {
Write-Error 'Please provide pester results with code coverage using the -CodeCoverage parameter'
return;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Opted for return here since Write-Error can be made fatal by setting $ErrorActionPreference = 'Stop'. Thoughts?

Copy link
Owner

Choose a reason for hiding this comment

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

I agree. This leaves all options open. I'll merge this little baby.

@JanDeDobbeleer
Copy link
Owner

Rebased and merged. Thanks for contributing!

@dahlbyk dahlbyk deleted the accept-PesterResults branch March 16, 2017 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants