Closed ghost closed 7 years ago
Hello, and welcome!
I totally agree, this should be available today. We actually briefly discussed this at VMworld and did nothing about it, so I'm glad you posted!
I like the direction of the possible solution, but it'll need a little TLC. When calling Invoke-Pester
, the parameters are nested like so:
OutputFile
OutputFormat
PassThru
Script
Path
Parameters
Cfg
TestFiles
Remediate
I suspect that this will be solved with a double splat (Invoke-Pester @NormalParams @SpicyParams
)...and possibly some $PSBoundParameters
fun if we want to be extra fancy.
Would you like to tackle?
Hello and thank you!
I would like to tackle this issue. I put this together last night
I haven't had a chance to test it yet, but I think out will populate the parameters as desired. I'll get some testing in and if successful will get a PR submitted.
Also haven't tested yet, but looks pretty good at first glance.
Assigning issue.
Expected Behavior
Meaning XMLOutput and Passthru are either or, not both.
Possible Solution
Populate Parameters variable once, then enter the if/else block to add additional attributes, finally splat the parameter variable into the Invoke-Pester call.
Context
Pester provides support for calling both parameters in the same execution. It can be handy to export the results to xml and separately iterate through the PSObject to log any failures into the event log. I can then pass the xml through reportunit and upload to a "dashboard", simultaneously LogInsight can find read in the events and alert me that config drift exists.