Skip to content
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
2 changes: 1 addition & 1 deletion publish/release.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ param (
[String] $PsGalleryApiKey,
[String] $NugetApiKey,
[String] $ChocolateyApiKey,
[String] $CertificateThumbprint = 'c7b0582906e5205b8399d92991694a614d0c0b22',
[String] $CertificateThumbprint = '2FCC9148EC2C9AB951C6F9654C0D2ED16AF27738',
[Switch] $Force
)

Expand Down
15 changes: 1 addition & 14 deletions src/functions/assertions/Should.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -99,20 +99,7 @@ function Should {
)

dynamicparam {
# Figuring out if we are using the old syntax is 'easy'
# we can use $myInvocation.Line to get the surrounding context
$myLine = if ($null -ne $MyInvocation -and 0 -le ($MyInvocation.OffsetInLine - 1)) {
$MyInvocation.Line.Substring($MyInvocation.OffsetInLine - 1)
}

# A bit of Regex lets us know if the line used the old form
if ($myLine -match '^\s{0,}should\s{1,}(?<Operator>[^\-\@\s]+)') {
$shouldErrorMsg = "Legacy Should syntax (without dashes) is not supported in Pester 5. Please refer to migration guide at: https://pester.dev/docs/migrations/v3-to-v4"
throw $shouldErrorMsg
}
else {
Get-AssertionDynamicParams
}
Get-AssertionDynamicParams
}

begin {
Expand Down
18 changes: 0 additions & 18 deletions tst/Pester.RSpec.ts.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -1990,24 +1990,6 @@ i -PassThru:$PassThru {
}
}

b "Should with legacy syntax will throw" {
t "Should with legacy syntax will throw" {
$sb = {
Describe "d" {
It "i" {
1 | Should Be 1
}
}
}

$container = New-PesterContainer -ScriptBlock $sb
$r = Invoke-Pester -Container $container -PassThru
$test = $r.Containers[0].Blocks[0].Tests[0]
$test.Result | Verify-Equal "Failed"
$test.ErrorRecord[0] -like "*Legacy Should syntax (without dashes) is not supported in Pester 5.*"
}
}

b "Running Pester in Pester" {
t "Invoke-Pester can run in Invoke-Pester" {
$container = New-PesterContainer -ScriptBlock {
Expand Down