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

Output is truncated, showing exception from this package instead of problem in test. #313

Open
mikebronner opened this issue Oct 11, 2024 · 1 comment

Comments

@mikebronner
Copy link

❯ pa test --parallel

  .......⨯......................................................⨯.......................
  .........................................................
  ──────────────────────────────────────────────────────────────────────────────────────  
   FAILED  Tests\Legacy\Http\Controllers\Api\Legacy\LeadSettings\LeadProviders</>…  Error   
  Unknown named parameter $daily_cap_error_msg

   TypeError 

  str_replace(): Argument #3 ($subject) must be of type array|string, null given

  at vendor/nunomaduro/collision/src/Writer.php:179
    175▕ 
    176▕                     foreach ($this->ignore as $ignore) {
    177▕                         if (is_string($ignore)) {
    178▕                             // Ensure paths are linux-style (like the ones on $this->ignore)
  ➜ 179▕                             $sanitizedPath = (string) str_replace('\\', '/', $frame->getFile());
    180▕                             if (preg_match($ignore, $sanitizedPath)) {
    181▕                                 return false;
    182▕                             }
    183▕                         }

      +1 vendor frames 

  2   [internal]:0
      NunoMaduro\Collision\Writer::NunoMaduro\Collision\{closure}()
      +5 vendor frames 

  8   [internal]:0
      NunoMaduro\Collision\Adapters\Phpunit\Style::NunoMaduro\Collision\Adapters\Phpunit\{closure}()

We are using this package along with PestPHP and are having the following issues as can be seen in the above error:

  1. The error is confusing, as it is showing the point of failure in the package. In dumping the $frame object, the file property is an empty string. Is this an error with the package, shouldn't it be able to process that if an empty string is a valid value for the file property in the frame object.
  2. The output is truncated to one line. This makes it very difficult to use effectively for debugging. Fully printed file paths with line numbers allow option-clicking to go directly to the test in question. Aside from that, when the output is truncated, we have no way to expand it to show actionable information.
@ammar-madni
Copy link

Hey @mikebronner, did you manage to figure this one out?

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

No branches or pull requests

2 participants