Title: Pester testing guideline for tests against thrown errors · Issue #4635 · PowerShell/PowerShell · GitHub
Open Graph Title: Pester testing guideline for tests against thrown errors · Issue #4635 · PowerShell/PowerShell
X Title: Pester testing guideline for tests against thrown errors · Issue #4635 · PowerShell/PowerShell
Description: As part of PR 4612, it was found that the current guideline here recommends this approach It "Get-Item on a nonexisting file should have error PathNotFound" { try { get-item "ThisFileCannotPossiblyExist" -ErrorAction Stop throw "No Excep...
Open Graph Description: As part of PR 4612, it was found that the current guideline here recommends this approach It "Get-Item on a nonexisting file should have error PathNotFound" { try { get-item "ThisFileCannotPossibly...
X Description: As part of PR 4612, it was found that the current guideline here recommends this approach It "Get-Item on a nonexisting file should have error PathNotFound" { try { get-item "ThisFil...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/4635
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Pester testing guideline for tests against thrown errors","articleBody":"As part of PR 4612, it was found that the current guideline [here](https://github.com/PowerShell/PowerShell/blob/68bcd4b5284bb169c52a570afbfdd1bb70d0de10/docs/testing-guidelines/WritingPesterTests.md) recommends this approach\r\n```\r\nIt \"Get-Item on a nonexisting file should have error PathNotFound\" {\r\n try\r\n {\r\n get-item \"ThisFileCannotPossiblyExist\" -ErrorAction Stop\r\n throw \"No Exception!\"\r\n }\r\n catch\r\n {\r\n $_.FullyQualifiedErrorId | should be \"PathNotFound,Microsoft.PowerShell.Commands.GetItemCommand\"\r\n }\r\n}\r\n```\r\n\r\nHowever, @iSazonov suggests [here](https://github.com/PowerShell/PowerShell/pull/4612#discussion_r134120245) that the guideline should be updated to this pattern:\r\n```\r\n{ get-item \"ThisFileCannotPossiblyExist\" -ErrorAction Stop } | ShouldBeErrorId \"PathNotFound,Microsoft.PowerShell.Commands.GetItemCommand\"\r\n```","author":{"url":"https://github.com/bergmeister","@type":"Person","name":"bergmeister"},"datePublished":"2017-08-21T21:42:13.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/4635/PowerShell/issues/4635"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:09c9a400-594f-21fa-233e-523616ce0511 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9F4E:3E45D3:4317F3:5A5BB2:6A5552ED |
| html-safe-nonce | c50894b26cb9f81274e26642dd93ac6ab72de9eeb59ce7f645789f0ebe2c44a1 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RjRFOjNFNDVEMzo0MzE3RjM6NUE1QkIyOjZBNTU1MkVEIiwidmlzaXRvcl9pZCI6IjE5NzA4MTEzNzY5NDg4MjY4NjEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 55172c337c257ff684938341e5a0b1bc9b83cc059be968bbb81d1064ca93507d |
| hovercard-subject-tag | issue:251779118 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PowerShell/PowerShell/4635/issue_layout |
| twitter:image | https://opengraph.githubassets.com/7ec500cc321b3aecefef262c20e011b1b74d299bfbd1e53e609695dd0ad87c08/PowerShell/PowerShell/issues/4635 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7ec500cc321b3aecefef262c20e011b1b74d299bfbd1e53e609695dd0ad87c08/PowerShell/PowerShell/issues/4635 |
| og:image:alt | As part of PR 4612, it was found that the current guideline here recommends this approach It "Get-Item on a nonexisting file should have error PathNotFound" { try { get-item "ThisFileCannotPossibly... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | bergmeister |
| hostname | github.com |
| expected-hostname | github.com |
| None | cd9eea424140838b22e9eabd53d92b5702617ddd6d76efcd3a37f08d44309ca5 |
| turbo-cache-control | no-preview |
| go-import | github.com/PowerShell/PowerShell git https://github.com/PowerShell/PowerShell.git |
| octolytics-dimension-user_id | 11524380 |
| octolytics-dimension-user_login | PowerShell |
| octolytics-dimension-repository_id | 49609581 |
| octolytics-dimension-repository_nwo | PowerShell/PowerShell |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 49609581 |
| octolytics-dimension-repository_network_root_nwo | PowerShell/PowerShell |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 3084b9f587e8f1e19803bbe0c77ac77ce3c99c5c |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width