-
-
Notifications
You must be signed in to change notification settings - Fork 530
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
Non-Statamic tests run slow after Statamic installation #10753
Comments
Are you able to share an example of a test that's running slow? What does your |
Hi @duncanmcclean, This is what my TestCase looks like: <?php
declare(strict_types = 1);
namespace Tests;
use Nuwave\Lighthouse\Testing\MakesGraphQLRequests;
use Nuwave\Lighthouse\Testing\RefreshesSchemaCache;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
abstract class TestCase extends BaseTestCase
{
use MakesGraphQLRequests;
use RefreshesSchemaCache;
/**
* Setup the test environment.
*
* @return void
*/
protected function setUp(): void
{
parent::setUp();
$this->withoutVite();
}
} I use Pest btw: <?php
declare(strict_types = 1);
use Illuminate\Foundation\Testing\RefreshDatabase;
uses(Tests\TestCase::class, RefreshDatabase::class)->in('Feature'); A test that runs slow for example is the following: <?php
declare(strict_types = 1);
test('that the dd and dump functions are not used in the codebase')
->expect(['dd', 'dump'])
->not
->toBeUsed(); This test takes ~6.5 seconds to complete with Statamic installed. |
Thanks! |
What about tests that aren't 5 seconds long to begin with? That's already slow. |
So, I trimmed some stuff down to have the bare minimum in feature tests: // tests/TestCase.php
<?php
declare(strict_types = 1);
namespace Tests;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
abstract class TestCase extends BaseTestCase
{
/**
* Setup the test environment.
*
* @return void
*/
protected function setUp(): void
{
parent::setUp();
$this->withoutVite();
}
} // tests/Pest.php
<?php
declare(strict_types = 1);
uses(Tests\TestCase::class)->in('Feature'); I wrote the most basic test I could think of and ran it both with and without Statamic: // tests/Feature/Test.php
<?php
declare(strict_types = 1);
test('true', function () {
expect(true)->toBe(true);
}); This test takes 0.42 sec on my machine without Statamic installed (this time I removed both Statamic packages from Composer). With Statamic, this test takes 1.91 sec. Do you have any idea what makes it run slower? |
Bug description
After installing Statamic in an existing Laravel project, all non-Statamic tests take more than a second per test longer.
I've been playing with some config settings, such as stache, but nothing seems to improve it.
How to reproduce
Logs
No response
Environment
Installation
Existing Laravel app
Additional details
No response
The text was updated successfully, but these errors were encountered: