PHPackages                             ozzie/pest-plugin-nest - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. ozzie/pest-plugin-nest

ActiveLibrary[Framework](/categories/framework)

ozzie/pest-plugin-nest
======================

Nest Pest PHP tests for better organization and readability

v1.0.0(3y ago)2028.3kMITPHPPHP ^8.1

Since Aug 4Pushed 2y ago1 watchersCompare

[ Source](https://github.com/ozziexsh/pest-plugin-nest)[ Packagist](https://packagist.org/packages/ozzie/pest-plugin-nest)[ Fund](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=66BYDWAT92N6L)[ GitHub Sponsors](https://github.com/nunomaduro)[ RSS](/packages/ozzie-pest-plugin-nest/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (5)Versions (4)Used By (0)

Warning

**DEPRECATED**: Pest has official support for describe blocks now

Nest - Visually group your Pest tests
=====================================

[](#nest---visually-group-your-pest-tests)

Nest is a plugin for [PestPHP](https://pestphp.com/) to allow visual separation in your test files and test output

Installation
------------

[](#installation)

For pest 2.0 you should make sure you are on ^1.0

```
composer require ozzie/pest-plugin-nest --dev
```

For pest 1.0 you should make sure you are on ^0.1

```
composer require ozzie/pest-plugin-nest "^0.1" --dev
```

Usage
-----

[](#usage)

> **Note**While these functions forward their api to the native Pest `test`/`it` functions, you must use the Nest namespaced functions in order for the reporting to properly display.

```
use function Ozzie\Nest\describe;
use function Ozzie\Nest\it;

describe('sub()', function() {
  it('subtracts the second number from the first')
    ->expect(Calc::sub(10, 5))
    ->toEqual(5);
});

describe('add()', function() {
  it('adds two numbers together')
    ->expect(Calc::add(1, 2))
    ->toEqual(3);
});
```

Produces:

[![basic usage test output](./assets/readme-basic.png)](./assets/readme-basic.png)

You can also nest multiple describe blocks and optionally use the `when()` block as an alternative to `describe()`

```
use function Ozzie\Nest\describe;
use function Ozzie\Nest\when;
use function Ozzie\Nest\it;

describe('abs()', function () {
  when('positive value', function() {
    it('returns the number back', function () {
      expect(Calc::abs(1))->toEqual(1);
    });
  });

  when('negative value', function() {
    it('returns the number back as positive', function () {
      expect(Calc::abs(-1))->toEqual(1);
    });
    it('returns a float number back as positive', function () {
      expect(Calc::abs(-1.5))->toEqual(1.5);
    });
  });
});

describe('sub()', function() {
  it('subtracts the second number from the first')
    ->expect(Calc::sub(10, 5))
    ->toEqual(5);
});
```

Produces:

[![basic usage test output](./assets/readme-advanced.png)](./assets/readme-advanced.png)

You can also call the class directly if you prefer

```
use Ozzie\Nest\Nest;

Nest::describe('sub()', function() {
  Nest::it('subtracts the second number from the first')
    ->expect(Calc::sub(10, 5))
    ->toEqual(5);
});

Nest::describe('add()', function() {
  Nest::it('adds two numbers together')
    ->expect(Calc::add(1, 2))
    ->toEqual(3);
});
```

API
---

[](#api)

### test / it

[](#test--it)

These functions operate exactly the same as the Pest provided ones (as they forward their calls there under the hood). We need to use these functions though so that we can properly modify the test name in the output

```
use function Ozzie\Nest\test;
use function Ozzie\Nest\it;

test('true is true')->expect(true)->toEqual(true);

it('is true')->expect(true)->toEqual(true);

// normal callbacks work as well
it('can do math', function() {
  expect(1 + 1)->toEqual(2);
});
```

### describe / when

[](#describe--when)

These functions are purely for grouping your `test`/`it` calls together

`describe()` will prefix all the nested tests with its description

`when()` will prefix all the nested tests with `when ` + its description

These functions can be nested as many times as you need

```
use function Ozzie\Nest\describe;
use function Ozzie\Nest\when;
use function Ozzie\Nest\it;

describe('abs()', function () {
  when('positive value', function() {
    it('returns the number back', function () {
      expect(Calc::abs(1))->toEqual(1);
    });
  });

  when('negative value', function() {
    it('returns the number back as positive', function () {
      expect(Calc::abs(-1))->toEqual(1);
    });
    it('returns a float number back as positive', function () {
      expect(Calc::abs(-1.5))->toEqual(1.5);
    });
  });
});
```

Limitations
-----------

[](#limitations)

Unfortunately due to how the setup/teardown functions work you cannot nest them within `describe`/`when` blocks and have them only apply to that block. You still must only have one e.g. `beforeEach` call in the entire file which applies to every test.

You must also explicitly use the `Ozze\Nest\test` and `Ozze\Nest\it` functions when using `describe` or `when` so that we can properly update the test output.

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity34

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 91.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~250 days

Total

2

Last Release

1126d ago

Major Versions

v0.1.0 → v1.0.02023-04-12

PHP version history (2 changes)v0.1.0PHP ^7.4 || ^8.0

v1.0.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/be670fed3185aa9290a43acbcc227b06817f626bb98e72ef0efb6c4c0ce65b40?d=identicon)[ozzie](/maintainers/ozzie)

---

Top Contributors

[![ozziexsh](https://avatars.githubusercontent.com/u/2093630?v=4)](https://github.com/ozziexsh "ozziexsh (11 commits)")[![deligoez](https://avatars.githubusercontent.com/u/3030815?v=4)](https://github.com/deligoez "deligoez (1 commits)")

---

Tags

phpplugintestingunitframeworktestpestnestdescribe

###  Code Quality

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/ozzie-pest-plugin-nest/health.svg)

```
[![Health](https://phpackages.com/badges/ozzie-pest-plugin-nest/health.svg)](https://phpackages.com/packages/ozzie-pest-plugin-nest)
```

###  Alternatives

[defstudio/pest-plugin-laravel-expectations

A plugin to add laravel tailored expectations to Pest

98548.9k4](/packages/defstudio-pest-plugin-laravel-expectations)[pestphp/pest-plugin-stressless

Stressless plugin for Pest

67792.6k16](/packages/pestphp-pest-plugin-stressless)[jonpurvis/lawman

A PestPHP Plugin to help with architecture testing SaloonPHP integrations

4027.7k8](/packages/jonpurvis-lawman)[spatie/pest-plugin-route-testing

Make sure all routes in your Laravel app are ok

13753.8k](/packages/spatie-pest-plugin-route-testing)[milroyfraser/pest-plugin-gwt

Given When Then(GWT) Plugin for Pest

10332.1k1](/packages/milroyfraser-pest-plugin-gwt)[alleyinteractive/pest-plugin-wordpress

WordPress Pest Integration

263.7k1](/packages/alleyinteractive-pest-plugin-wordpress)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
