Skip to content

Update pester syntax to v4 - #11544

Merged
Ilya (iSazonov) merged 12 commits into
PowerShell:masterfrom
xtqqczze:update-pester-syntax
Jan 11, 2020
Merged

Ilya (iSazonov) merged 12 commits into
PowerShell:masterfrom
xtqqczze:update-pester-syntax

Conversation

@xtqqczze

@xtqqczze xtqqczze commented Jan 9, 2020 •

Copy link
Copy Markdown
Contributor

PR Summary

  • Update Pester tests to dashed v4 syntax
  • Capitalise 'Should' and parameters

PR Context

Pester documentation for 4.x recommends using Should -Be instead of Should Be syntax.

PR Checklist

@iSazonov

Copy link
Copy Markdown
Collaborator

xtqqczze It is a huge PR. Please to split it on some small PR. It is easy to fix and review.

@xtqqczze
xtqqczze force-pushed the update-pester-syntax branch from 01dbaea to c4de7ba Compare January 10, 2020 21:04
@xtqqczze xtqqczze changed the title [WIP]Update pester syntax Update pester syntax to v4 Jan 10, 2020
```powershell
$_ -ireplace '\s?\|\s?should\b',' | Should'
```
```powershell
$_ -ireplace '(\| Should) not\b','$1 -Not'
```
```powershell
$_ -ireplace '(\| Should(?: -Not)?) -?be\b','$1 -Be'
```
$_ -ireplace '(\| Should(?: -Not)?) -?beexactly\b','$1 -BeExactly'
```powershell
$_ -ireplace '(\| Should(?: -Not)?) -?begreaterthan\b','$1 -BeGreaterThan'
```
```powershell
$_ -ireplace '(\| Should(?: -Not)?) -Be\s\$?true\b','$1 -BeTrue'
```
```powershell
$_ -ireplace '(\| Should(?: -Not)?) -Be\s\$?false\b','$1 -BeFalse'
```
```powershell
$_ -ireplace '(\| Should(?: -Not)?)\s-?match\b','$1 -Match'
```
```powershell
$_ -ireplace '(\| Should(?: -Not)?)\s-?throw\b','$1 -Throw'
```
```powershell
$_ -ireplace '(\| Should(?: -Not)?)\s-?benullorempty\b','$1 -BeNullOrEmpty'
```
```powershell
$_ -ireplace '\s-because\b',' -Because'
```
@xtqqczze
xtqqczze force-pushed the update-pester-syntax branch from c4de7ba to e829996 Compare January 11, 2020 13:09
@xtqqczze

Copy link
Copy Markdown
Contributor Author

Ilya (@iSazonov) Removed some commits and rebased, PR is ready for merge.

@iSazonov Ilya (iSazonov) added the CL-Test Indicates that a PR should be marked as a test change in the Change Log label Jan 11, 2020
@iSazonov Ilya (iSazonov) added this to the 7.1.0-preview.1 milestone Jan 11, 2020
@iSazonov
Ilya (iSazonov) merged commit 7439833 into PowerShell:master Jan 11, 2020
@iSazonov

Copy link
Copy Markdown
Collaborator

xtqqczze Thanks for your contribution!

@ghost

Copy link
Copy Markdown

🎉v7.1.0-preview.1 has been released which incorporates this pull request.:tada:

Handy links:

@xtqqczze
xtqqczze deleted the update-pester-syntax branch May 6, 2020 01:25
Thatgfsj (Thatgfsj) pushed a commit to Thatgfsj-contribs/PowerShell that referenced this pull request Aug 6, 2026
* Capitalize 'Should' command and fix whitespace

```powershell
$_ -ireplace '\s?\|\s?should\b',' | Should'
```

* Capitalise and apply hyphen to 'Not' parameter

```powershell
$_ -ireplace '(\| Should) not\b','$1 -Not'
```

* Capitalise and apply hyphen to 'Be' parameter

```powershell
$_ -ireplace '(\| Should(?: -Not)?) -?be\b','$1 -Be'
```

* Capitalise and apply hyphen to 'BeExactly' parameter

$_ -ireplace '(\| Should(?: -Not)?) -?beexactly\b','$1 -BeExactly'

* Capitalise and apply hyphen to 'BeGreaterThan' parameter

```powershell
$_ -ireplace '(\| Should(?: -Not)?) -?begreaterthan\b','$1 -BeGreaterThan'
```

* Use 'BeTrue' parameter

```powershell
$_ -ireplace '(\| Should(?: -Not)?) -Be\s\$?true\b','$1 -BeTrue'
```

* Use 'BeFalse' parameter

```powershell
$_ -ireplace '(\| Should(?: -Not)?) -Be\s\$?false\b','$1 -BeFalse'
```

* Capitalise and apply hyphen to 'Match' parameter

```powershell
$_ -ireplace '(\| Should(?: -Not)?)\s-?match\b','$1 -Match'
```

* Capitalise and apply hyphen to 'Throw' parameter

```powershell
$_ -ireplace '(\| Should(?: -Not)?)\s-?throw\b','$1 -Throw'
```

* Capitalise and apply hyphen to 'BeNullOrEmpty' parameter

```powershell
$_ -ireplace '(\| Should(?: -Not)?)\s-?benullorempty\b','$1 -BeNullOrEmpty'
```

* Capitalise 'Because' parameter

```powershell
$_ -ireplace '\s-because\b',' -Because'
```

* Fix 'BeNullOrEmpty'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CL-Test Indicates that a PR should be marked as a test change in the Change Log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants