-
Notifications
You must be signed in to change notification settings - Fork 9
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
Unit tests are now running using Pester 5 #41
Conversation
This PR is waiting for pipeline fixes to support Pester 5. |
We'll need to release the new sampler version after that. |
Yep, and then wait for the HQRM tests to be resolved (so they can be run in both Pester 4 and Pester 5). |
Closing and reopening |
I will fix the bugs in the unit tests. After that the HQRM tests are dependent on the PR dsccommunity/DscResource.Test#76. |
This comment has been minimized.
This comment has been minimized.
The failing test have been refactored. This PR is now waiting for the HQRM tests to work in Pester 5. |
There seems to be a bug in the HQRM tests that need to be sorted before this PR can be merged. |
@PlagueHO do you have time to review this? No hurry at all. It is a bit large. But there have been no changes to code, just the tests have been modified to work with Pester 5. |
Codecov Report
@@ Coverage Diff @@
## main #41 +/- ##
=========================================
+ Coverage 0 91.30% +91.30%
=========================================
Files 0 26 +26
Lines 0 460 +460
=========================================
+ Hits 0 420 +420
- Misses 0 40 +40
Continue to review full report at Codecov.
|
Now the correct code coverage is reported, so the missing code coverage have to be resolved in another PR (unless I messed up and accidently removed a test). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some minor tweaks but looking good - I love the new test init structure (so much improved over the old one 😁).
Reviewed 25 of 28 files at r1, 2 of 3 files at r3, 1 of 1 files at r4, 1 of 1 files at r5.
Reviewable status: all files reviewed, 10 unresolved discussions (waiting on @johlju)
cocdecov.yml, line 3 at r5 (raw file):
codecov: require_ci_to_pass: no # master should be the baseline for reporting
Should be main here
tests/QA/module.tests.ps1, line 24 at r5 (raw file):
Describe 'General module control' -Tags 'FunctionalQuality' { It 'imports without errors' {
Message should be 'Should import without errors'
tests/QA/module.tests.ps1, line 63 at r5 (raw file):
if ($ErrorActionPreference -ne 'Stop') { Write-Warning -Message "ScriptAnalyzer not found!"
Single quotes here.
tests/QA/module.tests.ps1, line 67 at r5 (raw file):
else { throw "ScriptAnalyzer not found!"
Single quotes here.
tests/QA/module.tests.ps1, line 73 at r5 (raw file):
It "<Name> has a unit test" -TestCases $testCases { Get-ChildItem "tests\" -Recurse -Include "$Name.Tests.ps1" | Should -Not -BeNullOrEmpty
Single quotes here and also needs parameter name
tests/QA/module.tests.ps1, line 77 at r5 (raw file):
It "Script Analyzer for <Name>" -TestCases $testCases -Skip:(-not $scriptAnalyzerRules) { $functionFile = Get-ChildItem -path $sourcePath -Recurse -Include "$Name.ps1"
Path parameter name needs caps
tests/QA/module.tests.ps1, line 125 at r5 (raw file):
$astSearchDelegate = { $args[0] -is [System.Management.Automation.Language.FunctionDefinitionAst] } $parsedFunction = $AbstractSyntaxTree.FindAll( $astSearchDelegate, $true ) | Where-Object -FilterScript { $_.Name -eq $Name }
{
$_.Name -eq $Name
}
tests/QA/module.tests.ps1, line 143 at r5 (raw file):
$astSearchDelegate = { $args[0] -is [System.Management.Automation.Language.FunctionDefinitionAst] } $parsedFunction = $AbstractSyntaxTree.FindAll( $astSearchDelegate, $true ) | Where-Object -FilterScript { $_.Name -eq $Name }
Can we use:
{
$_.Name -eq $Name
}
tests/QA/module.tests.ps1, line 147 at r5 (raw file):
$functionHelp = $parsedFunction.GetHelpContent() $parameters = $parsedFunction.Body.ParamBlock.Parameters.Name.VariablePath.ForEach{ $_.ToString() }
Nitpick: ForEach({})
tests/Unit/Public/Compare-DscParameterState.Tests.ps1, line 991 at r5 (raw file):
It 'Should return $false for PSCredential InDesiredState' { $script:result.where({$_.Property -eq 'PSCredential'}).InDesiredState | Should -BeFalse
Where should be capital 'W' - also can we use:
$script:result.Where({
$_.Property -eq 'PSCredential'
}).InDesiredState | Should -BeFalse
and throughout.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 24 of 28 files at r1, 1 of 3 files at r3, 1 of 1 files at r5, 3 of 3 files at r6.
Reviewable status: all files reviewed, 10 unresolved discussions (waiting on @PlagueHO)
cocdecov.yml, line 3 at r5 (raw file):
Previously, PlagueHO (Daniel Scott-Raynsford) wrote…
Should be main here
Done.
tests/QA/module.tests.ps1, line 24 at r5 (raw file):
Previously, PlagueHO (Daniel Scott-Raynsford) wrote…
Message should be 'Should import without errors'
Done.
tests/QA/module.tests.ps1, line 63 at r5 (raw file):
Previously, PlagueHO (Daniel Scott-Raynsford) wrote…
Single quotes here.
Done.
tests/QA/module.tests.ps1, line 67 at r5 (raw file):
Previously, PlagueHO (Daniel Scott-Raynsford) wrote…
Single quotes here.
Done.
tests/QA/module.tests.ps1, line 73 at r5 (raw file):
Previously, PlagueHO (Daniel Scott-Raynsford) wrote…
Single quotes here and also needs parameter name
Done.
tests/QA/module.tests.ps1, line 77 at r5 (raw file):
Previously, PlagueHO (Daniel Scott-Raynsford) wrote…
Path parameter name needs caps
Done.
tests/QA/module.tests.ps1, line 125 at r5 (raw file):
Previously, PlagueHO (Daniel Scott-Raynsford) wrote…
{ $_.Name -eq $Name }
Done.
tests/QA/module.tests.ps1, line 143 at r5 (raw file):
Previously, PlagueHO (Daniel Scott-Raynsford) wrote…
Can we use:
{ $_.Name -eq $Name }
Done.
tests/QA/module.tests.ps1, line 147 at r5 (raw file):
Previously, PlagueHO (Daniel Scott-Raynsford) wrote…
Nitpick: ForEach({})
Done.
tests/Unit/Public/Compare-DscParameterState.Tests.ps1, line 991 at r5 (raw file):
Previously, PlagueHO (Daniel Scott-Raynsford) wrote…
Where should be capital 'W' - also can we use:
$script:result.Where({ $_.Property -eq 'PSCredential' }).InDesiredState | Should -BeFalseand throughout.
Done. And fixed everywhere... A LOT of them ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 3 of 3 files at r6.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @johlju)
Pull Request (PR) description
in folder source from the HQRM testing.
This Pull Request (PR) fixes the following issues
Task list
file CHANGELOG.md. Entry should say what was changed and how that
affects users (if applicable), and reference the issue being resolved
(if applicable).
DSC Community Testing Guidelines.
This change is