Skip to content
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

[Bug]: beforeAll and afterAll global hooks are not working #1343

Open
HassanDomeDenea opened this issue Jan 24, 2025 · 1 comment
Open

[Bug]: beforeAll and afterAll global hooks are not working #1343

HassanDomeDenea opened this issue Jan 24, 2025 · 1 comment
Labels

Comments

@HassanDomeDenea
Copy link

What Happened

When I add global hooks beforeAll or afterAll inside tests/Pest.php, they do not work, while beforeEach and afterEach are being called properly.

How to Reproduce

composer global require laravel/installer

laravel new example-app

choosing pest for testing.

in tests/Pest.php, I added:

// tests/Pest.php

pest()
    ->beforeAll(function () {
        echo "Before All\n";
    })
    ->beforeEach(function () {
        echo "Before Each\n";
    })
    ->in('Unit');

running:
php artisan test

I see BeforeEach in output, but I do not see BeforeAll.

Sample Repository

No response

Pest Version

3.7.4

PHP Version

8.4.2

Operation System

Windows

Notes

No response

@laylatichy
Copy link

@HassanDomeDenea I have pr with fix for it waiting for 2 months or so

#1322

these hooks don't work since 3.0.4

downgrade to 3.0.3 for time being

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants