Fix specifications locator to find feature files - #1239
Conversation
|
Patch for your composers: |
| * @param FeatureNode[] $features | ||
| */ | ||
| public function __construct(Suite $suite, Gherkin $gherkin, array $paths, array $filters = array()) | ||
| public function __construct(Suite $suite, Gherkin $gherkin, array $paths, array $filters = array(), $features = array()) |
| $features = array(); | ||
| foreach ($this->findFeatureFiles($locator) as $featureFile) { | ||
| // Collect all the feature specification files. | ||
| $features = array_merge($features, $this->gherkin->load($featureFile, $filters)); |
There was a problem hiding this comment.
i imagine this to be quite slow for big projects. wondering if we can improve it somehow.
There was a problem hiding this comment.
Not sure. In my case the $locator is an exact feature file path. In this case foreach will loop only 1 time.
In addiition I guess it will be as "slow" as the next foreach block in this file below.
|
Tests are failing. This patch seems to be duplicating features in some cases. |
|
I don't think this is the right approach. It should be possible to fix this bug without changing the existing interfaces. Before 08802b7 it all worked fine, so I expect the issue is related to normalising the path, rather than changing the logic of finding features. |
Thank you for the feedback. I simply did not find another way to set the
Good to know. I've just installed behat a few days ago, I am not very familiar with the previous versions. That was a quick workaround from my side to get the tests working. Feel free to close this PR if you preffer a different approach. |
|
Behat/Gherkin#129 is the fix for this, already since 2017 |

This is my fix for the #1076 issue.
Looks like feature files were not discovered properly. I have extended the locator and iterator for this.
Before:
After:
P.S. Tests\Behat\Gherkin\Loader\GherkinFileLoaderTest shows no errors.