Skip to content

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

@TobiasNagel01

Description

@TobiasNagel01

What Happened

In my Bitbucket Pipeline, I can't run my tests:

I am just running php artisan test without --mutate, but all my files have the covers(...) method to ensure that I can run the mutate tests.

Locally on my sail enviroment, both with and without --mutate works flawlessly.

The Pipeline Image running has PCOV installed and configured.

php artisan test
Pest\Exceptions\ShouldNotHappen
This should not happen - please create an new issue here: https://github.com/pestphp/pest/issues
Issue: A dependency with the name Pest\Mutate\Contracts\MutationTestRunner cannot be resolved.
PHP version: 8.4.14
Operating system: Linux
at vendor/pestphp/pest/src/Exceptions/ShouldNotHappen.php:37
33▕ * Creates a new instance of should not happen without a specific exception.
34▕ */
35▕ public static function fromMessage(string $message): ShouldNotHappen
36▕ {
➜ 37▕ return new ShouldNotHappen(new Exception($message));
38▕ }
39▕ }
40▕
+3 vendor frames
4 [tests/Unit/Helpers/DatabaseHelperTest.php:6]

How to Reproduce

Samples from my Bitbucket Pipeline Config:

steps:
- step: &installing-vendor
name: Installing Dependencies
caches:
- vendor
script:
- php /usr/local/bin/composer install --no-interaction --no-suggest
artifacts:
- vendor/**
- step: &testing-pest
name: Run tests (Pest)
script:
- cp .env.pipeline .env
- php artisan key:generate
- php artisan test

pipelines:
branches:
master:
- step: *installing-vendor
- step: *testing-pest

Dockerfile of my Pipeline Image:

FROM php:8.4-fpm

#Update
RUN apt update

RUN apt install -y git-all

Dependencies

RUN apt install -y libfreetype6-dev libjpeg62-turbo-dev libpng-dev
RUN apt install -y libzip-dev
RUN apt install -y curl
RUN apt install -y git
RUN apt install -y zip
RUN apt install -y unzip
RUN apt install -y libzip-dev
RUN apt install -y libicu-dev
RUN apt install -y libxslt1-dev
RUN apt install -y jq
RUN apt install -y libmagickwand-dev

RUN apt install -y default-mysql-client

Configure php extensions

RUN pecl install imagick &&
docker-php-ext-enable imagick
RUN docker-php-ext-configure gd --with-freetype --with-jpeg
RUN docker-php-ext-configure intl
RUN docker-php-ext-install -j$(nproc) pdo_mysql gd exif ctype bcmath zip intl xsl pcntl

#PCOV
RUN pecl install pcov
RUN docker-php-ext-enable pcov

Composer

RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

#Update
RUN apt update
RUN apt autoremove
RUN apt autoclean

Setup working directory

WORKDIR /var/www

Sample Repository

No response

Pest Version

4.1.3

PHP Version

8.4.14

Operation System

Linux

Notes

Adding ls -la vendor/pestphp/pest-plugin-mutate/src/Contracts to my pipeline returned:

ls -la vendor/pestphp/pest-plugin-mutate/src/Contracts
total 36
drwxr-xr-x 2 root root 4096 Nov 18 20:36 .
drwxr-xr-x 15 root root 4096 Nov 18 20:36 ..
-rw-r--r-- 1 root root 1503 Nov 18 20:36 Configuration.php
-rw-r--r-- 1 root root 86 Nov 18 20:36 Event.php
-rw-r--r-- 1 root root 451 Nov 18 20:36 MutationTestRunner.php
-rw-r--r-- 1 root root 419 Nov 18 20:36 Mutator.php
-rw-r--r-- 1 root root 247 Nov 18 20:36 MutatorSet.php
-rw-r--r-- 1 root root 1095 Nov 18 20:36 Printer.php
-rw-r--r-- 1 root root 91 Nov 18 20:36 Subscriber.php

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions