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.07k stars 315 forks source link

Signal 11 error #824

Closed Tickthokk closed 1 year ago

Tickthokk commented 1 year ago

Version Data:

Pest: 2.6.1, PHPUnit: 10.1.3 Laravel 10, Sail, PHP 8.2

Steps to repeat:

Error:

   Symfony\Component\Process\Exception\ProcessSignaledException 

  The process has been signaled with signal "11".

  at vendor/symfony/process/Process.php:434
    430▕             usleep(1000);
    431▕         }
    432▕ 
    433▕         if ($this->processInformation['signaled'] && $this->processInformation['termsig'] !== $this->latestSignal) {
  ➜ 434▕             throw new ProcessSignaledException($this);
    435▕         }
    436▕ 
    437▕         return $this->exitcode;
    438▕     }

      +14 vendor frames 

  15  artisan:35
      Illuminate\Foundation\Console\Kernel::handle()

I've tracked it down to the existence of this file:

vendor/pestphp/pest/.temp/test-results

Removing this file allows the tests to work again, which leads me to believe this is a Pest issue. I can't really share my setup, but this is 100% repeatable for me and I'd be happy to attempt any logging.


Thank you for Pest!

nunomaduro commented 1 year ago

Sorry, no idea what's happening here.

jhoanborges commented 4 days ago

+1 i realized that it happends when i use RefreshDatabase

<?php

namespace Tests\Feature;

use Tests\TestCase;
use App\Models\User;
use Illuminate\Http\Response;
use Database\Seeders\RolesSeeder;
use function Pest\Laravel\getJson;
use Spatie\Permission\Models\Role;
use function Pest\Laravel\actingAs;
use Illuminate\Foundation\Testing\RefreshDatabase;

uses(RefreshDatabase::class);

it('transforms a user with Employee role into an array', function () {

    $this->seed(RolesSeeder::class);

    // Define the roles you expect to be created
    $expectedRoles = User::ROLES;

    // Assert that each expected role exists in the database
    foreach ($expectedRoles as $roleName) {
        $role = Role::where('name', $roleName)->first();
        expect($role)->not->toBeNull();
        expect($role->name)->toBe($roleName);
    }

    // Arrange: Create a User with Employee role
    $user = User::factory()->create();
    $user->assignRole('employee');
     // Act
     actingAs($user); // Authenticate as the hirer's user
    // Act: Retrieve the EmployeeResource JSON

    $response = getJson(route('employee.show', ['employee' => $user->id]));

    // Assert: Check the JSON structure and values
    $response
        ->assertStatus(Response::HTTP_OK)
        ->assertJson([
            'id' => $user->id,
            'user_id' => $user->id,
            'email' => $user->email,
            'firstname' => $user->name,
            'lastname' => $user->lastname,
            'area_code' => $user->area_code,
            'phone' => $user->phone,
            // Add more assertions for other attributes as needed
        ]);
});
{
    "name": "laravel/laravel",
    "type": "project",
    "description": "The skeleton application for the Laravel framework.",
    "keywords": [
        "laravel",
        "framework"
    ],
    "license": "MIT",
    "require": {
        "php": "^8.2",
        "algolia/algoliasearch-client-php": "^3.4",
        "algolia/scout-extended": "^3.1",
        "althinect/filament-spatie-roles-permissions": "^2.2",
        "artesaos/seotools": "^1.3",
        "aws/aws-sdk-php": "^3.305",
        "calebporzio/sushi": "^2.5",
        "caseyamcl/guzzle_retry_middleware": "^2.9",
        "dedoc/scramble": "^0.9.0",
        "doctrine/dbal": "^4.0",
        "eightynine/filament-excel-import": "^3.0",
        "fakerphp/faker": "^1.23",
        "filament/filament": "^3.2",
        "filament/spatie-laravel-media-library-plugin": "^3.2",
        "filipfonal/filament-log-manager": "^2.0",
        "geo-sot/filament-env-editor": "^0.0.4",
        "kainiklas/filament-scout": "^0.4.0",
        "knuckleswtf/scribe": "^4.36",
        "larastan/larastan": "^2.0",
        "laravel/framework": "^11.0",
        "laravel/horizon": "^5.24",
        "laravel/pint": "^1.15",
        "laravel/pulse": "^1.0@beta",
        "laravel/sanctum": "^4.0",
        "laravel/scout": "^10.9",
        "laravel/telescope": "^5.0",
        "laravel/tinker": "^2.9",
        "laravel/ui": "^4.5",
        "league/flysystem-aws-s3-v3": "^3.27",
        "nextapps/laravel-verification-code": "^2.1",
        "nunomaduro/phpinsights": "^2.11",
        "rappasoft/laravel-authentication-log": "^4.0",
        "rawilk/laravel-settings": "^3.3",
        "sentry/sentry-laravel": "^4.4",
        "shuvroroy/filament-spatie-laravel-health": "^2.0",
        "spatie/laravel-activitylog": "^4.8",
        "spatie/laravel-health": "^1.28",
        "spatie/laravel-medialibrary": "^11.4",
        "spatie/laravel-permission": "^6.4",
        "spatie/laravel-sluggable": "^3.6",
        "spatie/security-advisories-health-check": "*",
        "tapp/filament-authentication-log": "^3.1",
        "torann/geoip": "^3.0"
    },
    "require-dev": {
        "laravel/sail": "^1.26",
        "mockery/mockery": "^1.6",
        "nunomaduro/collision": "^8.0",
        "pestphp/pest": "^2.34",
        "pestphp/pest-plugin-faker": "^2.0",
        "pestphp/pest-plugin-laravel": "^2.4",
        "pestphp/pest-plugin-livewire": "^2.1",
        "pestphp/pest-plugin-watch": "^2.1",
        "spatie/laravel-ignition": "^2.4"
    },
    "autoload": {
        "psr-4": {
            "App\\": "app/",
            "Database\\Factories\\": "database/factories/",
            "Database\\Seeders\\": "database/seeders/"
        },
        "files": [
            "app/Helpers/Helper.php"
        ]
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        }
    },
    "scripts": {
        "post-autoload-dump": [
            "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover --ansi",
            "@php artisan filament:upgrade"
        ],
        "post-update-cmd": [
            "@php artisan vendor:publish --tag=laravel-assets --ansi --force"
        ],
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "@php artisan key:generate --ansi",
            "@php -r \"file_exists('database/database.sqlite') || touch('database/database.sqlite');\"",
            "@php artisan migrate --graceful --ansi"
        ],
        "phpstan": [
            "./vendor/bin/phpstan analyse"
        ],
        "pest": [
            "./vendor/bin/pest"
        ],
        "pint": [
            "./vendor/bin/pint"
        ],
        "phpinsights": [
            "./vendor/bin/phpinsights"
        ]
    },
    "extra": {
        "laravel": {
            "dont-discover": []
        }
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": "dist",
        "sort-packages": true,
        "allow-plugins": {
            "pestphp/pest-plugin": true,
            "php-http/discovery": true,
            "dealerdirect/phpcodesniffer-composer-installer": true
        }
    },
    "minimum-stability": "beta",
    "prefer-stable": true
}