Skip to content
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

Remove code specifically for PS 2.0-5.0 #2510

Open
xtqqczze opened this issue Jun 23, 2024 · 5 comments
Open

Remove code specifically for PS 2.0-5.0 #2510

xtqqczze opened this issue Jun 23, 2024 · 5 comments

Comments

@xtqqczze
Copy link

          Should we let this stabilize for a patch or minor release before starting cleanup of PS 3/4 logic and syntax (like `New-Object` -> `::new()`) ?

Originally posted by @fflaten in #2432 (comment)

@fflaten
Copy link
Collaborator

fflaten commented Jun 23, 2024

Closing as no longer applicable. The PowerShell requirement change was delayed to next major release (v6).

@fflaten fflaten closed this as completed Jun 23, 2024
@xtqqczze
Copy link
Author

Since v6 development is ongoing on main, should this issue not remain open?

@fflaten
Copy link
Collaborator

fflaten commented Jun 24, 2024

We usually close issues on merge. Many parts of the backcompat code are already removed and released in 6.0.0-alpha1.

Please correct me if I misunderstood. 🙂

@xtqqczze
Copy link
Author

e.g.

# Using internal code as [System.Management.Automation.Cmdlet]::CommonParameters is unavailable in PSv3

@fflaten
Copy link
Collaborator

fflaten commented Jun 30, 2024

Reopen to track future cleanup of PS v2/v3/v4/v5.0 code. Avoid large PRs and changes that doesn't provide a clear benefit.

E.g. changing this which would be unnecessary breaking change for projects migrating to Pester v6

if ($Type) {
# This block is not using `Format-Nicely`, as in PSv2 the output differs. Eg:
# PS2> [System.DateTime]
# PS5> [datetime]
[type]$actualType = $ActualValue.Parameters[$ParameterName].ParameterType
$testType = ($Type -eq $actualType)
$filters += "$(if ($Negate) { 'not ' })of type [$($Type.FullName)]"
if (-not $Negate -and -not $testType) {
$buts += "it was of type [$($actualType.FullName)]"
}
elseif ($Negate -and $testType) {
$buts += "it was of type [$($Type.FullName)]"
}
}

@fflaten fflaten reopened this Jun 30, 2024
@fflaten fflaten changed the title Remove code specifically for PSv2/PSv3 Remove code specifically for PS 2.0-5.0 Jun 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants