resolve merge conflicts

This commit is contained in:
Kevin Marquette
2018-12-28 14:46:55 -08:00
29 changed files with 1038 additions and 19 deletions

View File

@@ -0,0 +1,33 @@
$Script:ModuleRoot = Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent
$Script:ModuleName = $Script:ModuleName = Get-ChildItem $ModuleRoot\*\*.psm1 | Select-object -ExpandProperty BaseName
Describe "Public commands have comment-based or external help" -Tags 'Build' {
$functions = Get-Command -Module $ModuleName
$help = foreach ($function in $functions) {
Get-Help -Name $function.Name
}
foreach ($node in $help)
{
Context $node.Name {
It "Should have a Description or Synopsis" {
($node.Description + $node.Synopsis) | Should Not BeNullOrEmpty
}
It "Should have an Example" {
$node.Examples | Should Not BeNullOrEmpty
$node.Examples | Out-String | Should -Match ($node.Name)
}
foreach ($parameter in $node.Parameters.Parameter)
{
if ($parameter -notmatch 'WhatIf|Confirm')
{
It "Should have a Description for Parameter [$($parameter.Name)]" {
$parameter.Description.Text | Should Not BeNullOrEmpty
}
}
}
}
}
}

View File

@@ -0,0 +1,45 @@
$Script:ModuleRoot = Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent
$Script:ModuleName = $Script:ModuleName = Get-ChildItem $ModuleRoot\*\*.psm1 | Select-object -ExpandProperty BaseName
$Script:SourceRoot = Join-Path -Path $ModuleRoot -ChildPath $ModuleName
Describe "All commands pass PSScriptAnalyzer rules" -Tag 'Build' {
$rules = "$ModuleRoot\ScriptAnalyzerSettings.psd1"
$scripts = Get-ChildItem -Path $SourceRoot -Include '*.ps1', '*.psm1', '*.psd1' -Recurse |
Where-Object FullName -notmatch 'Classes'
foreach ($script in $scripts)
{
Context $script.FullName {
$results = Invoke-ScriptAnalyzer -Path $script.FullName -Settings $rules
if ($results)
{
foreach ($rule in $results)
{
It $rule.RuleName {
$message = "{0} Line {1}: {2}" -f $rule.Severity, $rule.Line, $rule.Message
$message | Should Be ""
}
}
}
else
{
It "Should not fail any rules" {
$results | Should BeNullOrEmpty
}
}
}
}
}
Describe "Public commands have Pester tests" -Tag 'Build' {
$commands = Get-Command -Module $ModuleName
foreach ($command in $commands.Name)
{
$file = Get-ChildItem -Path "$ModuleRoot\Tests" -Include "$command.Tests.ps1" -Recurse
It "Should have a Pester test for [$command]" {
$file.FullName | Should Not BeNullOrEmpty
}
}
}