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
Plans for describe
blocks?
#15
Comments
It's a good idea, but no plans for now. |
This is pretty important, as without it we have no idea what "it" is referring to in tests. Currently,
=> "User can log in if verified" Or even allow nested descriptions, using
=> "User is verified can log in", "User is not verified can not log in" |
Would tend to agree with you 👍 |
@nunomaduro I think It would be very meaningful to have |
Would be a nice to have for sure. Given that this issue was re-opened recently, I am curious what everyone has in mind for how |
@jordanbrauer seeing as @nunomaduro was the one to reopen, I am guessing he is (or will be) working on this personally. |
@jordanbrauer I think it's totally fine for you to try and work out a PR for this and figure out what it's supposed to do. One note about adding this is that it will be a breaking change for the IntelliJ Plugin, so changes has to be made before the IntelliJ plugin can work with it. |
Sorry - if considering this once again, we are going to put this on hold. |
@nunomaduro Any expectation to see this feature in Pest v2? 😊 |
Describe and contexts are needed IMO |
This feature would provide a lot of value. In a single test suite, I might test multiple functions, and with multiple scenarios. But all the console descriptions are "it does ____". It would be really nice to be able to group things by function or scenario with |
One more vote for I segment test files using comments, but they are not included in reports. And when a class has more than a couple of methods, I sometimes have to artificially change test descriptions to avoid collisions. A way to group tests inside the same Pest file would be a great addition! |
I'd love for Pest to use describe-it syntax, which includes describe and context. Right now we just have it syntax, and I'm overloading a lot of context into test names. Its also making it hard to share setups. it('returns valid response when there are records', function () {
Specie::factory()
->count(5)
->create();
// assertion
});
it('returns valid response when there are no records', function () {
$this->assertEquals(0, Specie::count());
// assertion
}); If this was using other describe-it tools in other languages I'd be doing this:
This is a load more lines but the output and debugging improvements that come with it are worth a whole lot more than the sore fingers. Or you can smush loads of assertions into one, either way context is really handy when you want to nest contexts. Please can we consider describe and context? See how they work in RSpec. https://www.betterspecs.org/#contexts |
This would be the selling feature for me to ditch phpUnit for. In fact I was under the impression Pest already has the elegant RSpec context syntax. Why do people switch then?? |
@nunomaduro, what would it take to get this on the roadmap? |
I think this is a main feature for a framework like Pest. Is there any plan for this @nunomaduro? |
Just a note to people here. You could create a plugin for doing this instead of |
I've forked the Pest plugin template and started a I haven't done any design or implementation yet, but the repo exists and I'll tinker with it when I have some free time. If anyone else is interested in contributing, PR's are welcome. Or feel free to open Issues or Discussions on that repo to get some discussion going. |
I wrote a plugin awhile ago that accomplishes this https://github.com/ozziexsh/pest-plugin-nest the caveat is that you need to use the plugin's exported you also cannot nest hook functions like |
Amazing! I will definitely check that out. |
@nunomaduro can we reopen this just to close it and pop some champagne! Thank you thank you thank you!!! I'll start planning our migration to Pest now :)) |
Still would love to see this functionality in Pest core without needing a plugin, as time allows. Being able to use functions like |
it's in the 2.9 anouncement, this feature is included in the core Pest |
Curious, what are your thoughts about implementing the standard
describe
blocks?Ala?
https://jestjs.io/docs/en/api#describename-fn
Example
The text was updated successfully, but these errors were encountered: