Giving the following structure with nested blocks:
beforeEach(fn () => dump('root block called'));
describe('#block1', function () {
beforeEach(fn() => dump('#block1'));
describe('#block1->subBlock#1', function () {
beforeEach(fn() => dump('#block1->subBlock#1'));
it('testing', function () {});
});
});
I would expect the beforeEach from #block1 to be executed
How to Reproduce
Create nested blocks with describe, each one having a beforeEach
Add any test only on the last child of describe
Example
describe('#block1', function () {
beforeEach(fn() => dump('#block1'));
describe('#block1->subBlock#1', function () {
beforeEach(fn() => dump('#block1->subBlock#1'));
it('testing', function () {});
});
});
Sample Repository
No response
Pest Version
2.34.7
PHP Version
8.2.0
Operation System
macOS
Notes
The root beforeEach is executed even when there is no test in same level, you can reproduce it by running the first code provided on "What Happened" section, you will notice that root block called is printed on terminal
What Happened
Giving the following structure with nested blocks:
I would expect the beforeEach from
#block1
to be executedHow to Reproduce
Example
Sample Repository
No response
Pest Version
2.34.7
PHP Version
8.2.0
Operation System
macOS
Notes
The root
beforeEach
is executed even when there is no test in same level, you can reproduce it by running the first code provided on "What Happened" section, you will notice thatroot block called
is printed on terminal