Skip to content

Fix Pester v4 installation for Visual Studio 2017 image and use Pester v4 assertion operator syntax #892

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
Feb 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Tests/DisabledRules/AvoidOneChar.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ $noViolations = Invoke-ScriptAnalyzer $directory\GoodCmdlet.ps1 | Where-Object {
Describe "Avoid Using One Char" {
Context "When there are violations" {
It "has 1 One Char Violation" {
$oneCharViolations.Count | Should Be 1
$oneCharViolations.Count | Should -Be 1
}

It "has the correct description message" {
$oneCharViolations[0].Message | Should Match $oneCharMessage
$oneCharViolations[0].Message | Should -Match $oneCharMessage
}
}

Context "When there are no violations" {
It "has no violations" {
$noReservedCharViolations.Count | Should Be 0
$noReservedCharViolations.Count | Should -Be 0
}
}
}
6 changes: 3 additions & 3 deletions Tests/DisabledRules/AvoidTrapStatements.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ $noViolations = Invoke-ScriptAnalyzer $directory\GoodCmdlet.ps1 | Where-Object {
Describe "AvoidTrapStatement" {
Context "When there are violations" {
It "has 1 avoid trap violations" {
$violations.Count | Should Be 1
$violations.Count | Should -Be 1
}

It "has the correct description message" {
$violations[0].Message | Should Match $violationMessage
$violations[0].Message | Should -Match $violationMessage
}

}

Context "When there are no violations" {
It "returns no violations" {
$noViolations.Count | Should Be 0
$noViolations.Count | Should -Be 0
}
}
}
6 changes: 3 additions & 3 deletions Tests/DisabledRules/AvoidUnloadableModule.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ $noViolations = Invoke-ScriptAnalyzer $directory\TestGoodModule\TestGoodModule.p
Describe "AvoidUnloadableModule" {
Context "When there are violations" {
It "has 1 unloadable module violation" {
$violations.Count | Should Be 1
$violations.Count | Should -Be 1
}

It "has the correct description message" {
$violations.Message | Should Match $unloadableMessage
$violations.Message | Should -Match $unloadableMessage
}
}

Context "When there are no violations" {
It "returns no violations" {
$noViolations.Count | Should Be 0
$noViolations.Count | Should -Be 0
}
}
}
6 changes: 3 additions & 3 deletions Tests/DisabledRules/AvoidUsingClearHost.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ $noViolations = Invoke-ScriptAnalyzer $directory\AvoidUsingClearHostNoViolations
Describe "AvoidUsingClearHost" {
Context "When there are violations" {
It "has 3 Clear-Host violations" {
$violations.Count | Should Be 3
$violations.Count | Should -Be 3
}

It "has the correct description message for Clear-Host" {
$violations[0].Message | Should Match $clearHostMessage
$violations[0].Message | Should -Match $clearHostMessage
}
}

Context "When there are no violations" {
It "returns no violations" {
$noViolations.Count | Should Be 0
$noViolations.Count | Should -Be 0
}
}
}
8 changes: 4 additions & 4 deletions Tests/DisabledRules/AvoidUsingFilePath.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,21 @@ $noViolations = Invoke-ScriptAnalyzer $directory\AvoidUsingFilePathNoViolations.
Describe "AvoidUsingFilePath" {
Context "When there are violations" {
It "has 4 avoid using file path violations" {
$violations.Count | Should Be 4
$violations.Count | Should -Be 4
}

It "has the correct description message with drive name" {
$violations[0].Message | Should Match $violationMessage
$violations[0].Message | Should -Match $violationMessage
}

It "has the correct description message (UNC)" {
$violations[2].Message | Should Match $violationUNCMessage
$violations[2].Message | Should -Match $violationUNCMessage
}
}

Context "When there are no violations" {
It "returns no violations" {
$noViolations.Count | Should Be 0
$noViolations.Count | Should -Be 0
}
}
}
6 changes: 3 additions & 3 deletions Tests/DisabledRules/AvoidUsingInternalURLs.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ $noViolations = Invoke-ScriptAnalyzer $directory\AvoidUsingInternalURLsNoViolati
Describe "AvoidUsingInternalURLs" {
Context "When there are violations" {
It "has 3 violations" {
$violations.Count | Should Be 3
$violations.Count | Should -Be 3
}

It "has the correct description message" {
$violations[0].Message | Should Match $violationMessage
$violations[0].Message | Should -Match $violationMessage
}
}

Context "When there are no violations" {
It "returns no violations" {
$noViolations.Count | Should Be 0
$noViolations.Count | Should -Be 0
}
}
}
6 changes: 3 additions & 3 deletions Tests/DisabledRules/AvoidUsingUninitializedVariable.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ $noViolations = Invoke-ScriptAnalyzer $directory\AvoidUsingUninitializedVariable
Describe "AvoidUsingUninitializedVariable" {
Context "Script uses uninitialized variables - Violation" {
It "Have 3 rule violations" {
$violations.Count | Should Be 3
$violations.Count | Should -Be 3
}

It "has the correct description message for UninitializedVariable rule violation" {
$violations[0].Message | Should Be $violationMessage
$violations[0].Message | Should -Be $violationMessage
}
}

Context "Script uses initialized variables - No violation" {
It "results in no rule violations" {
$noViolations.Count | Should Be 0
$noViolations.Count | Should -Be 0
}
}
}
8 changes: 4 additions & 4 deletions Tests/DisabledRules/CommandNotFound.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@ $noViolationsDSC = Invoke-ScriptAnalyzer -ErrorAction SilentlyContinue $director
Describe "CommandNotFound" {
Context "When there are violations" {
It "has 1 Command Not Found violation" {
$violations.Count | Should Be 1
$violations.Count | Should -Be 1
}

It "has the correct description message" {
$violations[0].Message | Should Match $violationMessage
$violations[0].Message | Should -Match $violationMessage
}
}

Context "When there are no violations" {
It "returns no violations" {
$noViolations.Count | Should Be 0
$noViolations.Count | Should -Be 0
}

It "returns no violations for DSC configuration" {
$noViolationsDSC.Count | Should Be 0
$noViolationsDSC.Count | Should -Be 0
}
}
}
8 changes: 4 additions & 4 deletions Tests/DisabledRules/ProvideVerboseMessage.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@ $noViolations = Invoke-ScriptAnalyzer $directory\GoodCmdlet.ps1 | Where-Object {
Describe "ProvideVerboseMessage" {
Context "When there are violations" {
It "has 1 provide verbose violation" {
$violations.Count | Should Be 1
$violations.Count | Should -Be 1
}

It "has the correct description message" {
$violations[0].Message | Should Match $violationMessage
$violations[0].Message | Should -Match $violationMessage
}

It "Does not count violation in DSC class" {
$dscViolations.Count | Should Be 0
$dscViolations.Count | Should -Be 0
}
}

Context "When there are no violations" {
It "returns no violations" {
$noViolations.Count | Should Be 0
$noViolations.Count | Should -Be 0
}
}
}
6 changes: 3 additions & 3 deletions Tests/DisabledRules/TypeNotFound.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ $noViolations = Invoke-ScriptAnalyzer $directory\GoodCmdlet.ps1 | Where-Object {
Describe "TypeNotFound" {
Context "When there are violations" {
It "has 2 Type Not Found violations" {
$violations.Count | Should Be 2
$violations.Count | Should -Be 2
}

It "has the correct description message" {
$violations[0].Message | Should Match $violationMessage
$violations[0].Message | Should -Match $violationMessage
}
}

Context "When there are no violations" {
It "returns no violations" {
$noViolations.Count | Should Be 0
$noViolations.Count | Should -Be 0
}
}
}
6 changes: 3 additions & 3 deletions Tests/DisabledRules/UseTypeAtVariableAssignment.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ $noViolations = Invoke-ScriptAnalyzer $directory\GoodCmdlet.ps1 | Where-Object {
Describe "UseTypeAtVariableAssignment" {
Context "When there are violations" {
It "has 3 Use Type At Variable Assignement violations" {
$violations.Count | Should Be 3
$violations.Count | Should -Be 3
}

It "has the correct description message" {
$violations[0].Message | Should Match $violationMessage
$violations[0].Message | Should -Match $violationMessage
}
}

Context "When there are no violations" {
It "returns no violations" {
$noViolations.Count | Should Be 0
$noViolations.Count | Should -Be 0
}
}
}
14 changes: 7 additions & 7 deletions Tests/Engine/CorrectionExtent.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ Describe "Correction Extent" {
It "creates the object with correct properties" {
$correctionExtent = $obj = New-Object -TypeName $type -ArgumentList 1, 1, 1, 3, "get-childitem", "newfile", "cool description"

$correctionExtent.StartLineNumber | Should Be 1
$correctionExtent.EndLineNumber | Should Be 1
$correctionExtent.StartColumnNumber | Should Be 1
$correctionExtent.EndColumnNumber | Should be 3
$correctionExtent.Text | Should Be "get-childitem"
$correctionExtent.File | Should Be "newfile"
$correctionExtent.Description | Should Be "cool description"
$correctionExtent.StartLineNumber | Should -Be 1
$correctionExtent.EndLineNumber | Should -Be 1
$correctionExtent.StartColumnNumber | Should -Be 1
$correctionExtent.EndColumnNumber | Should -Be 3
$correctionExtent.Text | Should -Be "get-childitem"
$correctionExtent.File | Should -Be "newfile"
$correctionExtent.Description | Should -Be "cool description"
}
}
}
Loading