Skip to content

Conversation

fflaten
Copy link
Contributor

@fflaten fflaten commented Apr 29, 2023

Description

Updates advanced function test to not use text-based assertion.

Motivation and Context

https://twitter.com/techdufus/status/1649075789822918656?s=20 hurts my eyes. 😄

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My code follows the code style of this project.
  • I have added Pester Tests that describe what my changes should do.
  • I have updated the documentation accordingly.

@TechDufus TechDufus self-requested a review May 1, 2023 15:05
$CurrentFunction.FullName | Should -FileContentMatch 'cmdletbinding'
$CurrentFunction.FullName | Should -FileContentMatch 'param'
It 'Should be an advanced function' -Skip:($Command.CommandType -ne 'Function' -or $Command.Name -in 'grep') -ForEach @{ Command = $Command } {
$Command.CmdletBinding | Should -BeTrue
Copy link
Contributor Author

@fflaten fflaten May 3, 2023

Choose a reason for hiding this comment

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

You could also move the skip-check inside the test and use ex. Set-ItResult -Skipped -Because 'this is a filter' to skip with a clear reason.

By doing it in It '' -Skip:($true), you'll evaluate and skip earlier during Discovery, making it slightly faster at the cost of no skip reason.

@TechDufus TechDufus merged commit 2aa31d8 into TechDufus:master Jul 21, 2023
@fflaten fflaten deleted the fflaten-patch-1 branch July 21, 2023 17:44
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

Successfully merging this pull request may close these issues.

2 participants