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

Idea: Ability to make failed tests show up in the run summary as warnings instead of errors in Azure DevOps run summary #2295

Closed
3 tasks done
erikgraa opened this issue Feb 4, 2023 · 4 comments · Fixed by #2296
Labels

Comments

@erikgraa
Copy link
Contributor

erikgraa commented Feb 4, 2023

Checklist

Summary of the feature request

If Pester >= 5.3 is run in Azure DevOps, the run summary gets errors, i.e.

image

Would it be possible to introduce a parameter that lets you choose whether these are shown as errors or warnings, i.e. ##vso[task.LogIssue type=warning;]?

How should it work?

$conf = New-PesterConfiguration

$conf.Output

Verbosity : [..]
StackTraceVerbosity : [..]
CIFormat : [..]
CISummaryMode : Whether to show CI output as errors or warnings, options are Error and Warning (Error, default: Error)
RenderMode : [..] 
@fflaten
Copy link
Collaborator

fflaten commented Feb 5, 2023

Thanks for the suggestion! Definitely possible and compatible with both CIs.

This is just me being curious: In what scenario would you use this?

@erikgraa
Copy link
Contributor Author

erikgraa commented Feb 5, 2023

Hi!

My idea was to use "warning" as guidelines or pointers for less dramatic "failures", e.g. when you are linting code using PSScriptAnalyzer and get suggestions to not use e.g Write-Host.

At least in my mind it seems counterintuitive to have a bunch of red errors in the run summary that won't stop the build because they are less serious "errors".

@fflaten
Copy link
Collaborator

fflaten commented Feb 5, 2023

Thanks, good point. This would be a run-specific setting, so then you'd likely want to run Pester in two steps:

  • Once for linting/style-tests where it's configured for warnings. Step would also need continueOnError/ignoreLASTEXITCODE because Pester would still give non-zero exit code on failing tests.
  • Once for normal tests where I assume you'd want errors due to broken functionality or quality-issue like missing help.

For PSSA specifically I'd generally recommend a separate step in CI for that. There's also prebuilt actions in marketplace for it. We use a dedicated workflow/pipeline for it here.

@erikgraa
Copy link
Contributor Author

erikgraa commented Feb 5, 2023

Thanks, good point. This would be a run-specific setting, so then you'd likely want to run Pester in two steps:

  • Once for linting/style-tests where it's configured for warnings. Step would also need continueOnError/ignoreLASTEXITCODE because Pester would still give non-zero exit code on failing tests.
  • Once for normal tests where I assume you'd want errors due to broken functionality or quality-issue like missing help.

Exactly!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants