diff --git a/grouping-tests.md b/grouping-tests.md index a5fd5f3..4599e4a 100644 --- a/grouping-tests.md +++ b/grouping-tests.md @@ -37,6 +37,16 @@ it('has home', function () { })->group('feature', 'browser'); ``` +If you want to assign a group to a describe block, you can do so by chaining the `group()` method onto the describe function. + +```php +describe('home', function () { + test('main page', function () + // + }); +})->group('feature'); +``` + In some cases, you may want to assign a whole file to a group. To do so, you may use the `pest()->group()` method within the file. ```php diff --git a/hooks.md b/hooks.md index dc183e1..b5246d3 100644 --- a/hooks.md +++ b/hooks.md @@ -22,6 +22,14 @@ describe('something', function () { }); // + + describe('something else', function () { + beforeEach(function () { + // + }); + + // + }); }); test('something', function () { diff --git a/pest3-now-available.md b/pest3-now-available.md index 9917f7b..6edc68a 100644 --- a/pest3-now-available.md +++ b/pest3-now-available.md @@ -18,6 +18,7 @@ Below, we'll cover all the juicy details about this release. And as usual, you c - **[Mutation Testing](#mutation-testing)**: An innovative new technique that introduces small changes to your code to see if your tests catch them. - **[Arch Presets](#arch-presets)**: A set of predefined rules that you can use to test your application's architecture. - **[Team Management](#team-management)**: A new feature that allows you to manage tasks and todos with your team directly from the console. +- **[Nested Describes](#nested-describes)**: You can now nest describe blocks within other describe blocks. - **[New Configuration API](#new-configuration-api)**: A new configuration API that is more intuitive and easier to use. - **[More Architectural Testing Improvements](#more-architectural-testing-improvements)**: `toUseStrictEquality`, `toHaveMethodsDocumented`, `->not->toHaveProtectedMethods`, and more. - **[And Much More...](#miscellaneous-improvements)**: Constants in Type Coverage, static analysis improvements, and more. @@ -235,6 +236,29 @@ Finally, you can view todos separately from the rest of your test suite by inclu There is so much more to explore with Team Management, you can learn more about it in our [Team Management](#team-management) section. + +## Nested Describes + +In Pest 3, you can now nest describe blocks within other describe blocks. This allows you to group tests more effectively and keep your test suite organized. + +```php +describe('home', function () { + beforeEach(function () { + // + }); + + it('can be visited', function () { + // + }); + + describe('footer', function () { + it('contains a link to the contact page', function () { + // + }); + }); +}); +``` + ## New Configuration API