You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The gist of it is that we have a module per functionality, and any amount of nesting inside a module.
As the project grows, the amount of module-specific test configuration we have to put in Pest.php is growing:
// Global configurationuses(LazilyRefreshDatabase::class, Tests\TestCase::class)
->beforeEach(function () {
\Saloon\Config::preventStrayRequests();
\Saloon\MockConfig::setFixturePath('tests/Fixtures');
})
->afterEach(fn () => MockClient::destroyGlobal())
->in('../src');
// Module-specific configurationsuses()
->beforeEach(function () {
Config::set('bamboo-importer.jwt_key', 'foo');
Config::set('bamboo-importer.secret', 'foo-bar-baz-foo-bar-baz-foo-bar-baz-foo-bar-baz');
Config::set('bamboo-importer.site_id', '1234');
})
->in('../src/Modules/BambooImporter');
// other `uses` for each module
Requested solution
As we would like to keep module-specific code in each module, including testing code, it would be great to natively support Pest.php file at the directory level.
I'm not sure how doable it would be, but in our case, since we have a service provider per module, we could do something like that:
While this is fine, an improved built-in support for non-Laravel-conventional architectures would be appreciated!
The feature would be something as simple as Pest detecting all Pest.php files and running them. In the example above, the src/Modules/BambooImporter/Pest.php file would still have the scoping responsibility:
Problem
We are using a modules-based architecture and are colocating test files next to their corresponding classes.
It looks like this:
The gist of it is that we have a module per functionality, and any amount of nesting inside a module.
As the project grows, the amount of module-specific test configuration we have to put in
Pest.php
is growing:Requested solution
As we would like to keep module-specific code in each module, including testing code, it would be great to natively support
Pest.php
file at the directory level.I'm not sure how doable it would be, but in our case, since we have a service provider per module, we could do something like that:
While this is fine, an improved built-in support for non-Laravel-conventional architectures would be appreciated!
The feature would be something as simple as Pest detecting all
Pest.php
files and running them. In the example above, thesrc/Modules/BambooImporter/Pest.php
file would still have the scoping responsibility:The text was updated successfully, but these errors were encountered: