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]: A dependency with the name Pest\Mutate\Contracts\MutationTestRunner cannot be resolved. #1327

Open
TimeglitchD opened this issue Dec 13, 2024 · 1 comment
Labels

Comments

@TimeglitchD
Copy link

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

@gehrisandro
Copy link
Contributor

Hi @TimeglitchD

Can I ask you why you want to do this in the first place?
The TestCase class should not contain tests at all, so I don't understand why you want to use covers() in there.

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