From 742dfefda3f6d722d25d912b6dc5a12ebd758f44 Mon Sep 17 00:00:00 2001 From: justin-p Date: Thu, 10 Jan 2019 16:36:17 +0100 Subject: [PATCH 01/79] Removed duplicated test folder in scaffold. Removed meta subfolder since its not used. Also refrences a repo that doenst exists anymore. `claudiospizzi/PowerShellModuleBase` Move tests folder out of src. Make test folder match src folder. Differentiate between Unit and Intergration tests. readme.md in plaster scaffold does not reflect what module does and can do. .\Build.ps1 -test does not work. There is no such task. .\Build.ps1 -test C:\_git\github\ModuleBuild\Build.ps1 : A parameter cannot be found that matches parameter name 'test'. At line:1 char:13 + .\Build.ps1 -test + ~~~~~ + CategoryInfo : InvalidArgument: (:) [Build.ps1], ParameterBindingException + FullyQualifiedErrorId : NamedParameterNotFound,Build.ps1 It does not download something from `claudiospizzi/PowerShellModuleBase`. It wouldn't be able to anyhow since doesn't exists anymore. --- PSScriptAnalyzerSettings.psd1 | 24 +- plaster/ModuleBuild/plasterManifest.xml | 24 +- .../build/docs/Additional/Acknowledgements.md | 4 +- plaster/ModuleBuild/scaffold/readme.md | 9 +- .../scaffold/src/tests/FunctionCBH.Tests.ps1 | 60 --- .../src/tests/ModuleManifest.Tests.ps1 | 205 ---------- .../src/tests/ScriptAnalyzer.Tests.ps1 | 32 -- .../src/tests/SensitiveTermScan.Tests.ps1 | 28 -- .../src/tests/meta/Autoload.Tests.ps1 | 23 -- .../src/tests/meta/FileContent.Tests.ps1 | 349 ------------------ .../src/tests/meta/FileEncoding.Tests.ps1 | 54 --- .../src/tests/meta/FileFormatting.Tests.ps1 | 96 ----- .../src/tests/meta/ProjectStructure.Tests.ps1 | 152 -------- .../src/tests/meta/ScriptAnalyzer.Tests.ps1 | 37 -- .../scaffold/tests/FunctionCBH.Tests.ps1 | 60 --- .../scaffold/tests/ModuleManifest.Tests.ps1 | 205 ---------- .../scaffold/tests/ScriptAnalyzer.Tests.ps1 | 32 -- .../tests/SensitiveTermScan.Tests.ps1 | 28 -- .../tests/intergration/other/readme.md | 1 + .../tests/intergration/private/readme.md | 1 + .../tests/intergration/public/readme.md | 1 + .../scaffold/tests/meta/Autoload.Tests.ps1 | 23 -- .../scaffold/tests/meta/FileContent.Tests.ps1 | 349 ------------------ .../tests/meta/FileEncoding.Tests.ps1 | 54 --- .../tests/meta/FileFormatting.Tests.ps1 | 96 ----- .../tests/meta/ProjectStructure.Tests.ps1 | 152 -------- .../tests/meta/ScriptAnalyzer.Tests.ps1 | 37 -- .../scaffold/tests/unit/other/readme.md | 1 + .../scaffold/tests/unit/private/readme.md | 1 + .../scaffold/tests/unit/public/readme.md | 1 + plaster/PlasterContent.ps1 | 36 +- src/tests/FunctionCBH.Tests.ps1 | 60 --- src/tests/ModuleManifest.Tests.ps1 | 205 ---------- src/tests/ScriptAnalyzer.Tests.ps1 | 32 -- src/tests/SensitiveTermScan.Tests.ps1 | 28 -- tests/intergration/private/readme.md | 1 + tests/intergration/public/readme.md | 1 + tests/unit/private/readme.md | 1 + tests/unit/public/readme.md | 1 + 39 files changed, 93 insertions(+), 2411 deletions(-) delete mode 100644 plaster/ModuleBuild/scaffold/src/tests/FunctionCBH.Tests.ps1 delete mode 100644 plaster/ModuleBuild/scaffold/src/tests/ModuleManifest.Tests.ps1 delete mode 100644 plaster/ModuleBuild/scaffold/src/tests/ScriptAnalyzer.Tests.ps1 delete mode 100644 plaster/ModuleBuild/scaffold/src/tests/SensitiveTermScan.Tests.ps1 delete mode 100644 plaster/ModuleBuild/scaffold/src/tests/meta/Autoload.Tests.ps1 delete mode 100644 plaster/ModuleBuild/scaffold/src/tests/meta/FileContent.Tests.ps1 delete mode 100644 plaster/ModuleBuild/scaffold/src/tests/meta/FileEncoding.Tests.ps1 delete mode 100644 plaster/ModuleBuild/scaffold/src/tests/meta/FileFormatting.Tests.ps1 delete mode 100644 plaster/ModuleBuild/scaffold/src/tests/meta/ProjectStructure.Tests.ps1 delete mode 100644 plaster/ModuleBuild/scaffold/src/tests/meta/ScriptAnalyzer.Tests.ps1 delete mode 100644 plaster/ModuleBuild/scaffold/tests/FunctionCBH.Tests.ps1 delete mode 100644 plaster/ModuleBuild/scaffold/tests/ModuleManifest.Tests.ps1 delete mode 100644 plaster/ModuleBuild/scaffold/tests/ScriptAnalyzer.Tests.ps1 delete mode 100644 plaster/ModuleBuild/scaffold/tests/SensitiveTermScan.Tests.ps1 create mode 100644 plaster/ModuleBuild/scaffold/tests/intergration/other/readme.md create mode 100644 plaster/ModuleBuild/scaffold/tests/intergration/private/readme.md create mode 100644 plaster/ModuleBuild/scaffold/tests/intergration/public/readme.md delete mode 100644 plaster/ModuleBuild/scaffold/tests/meta/Autoload.Tests.ps1 delete mode 100644 plaster/ModuleBuild/scaffold/tests/meta/FileContent.Tests.ps1 delete mode 100644 plaster/ModuleBuild/scaffold/tests/meta/FileEncoding.Tests.ps1 delete mode 100644 plaster/ModuleBuild/scaffold/tests/meta/FileFormatting.Tests.ps1 delete mode 100644 plaster/ModuleBuild/scaffold/tests/meta/ProjectStructure.Tests.ps1 delete mode 100644 plaster/ModuleBuild/scaffold/tests/meta/ScriptAnalyzer.Tests.ps1 create mode 100644 plaster/ModuleBuild/scaffold/tests/unit/other/readme.md create mode 100644 plaster/ModuleBuild/scaffold/tests/unit/private/readme.md create mode 100644 plaster/ModuleBuild/scaffold/tests/unit/public/readme.md delete mode 100644 src/tests/FunctionCBH.Tests.ps1 delete mode 100644 src/tests/ModuleManifest.Tests.ps1 delete mode 100644 src/tests/ScriptAnalyzer.Tests.ps1 delete mode 100644 src/tests/SensitiveTermScan.Tests.ps1 create mode 100644 tests/intergration/private/readme.md create mode 100644 tests/intergration/public/readme.md create mode 100644 tests/unit/private/readme.md create mode 100644 tests/unit/public/readme.md diff --git a/PSScriptAnalyzerSettings.psd1 b/PSScriptAnalyzerSettings.psd1 index 80bfffb..bcc0a92 100644 --- a/PSScriptAnalyzerSettings.psd1 +++ b/PSScriptAnalyzerSettings.psd1 @@ -1,4 +1,24 @@ @{ - IncludeRules=@('PSProvideCommentHelp', - 'PSAvoidUsingWriteHost') + IncludeRules=@('PSUseApprovedVerbs', + 'PSReservedCmdletChar', + 'PSReservedParams', + 'PSShouldProcess', + 'PSUseShouldProcessForStateChangingFunctions', + 'PSUseSingularNouns', + 'PSMissingModuleManifestField', + 'PSAvoidDefaultValueSwitchParameter', + 'PSAvoidUsingCmdletAliases', + 'PSAvoidUsingWMICmdlet', + 'PSAvoidUsingEmptyCatchBlock', + 'PSUseCmdletCorrectly', + 'PSUseShouldProcessForStateChangingFunctions', + 'PSAvoidUsingPositionalParameters', + 'PSAvoidGlobalVars', + 'PSUseDeclaredVarsMoreThanAssignments', + 'PSAvoidUsingInvokeExpression', + 'PSAvoidUsingPlainTextForPassword', + 'PSAvoidUsingComputerNameHardcoded', + 'PSUsePSCredentialType', + 'PSDSC*' + ) } \ No newline at end of file diff --git a/plaster/ModuleBuild/plasterManifest.xml b/plaster/ModuleBuild/plasterManifest.xml index 36a4e46..d95627c 100644 --- a/plaster/ModuleBuild/plasterManifest.xml +++ b/plaster/ModuleBuild/plasterManifest.xml @@ -4,7 +4,7 @@ templateType="Project" xmlns="http://www.microsoft.com/schemas/PowerShell/Plaster/v1"> ModuleBuild - 3fd34e00-75da-4e7d-96c4-64009f3790e2 + 4794ac4a-1fbc-49f4-973f-9ece24eaa1d9 0.0.1 New ModuleBuild Project Create a new PowerShell Module with a ModuleBuild wrapper @@ -190,8 +190,26 @@ source="scaffold\src\templates\*" destination="src\templates" /> + source="scaffold\tests\" + destination="tests" /> + + + + + + ](<%=$PLASTER_PARAM_ModuleWebsite%>) -This project owes some acknowlegement to other projects. Here are some other authors or projects which have made this project possible. If you believe you or a project should be included in this list please let us know. +This project owes some acknowledgements to other projects. Here are some other authors or projects which have made this project possible. If you believe you or a project should be included in this list please let us know. -[ModuleBuild](https://github.com/zloeber/ModuleBuild) - A PowerShell module build framwork. \ No newline at end of file +[ModuleBuild](https://github.com/zloeber/ModuleBuild) - A PowerShell module build framework. \ No newline at end of file diff --git a/plaster/ModuleBuild/scaffold/readme.md b/plaster/ModuleBuild/scaffold/readme.md index 9720b6f..087d0f7 100644 --- a/plaster/ModuleBuild/scaffold/readme.md +++ b/plaster/ModuleBuild/scaffold/readme.md @@ -36,10 +36,11 @@ Studio Code and ensure that the PowerShell extension is installed. * [Visual Studio Code] * [PowerShell Extension] -This module is tested with the PowerShell testing framework Pester. To run all -tests, just start the included test script `.\Build.ps1 -test` or invoke Pester -directly with the `Invoke-Pester` cmdlet in the tests directory. The tests will automatically download -the latest meta test from the claudiospizzi/PowerShellModuleBase repository. +// This module is tested with the PowerShell testing framework Pester. To run all +// tests, just start the included test script `.\Build.ps1 -test` or invoke Pester +// directly with the `Invoke-Pester` cmdlet in the tests directory. + +// Not true at the moment. ## Other Information diff --git a/plaster/ModuleBuild/scaffold/src/tests/FunctionCBH.Tests.ps1 b/plaster/ModuleBuild/scaffold/src/tests/FunctionCBH.Tests.ps1 deleted file mode 100644 index 0f418c3..0000000 --- a/plaster/ModuleBuild/scaffold/src/tests/FunctionCBH.Tests.ps1 +++ /dev/null @@ -1,60 +0,0 @@ -#Requires -Modules Pester -<# - This pester test verifies the module's public functions all have proper comment based help required for building documentation via PlatyPS. - - Example: - PS> Invoke-Pester -Script @{Path = '.\src\tests\FuncitonCBH.Tests.ps1'; Parameters = @{ ModuleName = MyModule}} -#> - -[CmdletBinding()] -Param( - [Parameter(HelpMessage = 'Module to scan.')] - [string]$ModuleName -) - -If (($ModuleName -like '*.psd1') -and (test-path $ModuleName)) { - $Module = (Split-Path $ModuleName -Leaf) -replace '.psd1','' -} -else { - $Module = $ModuleName -} - -if (-not (Get-Module $Module)) { - try { - Import-Module $ModuleName -force - } - catch { - throw "$Module is not loaded." - } -} - -Describe "Comment Based Help tests for $Module" -Tags Build { - - $functions = Get-Command -Module $Module -CommandType Function - foreach($Function in $Functions){ - $help = Get-Help $Function.name - Context $help.name { - it "Has a HelpUri" { - $Function.HelpUri | Should Not BeNullOrEmpty - } - It "Has related Links" { - $help.relatedLinks.navigationLink.uri.count | Should BeGreaterThan 0 - } - it "Has a description" { - $help.description | Should Not BeNullOrEmpty - } - it "Has an example" { - $help.examples | Should Not BeNullOrEmpty - } - foreach($parameter in $help.parameters.parameter) - { - if($parameter -notmatch 'whatif|confirm') - { - it "Has a Parameter description for '$($parameter.name)'" { - $parameter.Description.text | Should Not BeNullOrEmpty - } - } - } - } - } -} \ No newline at end of file diff --git a/plaster/ModuleBuild/scaffold/src/tests/ModuleManifest.Tests.ps1 b/plaster/ModuleBuild/scaffold/src/tests/ModuleManifest.Tests.ps1 deleted file mode 100644 index c6bf56f..0000000 --- a/plaster/ModuleBuild/scaffold/src/tests/ModuleManifest.Tests.ps1 +++ /dev/null @@ -1,205 +0,0 @@ -#Requires -Modules Pester - -<# - This pester test verifies the PowerShell module manifest file has valid content that will be required to - upload to the PowerShell Gallary. - - .EXAMPLE - PS> Invoke-Pester -Script @{Path = '.\src\tests\ModuleManifest.Tests.ps1'; Parameters = @{ ManifestPath = 'C:\Users\zloeber\Dropbox\Zach_Docs\Projects\Git\PSAD'; Author = 'Zachary Loeber'; Website = 'https://github.com/zloeber/PSAD'; Tags = @('ADSI', 'Active_Directory', 'DC') }} - - Runs some standard tests and a few manual validations (Tags, Author, and Website). - .EXAMPLE - PS> Invoke-Pester -Script @{Path = '.\src\tests\ModuleManifest.Tests.ps1'; Parameters = @{ ManifestPath = '.\PSAD.psd1'}} - - Runs several generic tests against the PSAD.psd1 manifest to ensure all required values for uploading to the PowerShell Gallery simply exist. -#> - -[CmdLetBinding(DefaultParameterSetName='Default')] -Param( - [Parameter(Mandatory = $True, ParameterSetName='Default')] - [Parameter(Mandatory = $True, ParameterSetName='Manual')] - [Parameter(Mandatory = $True, ParameterSetName='ModuleBuild')] - [string]$ManifestPath, - [Parameter(Mandatory = $True, ParameterSetName='ModuleBuild')] - [string]$ModuleBuildJSONPath, - [Parameter(ParameterSetName='Manual')] - [string]$Author, - [Parameter(ParameterSetName='Manual')] - [string]$Copyright, - [Parameter(ParameterSetName='Manual')] - [string]$Website, - [Parameter(ParameterSetName='Manual')] - [string]$LicenseURI, - [Parameter(ParameterSetName='Manual')] - [string]$Version, - [Parameter(ParameterSetName='Manual')] - [string[]]$Tags -) - -if (($ManifestPath.EndsWith('psd1')) -and (Test-Path $ManifestPath)) { - # Grab the short module name - $ModuleName = (Split-Path $ManifestPath -Leaf).Split('.')[0] - - Describe 'Module Manifest - Standard Tests' { - Context "Testing $ManifestPath" { - It 'should be a valid module manifest file' { - { - $Script:Manifest = Test-ModuleManifest -Path $ManifestPath -ErrorAction Stop -WarningAction SilentlyContinue - } | Should Not Throw - } - - It 'should have a valid RootModule value' { - $Script:Manifest.RootModule | Should Be "$ModuleName.psm1" - } - - It 'should have a valid GUID' { - ($Script:Manifest.Guid).Guid | Should BeLike '????????-????-????-????-????????????' - } - - It 'should have a valid PowerShellVersion value' { - $Script:Manifest.PowerShellVersion | Should Not BeNullOrEmpty - } - } - } - - switch ($PSCmdlet.ParameterSetName) { - 'Default' { - # Passed just a module manifest file name with no other information to validate - # This will check for several entries that they simply exist. - Describe 'Module Manifest - Generic Tests' { - Context "Testing $ManifestPath" { - It 'should have a valid Module version' { - ($Script:Manifest.Version).ToString() -as [Version] | Should Not BeNullOrEmpty - } - - It 'should have a valid module description' { - $Script:Manifest.Description | Should Not BeNullOrEmpty - } - - It 'should have a valid module author' { - $Script:Manifest.Author | Should Not BeNullOrEmpty - } - - It 'should have a valid module project website' { - $Script:Manifest.ProjectUri.OriginalString | Should Not BeNullOrEmpty - } - - It 'should have a valid license URL' { - $Script:Manifest.LicenseUri | Should Not BeNullOrEmpty - } - - It 'should have some tags' { - @($Script:Manifest.PrivateData.PSData.Tags).Count -gt 0 | Should Be $true - } - } - } - } - 'Manual' { - # Passed a manifest name and several manual entries to validate - Describe 'Module Manifest - Manual Tests' { - Context "Testing $ManifestPath" { - if (-not [string]::IsNullOrEmpty($Version)) { - It "should be module version '$Version'" { - ($Script:Manifest.Version).ToString() -as [Version] | Should Be $Version - } - } - if (-not [string]::IsNullOrEmpty($Description)) { - It "should have a module description of '$Description'" { - $Script:Manifest.Description | Should Be $Description - } - } - - if (-not [string]::IsNullOrEmpty($Author)) { - It "should have the module author of '$Author'" { - $Script:Manifest.Author | Should Be $Author - } - } - - if (-not [string]::IsNullOrEmpty($Copyright)) { - It "should have a Copyright of '$Copyright'" { - $Script:Manifest.Copyright | Should Be $Copyright - } - } - - if (-not [string]::IsNullOrEmpty($Website)) { - It "should have the project website of '$Website'" { - $Script:Manifest.ProjectUri.OriginalString | Should Be $Website - } - } - - if (-not [string]::IsNullOrEmpty($LicenseURI)) { - It "should have the license URI of '$LicenseURI'" { - $Script:Manifest.LicenseUri | Should Be $LicenseURI - } - } - if ($Tags.Count -gt 0) { - It "should have these tags: $($Tags -join ',')" { - Compare-Object $Script:Manifest.PrivateData.PSData.Tags $Tags | Should Be $Null - } - } - } - } - } - 'ModuleBuild' { - # Passed a manifest name and a ModuleBuild json configuration file to validate - if (($ModuleBuildJSONPath.EndsWith('psd1')) -and (Test-Path $ModuleBuildJSONPath)) { - try { - $ModuleInfo = get-content $ModuleBuildJSONPath | ConvertFrom-Json - } - catch { - throw "$ModuleBuildJSONPath either does not exist or is not a json file!" - } - } - else { - throw "$ModuleBuildJSONPath either does not exist or is not a json file!" - } - # Passed a manifest name and several manual entries to validate - Describe 'Module Manifest - ModuleBuild Tests' { - Context "Testing $ManifestPath" { - if (-not [string]::IsNullOrEmpty($Version)) { - It "should be module version '$Version'" { - ($Script:Manifest.Version).ToString() -as [Version] | Should Be $ModuleInfo.ModuleVersion - } - } - if (-not [string]::IsNullOrEmpty($Description)) { - It "should have a module description of '$Description'" { - $Script:Manifest.Description | Should Be $ModuleInfo.ModuleDescription - } - } - - if (-not [string]::IsNullOrEmpty($Author)) { - It "should have the module author of '$Author'" { - $Script:Manifest.Author | Should Be $ModuleInfo.ModuleAuthor - } - } - - if (-not [string]::IsNullOrEmpty($Copyright)) { - It "should have a Copyright of '$Copyright'" { - $Script:Manifest.Copyright | Should Be $ModuleInfo.ModuleCopyright - } - } - - if (-not [string]::IsNullOrEmpty($Website)) { - It "should have the project website of '$Website'" { - $Script:Manifest.ProjectUri.OriginalString | Should Be $ModuleInfo.ModuleWebsite - } - } - - if (-not [string]::IsNullOrEmpty($LicenseURI)) { - It "should have the license URI of '$LicenseURI'" { - $Script:Manifest.LicenseUri | Should Be $ModuleInfo.ModuleLicenseURI - } - } - if ($Tags.Count -gt 0) { - It "should have these tags: $($ModuleInfo.ModuleTags -join ',')" { - Compare-Object $Script:Manifest.PrivateData.PSData.Tags $ModuleInfo.ModuleTags | Should Be $Null - } - } - } - } - } - } -} -else { - Write-Error "$ManifestPath was not found!" -} \ No newline at end of file diff --git a/plaster/ModuleBuild/scaffold/src/tests/ScriptAnalyzer.Tests.ps1 b/plaster/ModuleBuild/scaffold/src/tests/ScriptAnalyzer.Tests.ps1 deleted file mode 100644 index b96ff54..0000000 --- a/plaster/ModuleBuild/scaffold/src/tests/ScriptAnalyzer.Tests.ps1 +++ /dev/null @@ -1,32 +0,0 @@ -#Requires -Modules Pester -<# - This pester test verifies the files in the specified path do not contain sensitive information. - - Example: - Invoke-Pester -Script @{Path = '.\src\tests\ScriptAnalyzer.Tests.ps1'; Parameters = @{ Path = 'C:\Users\zloeber\Dropbox\Zach_Docs\Projects\Git\PSAD' }} -#> - -[CmdletBinding()] -Param( - [Parameter(HelpMessage = 'Path to the files to scan.')] - [string]$Path -) - -if (-not (Get-Item $Path -ErrorAction:SilentlyContinue).PSIsContainer) { - throw "Either $Path is not a directory or does not exist" -} - -Describe 'Testing against PSSA rules' { - Context 'PSSA Standard Rules' { - $analysis = Invoke-ScriptAnalyzer -Path $Path - $scriptAnalyzerRules = Get-ScriptAnalyzerRule - forEach ($rule in $scriptAnalyzerRules) { - It "Should pass $rule" { - If ($analysis.RuleName -contains $rule) { - $analysis | Where RuleName -EQ $rule -outvariable failures | Out-Default - $failures.Count | Should Be 0 - } - } - } - } -} \ No newline at end of file diff --git a/plaster/ModuleBuild/scaffold/src/tests/SensitiveTermScan.Tests.ps1 b/plaster/ModuleBuild/scaffold/src/tests/SensitiveTermScan.Tests.ps1 deleted file mode 100644 index 7e5553a..0000000 --- a/plaster/ModuleBuild/scaffold/src/tests/SensitiveTermScan.Tests.ps1 +++ /dev/null @@ -1,28 +0,0 @@ -#Requires -Modules Pester -<# - This pester test verifies the files in the specified path do not contain sensitive information. - - Example: - Invoke-Pester -Script @{Path = '.\src\tests\SensitiveTermScan.Tests.ps1'; Parameters = @{ Path = 'C:\Users\zloeber\Dropbox\Zach_Docs\Projects\Git\PSAD'; Terms = @('mydomainname.com', 'myservername') }} -#> - -[CmdletBinding()] -Param( - [Parameter(HelpMessage = 'Path to the files to scan.')] - [string]$Path, - [Parameter(HelpMessage = 'Terms to scan for.')] - [string[]]$Terms -) - -if (Test-Path $Path) { - Describe 'Scan for sensitive terms.' { - foreach ($Term in $Terms) { - $TermSearch = @(Get-ChildItem -Recurse -Path $Path | Select-String -Pattern $Term) - Context "Files in $Path" { - It "should not contain the term $Term" { - $TermSearch.Count -gt 0 | Should Be $false - } - } - } - } -} \ No newline at end of file diff --git a/plaster/ModuleBuild/scaffold/src/tests/meta/Autoload.Tests.ps1 b/plaster/ModuleBuild/scaffold/src/tests/meta/Autoload.Tests.ps1 deleted file mode 100644 index 5d0549c..0000000 --- a/plaster/ModuleBuild/scaffold/src/tests/meta/Autoload.Tests.ps1 +++ /dev/null @@ -1,23 +0,0 @@ - -<# - Use this tests to verify, if the latest meta tests are available in this - repository, compared to the claudiospizzi/PowerShellModuleBase repository. -#> - -Describe 'Meta Autoload' { - - $baseApi = 'https://api.github.com/repos/claudiospizzi/PowerShellModuleBase/contents/Tests/Meta' - - $files = Invoke-RestMethod -Method Get -Uri $baseApi - - foreach ($file in $files) - { - if ($file.name -ne 'Autoload.Tests.ps1') - { - It "should download the latest version of \$($file.path.Replace('/', '\'))" { - - { Invoke-WebRequest -Uri $file.download_url -OutFile "$PSScriptRoot\$($file.name)" -Headers @{ 'Cache-Control' = 'no-cache' } -UseBasicParsing -ErrorAction Stop } | Should Not Throw - } - } - } -} diff --git a/plaster/ModuleBuild/scaffold/src/tests/meta/FileContent.Tests.ps1 b/plaster/ModuleBuild/scaffold/src/tests/meta/FileContent.Tests.ps1 deleted file mode 100644 index d05bd76..0000000 --- a/plaster/ModuleBuild/scaffold/src/tests/meta/FileContent.Tests.ps1 +++ /dev/null @@ -1,349 +0,0 @@ - -<# - This meta tests verify, if the PowerShell module core project file have a - valid content. -#> - -$ModulePath = Resolve-Path -Path "$PSScriptRoot\..\..\Modules" | ForEach-Object Path -$ModuleName = Get-ChildItem -Path $ModulePath | Select-Object -First 1 -ExpandProperty BaseName - -Remove-Module -Name $ModuleName -Force -ErrorAction SilentlyContinue -Import-Module -Name "$ModulePath\$ModuleName" -Force - -Describe 'Meta File Content' { - - $rootPath = Resolve-Path -Path "$PSScriptRoot\..\.." | ForEach-Object Path - - Context '\README.md' { - - $content = Get-Content -Path "$rootPath\README.md" - - It 'should have 4 badges at the top' { - - # Arrange - $expectAppVeyorMaster = "[![AppVeyor - master](https://img.shields.io/appveyor/ci/claudiospizzi/$ModuleName/master.svg)](https://ci.appveyor.com/project/claudiospizzi/$ModuleName/branch/master)" - $expectAppVeyorMaster = "[![AppVeyor - dev](https://img.shields.io/appveyor/ci/claudiospizzi/$ModuleName/dev.svg)](https://ci.appveyor.com/project/claudiospizzi/$ModuleName/branch/dev)" - $expectGitHubRelease = "[![GitHub - Release](https://img.shields.io/github/release/claudiospizzi/$ModuleName.svg)](https://github.com/claudiospizzi/$ModuleName/releases)" - $expectPowerShellGallery = "[![PowerShell Gallery - $ModuleName](https://img.shields.io/badge/PowerShell_Gallery-$ModuleName-0072C6.svg)](https://www.powershellgallery.com/packages/$ModuleName)" - - # Act - $actualAppVeyorMaster = $content[0] - $actualAppVeyorMaster = $content[1] - $actualGitHubRelease = $content[2] - $actualPowerShellGallery = $content[3] - - # Assert - $actualAppVeyorMaster | Should BeExactly $expectAppVeyorMaster - $actualAppVeyorMaster | Should BeExactly $expectAppVeyorMaster - $actualGitHubRelease | Should BeExactly $expectGitHubRelease - $actualPowerShellGallery | Should BeExactly $expectPowerShellGallery - } - - It 'should have one main title' { - - # Arrange - $expectCount = 1 - $expectTitle = "# $ModuleName PowerShell Module" - - # Act - $actualTitle = @() - $isCodeBlock = $false - foreach ($line in $content) - { - if ($line -like '``````*') - { - $isCodeBlock = -not $isCodeBlock - } - if (($line -like '# *') -and (-not $isCodeBlock)) - { - $actualTitle += $line - } - } - - # Assert - $actualTitle.Count | Should Be $expectCount - $actualTitle[0] | Should BeExactly $expectTitle - } - - It 'should have a all subtitles' { - - # Arrange - $expectCount = 6 - $expectSubtitles = "## Introduction", "## Requirements", "## Installation", "## Features", "## Versions", "## Contribute" - - # Act - $actualSubtitles = @($content | Where-Object { $_ -like '## *' }) - - # Assert - $actualSubtitles.Count | Should Be $expectCount - $actualSubtitles[0] | Should BeExactly $expectSubtitles[0] - $actualSubtitles[1] | Should BeExactly $expectSubtitles[1] - $actualSubtitles[2] | Should BeExactly $expectSubtitles[2] - $actualSubtitles[3] | Should BeExactly $expectSubtitles[3] - $actualSubtitles[4] | Should BeExactly $expectSubtitles[4] - $actualSubtitles[5] | Should BeExactly $expectSubtitles[5] - } - - It 'should cover every function in the features capture' { - - # Arrange - $expectFunctions = @(Get-ChildItem -Path "$ModulePath\$ModuleName\Functions" | ForEach-Object { '* **' + $_.BaseName + '** ' } | Sort-Object) - - # Act - $actualFunctions = @($content | Where-Object { $_ -like '`* `*`**`*`* ' } | Sort-Object) - - # Assert - $actualFunctions.Count | Should Not Be 0 - $actualFunctions.Count | Should Be $expectFunctions.Count - for ($i = 0; $i -lt $expectFunctions.Count; $i++) - { - $actualFunctions[$i] | Should BeExactly $expectFunctions[$i] - } - } - - It 'should contain an installation capture' { - - # Arrange - $expectLines = @( - 'With PowerShell 5.0, the new [PowerShell Gallery] was introduced. Additionally,' - 'the new module [PowerShellGet] was added to the default WMF 5.0 installation.' - 'With the cmdlet `Install-Module`, a published module from the PowerShell Gallery' - 'can be downloaded and installed directly within the PowerShell host, optionally' - 'with the scope definition:' - '' - '```powershell' - "Install-Module $ModuleName [-Scope {CurrentUser | AllUsers}]" - '```' - '' - 'Alternatively, download the latest release from GitHub and install the module' - 'manually on your local system:' - '' - '1. Download the latest release from GitHub as a ZIP file: [GitHub Releases]' - '2. Extract the module and install it: [Installing a PowerShell Module]' - ) - - # Act - $lineIndex = $content.IndexOf($expectLines[0]) - - # Assert - $lineIndex | Should Not Be -1 - for ($i = 0; $i -lt $expectLines.Count; $i++) - { - $actual = '{{{0}}}{1}' -f $i, $content[$i + $lineIndex] - $expect = '{{{0}}}{1}' -f $i, $expectLines[$i] - - $actual | Should BeExactly $expect - } - } - - It 'should contain an contribute capture' { - - # Arrange - $expectLines = @( - '## Contribute' - '' - 'Please feel free to contribute by opening new issues or providing pull requests.' - 'For the best development experience, open this project as a folder in Visual' - 'Studio Code and ensure that the PowerShell extension is installed.' - '' - '* [Visual Studio Code]' - '* [PowerShell Extension]' - '' - 'This module is tested with the PowerShell testing framework Pester. To run all' - 'tests, just start the included test script `.\Scripts\test.ps1` or invoke Pester' - 'directly with the `Invoke-Pester` cmdlet. The tests will automatically download' - 'the latest meta test from the claudiospizzi/PowerShellModuleBase repository.' - '' - 'To debug the module, just copy the existing `.\Scripts\debug.default.ps1` file' - 'to `.\Scripts\debug.ps1`, which is ignored by git. Now add the command to the' - 'debug file and start it.' - ) - - # Act - $lineIndex = $content.IndexOf($expectLines[0]) - - # Assert - $lineIndex | Should Not Be -1 - for ($i = 0; $i -lt $expectLines.Count; $i++) - { - $actual = '{{{0}}}{1}' -f $i, $content[$i + $lineIndex] - $expect = '{{{0}}}{1}' -f $i, $expectLines[$i] - - $actual | Should BeExactly $expect - } - } - } - - Context '\.gitignore' { - - $content = Get-Content -Path "$rootPath\.gitignore" - - It 'should have entries for all test and debug files' { - - # Arrange - $expect = @( - 'Scripts/debug.ps1' - 'Tests/Meta/FileContent.Tests.ps1' - 'Tests/Meta/FileEncoding.Tests.ps1' - 'Tests/Meta/FileFormatting.Tests.ps1' - 'Tests/Meta/ProjectStructure.Tests.ps1' - 'Tests/Meta/ScriptAnalyzer.Tests.ps1' - ) - - # Act - - # Assert - foreach ($expectLine in $expect) - { - $content -contains $expectLine | Should Be $true - } - } - } - - Context ".\Modules\$ModuleName\$ModuleName.psd1" { - - $data = Import-PowerShellDataFile -Path "$rootPath\Modules\$ModuleName\$ModuleName.psd1" - - It 'should have a valid RootModule value' { - - # Arrange - $expect = "$ModuleName.psm1" - - # Act - $actual = $data.RootModule - - # Assert - $actual | Should BeExactly $expect - } - - It 'should have a valid ModuleVersion value' { - - # Arrange - $expect = '*.*.*' - - # Act - $actual = $data.ModuleVersion - - # Assert - $actual | Should BeLike $expect - } - - It 'should have a valid GUID value' { - - # Arrange - $expect = '????????-????-????-????-????????????' - - # Act - $actual = $data.GUID - - # Assert - $actual | Should BeLike $expect - } - - It 'should have a valid Author value' { - - # Arrange - $expect = 'Claudio Spizzi' - - # Act - $actual = $data.Author - - # Assert - $actual | Should BeExactly $expect - } - - It 'should have a valid Copyright value' { - - # Arrange - - # Act - $actual = $data.Copyright - - # Assert - $actual | Should Not BeNullOrEmpty - } - - It 'should have a valid Description value' { - - # Arrange - - # Act - $actual = $data.Description - - # Assert - $actual | Should Not BeNullOrEmpty - } - - It 'should have a valid PowerShellVersion value' { - - # Arrange - - # Act - $actual = $data.PowerShellVersion - - # Assert - $actual | Should Not BeNullOrEmpty - } - - It 'should have valid TypesToProcess values' { - - # Arrange - $expect = @( - "Resources\$ModuleName.Types.ps1xml" - ) - - # Act - $actual = $data.TypesToProcess - - # Assert - $actual.Count | Should Be 1 - $actual[0] | Should BeExactly $expect[0] - } - - It 'should have valid FormatsToProcess values' { - - # Arrange - $expect = @( - "Resources\$ModuleName.Formats.ps1xml" - ) - - # Act - $actual = $data.FormatsToProcess - - # Assert - $actual.Count | Should Be 1 - $actual[0] | Should BeExactly $expect[0] - } - - It 'should have valid FunctionsToExport values' { - - # Arrange - $expect = @(Get-ChildItem -Path "$ModulePath\$ModuleName\Functions" | ForEach-Object BaseName | Sort-Object) - - # Act - $actual = @($data.FunctionsToExport | Sort-Object) - - # Assert - $actual.Count | Should Be $expect.Count - for ($i = 0; $i -lt $expect.Count; $i++) - { - $actual[$i] | Should BeExactly $expect[$i] - } - } - - It 'should have valid PrivateData hash table' { - - # Arrange - $expectLicenseUri = "https://raw.githubusercontent.com/claudiospizzi/$ModuleName/master/LICENSE" - $expectProjectUri = "https://github.com/claudiospizzi/$ModuleName" - - # Act - $actual = $data.PrivateData - - # Assert - $actual.PSData.Tags -contains 'PSModule' | Should Be $true - $actual.PSData.LicenseUri | Should BeExactly $expectLicenseUri - $actual.PSData.ProjectUri | Should BeExactly $expectProjectUri - } - } -} diff --git a/plaster/ModuleBuild/scaffold/src/tests/meta/FileEncoding.Tests.ps1 b/plaster/ModuleBuild/scaffold/src/tests/meta/FileEncoding.Tests.ps1 deleted file mode 100644 index 9ad1edd..0000000 --- a/plaster/ModuleBuild/scaffold/src/tests/meta/FileEncoding.Tests.ps1 +++ /dev/null @@ -1,54 +0,0 @@ - -<# - Check if the encoding of all text files in the PowerShell module is valid, - this means no Unicode or UTF-8 with BOM files. -#> - -$ModulePath = Resolve-Path -Path "$PSScriptRoot\..\..\Modules" | ForEach-Object Path -$ModuleName = Get-ChildItem -Path $ModulePath | Select-Object -First 1 -ExpandProperty BaseName - -Remove-Module -Name $ModuleName -Force -ErrorAction SilentlyContinue -Import-Module -Name "$ModulePath\$ModuleName" -Force - -Describe 'Meta File Encoding' { - - $fileExtensions = '.ps1', '.psm1', '.psd1', '.ps1xml', '.txt', '.xml', - '.cmd', '.json', '.md', '.csv', '.yml', '.log', - '.gitignore', '.gitattributes' - - $rootPath = Resolve-Path -Path "$PSScriptRoot\..\.." | ForEach-Object Path - $textFiles = Get-ChildItem -Path $rootPath -File -Recurse | - Where-Object { -not $_.FullName.StartsWith("$rootPath\Sources\") } | - Where-Object { $fileExtensions -contains $_.Extension } | - ForEach-Object { $_.FullName.Replace($rootPath, '') } - - Context 'No Unicode encoding' { - - foreach ($textFile in $textFiles) - { - # To check, if the file is encoded in Unicode, check for 0x00 byte - # characters. In a Unicode file, every second charcter is normally - # a 0x00 character, because to majority of chars don't use more than - # the first byte. - It "should not use Unicode encoding for $textFile" { - - @([System.IO.File]::ReadAllBytes("$rootPath\$textFile") -eq 0).Length -eq 0 | Should Be $true - } - } - } - - Context 'No UTF-8 with BOM encoding' { - - foreach ($textFile in $textFiles) - { - # We use UTF-8 encoding with byte order mask (BOM). Therefore we - # check if the file starts with the bytes 0xEF, 0xBB, 0xBF. - It "should not use BOM for UTF-8 encoding for $textFile" { - - $bytes = [System.IO.File]::ReadAllBytes("$rootPath\$textFile") - - ($bytes.Length -ge 3 -and $bytes[0] -eq 239 -and $bytes[1] -eq 187 -and $bytes[2] -eq 191) | Should Be $false - } - } - } -} diff --git a/plaster/ModuleBuild/scaffold/src/tests/meta/FileFormatting.Tests.ps1 b/plaster/ModuleBuild/scaffold/src/tests/meta/FileFormatting.Tests.ps1 deleted file mode 100644 index 690cb2f..0000000 --- a/plaster/ModuleBuild/scaffold/src/tests/meta/FileFormatting.Tests.ps1 +++ /dev/null @@ -1,96 +0,0 @@ - -<# - Verify that the file content if formatted property. It will verify the - following criterias: Use spaces instead of tabs for indentation, no trailing - spaces for lines and should end with a new line. -#> - -$ModulePath = Resolve-Path -Path "$PSScriptRoot\..\..\Modules" | ForEach-Object Path -$ModuleName = Get-ChildItem -Path $ModulePath | Select-Object -First 1 -ExpandProperty BaseName - -Remove-Module -Name $ModuleName -Force -ErrorAction SilentlyContinue -Import-Module -Name "$ModulePath\$ModuleName" -Force - -Describe 'Meta File Formatting' { - - $fileExtensions = '.ps1', '.psm1', '.psd1', '.ps1xml', '.txt', '.xml', - '.cmd', '.json', '.md', '.csv', '.yml', '.log', - '.gitignore', '.gitattributes' - - $rootPath = Resolve-Path -Path "$PSScriptRoot\..\.." | ForEach-Object Path - $textFiles = Get-ChildItem -Path $rootPath -File -Recurse | - Where-Object { -not $_.FullName.StartsWith("$rootPath\Sources\") } | - Where-Object { $fileExtensions -contains $_.Extension } | - ForEach-Object { $_.FullName.Replace($rootPath, '') } - - Context 'Space Indentation' { - - foreach ($textFile in $textFiles) - { - It "should use spaces and not tabs for indentation in $textFile" { - - $errorLines = @() - - $content = @(Get-Content -Path "$rootPath$textFile") - - for ($line = 0; $line -lt $content.Length; $line++) - { - if(($content[$line] | Select-String "`t" | Measure-Object).Count -ne 0) - { - $errorLines += $line + 1 - - Write-Warning "There are tabs instead of spaces in $textFile`:$($line + 1)" - } - } - - $errorLines.Count | Should Be 0 - } - } - } - - Context 'No Trailing Spaces' { - - # Do not test markdown files for trailing spaces. - $textFilesFiltered = $textFiles | Where-Object { $_ -notlike '*.md' } - - foreach ($textFile in $textFilesFiltered) - { - It "should not have trailing spaces in $textFile" { - - $errorLines = @() - - $content = @(Get-Content -Path "$rootPath$textFile") - - for ($line = 0; $line -lt $content.Length; $line++) - { - if($content[$Line].ToString().TrimEnd() -ne $content[$Line]) - { - $errorLines += $line + 1 - - Write-Warning "There are trailing spaces in $textFile`:$($line + 1)" - } - } - - $errorLines.Count | Should Be 0 - } - } - } - - Context 'New Line Termination' { - - # Do not test files in .vscode for trailing spaces. - $textFilesFiltered = $textFiles | Where-Object { $_ -notlike '*\.vscode\*' } - - foreach ($textFile in $textFilesFiltered) - { - - It "should terminate with a new line in $textFile" { - - $content = Get-Content -Path "$rootPath$textFile" -Raw - - $content.Length | Should Not Be 0 - $content[-1] | Should Be "`n" - } - } - } -} diff --git a/plaster/ModuleBuild/scaffold/src/tests/meta/ProjectStructure.Tests.ps1 b/plaster/ModuleBuild/scaffold/src/tests/meta/ProjectStructure.Tests.ps1 deleted file mode 100644 index c120da7..0000000 --- a/plaster/ModuleBuild/scaffold/src/tests/meta/ProjectStructure.Tests.ps1 +++ /dev/null @@ -1,152 +0,0 @@ - -<# - This meta tests verify, if the PowerShell module project structure is - adhered to the best practices. -#> - -$ModulePath = Resolve-Path -Path "$PSScriptRoot\..\..\Modules" | ForEach-Object Path -$ModuleName = Get-ChildItem -Path $ModulePath | Select-Object -First 1 -ExpandProperty BaseName - -Remove-Module -Name $ModuleName -Force -ErrorAction SilentlyContinue -Import-Module -Name "$ModulePath\$ModuleName" -Force - -Describe 'Meta Project Structure' { - - $rootPath = Resolve-Path -Path "$PSScriptRoot\..\.." | ForEach-Object Path - - Context 'Folders' { - - $requiredFolders = @( - '\Scripts' - '\Modules' - "\Modules\$ModuleName" - "\Modules\$ModuleName\en-US" - "\Modules\$ModuleName\Functions" - "\Modules\$ModuleName\Resources" - '\Tests' - '\Tests\Meta' - '\Tests\Unit' - ) - - $optionalFolders = @( - "\Modules\$ModuleName\Helpers" - '\Sources' - "\Sources\$ModuleName" - '\Tests\Integration' - ) - - foreach ($requiredFolder in $requiredFolders) - { - It "should contain the folder $requiredFolder" { - - Test-Path -Path "$rootPath$requiredFolder" | Should Be $true - } - } - - foreach ($optionalFolder in $optionalFolders) - { - It "can contain the folder $optionalFolder" { - - if ((Test-Path -Path "$rootPath$optionalFolder")) - { - Test-Path -Path "$rootPath$optionalFolder" | Should Be $true - } - else - { - Set-TestInconclusive -Message "Optional folder $optionalFolder not found!" - } - } - } - } - - Context 'Files' { - - $requiredFiles = @( - '\appveyor.yml' - '\LICENSE' - '\README.md' - '\Scripts\build.ps1' - '\Scripts\debug.default.ps1' - '\Scripts\release.ps1' - '\Scripts\test.ps1' - "\Modules\$ModuleName\en-US\about_$ModuleName.help.txt" - "\Modules\$ModuleName\Resources\$ModuleName.Formats.ps1xml" - "\Modules\$ModuleName\Resources\$ModuleName.Types.ps1xml" - "\Modules\$ModuleName\$ModuleName.psd1" - "\Modules\$ModuleName\$ModuleName.psm1" - '\Tests\Meta\Autoload.Tests.ps1' - ) - - $optionalFiles = @( - "\Sources\$ModuleName.sln" - ) - - foreach ($requiredFile in $requiredFiles) - { - It "should contain the file $requiredFile" { - - Test-Path -Path "$rootPath\$requiredFile" | Should Be $true - } - } - - foreach ($optionalFile in $optionalFiles) - { - It "can contain the file $optionalFile" { - - if ((Test-Path -Path "$rootPath$optionalFile")) - { - Test-Path -Path "$rootPath$optionalFile" | Should Be $true - } - else - { - Set-TestInconclusive -Message "Optional file $optionalFile not found!" - } - } - } - } - - Context 'Version' { - - # Arrange - $requiredVersion = (Import-PowerShellDataFile -Path "$rootPath\Modules\$ModuleName\$ModuleName.psd1")['ModuleVersion'] - - It "should have version $requiredVersion in README.md" { - - # Act - $versionHeadline = @(Get-Content -Path "$rootPath\README.md" | Where-Object { $_ -eq "### $requiredVersion" }) - - # Assert - $versionHeadline.Count | Should Be 1 - $versionHeadline[0] | Should BeExactly "### $requiredVersion" - } - - It "should have version $requiredVersion in $ModuleName.psd1" { - - # Act - $moduleDefinition = Import-PowerShellDataFile -Path "$rootPath\Modules\$ModuleName\$ModuleName.psd1" - - # Assert - $moduleDefinition.ModuleVersion | Should Be $requiredVersion - } - - if ((Test-Path -Path "$rootPath\Sources\$ModuleName")) - { - It "should have version $requiredVersion in $ModuleName.dll" { - - if ((Test-Path -Path "$rootPath\Modules\$ModuleName\$ModuleName.dll")) - { - # Act - $moduleAssembly = Get-Item -Path "$rootPath\Modules\$ModuleName\$ModuleName.dll" - - # Assert - $moduleAssembly.VersionInfo.ProductVersion | Should Be $requiredVersion - $moduleAssembly.VersionInfo.FileVersion | Should Be $requiredVersion - } - else - { - Set-TestInconclusive -Message "$ModuleName.dll file was not found!" - } - } - } - } -} diff --git a/plaster/ModuleBuild/scaffold/src/tests/meta/ScriptAnalyzer.Tests.ps1 b/plaster/ModuleBuild/scaffold/src/tests/meta/ScriptAnalyzer.Tests.ps1 deleted file mode 100644 index 18a2d69..0000000 --- a/plaster/ModuleBuild/scaffold/src/tests/meta/ScriptAnalyzer.Tests.ps1 +++ /dev/null @@ -1,37 +0,0 @@ - -<# - Check all scripts files in the sources folder against all script analyzer - rules. It should comply with all rules. -#> - -$ModulePath = Resolve-Path -Path "$PSScriptRoot\..\..\Modules" | ForEach-Object Path -$ModuleName = Get-ChildItem -Path $ModulePath | Select-Object -First 1 -ExpandProperty BaseName - -Remove-Module -Name $ModuleName -Force -ErrorAction SilentlyContinue -Import-Module -Name "$ModulePath\$ModuleName" -Force - -Describe 'Meta Script Analyzer' { - - foreach ($severity in 'Information', 'Warning', 'Error') - { - Context "$severity Rules" { - - $scriptAnalyzerRules = Get-ScriptAnalyzerRule -Severity $severity - - foreach ($scriptAnalyzerRule in $scriptAnalyzerRules) - { - It "should conform the rule $($scriptAnalyzerRule.RuleName)" { - - $scriptAnalyzerResults = @(Invoke-ScriptAnalyzer -Path $ModulePath -IncludeRule $scriptAnalyzerRule -Recurse) - - foreach ($scriptAnalyzerResult in $scriptAnalyzerResults) - { - Write-Warning ('{0}, line {1}: {2}' -f $scriptAnalyzerResult.ScriptPath.Replace("$ModulePath", 'Modules'), $scriptAnalyzerResult.Line, $scriptAnalyzerResult.Message) - } - - $scriptAnalyzerResults.Count | Should Be 0 - } - } - } - } -} diff --git a/plaster/ModuleBuild/scaffold/tests/FunctionCBH.Tests.ps1 b/plaster/ModuleBuild/scaffold/tests/FunctionCBH.Tests.ps1 deleted file mode 100644 index 0f418c3..0000000 --- a/plaster/ModuleBuild/scaffold/tests/FunctionCBH.Tests.ps1 +++ /dev/null @@ -1,60 +0,0 @@ -#Requires -Modules Pester -<# - This pester test verifies the module's public functions all have proper comment based help required for building documentation via PlatyPS. - - Example: - PS> Invoke-Pester -Script @{Path = '.\src\tests\FuncitonCBH.Tests.ps1'; Parameters = @{ ModuleName = MyModule}} -#> - -[CmdletBinding()] -Param( - [Parameter(HelpMessage = 'Module to scan.')] - [string]$ModuleName -) - -If (($ModuleName -like '*.psd1') -and (test-path $ModuleName)) { - $Module = (Split-Path $ModuleName -Leaf) -replace '.psd1','' -} -else { - $Module = $ModuleName -} - -if (-not (Get-Module $Module)) { - try { - Import-Module $ModuleName -force - } - catch { - throw "$Module is not loaded." - } -} - -Describe "Comment Based Help tests for $Module" -Tags Build { - - $functions = Get-Command -Module $Module -CommandType Function - foreach($Function in $Functions){ - $help = Get-Help $Function.name - Context $help.name { - it "Has a HelpUri" { - $Function.HelpUri | Should Not BeNullOrEmpty - } - It "Has related Links" { - $help.relatedLinks.navigationLink.uri.count | Should BeGreaterThan 0 - } - it "Has a description" { - $help.description | Should Not BeNullOrEmpty - } - it "Has an example" { - $help.examples | Should Not BeNullOrEmpty - } - foreach($parameter in $help.parameters.parameter) - { - if($parameter -notmatch 'whatif|confirm') - { - it "Has a Parameter description for '$($parameter.name)'" { - $parameter.Description.text | Should Not BeNullOrEmpty - } - } - } - } - } -} \ No newline at end of file diff --git a/plaster/ModuleBuild/scaffold/tests/ModuleManifest.Tests.ps1 b/plaster/ModuleBuild/scaffold/tests/ModuleManifest.Tests.ps1 deleted file mode 100644 index c6bf56f..0000000 --- a/plaster/ModuleBuild/scaffold/tests/ModuleManifest.Tests.ps1 +++ /dev/null @@ -1,205 +0,0 @@ -#Requires -Modules Pester - -<# - This pester test verifies the PowerShell module manifest file has valid content that will be required to - upload to the PowerShell Gallary. - - .EXAMPLE - PS> Invoke-Pester -Script @{Path = '.\src\tests\ModuleManifest.Tests.ps1'; Parameters = @{ ManifestPath = 'C:\Users\zloeber\Dropbox\Zach_Docs\Projects\Git\PSAD'; Author = 'Zachary Loeber'; Website = 'https://github.com/zloeber/PSAD'; Tags = @('ADSI', 'Active_Directory', 'DC') }} - - Runs some standard tests and a few manual validations (Tags, Author, and Website). - .EXAMPLE - PS> Invoke-Pester -Script @{Path = '.\src\tests\ModuleManifest.Tests.ps1'; Parameters = @{ ManifestPath = '.\PSAD.psd1'}} - - Runs several generic tests against the PSAD.psd1 manifest to ensure all required values for uploading to the PowerShell Gallery simply exist. -#> - -[CmdLetBinding(DefaultParameterSetName='Default')] -Param( - [Parameter(Mandatory = $True, ParameterSetName='Default')] - [Parameter(Mandatory = $True, ParameterSetName='Manual')] - [Parameter(Mandatory = $True, ParameterSetName='ModuleBuild')] - [string]$ManifestPath, - [Parameter(Mandatory = $True, ParameterSetName='ModuleBuild')] - [string]$ModuleBuildJSONPath, - [Parameter(ParameterSetName='Manual')] - [string]$Author, - [Parameter(ParameterSetName='Manual')] - [string]$Copyright, - [Parameter(ParameterSetName='Manual')] - [string]$Website, - [Parameter(ParameterSetName='Manual')] - [string]$LicenseURI, - [Parameter(ParameterSetName='Manual')] - [string]$Version, - [Parameter(ParameterSetName='Manual')] - [string[]]$Tags -) - -if (($ManifestPath.EndsWith('psd1')) -and (Test-Path $ManifestPath)) { - # Grab the short module name - $ModuleName = (Split-Path $ManifestPath -Leaf).Split('.')[0] - - Describe 'Module Manifest - Standard Tests' { - Context "Testing $ManifestPath" { - It 'should be a valid module manifest file' { - { - $Script:Manifest = Test-ModuleManifest -Path $ManifestPath -ErrorAction Stop -WarningAction SilentlyContinue - } | Should Not Throw - } - - It 'should have a valid RootModule value' { - $Script:Manifest.RootModule | Should Be "$ModuleName.psm1" - } - - It 'should have a valid GUID' { - ($Script:Manifest.Guid).Guid | Should BeLike '????????-????-????-????-????????????' - } - - It 'should have a valid PowerShellVersion value' { - $Script:Manifest.PowerShellVersion | Should Not BeNullOrEmpty - } - } - } - - switch ($PSCmdlet.ParameterSetName) { - 'Default' { - # Passed just a module manifest file name with no other information to validate - # This will check for several entries that they simply exist. - Describe 'Module Manifest - Generic Tests' { - Context "Testing $ManifestPath" { - It 'should have a valid Module version' { - ($Script:Manifest.Version).ToString() -as [Version] | Should Not BeNullOrEmpty - } - - It 'should have a valid module description' { - $Script:Manifest.Description | Should Not BeNullOrEmpty - } - - It 'should have a valid module author' { - $Script:Manifest.Author | Should Not BeNullOrEmpty - } - - It 'should have a valid module project website' { - $Script:Manifest.ProjectUri.OriginalString | Should Not BeNullOrEmpty - } - - It 'should have a valid license URL' { - $Script:Manifest.LicenseUri | Should Not BeNullOrEmpty - } - - It 'should have some tags' { - @($Script:Manifest.PrivateData.PSData.Tags).Count -gt 0 | Should Be $true - } - } - } - } - 'Manual' { - # Passed a manifest name and several manual entries to validate - Describe 'Module Manifest - Manual Tests' { - Context "Testing $ManifestPath" { - if (-not [string]::IsNullOrEmpty($Version)) { - It "should be module version '$Version'" { - ($Script:Manifest.Version).ToString() -as [Version] | Should Be $Version - } - } - if (-not [string]::IsNullOrEmpty($Description)) { - It "should have a module description of '$Description'" { - $Script:Manifest.Description | Should Be $Description - } - } - - if (-not [string]::IsNullOrEmpty($Author)) { - It "should have the module author of '$Author'" { - $Script:Manifest.Author | Should Be $Author - } - } - - if (-not [string]::IsNullOrEmpty($Copyright)) { - It "should have a Copyright of '$Copyright'" { - $Script:Manifest.Copyright | Should Be $Copyright - } - } - - if (-not [string]::IsNullOrEmpty($Website)) { - It "should have the project website of '$Website'" { - $Script:Manifest.ProjectUri.OriginalString | Should Be $Website - } - } - - if (-not [string]::IsNullOrEmpty($LicenseURI)) { - It "should have the license URI of '$LicenseURI'" { - $Script:Manifest.LicenseUri | Should Be $LicenseURI - } - } - if ($Tags.Count -gt 0) { - It "should have these tags: $($Tags -join ',')" { - Compare-Object $Script:Manifest.PrivateData.PSData.Tags $Tags | Should Be $Null - } - } - } - } - } - 'ModuleBuild' { - # Passed a manifest name and a ModuleBuild json configuration file to validate - if (($ModuleBuildJSONPath.EndsWith('psd1')) -and (Test-Path $ModuleBuildJSONPath)) { - try { - $ModuleInfo = get-content $ModuleBuildJSONPath | ConvertFrom-Json - } - catch { - throw "$ModuleBuildJSONPath either does not exist or is not a json file!" - } - } - else { - throw "$ModuleBuildJSONPath either does not exist or is not a json file!" - } - # Passed a manifest name and several manual entries to validate - Describe 'Module Manifest - ModuleBuild Tests' { - Context "Testing $ManifestPath" { - if (-not [string]::IsNullOrEmpty($Version)) { - It "should be module version '$Version'" { - ($Script:Manifest.Version).ToString() -as [Version] | Should Be $ModuleInfo.ModuleVersion - } - } - if (-not [string]::IsNullOrEmpty($Description)) { - It "should have a module description of '$Description'" { - $Script:Manifest.Description | Should Be $ModuleInfo.ModuleDescription - } - } - - if (-not [string]::IsNullOrEmpty($Author)) { - It "should have the module author of '$Author'" { - $Script:Manifest.Author | Should Be $ModuleInfo.ModuleAuthor - } - } - - if (-not [string]::IsNullOrEmpty($Copyright)) { - It "should have a Copyright of '$Copyright'" { - $Script:Manifest.Copyright | Should Be $ModuleInfo.ModuleCopyright - } - } - - if (-not [string]::IsNullOrEmpty($Website)) { - It "should have the project website of '$Website'" { - $Script:Manifest.ProjectUri.OriginalString | Should Be $ModuleInfo.ModuleWebsite - } - } - - if (-not [string]::IsNullOrEmpty($LicenseURI)) { - It "should have the license URI of '$LicenseURI'" { - $Script:Manifest.LicenseUri | Should Be $ModuleInfo.ModuleLicenseURI - } - } - if ($Tags.Count -gt 0) { - It "should have these tags: $($ModuleInfo.ModuleTags -join ',')" { - Compare-Object $Script:Manifest.PrivateData.PSData.Tags $ModuleInfo.ModuleTags | Should Be $Null - } - } - } - } - } - } -} -else { - Write-Error "$ManifestPath was not found!" -} \ No newline at end of file diff --git a/plaster/ModuleBuild/scaffold/tests/ScriptAnalyzer.Tests.ps1 b/plaster/ModuleBuild/scaffold/tests/ScriptAnalyzer.Tests.ps1 deleted file mode 100644 index b96ff54..0000000 --- a/plaster/ModuleBuild/scaffold/tests/ScriptAnalyzer.Tests.ps1 +++ /dev/null @@ -1,32 +0,0 @@ -#Requires -Modules Pester -<# - This pester test verifies the files in the specified path do not contain sensitive information. - - Example: - Invoke-Pester -Script @{Path = '.\src\tests\ScriptAnalyzer.Tests.ps1'; Parameters = @{ Path = 'C:\Users\zloeber\Dropbox\Zach_Docs\Projects\Git\PSAD' }} -#> - -[CmdletBinding()] -Param( - [Parameter(HelpMessage = 'Path to the files to scan.')] - [string]$Path -) - -if (-not (Get-Item $Path -ErrorAction:SilentlyContinue).PSIsContainer) { - throw "Either $Path is not a directory or does not exist" -} - -Describe 'Testing against PSSA rules' { - Context 'PSSA Standard Rules' { - $analysis = Invoke-ScriptAnalyzer -Path $Path - $scriptAnalyzerRules = Get-ScriptAnalyzerRule - forEach ($rule in $scriptAnalyzerRules) { - It "Should pass $rule" { - If ($analysis.RuleName -contains $rule) { - $analysis | Where RuleName -EQ $rule -outvariable failures | Out-Default - $failures.Count | Should Be 0 - } - } - } - } -} \ No newline at end of file diff --git a/plaster/ModuleBuild/scaffold/tests/SensitiveTermScan.Tests.ps1 b/plaster/ModuleBuild/scaffold/tests/SensitiveTermScan.Tests.ps1 deleted file mode 100644 index 7e5553a..0000000 --- a/plaster/ModuleBuild/scaffold/tests/SensitiveTermScan.Tests.ps1 +++ /dev/null @@ -1,28 +0,0 @@ -#Requires -Modules Pester -<# - This pester test verifies the files in the specified path do not contain sensitive information. - - Example: - Invoke-Pester -Script @{Path = '.\src\tests\SensitiveTermScan.Tests.ps1'; Parameters = @{ Path = 'C:\Users\zloeber\Dropbox\Zach_Docs\Projects\Git\PSAD'; Terms = @('mydomainname.com', 'myservername') }} -#> - -[CmdletBinding()] -Param( - [Parameter(HelpMessage = 'Path to the files to scan.')] - [string]$Path, - [Parameter(HelpMessage = 'Terms to scan for.')] - [string[]]$Terms -) - -if (Test-Path $Path) { - Describe 'Scan for sensitive terms.' { - foreach ($Term in $Terms) { - $TermSearch = @(Get-ChildItem -Recurse -Path $Path | Select-String -Pattern $Term) - Context "Files in $Path" { - It "should not contain the term $Term" { - $TermSearch.Count -gt 0 | Should Be $false - } - } - } - } -} \ No newline at end of file diff --git a/plaster/ModuleBuild/scaffold/tests/intergration/other/readme.md b/plaster/ModuleBuild/scaffold/tests/intergration/other/readme.md new file mode 100644 index 0000000..536a744 --- /dev/null +++ b/plaster/ModuleBuild/scaffold/tests/intergration/other/readme.md @@ -0,0 +1 @@ +Intergration tests for scripts in other folder go here \ No newline at end of file diff --git a/plaster/ModuleBuild/scaffold/tests/intergration/private/readme.md b/plaster/ModuleBuild/scaffold/tests/intergration/private/readme.md new file mode 100644 index 0000000..1f6dba4 --- /dev/null +++ b/plaster/ModuleBuild/scaffold/tests/intergration/private/readme.md @@ -0,0 +1 @@ +Intergration tests for private functions go here \ No newline at end of file diff --git a/plaster/ModuleBuild/scaffold/tests/intergration/public/readme.md b/plaster/ModuleBuild/scaffold/tests/intergration/public/readme.md new file mode 100644 index 0000000..5cf9b73 --- /dev/null +++ b/plaster/ModuleBuild/scaffold/tests/intergration/public/readme.md @@ -0,0 +1 @@ +Intergration tests for public functions go here \ No newline at end of file diff --git a/plaster/ModuleBuild/scaffold/tests/meta/Autoload.Tests.ps1 b/plaster/ModuleBuild/scaffold/tests/meta/Autoload.Tests.ps1 deleted file mode 100644 index 5d0549c..0000000 --- a/plaster/ModuleBuild/scaffold/tests/meta/Autoload.Tests.ps1 +++ /dev/null @@ -1,23 +0,0 @@ - -<# - Use this tests to verify, if the latest meta tests are available in this - repository, compared to the claudiospizzi/PowerShellModuleBase repository. -#> - -Describe 'Meta Autoload' { - - $baseApi = 'https://api.github.com/repos/claudiospizzi/PowerShellModuleBase/contents/Tests/Meta' - - $files = Invoke-RestMethod -Method Get -Uri $baseApi - - foreach ($file in $files) - { - if ($file.name -ne 'Autoload.Tests.ps1') - { - It "should download the latest version of \$($file.path.Replace('/', '\'))" { - - { Invoke-WebRequest -Uri $file.download_url -OutFile "$PSScriptRoot\$($file.name)" -Headers @{ 'Cache-Control' = 'no-cache' } -UseBasicParsing -ErrorAction Stop } | Should Not Throw - } - } - } -} diff --git a/plaster/ModuleBuild/scaffold/tests/meta/FileContent.Tests.ps1 b/plaster/ModuleBuild/scaffold/tests/meta/FileContent.Tests.ps1 deleted file mode 100644 index d05bd76..0000000 --- a/plaster/ModuleBuild/scaffold/tests/meta/FileContent.Tests.ps1 +++ /dev/null @@ -1,349 +0,0 @@ - -<# - This meta tests verify, if the PowerShell module core project file have a - valid content. -#> - -$ModulePath = Resolve-Path -Path "$PSScriptRoot\..\..\Modules" | ForEach-Object Path -$ModuleName = Get-ChildItem -Path $ModulePath | Select-Object -First 1 -ExpandProperty BaseName - -Remove-Module -Name $ModuleName -Force -ErrorAction SilentlyContinue -Import-Module -Name "$ModulePath\$ModuleName" -Force - -Describe 'Meta File Content' { - - $rootPath = Resolve-Path -Path "$PSScriptRoot\..\.." | ForEach-Object Path - - Context '\README.md' { - - $content = Get-Content -Path "$rootPath\README.md" - - It 'should have 4 badges at the top' { - - # Arrange - $expectAppVeyorMaster = "[![AppVeyor - master](https://img.shields.io/appveyor/ci/claudiospizzi/$ModuleName/master.svg)](https://ci.appveyor.com/project/claudiospizzi/$ModuleName/branch/master)" - $expectAppVeyorMaster = "[![AppVeyor - dev](https://img.shields.io/appveyor/ci/claudiospizzi/$ModuleName/dev.svg)](https://ci.appveyor.com/project/claudiospizzi/$ModuleName/branch/dev)" - $expectGitHubRelease = "[![GitHub - Release](https://img.shields.io/github/release/claudiospizzi/$ModuleName.svg)](https://github.com/claudiospizzi/$ModuleName/releases)" - $expectPowerShellGallery = "[![PowerShell Gallery - $ModuleName](https://img.shields.io/badge/PowerShell_Gallery-$ModuleName-0072C6.svg)](https://www.powershellgallery.com/packages/$ModuleName)" - - # Act - $actualAppVeyorMaster = $content[0] - $actualAppVeyorMaster = $content[1] - $actualGitHubRelease = $content[2] - $actualPowerShellGallery = $content[3] - - # Assert - $actualAppVeyorMaster | Should BeExactly $expectAppVeyorMaster - $actualAppVeyorMaster | Should BeExactly $expectAppVeyorMaster - $actualGitHubRelease | Should BeExactly $expectGitHubRelease - $actualPowerShellGallery | Should BeExactly $expectPowerShellGallery - } - - It 'should have one main title' { - - # Arrange - $expectCount = 1 - $expectTitle = "# $ModuleName PowerShell Module" - - # Act - $actualTitle = @() - $isCodeBlock = $false - foreach ($line in $content) - { - if ($line -like '``````*') - { - $isCodeBlock = -not $isCodeBlock - } - if (($line -like '# *') -and (-not $isCodeBlock)) - { - $actualTitle += $line - } - } - - # Assert - $actualTitle.Count | Should Be $expectCount - $actualTitle[0] | Should BeExactly $expectTitle - } - - It 'should have a all subtitles' { - - # Arrange - $expectCount = 6 - $expectSubtitles = "## Introduction", "## Requirements", "## Installation", "## Features", "## Versions", "## Contribute" - - # Act - $actualSubtitles = @($content | Where-Object { $_ -like '## *' }) - - # Assert - $actualSubtitles.Count | Should Be $expectCount - $actualSubtitles[0] | Should BeExactly $expectSubtitles[0] - $actualSubtitles[1] | Should BeExactly $expectSubtitles[1] - $actualSubtitles[2] | Should BeExactly $expectSubtitles[2] - $actualSubtitles[3] | Should BeExactly $expectSubtitles[3] - $actualSubtitles[4] | Should BeExactly $expectSubtitles[4] - $actualSubtitles[5] | Should BeExactly $expectSubtitles[5] - } - - It 'should cover every function in the features capture' { - - # Arrange - $expectFunctions = @(Get-ChildItem -Path "$ModulePath\$ModuleName\Functions" | ForEach-Object { '* **' + $_.BaseName + '** ' } | Sort-Object) - - # Act - $actualFunctions = @($content | Where-Object { $_ -like '`* `*`**`*`* ' } | Sort-Object) - - # Assert - $actualFunctions.Count | Should Not Be 0 - $actualFunctions.Count | Should Be $expectFunctions.Count - for ($i = 0; $i -lt $expectFunctions.Count; $i++) - { - $actualFunctions[$i] | Should BeExactly $expectFunctions[$i] - } - } - - It 'should contain an installation capture' { - - # Arrange - $expectLines = @( - 'With PowerShell 5.0, the new [PowerShell Gallery] was introduced. Additionally,' - 'the new module [PowerShellGet] was added to the default WMF 5.0 installation.' - 'With the cmdlet `Install-Module`, a published module from the PowerShell Gallery' - 'can be downloaded and installed directly within the PowerShell host, optionally' - 'with the scope definition:' - '' - '```powershell' - "Install-Module $ModuleName [-Scope {CurrentUser | AllUsers}]" - '```' - '' - 'Alternatively, download the latest release from GitHub and install the module' - 'manually on your local system:' - '' - '1. Download the latest release from GitHub as a ZIP file: [GitHub Releases]' - '2. Extract the module and install it: [Installing a PowerShell Module]' - ) - - # Act - $lineIndex = $content.IndexOf($expectLines[0]) - - # Assert - $lineIndex | Should Not Be -1 - for ($i = 0; $i -lt $expectLines.Count; $i++) - { - $actual = '{{{0}}}{1}' -f $i, $content[$i + $lineIndex] - $expect = '{{{0}}}{1}' -f $i, $expectLines[$i] - - $actual | Should BeExactly $expect - } - } - - It 'should contain an contribute capture' { - - # Arrange - $expectLines = @( - '## Contribute' - '' - 'Please feel free to contribute by opening new issues or providing pull requests.' - 'For the best development experience, open this project as a folder in Visual' - 'Studio Code and ensure that the PowerShell extension is installed.' - '' - '* [Visual Studio Code]' - '* [PowerShell Extension]' - '' - 'This module is tested with the PowerShell testing framework Pester. To run all' - 'tests, just start the included test script `.\Scripts\test.ps1` or invoke Pester' - 'directly with the `Invoke-Pester` cmdlet. The tests will automatically download' - 'the latest meta test from the claudiospizzi/PowerShellModuleBase repository.' - '' - 'To debug the module, just copy the existing `.\Scripts\debug.default.ps1` file' - 'to `.\Scripts\debug.ps1`, which is ignored by git. Now add the command to the' - 'debug file and start it.' - ) - - # Act - $lineIndex = $content.IndexOf($expectLines[0]) - - # Assert - $lineIndex | Should Not Be -1 - for ($i = 0; $i -lt $expectLines.Count; $i++) - { - $actual = '{{{0}}}{1}' -f $i, $content[$i + $lineIndex] - $expect = '{{{0}}}{1}' -f $i, $expectLines[$i] - - $actual | Should BeExactly $expect - } - } - } - - Context '\.gitignore' { - - $content = Get-Content -Path "$rootPath\.gitignore" - - It 'should have entries for all test and debug files' { - - # Arrange - $expect = @( - 'Scripts/debug.ps1' - 'Tests/Meta/FileContent.Tests.ps1' - 'Tests/Meta/FileEncoding.Tests.ps1' - 'Tests/Meta/FileFormatting.Tests.ps1' - 'Tests/Meta/ProjectStructure.Tests.ps1' - 'Tests/Meta/ScriptAnalyzer.Tests.ps1' - ) - - # Act - - # Assert - foreach ($expectLine in $expect) - { - $content -contains $expectLine | Should Be $true - } - } - } - - Context ".\Modules\$ModuleName\$ModuleName.psd1" { - - $data = Import-PowerShellDataFile -Path "$rootPath\Modules\$ModuleName\$ModuleName.psd1" - - It 'should have a valid RootModule value' { - - # Arrange - $expect = "$ModuleName.psm1" - - # Act - $actual = $data.RootModule - - # Assert - $actual | Should BeExactly $expect - } - - It 'should have a valid ModuleVersion value' { - - # Arrange - $expect = '*.*.*' - - # Act - $actual = $data.ModuleVersion - - # Assert - $actual | Should BeLike $expect - } - - It 'should have a valid GUID value' { - - # Arrange - $expect = '????????-????-????-????-????????????' - - # Act - $actual = $data.GUID - - # Assert - $actual | Should BeLike $expect - } - - It 'should have a valid Author value' { - - # Arrange - $expect = 'Claudio Spizzi' - - # Act - $actual = $data.Author - - # Assert - $actual | Should BeExactly $expect - } - - It 'should have a valid Copyright value' { - - # Arrange - - # Act - $actual = $data.Copyright - - # Assert - $actual | Should Not BeNullOrEmpty - } - - It 'should have a valid Description value' { - - # Arrange - - # Act - $actual = $data.Description - - # Assert - $actual | Should Not BeNullOrEmpty - } - - It 'should have a valid PowerShellVersion value' { - - # Arrange - - # Act - $actual = $data.PowerShellVersion - - # Assert - $actual | Should Not BeNullOrEmpty - } - - It 'should have valid TypesToProcess values' { - - # Arrange - $expect = @( - "Resources\$ModuleName.Types.ps1xml" - ) - - # Act - $actual = $data.TypesToProcess - - # Assert - $actual.Count | Should Be 1 - $actual[0] | Should BeExactly $expect[0] - } - - It 'should have valid FormatsToProcess values' { - - # Arrange - $expect = @( - "Resources\$ModuleName.Formats.ps1xml" - ) - - # Act - $actual = $data.FormatsToProcess - - # Assert - $actual.Count | Should Be 1 - $actual[0] | Should BeExactly $expect[0] - } - - It 'should have valid FunctionsToExport values' { - - # Arrange - $expect = @(Get-ChildItem -Path "$ModulePath\$ModuleName\Functions" | ForEach-Object BaseName | Sort-Object) - - # Act - $actual = @($data.FunctionsToExport | Sort-Object) - - # Assert - $actual.Count | Should Be $expect.Count - for ($i = 0; $i -lt $expect.Count; $i++) - { - $actual[$i] | Should BeExactly $expect[$i] - } - } - - It 'should have valid PrivateData hash table' { - - # Arrange - $expectLicenseUri = "https://raw.githubusercontent.com/claudiospizzi/$ModuleName/master/LICENSE" - $expectProjectUri = "https://github.com/claudiospizzi/$ModuleName" - - # Act - $actual = $data.PrivateData - - # Assert - $actual.PSData.Tags -contains 'PSModule' | Should Be $true - $actual.PSData.LicenseUri | Should BeExactly $expectLicenseUri - $actual.PSData.ProjectUri | Should BeExactly $expectProjectUri - } - } -} diff --git a/plaster/ModuleBuild/scaffold/tests/meta/FileEncoding.Tests.ps1 b/plaster/ModuleBuild/scaffold/tests/meta/FileEncoding.Tests.ps1 deleted file mode 100644 index 9ad1edd..0000000 --- a/plaster/ModuleBuild/scaffold/tests/meta/FileEncoding.Tests.ps1 +++ /dev/null @@ -1,54 +0,0 @@ - -<# - Check if the encoding of all text files in the PowerShell module is valid, - this means no Unicode or UTF-8 with BOM files. -#> - -$ModulePath = Resolve-Path -Path "$PSScriptRoot\..\..\Modules" | ForEach-Object Path -$ModuleName = Get-ChildItem -Path $ModulePath | Select-Object -First 1 -ExpandProperty BaseName - -Remove-Module -Name $ModuleName -Force -ErrorAction SilentlyContinue -Import-Module -Name "$ModulePath\$ModuleName" -Force - -Describe 'Meta File Encoding' { - - $fileExtensions = '.ps1', '.psm1', '.psd1', '.ps1xml', '.txt', '.xml', - '.cmd', '.json', '.md', '.csv', '.yml', '.log', - '.gitignore', '.gitattributes' - - $rootPath = Resolve-Path -Path "$PSScriptRoot\..\.." | ForEach-Object Path - $textFiles = Get-ChildItem -Path $rootPath -File -Recurse | - Where-Object { -not $_.FullName.StartsWith("$rootPath\Sources\") } | - Where-Object { $fileExtensions -contains $_.Extension } | - ForEach-Object { $_.FullName.Replace($rootPath, '') } - - Context 'No Unicode encoding' { - - foreach ($textFile in $textFiles) - { - # To check, if the file is encoded in Unicode, check for 0x00 byte - # characters. In a Unicode file, every second charcter is normally - # a 0x00 character, because to majority of chars don't use more than - # the first byte. - It "should not use Unicode encoding for $textFile" { - - @([System.IO.File]::ReadAllBytes("$rootPath\$textFile") -eq 0).Length -eq 0 | Should Be $true - } - } - } - - Context 'No UTF-8 with BOM encoding' { - - foreach ($textFile in $textFiles) - { - # We use UTF-8 encoding with byte order mask (BOM). Therefore we - # check if the file starts with the bytes 0xEF, 0xBB, 0xBF. - It "should not use BOM for UTF-8 encoding for $textFile" { - - $bytes = [System.IO.File]::ReadAllBytes("$rootPath\$textFile") - - ($bytes.Length -ge 3 -and $bytes[0] -eq 239 -and $bytes[1] -eq 187 -and $bytes[2] -eq 191) | Should Be $false - } - } - } -} diff --git a/plaster/ModuleBuild/scaffold/tests/meta/FileFormatting.Tests.ps1 b/plaster/ModuleBuild/scaffold/tests/meta/FileFormatting.Tests.ps1 deleted file mode 100644 index 690cb2f..0000000 --- a/plaster/ModuleBuild/scaffold/tests/meta/FileFormatting.Tests.ps1 +++ /dev/null @@ -1,96 +0,0 @@ - -<# - Verify that the file content if formatted property. It will verify the - following criterias: Use spaces instead of tabs for indentation, no trailing - spaces for lines and should end with a new line. -#> - -$ModulePath = Resolve-Path -Path "$PSScriptRoot\..\..\Modules" | ForEach-Object Path -$ModuleName = Get-ChildItem -Path $ModulePath | Select-Object -First 1 -ExpandProperty BaseName - -Remove-Module -Name $ModuleName -Force -ErrorAction SilentlyContinue -Import-Module -Name "$ModulePath\$ModuleName" -Force - -Describe 'Meta File Formatting' { - - $fileExtensions = '.ps1', '.psm1', '.psd1', '.ps1xml', '.txt', '.xml', - '.cmd', '.json', '.md', '.csv', '.yml', '.log', - '.gitignore', '.gitattributes' - - $rootPath = Resolve-Path -Path "$PSScriptRoot\..\.." | ForEach-Object Path - $textFiles = Get-ChildItem -Path $rootPath -File -Recurse | - Where-Object { -not $_.FullName.StartsWith("$rootPath\Sources\") } | - Where-Object { $fileExtensions -contains $_.Extension } | - ForEach-Object { $_.FullName.Replace($rootPath, '') } - - Context 'Space Indentation' { - - foreach ($textFile in $textFiles) - { - It "should use spaces and not tabs for indentation in $textFile" { - - $errorLines = @() - - $content = @(Get-Content -Path "$rootPath$textFile") - - for ($line = 0; $line -lt $content.Length; $line++) - { - if(($content[$line] | Select-String "`t" | Measure-Object).Count -ne 0) - { - $errorLines += $line + 1 - - Write-Warning "There are tabs instead of spaces in $textFile`:$($line + 1)" - } - } - - $errorLines.Count | Should Be 0 - } - } - } - - Context 'No Trailing Spaces' { - - # Do not test markdown files for trailing spaces. - $textFilesFiltered = $textFiles | Where-Object { $_ -notlike '*.md' } - - foreach ($textFile in $textFilesFiltered) - { - It "should not have trailing spaces in $textFile" { - - $errorLines = @() - - $content = @(Get-Content -Path "$rootPath$textFile") - - for ($line = 0; $line -lt $content.Length; $line++) - { - if($content[$Line].ToString().TrimEnd() -ne $content[$Line]) - { - $errorLines += $line + 1 - - Write-Warning "There are trailing spaces in $textFile`:$($line + 1)" - } - } - - $errorLines.Count | Should Be 0 - } - } - } - - Context 'New Line Termination' { - - # Do not test files in .vscode for trailing spaces. - $textFilesFiltered = $textFiles | Where-Object { $_ -notlike '*\.vscode\*' } - - foreach ($textFile in $textFilesFiltered) - { - - It "should terminate with a new line in $textFile" { - - $content = Get-Content -Path "$rootPath$textFile" -Raw - - $content.Length | Should Not Be 0 - $content[-1] | Should Be "`n" - } - } - } -} diff --git a/plaster/ModuleBuild/scaffold/tests/meta/ProjectStructure.Tests.ps1 b/plaster/ModuleBuild/scaffold/tests/meta/ProjectStructure.Tests.ps1 deleted file mode 100644 index c120da7..0000000 --- a/plaster/ModuleBuild/scaffold/tests/meta/ProjectStructure.Tests.ps1 +++ /dev/null @@ -1,152 +0,0 @@ - -<# - This meta tests verify, if the PowerShell module project structure is - adhered to the best practices. -#> - -$ModulePath = Resolve-Path -Path "$PSScriptRoot\..\..\Modules" | ForEach-Object Path -$ModuleName = Get-ChildItem -Path $ModulePath | Select-Object -First 1 -ExpandProperty BaseName - -Remove-Module -Name $ModuleName -Force -ErrorAction SilentlyContinue -Import-Module -Name "$ModulePath\$ModuleName" -Force - -Describe 'Meta Project Structure' { - - $rootPath = Resolve-Path -Path "$PSScriptRoot\..\.." | ForEach-Object Path - - Context 'Folders' { - - $requiredFolders = @( - '\Scripts' - '\Modules' - "\Modules\$ModuleName" - "\Modules\$ModuleName\en-US" - "\Modules\$ModuleName\Functions" - "\Modules\$ModuleName\Resources" - '\Tests' - '\Tests\Meta' - '\Tests\Unit' - ) - - $optionalFolders = @( - "\Modules\$ModuleName\Helpers" - '\Sources' - "\Sources\$ModuleName" - '\Tests\Integration' - ) - - foreach ($requiredFolder in $requiredFolders) - { - It "should contain the folder $requiredFolder" { - - Test-Path -Path "$rootPath$requiredFolder" | Should Be $true - } - } - - foreach ($optionalFolder in $optionalFolders) - { - It "can contain the folder $optionalFolder" { - - if ((Test-Path -Path "$rootPath$optionalFolder")) - { - Test-Path -Path "$rootPath$optionalFolder" | Should Be $true - } - else - { - Set-TestInconclusive -Message "Optional folder $optionalFolder not found!" - } - } - } - } - - Context 'Files' { - - $requiredFiles = @( - '\appveyor.yml' - '\LICENSE' - '\README.md' - '\Scripts\build.ps1' - '\Scripts\debug.default.ps1' - '\Scripts\release.ps1' - '\Scripts\test.ps1' - "\Modules\$ModuleName\en-US\about_$ModuleName.help.txt" - "\Modules\$ModuleName\Resources\$ModuleName.Formats.ps1xml" - "\Modules\$ModuleName\Resources\$ModuleName.Types.ps1xml" - "\Modules\$ModuleName\$ModuleName.psd1" - "\Modules\$ModuleName\$ModuleName.psm1" - '\Tests\Meta\Autoload.Tests.ps1' - ) - - $optionalFiles = @( - "\Sources\$ModuleName.sln" - ) - - foreach ($requiredFile in $requiredFiles) - { - It "should contain the file $requiredFile" { - - Test-Path -Path "$rootPath\$requiredFile" | Should Be $true - } - } - - foreach ($optionalFile in $optionalFiles) - { - It "can contain the file $optionalFile" { - - if ((Test-Path -Path "$rootPath$optionalFile")) - { - Test-Path -Path "$rootPath$optionalFile" | Should Be $true - } - else - { - Set-TestInconclusive -Message "Optional file $optionalFile not found!" - } - } - } - } - - Context 'Version' { - - # Arrange - $requiredVersion = (Import-PowerShellDataFile -Path "$rootPath\Modules\$ModuleName\$ModuleName.psd1")['ModuleVersion'] - - It "should have version $requiredVersion in README.md" { - - # Act - $versionHeadline = @(Get-Content -Path "$rootPath\README.md" | Where-Object { $_ -eq "### $requiredVersion" }) - - # Assert - $versionHeadline.Count | Should Be 1 - $versionHeadline[0] | Should BeExactly "### $requiredVersion" - } - - It "should have version $requiredVersion in $ModuleName.psd1" { - - # Act - $moduleDefinition = Import-PowerShellDataFile -Path "$rootPath\Modules\$ModuleName\$ModuleName.psd1" - - # Assert - $moduleDefinition.ModuleVersion | Should Be $requiredVersion - } - - if ((Test-Path -Path "$rootPath\Sources\$ModuleName")) - { - It "should have version $requiredVersion in $ModuleName.dll" { - - if ((Test-Path -Path "$rootPath\Modules\$ModuleName\$ModuleName.dll")) - { - # Act - $moduleAssembly = Get-Item -Path "$rootPath\Modules\$ModuleName\$ModuleName.dll" - - # Assert - $moduleAssembly.VersionInfo.ProductVersion | Should Be $requiredVersion - $moduleAssembly.VersionInfo.FileVersion | Should Be $requiredVersion - } - else - { - Set-TestInconclusive -Message "$ModuleName.dll file was not found!" - } - } - } - } -} diff --git a/plaster/ModuleBuild/scaffold/tests/meta/ScriptAnalyzer.Tests.ps1 b/plaster/ModuleBuild/scaffold/tests/meta/ScriptAnalyzer.Tests.ps1 deleted file mode 100644 index 805027d..0000000 --- a/plaster/ModuleBuild/scaffold/tests/meta/ScriptAnalyzer.Tests.ps1 +++ /dev/null @@ -1,37 +0,0 @@ -# Requires -Modules Pester -<# - Check all scripts files in the sources folder against all script analyzer - rules. It should comply with all rules. -#> - -$ModulePath = Resolve-Path -Path "$PSScriptRoot\..\..\Modules" | ForEach-Object Path -$ModuleName = Get-ChildItem -Path $ModulePath | Select-Object -First 1 -ExpandProperty BaseName - -Remove-Module -Name $ModuleName -Force -ErrorAction SilentlyContinue -Import-Module -Name "$ModulePath\$ModuleName" -Force - -Describe 'Meta Script Analyzer' { - - foreach ($severity in 'Information', 'Warning', 'Error') - { - Context "$severity Rules" { - - $scriptAnalyzerRules = Get-ScriptAnalyzerRule -Severity $severity - - foreach ($scriptAnalyzerRule in $scriptAnalyzerRules) - { - It "should conform the rule $($scriptAnalyzerRule.RuleName)" { - - $scriptAnalyzerResults = @(Invoke-ScriptAnalyzer -Path $ModulePath -IncludeRule $scriptAnalyzerRule -Recurse) - - foreach ($scriptAnalyzerResult in $scriptAnalyzerResults) - { - Write-Warning ('{0}, line {1}: {2}' -f $scriptAnalyzerResult.ScriptPath.Replace("$ModulePath", 'Modules'), $scriptAnalyzerResult.Line, $scriptAnalyzerResult.Message) - } - - $scriptAnalyzerResults.Count | Should Be 0 - } - } - } - } -} diff --git a/plaster/ModuleBuild/scaffold/tests/unit/other/readme.md b/plaster/ModuleBuild/scaffold/tests/unit/other/readme.md new file mode 100644 index 0000000..0f8a083 --- /dev/null +++ b/plaster/ModuleBuild/scaffold/tests/unit/other/readme.md @@ -0,0 +1 @@ +Unit tests for scripts in other folder go here \ No newline at end of file diff --git a/plaster/ModuleBuild/scaffold/tests/unit/private/readme.md b/plaster/ModuleBuild/scaffold/tests/unit/private/readme.md new file mode 100644 index 0000000..f5215b7 --- /dev/null +++ b/plaster/ModuleBuild/scaffold/tests/unit/private/readme.md @@ -0,0 +1 @@ +Unit tests for private functions go here \ No newline at end of file diff --git a/plaster/ModuleBuild/scaffold/tests/unit/public/readme.md b/plaster/ModuleBuild/scaffold/tests/unit/public/readme.md new file mode 100644 index 0000000..b082d23 --- /dev/null +++ b/plaster/ModuleBuild/scaffold/tests/unit/public/readme.md @@ -0,0 +1 @@ +Unit tests for public functions go here \ No newline at end of file diff --git a/plaster/PlasterContent.ps1 b/plaster/PlasterContent.ps1 index 44633db..87b1a64 100644 --- a/plaster/PlasterContent.ps1 +++ b/plaster/PlasterContent.ps1 @@ -26,7 +26,7 @@ $Content = @( ContentType = 'file' Source = 'scaffold\gitattributes' Destination = '.gitattributes' - }, + }, @{ ContentType = 'templateFile' Source = 'scaffold\vscode\*' @@ -59,8 +59,38 @@ $Content = @( }, @{ ContentType = 'file' - Source = 'scaffold\tests\*' - Destination = 'src\tests' + Source = 'scaffold\tests\' + Destination = 'tests' + }, + @{ + ContentType = 'file' + Source = 'scaffold\tests\intergration' + Destination = 'tests\intergration' + }, + @{ + ContentType = 'file' + Source = 'scaffold\tests\unit' + Destination = 'tests\unit' + }, + @{ + ContentType = 'file' + Source = 'scaffold\tests\intergration\private\*' + Destination = 'tests\intergration\private' + }, + @{ + ContentType = 'file' + Source = 'scaffold\tests\intergration\public\*' + Destination = 'tests\intergration\public' + }, + @{ + ContentType = 'file' + Source = 'scaffold\tests\unit\private\*' + Destination = 'tests\unit\private' + }, + @{ + ContentType = 'file' + Source = 'scaffold\tests\unit\public\*' + Destination = 'tests\unit\public' }, @{ ContentType = 'templateFile' diff --git a/src/tests/FunctionCBH.Tests.ps1 b/src/tests/FunctionCBH.Tests.ps1 deleted file mode 100644 index 0f418c3..0000000 --- a/src/tests/FunctionCBH.Tests.ps1 +++ /dev/null @@ -1,60 +0,0 @@ -#Requires -Modules Pester -<# - This pester test verifies the module's public functions all have proper comment based help required for building documentation via PlatyPS. - - Example: - PS> Invoke-Pester -Script @{Path = '.\src\tests\FuncitonCBH.Tests.ps1'; Parameters = @{ ModuleName = MyModule}} -#> - -[CmdletBinding()] -Param( - [Parameter(HelpMessage = 'Module to scan.')] - [string]$ModuleName -) - -If (($ModuleName -like '*.psd1') -and (test-path $ModuleName)) { - $Module = (Split-Path $ModuleName -Leaf) -replace '.psd1','' -} -else { - $Module = $ModuleName -} - -if (-not (Get-Module $Module)) { - try { - Import-Module $ModuleName -force - } - catch { - throw "$Module is not loaded." - } -} - -Describe "Comment Based Help tests for $Module" -Tags Build { - - $functions = Get-Command -Module $Module -CommandType Function - foreach($Function in $Functions){ - $help = Get-Help $Function.name - Context $help.name { - it "Has a HelpUri" { - $Function.HelpUri | Should Not BeNullOrEmpty - } - It "Has related Links" { - $help.relatedLinks.navigationLink.uri.count | Should BeGreaterThan 0 - } - it "Has a description" { - $help.description | Should Not BeNullOrEmpty - } - it "Has an example" { - $help.examples | Should Not BeNullOrEmpty - } - foreach($parameter in $help.parameters.parameter) - { - if($parameter -notmatch 'whatif|confirm') - { - it "Has a Parameter description for '$($parameter.name)'" { - $parameter.Description.text | Should Not BeNullOrEmpty - } - } - } - } - } -} \ No newline at end of file diff --git a/src/tests/ModuleManifest.Tests.ps1 b/src/tests/ModuleManifest.Tests.ps1 deleted file mode 100644 index c6bf56f..0000000 --- a/src/tests/ModuleManifest.Tests.ps1 +++ /dev/null @@ -1,205 +0,0 @@ -#Requires -Modules Pester - -<# - This pester test verifies the PowerShell module manifest file has valid content that will be required to - upload to the PowerShell Gallary. - - .EXAMPLE - PS> Invoke-Pester -Script @{Path = '.\src\tests\ModuleManifest.Tests.ps1'; Parameters = @{ ManifestPath = 'C:\Users\zloeber\Dropbox\Zach_Docs\Projects\Git\PSAD'; Author = 'Zachary Loeber'; Website = 'https://github.com/zloeber/PSAD'; Tags = @('ADSI', 'Active_Directory', 'DC') }} - - Runs some standard tests and a few manual validations (Tags, Author, and Website). - .EXAMPLE - PS> Invoke-Pester -Script @{Path = '.\src\tests\ModuleManifest.Tests.ps1'; Parameters = @{ ManifestPath = '.\PSAD.psd1'}} - - Runs several generic tests against the PSAD.psd1 manifest to ensure all required values for uploading to the PowerShell Gallery simply exist. -#> - -[CmdLetBinding(DefaultParameterSetName='Default')] -Param( - [Parameter(Mandatory = $True, ParameterSetName='Default')] - [Parameter(Mandatory = $True, ParameterSetName='Manual')] - [Parameter(Mandatory = $True, ParameterSetName='ModuleBuild')] - [string]$ManifestPath, - [Parameter(Mandatory = $True, ParameterSetName='ModuleBuild')] - [string]$ModuleBuildJSONPath, - [Parameter(ParameterSetName='Manual')] - [string]$Author, - [Parameter(ParameterSetName='Manual')] - [string]$Copyright, - [Parameter(ParameterSetName='Manual')] - [string]$Website, - [Parameter(ParameterSetName='Manual')] - [string]$LicenseURI, - [Parameter(ParameterSetName='Manual')] - [string]$Version, - [Parameter(ParameterSetName='Manual')] - [string[]]$Tags -) - -if (($ManifestPath.EndsWith('psd1')) -and (Test-Path $ManifestPath)) { - # Grab the short module name - $ModuleName = (Split-Path $ManifestPath -Leaf).Split('.')[0] - - Describe 'Module Manifest - Standard Tests' { - Context "Testing $ManifestPath" { - It 'should be a valid module manifest file' { - { - $Script:Manifest = Test-ModuleManifest -Path $ManifestPath -ErrorAction Stop -WarningAction SilentlyContinue - } | Should Not Throw - } - - It 'should have a valid RootModule value' { - $Script:Manifest.RootModule | Should Be "$ModuleName.psm1" - } - - It 'should have a valid GUID' { - ($Script:Manifest.Guid).Guid | Should BeLike '????????-????-????-????-????????????' - } - - It 'should have a valid PowerShellVersion value' { - $Script:Manifest.PowerShellVersion | Should Not BeNullOrEmpty - } - } - } - - switch ($PSCmdlet.ParameterSetName) { - 'Default' { - # Passed just a module manifest file name with no other information to validate - # This will check for several entries that they simply exist. - Describe 'Module Manifest - Generic Tests' { - Context "Testing $ManifestPath" { - It 'should have a valid Module version' { - ($Script:Manifest.Version).ToString() -as [Version] | Should Not BeNullOrEmpty - } - - It 'should have a valid module description' { - $Script:Manifest.Description | Should Not BeNullOrEmpty - } - - It 'should have a valid module author' { - $Script:Manifest.Author | Should Not BeNullOrEmpty - } - - It 'should have a valid module project website' { - $Script:Manifest.ProjectUri.OriginalString | Should Not BeNullOrEmpty - } - - It 'should have a valid license URL' { - $Script:Manifest.LicenseUri | Should Not BeNullOrEmpty - } - - It 'should have some tags' { - @($Script:Manifest.PrivateData.PSData.Tags).Count -gt 0 | Should Be $true - } - } - } - } - 'Manual' { - # Passed a manifest name and several manual entries to validate - Describe 'Module Manifest - Manual Tests' { - Context "Testing $ManifestPath" { - if (-not [string]::IsNullOrEmpty($Version)) { - It "should be module version '$Version'" { - ($Script:Manifest.Version).ToString() -as [Version] | Should Be $Version - } - } - if (-not [string]::IsNullOrEmpty($Description)) { - It "should have a module description of '$Description'" { - $Script:Manifest.Description | Should Be $Description - } - } - - if (-not [string]::IsNullOrEmpty($Author)) { - It "should have the module author of '$Author'" { - $Script:Manifest.Author | Should Be $Author - } - } - - if (-not [string]::IsNullOrEmpty($Copyright)) { - It "should have a Copyright of '$Copyright'" { - $Script:Manifest.Copyright | Should Be $Copyright - } - } - - if (-not [string]::IsNullOrEmpty($Website)) { - It "should have the project website of '$Website'" { - $Script:Manifest.ProjectUri.OriginalString | Should Be $Website - } - } - - if (-not [string]::IsNullOrEmpty($LicenseURI)) { - It "should have the license URI of '$LicenseURI'" { - $Script:Manifest.LicenseUri | Should Be $LicenseURI - } - } - if ($Tags.Count -gt 0) { - It "should have these tags: $($Tags -join ',')" { - Compare-Object $Script:Manifest.PrivateData.PSData.Tags $Tags | Should Be $Null - } - } - } - } - } - 'ModuleBuild' { - # Passed a manifest name and a ModuleBuild json configuration file to validate - if (($ModuleBuildJSONPath.EndsWith('psd1')) -and (Test-Path $ModuleBuildJSONPath)) { - try { - $ModuleInfo = get-content $ModuleBuildJSONPath | ConvertFrom-Json - } - catch { - throw "$ModuleBuildJSONPath either does not exist or is not a json file!" - } - } - else { - throw "$ModuleBuildJSONPath either does not exist or is not a json file!" - } - # Passed a manifest name and several manual entries to validate - Describe 'Module Manifest - ModuleBuild Tests' { - Context "Testing $ManifestPath" { - if (-not [string]::IsNullOrEmpty($Version)) { - It "should be module version '$Version'" { - ($Script:Manifest.Version).ToString() -as [Version] | Should Be $ModuleInfo.ModuleVersion - } - } - if (-not [string]::IsNullOrEmpty($Description)) { - It "should have a module description of '$Description'" { - $Script:Manifest.Description | Should Be $ModuleInfo.ModuleDescription - } - } - - if (-not [string]::IsNullOrEmpty($Author)) { - It "should have the module author of '$Author'" { - $Script:Manifest.Author | Should Be $ModuleInfo.ModuleAuthor - } - } - - if (-not [string]::IsNullOrEmpty($Copyright)) { - It "should have a Copyright of '$Copyright'" { - $Script:Manifest.Copyright | Should Be $ModuleInfo.ModuleCopyright - } - } - - if (-not [string]::IsNullOrEmpty($Website)) { - It "should have the project website of '$Website'" { - $Script:Manifest.ProjectUri.OriginalString | Should Be $ModuleInfo.ModuleWebsite - } - } - - if (-not [string]::IsNullOrEmpty($LicenseURI)) { - It "should have the license URI of '$LicenseURI'" { - $Script:Manifest.LicenseUri | Should Be $ModuleInfo.ModuleLicenseURI - } - } - if ($Tags.Count -gt 0) { - It "should have these tags: $($ModuleInfo.ModuleTags -join ',')" { - Compare-Object $Script:Manifest.PrivateData.PSData.Tags $ModuleInfo.ModuleTags | Should Be $Null - } - } - } - } - } - } -} -else { - Write-Error "$ManifestPath was not found!" -} \ No newline at end of file diff --git a/src/tests/ScriptAnalyzer.Tests.ps1 b/src/tests/ScriptAnalyzer.Tests.ps1 deleted file mode 100644 index b96ff54..0000000 --- a/src/tests/ScriptAnalyzer.Tests.ps1 +++ /dev/null @@ -1,32 +0,0 @@ -#Requires -Modules Pester -<# - This pester test verifies the files in the specified path do not contain sensitive information. - - Example: - Invoke-Pester -Script @{Path = '.\src\tests\ScriptAnalyzer.Tests.ps1'; Parameters = @{ Path = 'C:\Users\zloeber\Dropbox\Zach_Docs\Projects\Git\PSAD' }} -#> - -[CmdletBinding()] -Param( - [Parameter(HelpMessage = 'Path to the files to scan.')] - [string]$Path -) - -if (-not (Get-Item $Path -ErrorAction:SilentlyContinue).PSIsContainer) { - throw "Either $Path is not a directory or does not exist" -} - -Describe 'Testing against PSSA rules' { - Context 'PSSA Standard Rules' { - $analysis = Invoke-ScriptAnalyzer -Path $Path - $scriptAnalyzerRules = Get-ScriptAnalyzerRule - forEach ($rule in $scriptAnalyzerRules) { - It "Should pass $rule" { - If ($analysis.RuleName -contains $rule) { - $analysis | Where RuleName -EQ $rule -outvariable failures | Out-Default - $failures.Count | Should Be 0 - } - } - } - } -} \ No newline at end of file diff --git a/src/tests/SensitiveTermScan.Tests.ps1 b/src/tests/SensitiveTermScan.Tests.ps1 deleted file mode 100644 index 7e5553a..0000000 --- a/src/tests/SensitiveTermScan.Tests.ps1 +++ /dev/null @@ -1,28 +0,0 @@ -#Requires -Modules Pester -<# - This pester test verifies the files in the specified path do not contain sensitive information. - - Example: - Invoke-Pester -Script @{Path = '.\src\tests\SensitiveTermScan.Tests.ps1'; Parameters = @{ Path = 'C:\Users\zloeber\Dropbox\Zach_Docs\Projects\Git\PSAD'; Terms = @('mydomainname.com', 'myservername') }} -#> - -[CmdletBinding()] -Param( - [Parameter(HelpMessage = 'Path to the files to scan.')] - [string]$Path, - [Parameter(HelpMessage = 'Terms to scan for.')] - [string[]]$Terms -) - -if (Test-Path $Path) { - Describe 'Scan for sensitive terms.' { - foreach ($Term in $Terms) { - $TermSearch = @(Get-ChildItem -Recurse -Path $Path | Select-String -Pattern $Term) - Context "Files in $Path" { - It "should not contain the term $Term" { - $TermSearch.Count -gt 0 | Should Be $false - } - } - } - } -} \ No newline at end of file diff --git a/tests/intergration/private/readme.md b/tests/intergration/private/readme.md new file mode 100644 index 0000000..1f6dba4 --- /dev/null +++ b/tests/intergration/private/readme.md @@ -0,0 +1 @@ +Intergration tests for private functions go here \ No newline at end of file diff --git a/tests/intergration/public/readme.md b/tests/intergration/public/readme.md new file mode 100644 index 0000000..5cf9b73 --- /dev/null +++ b/tests/intergration/public/readme.md @@ -0,0 +1 @@ +Intergration tests for public functions go here \ No newline at end of file diff --git a/tests/unit/private/readme.md b/tests/unit/private/readme.md new file mode 100644 index 0000000..f5215b7 --- /dev/null +++ b/tests/unit/private/readme.md @@ -0,0 +1 @@ +Unit tests for private functions go here \ No newline at end of file diff --git a/tests/unit/public/readme.md b/tests/unit/public/readme.md new file mode 100644 index 0000000..b082d23 --- /dev/null +++ b/tests/unit/public/readme.md @@ -0,0 +1 @@ +Unit tests for public functions go here \ No newline at end of file From d4e78a8308dd7f1c48d48327315760b2c482f8f7 Mon Sep 17 00:00:00 2001 From: justin-p Date: Thu, 10 Jan 2019 16:40:23 +0100 Subject: [PATCH 02/79] removed other folder --- plaster/ModuleBuild/plasterManifest.xml | 2 +- plaster/ModuleBuild/scaffold/tests/intergration/other/readme.md | 1 - plaster/ModuleBuild/scaffold/tests/unit/other/readme.md | 1 - 3 files changed, 1 insertion(+), 3 deletions(-) delete mode 100644 plaster/ModuleBuild/scaffold/tests/intergration/other/readme.md delete mode 100644 plaster/ModuleBuild/scaffold/tests/unit/other/readme.md diff --git a/plaster/ModuleBuild/plasterManifest.xml b/plaster/ModuleBuild/plasterManifest.xml index d95627c..629ea61 100644 --- a/plaster/ModuleBuild/plasterManifest.xml +++ b/plaster/ModuleBuild/plasterManifest.xml @@ -4,7 +4,7 @@ templateType="Project" xmlns="http://www.microsoft.com/schemas/PowerShell/Plaster/v1"> ModuleBuild - 4794ac4a-1fbc-49f4-973f-9ece24eaa1d9 + fc5c0ee0-65ae-4cc0-b8af-85c2598ed8ef 0.0.1 New ModuleBuild Project Create a new PowerShell Module with a ModuleBuild wrapper diff --git a/plaster/ModuleBuild/scaffold/tests/intergration/other/readme.md b/plaster/ModuleBuild/scaffold/tests/intergration/other/readme.md deleted file mode 100644 index 536a744..0000000 --- a/plaster/ModuleBuild/scaffold/tests/intergration/other/readme.md +++ /dev/null @@ -1 +0,0 @@ -Intergration tests for scripts in other folder go here \ No newline at end of file diff --git a/plaster/ModuleBuild/scaffold/tests/unit/other/readme.md b/plaster/ModuleBuild/scaffold/tests/unit/other/readme.md deleted file mode 100644 index 0f8a083..0000000 --- a/plaster/ModuleBuild/scaffold/tests/unit/other/readme.md +++ /dev/null @@ -1 +0,0 @@ -Unit tests for scripts in other folder go here \ No newline at end of file From e53d8a1f83caf8ebbfc79a4715afcb04a2417bff Mon Sep 17 00:00:00 2001 From: justin-p Date: Tue, 15 Jan 2019 12:46:23 +0100 Subject: [PATCH 03/79] remove cleanup function from build.ps1 --- Build.ps1 | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Build.ps1 b/Build.ps1 index a836e8d..a8b11b0 100644 --- a/Build.ps1 +++ b/Build.ps1 @@ -61,8 +61,6 @@ switch ($psCmdlet.ParameterSetName) { throw } } - - CleanUp } 'Build' { if ($NewVersion -ne $null) { @@ -104,7 +102,5 @@ switch ($psCmdlet.ParameterSetName) { throw 'Unable to upload project to the PowerShell Gallery!' } } - - CleanUp } } \ No newline at end of file From cb04c5f7ff8dd44818e8afdbdb6be7d2b4171ad3 Mon Sep 17 00:00:00 2001 From: justin-p Date: Tue, 15 Jan 2019 12:48:51 +0100 Subject: [PATCH 04/79] basic appveyor.yml and updated scaffold regarding last commit --- appveyor.yml | 14 ++++++++++++++ plaster/ModuleBuild/scaffold/Build.template | 4 ---- plaster/PlasterContent.ps1 | 5 +++++ 3 files changed, 19 insertions(+), 4 deletions(-) create mode 100644 appveyor.yml diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..798271c --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,14 @@ +# See http://www.appveyor.com/docs/appveyor-yml for many more options +# Allow WMF5 (i.e. PowerShellGallery functionality) +os: WMF 5 + +# Skip on updates to the readme. +# We can force this by adding [skip ci] or [ci skip] anywhere in commit message +skip_commits: + message: /updated readme.*|update readme.*s/ + +build: false + +#Kick off the CI/CD pipeline +test_script: + - ps: . .\Build.ps1 -BuildModule diff --git a/plaster/ModuleBuild/scaffold/Build.template b/plaster/ModuleBuild/scaffold/Build.template index a836e8d..a8b11b0 100644 --- a/plaster/ModuleBuild/scaffold/Build.template +++ b/plaster/ModuleBuild/scaffold/Build.template @@ -61,8 +61,6 @@ switch ($psCmdlet.ParameterSetName) { throw } } - - CleanUp } 'Build' { if ($NewVersion -ne $null) { @@ -104,7 +102,5 @@ switch ($psCmdlet.ParameterSetName) { throw 'Unable to upload project to the PowerShell Gallery!' } } - - CleanUp } } \ No newline at end of file diff --git a/plaster/PlasterContent.ps1 b/plaster/PlasterContent.ps1 index 87b1a64..45e04de 100644 --- a/plaster/PlasterContent.ps1 +++ b/plaster/PlasterContent.ps1 @@ -226,4 +226,9 @@ $Content = @( Source = 'scaffold\PSScriptAnalyzerSettings.psd1' Destination = 'PSScriptAnalyzerSettings.psd1' } + @{ + ContentType = 'file' + Source = 'scaffold\appveyor.yml' + Destination = 'appveyor.yml' + } ) \ No newline at end of file From 991d73ddde09e823225f13d05d4229d36a0edb31 Mon Sep 17 00:00:00 2001 From: Justin Date: Tue, 15 Jan 2019 11:55:46 +0000 Subject: [PATCH 05/79] Delete appveyor.yml --- appveyor.yml | 14 -------------- 1 file changed, 14 deletions(-) delete mode 100644 appveyor.yml diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 798271c..0000000 --- a/appveyor.yml +++ /dev/null @@ -1,14 +0,0 @@ -# See http://www.appveyor.com/docs/appveyor-yml for many more options -# Allow WMF5 (i.e. PowerShellGallery functionality) -os: WMF 5 - -# Skip on updates to the readme. -# We can force this by adding [skip ci] or [ci skip] anywhere in commit message -skip_commits: - message: /updated readme.*|update readme.*s/ - -build: false - -#Kick off the CI/CD pipeline -test_script: - - ps: . .\Build.ps1 -BuildModule From 26078e058481fd6049f4244c73eaff47b03f4daa Mon Sep 17 00:00:00 2001 From: Justin-p Date: Tue, 17 Dec 2019 10:11:36 +0100 Subject: [PATCH 06/79] missing links to VSCode and the PS Extension --- plaster/ModuleBuild/scaffold/readme.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plaster/ModuleBuild/scaffold/readme.md b/plaster/ModuleBuild/scaffold/readme.md index 087d0f7..64d9f92 100644 --- a/plaster/ModuleBuild/scaffold/readme.md +++ b/plaster/ModuleBuild/scaffold/readme.md @@ -33,8 +33,8 @@ Please feel free to contribute by opening new issues or providing pull requests. For the best development experience, open this project as a folder in Visual Studio Code and ensure that the PowerShell extension is installed. -* [Visual Studio Code] -* [PowerShell Extension] +* [Visual Studio Code](https://code.visualstudio.com/) +* [PowerShell Extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode.PowerShell) // This module is tested with the PowerShell testing framework Pester. To run all // tests, just start the included test script `.\Build.ps1 -test` or invoke Pester From 278c537b4c63341a3fd3f3222b82f21f13286123 Mon Sep 17 00:00:00 2001 From: Justin-p Date: Tue, 17 Dec 2019 10:15:53 +0100 Subject: [PATCH 07/79] Link to ChangeLog in index.md was plural --- plaster/ModuleBuild/scaffold/build/docs/Additional/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plaster/ModuleBuild/scaffold/build/docs/Additional/index.md b/plaster/ModuleBuild/scaffold/build/docs/Additional/index.md index 2307b7d..4c12c29 100644 --- a/plaster/ModuleBuild/scaffold/build/docs/Additional/index.md +++ b/plaster/ModuleBuild/scaffold/build/docs/Additional/index.md @@ -28,7 +28,7 @@ Install-Module -Name <%=$PLASTER_PARAM_ModuleName%> -Scope CurrentUser [Notes on contributing to this project](Contributing.md) ## Change Logs -[Change notes for each release](ChangeLogs.md) +[Change notes for each release](ChangeLog.md) ## Acknowledgements [Other projects or sources of inspiration](Acknowledgements.md) From 93c46877461abb1da07300d6e1d966ec560be9f6 Mon Sep 17 00:00:00 2001 From: Justin-p Date: Tue, 17 Dec 2019 11:05:19 +0100 Subject: [PATCH 08/79] Added CI/CD option to plaster. Added AppVeyor template to plaster. --- buildreports/CodeHealthReport-Private.html | 368 ++------ buildreports/CodeHealthReport-Public.html | 134 +-- docs/ChangeLog.md | 2 +- .../Functions/Import-ModulePrivateFunction.md | 4 +- docs/Functions/Import-ModulePublicFunction.md | 4 +- docs/Functions/Set-BuildEnvironment.md | 515 +---------- plaster/ModuleBuild/plasterManifest.xml | 20 +- plaster/ModuleBuild/scaffold/appveyor.yml | 14 + plaster/PlasterContent.ps1 | 1 + plaster/PlasterParams.ps1 | 18 + release/0.2.3/ModuleBuild.psd1 | 8 +- release/0.2.3/ModuleBuild.psm1 | 335 ++++--- .../docs/Import-ModulePrivateFunction.md | 4 +- .../0.2.3/docs/Import-ModulePublicFunction.md | 4 +- release/0.2.3/docs/ModuleBuild.md | 2 +- release/0.2.3/docs/Set-BuildEnvironment.md | 515 +---------- release/0.2.3/en-US/ModuleBuild-help.xml | 858 +----------------- ...49-a717-96d64a1cc5b3_en-US_HelpContent.cab | Bin 4701 -> 0 bytes ...49-a717-96d64a1cc5b3_en-US_HelpContent.zip | Bin 4961 -> 0 bytes ...-6411-4949-a717-96d64a1cc5b3_HelpInfo.xml} | 0 ...49-a717-96d64a1cc5b3_en-US_HelpContent.cab | Bin 0 -> 3430 bytes ...49-a717-96d64a1cc5b3_en-US_HelpContent.zip | Bin 0 -> 3683 bytes .../plaster/ModuleBuild/plasterManifest.xml | 67 +- .../ModuleBuild/scaffold/Build.template | 10 +- .../scaffold/PSScriptAnalyzerSettings.psd1 | 26 + .../plaster/ModuleBuild/scaffold/appveyor.yml | 14 + .../build/docs/Additional/Acknowledgements.md | 4 +- .../build/docs/Additional/Contributing.md | 2 +- .../scaffold/build/docs/Additional/Index.md | 2 +- .../scaffold/modulename.build.template | 57 +- .../plaster/ModuleBuild/scaffold/readme.md | 13 +- .../scaffold/src/other/PostLoad.ps1 | 2 + .../scaffold/src/tests/FunctionCBH.Tests.ps1 | 60 -- .../src/tests/ModuleManifest.Tests.ps1 | 205 ----- .../src/tests/ScriptAnalyzer.Tests.ps1 | 32 - .../src/tests/SensitiveTermScan.Tests.ps1 | 28 - .../src/tests/meta/Autoload.Tests.ps1 | 23 - .../src/tests/meta/FileContent.Tests.ps1 | 349 ------- .../src/tests/meta/FileEncoding.Tests.ps1 | 54 -- .../src/tests/meta/FileFormatting.Tests.ps1 | 96 -- .../src/tests/meta/ProjectStructure.Tests.ps1 | 152 ---- .../src/tests/meta/ScriptAnalyzer.Tests.ps1 | 37 - .../scaffold/tests/FunctionCBH.Tests.ps1 | 60 -- .../scaffold/tests/ModuleManifest.Tests.ps1 | 205 ----- .../scaffold/tests/ScriptAnalyzer.Tests.ps1 | 32 - .../tests/SensitiveTermScan.Tests.ps1 | 28 - .../tests/intergration/private/readme.md | 1 + .../tests/intergration/public/readme.md | 1 + .../scaffold/tests/meta/Autoload.Tests.ps1 | 23 - .../scaffold/tests/meta/FileContent.Tests.ps1 | 349 ------- .../tests/meta/FileEncoding.Tests.ps1 | 54 -- .../tests/meta/FileFormatting.Tests.ps1 | 96 -- .../tests/meta/ProjectStructure.Tests.ps1 | 152 ---- .../tests/meta/ScriptAnalyzer.Tests.ps1 | 37 - .../scaffold/tests/unit/private/readme.md | 1 + .../scaffold/tests/unit/public/readme.md | 1 + .../ModuleBuild/scaffold/vscode/settings.json | 14 +- .../ModuleBuild/scaffold/vscode/tasks.json | 6 +- release/0.2.3/plaster/PlasterContent.ps1 | 69 +- release/0.2.3/plaster/PlasterParams.ps1 | 23 + release/0.2.3/plaster/make.ps1 | 2 +- release/ModuleBuild-current.zip | Bin 983365 -> 958179 bytes release/ModuleBuild/ModuleBuild.psd1 | 8 +- release/ModuleBuild/ModuleBuild.psm1 | 335 ++++--- .../docs/Import-ModulePrivateFunction.md | 4 +- .../docs/Import-ModulePublicFunction.md | 4 +- release/ModuleBuild/docs/ModuleBuild.md | 2 +- .../ModuleBuild/docs/Set-BuildEnvironment.md | 515 +---------- .../ModuleBuild/en-US/ModuleBuild-help.xml | 858 +----------------- ...49-a717-96d64a1cc5b3_en-US_HelpContent.cab | Bin 4701 -> 0 bytes ...49-a717-96d64a1cc5b3_en-US_HelpContent.zip | Bin 4961 -> 0 bytes ...-6411-4949-a717-96d64a1cc5b3_HelpInfo.xml} | 0 ...49-a717-96d64a1cc5b3_en-US_HelpContent.cab | Bin 0 -> 3430 bytes ...49-a717-96d64a1cc5b3_en-US_HelpContent.zip | Bin 0 -> 3683 bytes .../plaster/ModuleBuild/plasterManifest.xml | 67 +- .../ModuleBuild/scaffold/Build.template | 10 +- .../scaffold/PSScriptAnalyzerSettings.psd1 | 26 + .../plaster/ModuleBuild/scaffold/appveyor.yml | 14 + .../build/docs/Additional/Acknowledgements.md | 4 +- .../build/docs/Additional/Contributing.md | 2 +- .../scaffold/build/docs/Additional/index.md | 2 +- .../scaffold/modulename.build.template | 57 +- .../plaster/ModuleBuild/scaffold/readme.md | 13 +- .../scaffold/src/other/PostLoad.ps1 | 2 + .../scaffold/src/tests/FunctionCBH.Tests.ps1 | 60 -- .../src/tests/ModuleManifest.Tests.ps1 | 205 ----- .../src/tests/ScriptAnalyzer.Tests.ps1 | 32 - .../src/tests/SensitiveTermScan.Tests.ps1 | 28 - .../src/tests/meta/Autoload.Tests.ps1 | 23 - .../src/tests/meta/FileContent.Tests.ps1 | 349 ------- .../src/tests/meta/FileEncoding.Tests.ps1 | 54 -- .../src/tests/meta/FileFormatting.Tests.ps1 | 96 -- .../src/tests/meta/ProjectStructure.Tests.ps1 | 152 ---- .../src/tests/meta/ScriptAnalyzer.Tests.ps1 | 37 - .../scaffold/tests/FunctionCBH.Tests.ps1 | 60 -- .../scaffold/tests/ModuleManifest.Tests.ps1 | 205 ----- .../scaffold/tests/ScriptAnalyzer.Tests.ps1 | 32 - .../tests/SensitiveTermScan.Tests.ps1 | 28 - .../tests/intergration/private/readme.md | 1 + .../tests/intergration/public/readme.md | 1 + .../scaffold/tests/meta/Autoload.Tests.ps1 | 23 - .../scaffold/tests/meta/FileContent.Tests.ps1 | 349 ------- .../tests/meta/FileEncoding.Tests.ps1 | 54 -- .../tests/meta/FileFormatting.Tests.ps1 | 96 -- .../tests/meta/ProjectStructure.Tests.ps1 | 152 ---- .../tests/meta/ScriptAnalyzer.Tests.ps1 | 37 - .../scaffold/tests/unit/private/readme.md | 1 + .../scaffold/tests/unit/public/readme.md | 1 + .../ModuleBuild/scaffold/vscode/settings.json | 14 +- .../ModuleBuild/scaffold/vscode/tasks.json | 6 +- .../ModuleBuild/plaster/PlasterContent.ps1 | 69 +- release/ModuleBuild/plaster/PlasterParams.ps1 | 23 + release/ModuleBuild/plaster/make.ps1 | 2 +- 113 files changed, 1170 insertions(+), 8136 deletions(-) create mode 100644 plaster/ModuleBuild/scaffold/appveyor.yml delete mode 100644 release/0.2.3/en-US/ModuleBuild_8f6090b4-6411-4949-a717-96d64a1cc5b3 8f6090b4-6411-4949-a717-96d64a1cc5b3_en-US_HelpContent.cab delete mode 100644 release/0.2.3/en-US/ModuleBuild_8f6090b4-6411-4949-a717-96d64a1cc5b3 8f6090b4-6411-4949-a717-96d64a1cc5b3_en-US_HelpContent.zip rename release/0.2.3/en-US/{ModuleBuild_8f6090b4-6411-4949-a717-96d64a1cc5b3 8f6090b4-6411-4949-a717-96d64a1cc5b3_HelpInfo.xml => ModuleBuild_8f6090b4-6411-4949-a717-96d64a1cc5b3_HelpInfo.xml} (100%) create mode 100644 release/0.2.3/en-US/ModuleBuild_8f6090b4-6411-4949-a717-96d64a1cc5b3_en-US_HelpContent.cab create mode 100644 release/0.2.3/en-US/ModuleBuild_8f6090b4-6411-4949-a717-96d64a1cc5b3_en-US_HelpContent.zip create mode 100644 release/0.2.3/plaster/ModuleBuild/scaffold/PSScriptAnalyzerSettings.psd1 create mode 100644 release/0.2.3/plaster/ModuleBuild/scaffold/appveyor.yml delete mode 100644 release/0.2.3/plaster/ModuleBuild/scaffold/src/tests/FunctionCBH.Tests.ps1 delete mode 100644 release/0.2.3/plaster/ModuleBuild/scaffold/src/tests/ModuleManifest.Tests.ps1 delete mode 100644 release/0.2.3/plaster/ModuleBuild/scaffold/src/tests/ScriptAnalyzer.Tests.ps1 delete mode 100644 release/0.2.3/plaster/ModuleBuild/scaffold/src/tests/SensitiveTermScan.Tests.ps1 delete mode 100644 release/0.2.3/plaster/ModuleBuild/scaffold/src/tests/meta/Autoload.Tests.ps1 delete mode 100644 release/0.2.3/plaster/ModuleBuild/scaffold/src/tests/meta/FileContent.Tests.ps1 delete mode 100644 release/0.2.3/plaster/ModuleBuild/scaffold/src/tests/meta/FileEncoding.Tests.ps1 delete mode 100644 release/0.2.3/plaster/ModuleBuild/scaffold/src/tests/meta/FileFormatting.Tests.ps1 delete mode 100644 release/0.2.3/plaster/ModuleBuild/scaffold/src/tests/meta/ProjectStructure.Tests.ps1 delete mode 100644 release/0.2.3/plaster/ModuleBuild/scaffold/src/tests/meta/ScriptAnalyzer.Tests.ps1 delete mode 100644 release/0.2.3/plaster/ModuleBuild/scaffold/tests/FunctionCBH.Tests.ps1 delete mode 100644 release/0.2.3/plaster/ModuleBuild/scaffold/tests/ModuleManifest.Tests.ps1 delete mode 100644 release/0.2.3/plaster/ModuleBuild/scaffold/tests/ScriptAnalyzer.Tests.ps1 delete mode 100644 release/0.2.3/plaster/ModuleBuild/scaffold/tests/SensitiveTermScan.Tests.ps1 create mode 100644 release/0.2.3/plaster/ModuleBuild/scaffold/tests/intergration/private/readme.md create mode 100644 release/0.2.3/plaster/ModuleBuild/scaffold/tests/intergration/public/readme.md delete mode 100644 release/0.2.3/plaster/ModuleBuild/scaffold/tests/meta/Autoload.Tests.ps1 delete mode 100644 release/0.2.3/plaster/ModuleBuild/scaffold/tests/meta/FileContent.Tests.ps1 delete mode 100644 release/0.2.3/plaster/ModuleBuild/scaffold/tests/meta/FileEncoding.Tests.ps1 delete mode 100644 release/0.2.3/plaster/ModuleBuild/scaffold/tests/meta/FileFormatting.Tests.ps1 delete mode 100644 release/0.2.3/plaster/ModuleBuild/scaffold/tests/meta/ProjectStructure.Tests.ps1 delete mode 100644 release/0.2.3/plaster/ModuleBuild/scaffold/tests/meta/ScriptAnalyzer.Tests.ps1 create mode 100644 release/0.2.3/plaster/ModuleBuild/scaffold/tests/unit/private/readme.md create mode 100644 release/0.2.3/plaster/ModuleBuild/scaffold/tests/unit/public/readme.md delete mode 100644 release/ModuleBuild/en-US/ModuleBuild_8f6090b4-6411-4949-a717-96d64a1cc5b3 8f6090b4-6411-4949-a717-96d64a1cc5b3_en-US_HelpContent.cab delete mode 100644 release/ModuleBuild/en-US/ModuleBuild_8f6090b4-6411-4949-a717-96d64a1cc5b3 8f6090b4-6411-4949-a717-96d64a1cc5b3_en-US_HelpContent.zip rename release/ModuleBuild/en-US/{ModuleBuild_8f6090b4-6411-4949-a717-96d64a1cc5b3 8f6090b4-6411-4949-a717-96d64a1cc5b3_HelpInfo.xml => ModuleBuild_8f6090b4-6411-4949-a717-96d64a1cc5b3_HelpInfo.xml} (100%) create mode 100644 release/ModuleBuild/en-US/ModuleBuild_8f6090b4-6411-4949-a717-96d64a1cc5b3_en-US_HelpContent.cab create mode 100644 release/ModuleBuild/en-US/ModuleBuild_8f6090b4-6411-4949-a717-96d64a1cc5b3_en-US_HelpContent.zip create mode 100644 release/ModuleBuild/plaster/ModuleBuild/scaffold/PSScriptAnalyzerSettings.psd1 create mode 100644 release/ModuleBuild/plaster/ModuleBuild/scaffold/appveyor.yml delete mode 100644 release/ModuleBuild/plaster/ModuleBuild/scaffold/src/tests/FunctionCBH.Tests.ps1 delete mode 100644 release/ModuleBuild/plaster/ModuleBuild/scaffold/src/tests/ModuleManifest.Tests.ps1 delete mode 100644 release/ModuleBuild/plaster/ModuleBuild/scaffold/src/tests/ScriptAnalyzer.Tests.ps1 delete mode 100644 release/ModuleBuild/plaster/ModuleBuild/scaffold/src/tests/SensitiveTermScan.Tests.ps1 delete mode 100644 release/ModuleBuild/plaster/ModuleBuild/scaffold/src/tests/meta/Autoload.Tests.ps1 delete mode 100644 release/ModuleBuild/plaster/ModuleBuild/scaffold/src/tests/meta/FileContent.Tests.ps1 delete mode 100644 release/ModuleBuild/plaster/ModuleBuild/scaffold/src/tests/meta/FileEncoding.Tests.ps1 delete mode 100644 release/ModuleBuild/plaster/ModuleBuild/scaffold/src/tests/meta/FileFormatting.Tests.ps1 delete mode 100644 release/ModuleBuild/plaster/ModuleBuild/scaffold/src/tests/meta/ProjectStructure.Tests.ps1 delete mode 100644 release/ModuleBuild/plaster/ModuleBuild/scaffold/src/tests/meta/ScriptAnalyzer.Tests.ps1 delete mode 100644 release/ModuleBuild/plaster/ModuleBuild/scaffold/tests/FunctionCBH.Tests.ps1 delete mode 100644 release/ModuleBuild/plaster/ModuleBuild/scaffold/tests/ModuleManifest.Tests.ps1 delete mode 100644 release/ModuleBuild/plaster/ModuleBuild/scaffold/tests/ScriptAnalyzer.Tests.ps1 delete mode 100644 release/ModuleBuild/plaster/ModuleBuild/scaffold/tests/SensitiveTermScan.Tests.ps1 create mode 100644 release/ModuleBuild/plaster/ModuleBuild/scaffold/tests/intergration/private/readme.md create mode 100644 release/ModuleBuild/plaster/ModuleBuild/scaffold/tests/intergration/public/readme.md delete mode 100644 release/ModuleBuild/plaster/ModuleBuild/scaffold/tests/meta/Autoload.Tests.ps1 delete mode 100644 release/ModuleBuild/plaster/ModuleBuild/scaffold/tests/meta/FileContent.Tests.ps1 delete mode 100644 release/ModuleBuild/plaster/ModuleBuild/scaffold/tests/meta/FileEncoding.Tests.ps1 delete mode 100644 release/ModuleBuild/plaster/ModuleBuild/scaffold/tests/meta/FileFormatting.Tests.ps1 delete mode 100644 release/ModuleBuild/plaster/ModuleBuild/scaffold/tests/meta/ProjectStructure.Tests.ps1 delete mode 100644 release/ModuleBuild/plaster/ModuleBuild/scaffold/tests/meta/ScriptAnalyzer.Tests.ps1 create mode 100644 release/ModuleBuild/plaster/ModuleBuild/scaffold/tests/unit/private/readme.md create mode 100644 release/ModuleBuild/plaster/ModuleBuild/scaffold/tests/unit/public/readme.md diff --git a/buildreports/CodeHealthReport-Private.html b/buildreports/CodeHealthReport-Private.html index a3defc8..77820ca 100644 --- a/buildreports/CodeHealthReport-Private.html +++ b/buildreports/CodeHealthReport-Private.html @@ -189,7 +189,7 @@

Analyzed path : src\private
- Analysis date : 2018-04-01 21:07:32Z + Analysis date : 2019-12-17 10:55:38Z
@@ -233,7 +233,7 @@

13

Lines of Code - Total

-

798

+

815

@@ -246,9 +246,9 @@