Repository navigation
fix: 🐛 Exempt Pest test bodies from DisallowBooleanArgumentFlag. - #402
Open
mikebronner wants to merge 1 commit into
Open
mikebronner wants to merge 1 commit into
mikebronner wants to merge 1 commit into
Conversation
A bool parameter on the closure or arrow function passed as the test body to a Pest it() or test() call receives a dataset value. It carries an expected value, not a behaviour switch, so the sniff no longer reports it. A static closure body and a \it() or \test() call are exempt too. A closure passed to any other function, including describe() and a method named it, still reports. So do a closure nested inside a test body, a closure in the first argument position, a plain function and a method. The exceptions and ignorepattern properties work as before.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A Pest test closure takes its parameters from a dataset. A
bool $expectedthere is an expected value, not a behaviour switch. Until now the sniff reported it, so consumers had to type the parameter asmixed.The sniff now skips a closure or arrow function in one position only: the test body, which is the second argument of a global
it()ortest()call. Astaticbody,\it()and an upper-caseIT()are covered too.These are still reported:
describe()and a method nameditThe
exceptionsandignorepatternproperties work as before. The complexity pin for this sniff's own file is updated to match the new methods.