Fix NullReferenceException for class type by bergmeister · Pull Request #1182 · PowerShell/PSScriptAnalyzer
PR Summary
Fix #1181
Since this bug was already present in 1.17.1, I think we should wait a bit before merging though (as development has not been merged into master yet)
PR Checklist
- PR has a meaningful title
- Use the present tense and imperative mood when describing your changes
- Summarized changes
- Change is not breaking
- Make sure all
.cs,.ps1and.psm1files have the correct copyright header - Make sure you've added a new test if existing tests do not effectively test the code changed and/or updated documentation
- This PR is ready to merge and is not Work in Progress.
- If the PR is work in progress, please add the prefix
WIP:to the beginning of the title and remove the prefix when the PR is ready.
- If the PR is work in progress, please add the prefix
| } | ||
| '@ | ||
| It "Does not throw or return diagnostic record" { | ||
| Invoke-ScriptAnalyzer -ScriptDefinition $scriptDefinition -ErrorAction Stop | Should -BeNullOrEmpty |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think this should probably be { Invoke-ScriptAnalyzer -ScriptDefinition $scriptDefinition -ErrorAction Stop } | Should -Not Throw
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-ErrorAction Stop already takes care of making the test throw. Jacub who maintains Pester has said that there is no purpose for using Should -Not Throw because Pester will fail the test if the error is terminating (hence the -ErrorAction Stop
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters