pest
pest copied to clipboard
[Bug]: Cannot use Datasets in subfolders
What Happened
As part of my transition from Laravel 9 to Laravel 10, I am also upgrading from Pest 1.x to 2.x. During this process, I encountered an issue concerning the resolution of datasets located within subfolders.
I'm not the only one with this problem, please refer to [laracast question] for more details. (https://laracasts.com/discuss/channels/testing/pest-global-datasets-not-allowed-in-modular-project)
How to Reproduce
Construct a dataset and place it within a subfolder inside the Datasets directory. Afterwards, execute the command ./vendor/bin/pest MyTest.php
, which unfortunately results in a failure.
However, this situation is peculiar as executing the test through PHPStorm does not present any issues, indicating that the problem only occurs when running the test from the terminal...
Sample Repository
No response
Pest Version
2.34.4
PHP Version
8.2.16
Operation System
macOS
Notes
No response
Same issue here (it's my post)
hi, would you mind to share here your test directory structure?
Sure, this is my general structure:
The core issue lies with the handling of Datasets; specifically, the inability to organize them into a Folder/Subfolder structure, as Pest fails to recognize the dataset in such a configuration. This is particularly rare because this limitation was not present in Pest 1.0 afaik...
Something defined within ExampleDataset.php
and ExampleDataset2.php
won't be loaded.
Hope this clarifies the issue
Hi !
Thanks for your work.
Any update on this issue ?
Hi !
Thanks for your work.
Any update on this issue ?
Working on this one, there are some caveats to fix, will be ready in a couple of days
Awesome, thank you very much for your work !
I've found a weird behaviour when running parallel tests, maybe someone's willing to have a deeper look here #1134
I have decided to make my own abstraction for my global datasets, it's ugly but it's working.