diff --git a/CHANGELOG.md b/CHANGELOG.md index bf45f2d..b4093d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed + +- Conceptual help for MOF-based resource works again (broken in v0.7.3) + ([issue #55](https://github.com/dsccommunity/DscResource.DocGenerator/issues/55)). + ## [0.7.3] - 2021-02-02 ### Added diff --git a/source/Public/New-DscResourcePowerShellHelp.ps1 b/source/Public/New-DscResourcePowerShellHelp.ps1 index 6348e77..f7bafcb 100644 --- a/source/Public/New-DscResourcePowerShellHelp.ps1 +++ b/source/Public/New-DscResourcePowerShellHelp.ps1 @@ -124,8 +124,8 @@ function New-DscResourcePowerShellHelp ) #region MOF-based resource - $mofSearchPath = (Join-Path -Path $ModulePath -ChildPath '\**\*.schema.mof') - $mofSchemas = @(Get-ChildItem -Path $mofSearchPath -File -Recurse) + $mofSearchPath = Join-Path -Path $ModulePath -ChildPath '\**\*.schema.mof' + $mofSchemas = @(Get-ChildItem -Path $mofSearchPath -Recurse) Write-Verbose -Message ($script:localizedData.FoundMofFilesMessage -f $mofSchemas.Count, $ModulePath) diff --git a/tests/unit/public/New-DscResourcePowerShellHelp.Tests.ps1 b/tests/unit/public/New-DscResourcePowerShellHelp.Tests.ps1 index 985d4de..59eb7c5 100644 --- a/tests/unit/public/New-DscResourcePowerShellHelp.Tests.ps1 +++ b/tests/unit/public/New-DscResourcePowerShellHelp.Tests.ps1 @@ -339,8 +339,7 @@ Configuration Example Context 'When there is no schemas found in the module folder' { BeforeAll { Mock ` - -CommandName Get-ChildItem ` - -ParameterFilter $script:getChildItemSchema_parameterFilter + -CommandName Get-ChildItem Mock ` -CommandName Out-File ` @@ -352,6 +351,18 @@ Configuration Example } It 'Should call the expected mocks ' { + <# + Regression test for issue https://github.com/dsccommunity/DscResource.DocGenerator/issues/55. + When parameter File is present the command Get-ChildItem + returns 0 (zero) files. + #> + Assert-MockCalled ` + -CommandName Get-ChildItem ` + -ParameterFilter { + $PSBoundParameters.ContainsKey('File') -eq $false + } ` + -Exactly -Times 1 + Assert-MockCalled ` -CommandName Get-ChildItem ` -ParameterFilter $script:getChildItemSchema_parameterFilter `