Skip to content
Closed
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
2 changes: 1 addition & 1 deletion docs/testing-guidelines/WritingPesterTests.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ it "Get-Item on a nonexisting file should have error PathNotFound" {
try
{
get-item "ThisFileCannotPossiblyExist" -ErrorAction Stop
throw "No Exception!"
throw "Expected an exception throw, but no Exception was thrown."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be grammatically correct, shouldn't it be an exception throw*n*?
Personally, I find We shouldn't get here, the previous command should have thrown an exception. to be the clearest.

}
catch
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@
try
{
Get-Command testgetcommand-dynamicparametersdcr -testtorun returnduplicateparameter -ErrorAction Stop
throw "No Exception!"
throw "Expected an exception throw, but no Exception was thrown."
}
catch
{
Expand All @@ -271,4 +271,4 @@
VerifyDynamicParametersExist -cmdlet $results[0] -parameterNames $paramName
VerifyParameterType -cmdlet $results[0] -parameterName $paramName -ParameterType Microsoft.PowerShell.Commands.FileSystemCmdletProviderEncoding
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ Describe "Start-Process" -Tags @("CI","SLOW") {
try
{
Start-Process -Verb runas -FilePath $pingCommand -ArgumentList $pingParam
throw "No Exception!"
throw "Expected an exception throw, but no Exception was thrown."
}
catch
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ Describe "Set-Timezone test cases" -Tags @('Feature', 'RequireAdminOnWindows') {
try
{
Set-TimeZone -Id "zzInvalidID"
throw "No Exception!"
throw "Expected an exception throw, but no Exception was thrown."
}
catch
{
Expand Down Expand Up @@ -196,7 +196,7 @@ Describe "Set-Timezone test cases" -Tags @('Feature', 'RequireAdminOnWindows') {
try
{
Set-TimeZone -Name "zzINVALID_Name"
throw "No Exception!"
throw "Expected an exception throw, but no Exception was thrown."
}
catch
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -919,7 +919,7 @@ ZoneId=$FileType
)
try {
Set-ExecutionPolicy -Scope $policyScope -ExecutionPolicy Restricted
throw "No Exception!"
throw "Expected an exception throw, but no Exception was thrown."
}
catch {
$_.FullyQualifiedErrorId | Should Be "CantSetGroupPolicy,Microsoft.PowerShell.Commands.SetExecutionPolicyCommand"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Describe "SecureString conversion tests" -Tags "CI" {
It "using null arguments to ConvertFrom-SecureString produces an exception" {
try {
ConvertFrom-SecureString -secureString $null -key $null
throw "No Exception!"
throw "Expected an exception throw, but no Exception was thrown."
}
catch {
$_.FullyQualifiedErrorId | should be "ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.ConvertFromSecureStringCommand"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ Describe "Export-Alias DRT Unit Tests" -Tags "CI" {

try{
Export-Alias $fulltestpath abcd02
throw "No Exception!"
throw "Expected an exception throw, but no Exception was thrown."
}
catch{
$_.FullyQualifiedErrorId | Should be "FileOpenFailure,Microsoft.PowerShell.Commands.ExportAliasCommand"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Describe "Format-Wide" -Tags "CI" {
try
{
Format-Wide -InputObject $(Get-ChildItem) -Property CreationTime -View aoeu
throw "No Exception!"
throw "Expected an exception throw, but no Exception was thrown."
}
catch
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ Describe "Get-Alias null tests" -Tags "CI" {
try
{
Get-Alias -Name $data
throw "No Exception!"
throw "Expected an exception throw, but no Exception was thrown."
}
catch { $_.FullyQualifiedErrorId | Should Be 'ParameterArgumentValidationError,Microsoft.PowerShell.Commands.GetAliasCommand' }
}
Expand All @@ -235,7 +235,7 @@ Describe "Get-Alias null tests" -Tags "CI" {
try
{
$data | Get-Alias -ErrorAction Stop
throw "No Exception!"
throw "Expected an exception throw, but no Exception was thrown."
}
catch { $_.FullyQualifiedErrorId | Should Be 'ParameterArgumentValidationError,Microsoft.PowerShell.Commands.GetAliasCommand' }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Describe "Get-Uptime" -Tags "CI" {
[system.management.automation.internal.internaltesthooks]::SetTestHook('StopwatchIsNotHighResolution', $true)

Get-Uptime
throw "No Exception!"
throw "Expected an exception throw, but no Exception was thrown."
}
catch
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
try
{
test-PositionalBinding1 1
throw "No Exception!"
throw "Expected an exception throw, but no Exception was thrown."
}
catch
{
Expand Down Expand Up @@ -65,7 +65,7 @@
try
{
test-allownullattributes -Parameter2 1 -Parameter3 $null -ShowMe 1
throw "No Exception!"
throw "Expected an exception throw, but no Exception was thrown."
}
catch
{
Expand All @@ -91,7 +91,7 @@
try
{
test-namedwithboolishargument -Parameter2 -Parameter1
throw "No Exception!"
throw "Expected an exception throw, but no Exception was thrown."
}
catch
{
Expand Down Expand Up @@ -151,7 +151,7 @@
try
{
test-singleintparameter -Parameter1 'dookie'
throw "No Exception!"
throw "Expected an exception throw, but no Exception was thrown."
}
catch
{
Expand Down Expand Up @@ -270,7 +270,7 @@
try
{
test-nameconflicts6 -Parameter2 1
throw "No Exception!"
throw "Expected an exception throw, but no Exception was thrown."
}
catch
{
Expand Down