pestphp / pestphp/pest

[Bug]: A dependency with the name `Pest\Mutate\Contracts\MutationTestRunner` cannot be resolved.

Open
#1,327 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
PHP
Stars
11.7k
Forks
538
Avg merge
4d 11h
Merged PRs (30d)
8

Description

What Happened

When I add covers([CLASS HERE]); to my tests/TestCase.php, Pest\Exceptions\ShouldNotHappen is thrown.

Exact output:

   Pest\Exceptions\ShouldNotHappen 

  This should not happen - please create an new issue here: https://github.com/pestphp/pest.

  Issue: A dependency with the name `Pest\Mutate\Contracts\MutationTestRunner` cannot be resolved.
  PHP version: 8.4.1
  Operating system: Linux

  at [internal]:0
      1▕ 

      +4 vendor frames 
  5   tests/TestCase.php:8
      +2 vendor frames 

  8   [internal]:0
      Composer\Autoload\ClassLoader::loadClass()
How to Reproduce

Install a fresh Laravel app, add PestPHP and add covers([\App\Providers\AppServiceProvider::class]); to tests/TestCase.php.

Other classes can be used as well instead of \App\Providers\AppServiceProvider::class.

<?php
/*
 * tests/TestCase.php
 */

namespace Tests;

use App\Providers\AppServiceProvider;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;

covers([AppServiceProvider::class]);

abstract class TestCase extends BaseTestCase {}
Sample Repository

https://github.com/TimeglitchD/pestphp-mutation-bug

Pest Version

3.7.1

PHP Version

8.4.1

Operation System

Linux

Notes

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure using the fresh Laravel app setup and the covers declaration in tests/TestCase.php, or use the linked sample repository. Trace why dependency resolution fails when that declaration is loaded. Done means covers works without throwing Pest\Exceptions\ShouldNotHappen and the relevant tests pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
laravel, php
Domain
testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.