Skip to content

Commit

Permalink
Adds notes on describes
Browse files Browse the repository at this point in the history
  • Loading branch information
nunomaduro committed Oct 22, 2024
1 parent dc9e1bf commit bfffb4d
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
10 changes: 10 additions & 0 deletions grouping-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions hooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ describe('something', function () {
});

//

describe('something else', function () {
beforeEach(function () {
//
});

//
});
});

test('something', function () {
Expand Down
24 changes: 24 additions & 0 deletions pest3-now-available.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.

<a name="nested-describes"></a>
## 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 () {
//
});
});
});
```

<a name="new-configuration-api"></a>
## New Configuration API

Expand Down

0 comments on commit bfffb4d

Please sign in to comment.