pestphp / pest

Pest is an elegant PHP testing Framework with a focus on simplicity, meticulously designed to bring back the joy of testing in PHP.
https://pestphp.com
MIT License
9.48k stars 343 forks source link

[Bug]: stat(): stat failed for vendor/pestphp/pest/src/Plugins/../../.temp/only.lock #1079

Closed eleftrik closed 8 months ago

eleftrik commented 8 months ago

What Happened

Laravel Zero, I got this error when running my test suite (or even some single test file):

  Tests:    89 passed (249 assertions)
  Duration: 3.94s
  Parallel: 4 processes

   Pest\Exceptions\FatalException

  stat(): stat failed for /Users/erik/Sviluppo/www/encodia/edit-cli/vendor/pestphp/pest/src/Plugins/../../.temp/only.lock

  at vendor/dg/bypass-finals/src/NativeWrapper.php:206
    202▕    private function native(string $func)
    203▕    {
    204▕        stream_wrapper_restore(self::PROTOCOL);
    205▕        try {
  ➜ 206▕            return $func(...array_slice(func_get_args(), 1));
    207▕        } finally {
    208▕            stream_wrapper_unregister(self::PROTOCOL);
    209▕            stream_wrapper_register(self::PROTOCOL, self::$outerWrapper);
    210▕        }

Script XDEBUG_MODE=off ./vendor/bin/pest --parallel --bail --exclude-group=API,S3 --colors=always handling the test event returned with error code 1

I'm requiring nunomaduro/mock-final-classes which, as I can see, it requires dg/bypass-finals (where the error is happening):

❯ composer why dg/bypass-finals
nunomaduro/mock-final-classes v1.2.0 requires dg/bypass-finals (^1.1)

Any hints?

Thank you so much.

How to Reproduce

Run two or more tests (running a single test doesn't seem to produce this error)

Sample Repository

No response

Pest Version

2.33.0

PHP Version

8.2.15

Operation System

macOS

Notes

No response

eleftrik commented 8 months ago

I can confirm that if I downgrade Pest to version 2.32.0, this error disappears.

eleftrik commented 8 months ago

The error also disappears if I remove nunomaduro/mock-final-classes and I remove final from tested classes.

nunomaduro commented 8 months ago

Fixed on Pest v2.33.2.

eleftrik commented 8 months ago

Thank you very much, @nunomaduro!