After upgrade from phpunit to pest testing is not discovering my custom tests

203 Views Asked by At

I am upgrading my existing Laravel 10 app to use pest2 and the installation went well. Had a few issues as not used tests for a while. My issue however is I have a custome set of tests in a folder called Eclipse but out of the 50 or so tests only one of them is run. I had to add a pest.php to my root folder which looks like this

<?php

use Illuminate\Support\Str;

return [
    'default' => 'feature',

    'watch' => [
        'directories' => [
            'app',
            'tests',
        ],
    ],

    'phpunit' => [
        'options' => [
            '--colors' => true,
        ],
    ],

    'paths' => [
        'test' => 'tests',
        'file' => 'tests/Pest.php',
        'hooks' => 'tests/PestHooks.php',
    ],

    'features' => [
        'feature' => [
            'suite' => 'Feature',
            'path' => 'tests/Feature',
        ],
        'eclipse' => [
            'suite' => 'Eclipse',
            'path' => 'tests/Eclipse',
        ],
        // Add more suites if needed.
    ],
];

The single test that is run in the EclipseFolder is a skipped test as it happens but even trying to run the tests individually (./vendor/bin/pest tests/Eclipse/Livewire/AddCommentTest.php) i get a test not found info error and the test is not run. This is the test I tried to run

<?php

use App\Http\Livewire\Modals\JobCommentTable;
use App\Models\JobComment;
use App\Models\User;
use Database\Seeders\LegacyFrequencyStatesSeeder;
use Database\Seeders\TestSeederBase;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Livewire\Livewire;

uses(RefreshDatabase::class, TestSeederBase::class);

test('add comment using livewire', function () {
    $this->seed( TestSeederBase::class );
    $this->seed( LegacyFrequencyStatesSeeder::class );

    Livewire::actingAs(User::find(1))
        ->test(JobCommentTable::class, [
            'comment' => '',
            'job_number' => 1
        ])
        ->set('comment', 'we all live in a yellow submarine')
        ->set('job_number', 1)
        ->call('create');

    $jc = JobComment::find(1);
    expect($jc->user_id)->toBe(1);
    expect($jc->comment)->toBe('we all live in a yellow submarine');
});

Any ideas what I may of missed and why this test isn't being run?

0

There are 0 best solutions below