jhedstrom / DrupalDriver

A collection of drivers for controlling Drupal.
GNU General Public License v2.0
64 stars 97 forks source link

Incompatible with gherkin 4.5.1? #138

Closed Sut3kh closed 5 years ago

Sut3kh commented 7 years ago

When upgrading to gherkin 4.5.1 if I run tests via paths (i.e. behat features/my.feature) then i get errors like:

[Behat\Testwork\Tester\Exception\WrongPathsException]
No specifications found at path(s) features/my.feature. This might be because of incorrect paths configuration in your suites.

I'm not sure what has changed in gherkin but when it tries to validate the path the pwd is DRUPAL_ROOT and it fails (it is comparing features/my.feature to web/features). If i comment out the following line in Drupal/Driver/Cores/Drupal8.php:30 'chdir(DRUPAL_ROOT);' then it works (but on an empty cache you get all sorts of weird issues when not in DRUPAL_ROOT).

The problem goes away if I force a downgrade via the following versions in composer:

"behat/behat": ">=3.1 <3.4",
"behat/gherkin": ">=4.4 <4.5",

Directory structure (using drupal-composer):

features/...
web/...
vendor/...
behat.yml
...

Major component versions when failing:

Major component versions when working:

danepowell commented 5 years ago

I think the problem you are facing is not due to Gherkin, but Behat (behat/behat). Specifically this change that appeared in 3.4 requires that you run Behat in the directory that you want to be the base path, rather than passing the path as an argument: https://github.com/Behat/Behat/commit/08802b7f2d736b88df339e5411a1c722e92adbe3

Seems like a bug to me, but I haven't had time to dig in.

Edit: this might be the actual bug report: https://github.com/Behat/Behat/issues/1076

And although the report is against behat, you might be right that the fix lies with Gherkin: https://github.com/Behat/Gherkin/pull/129

danepowell commented 5 years ago

@jhedstrom this can probably be closed in favor of the upstream bug I linked above

pfrenssen commented 5 years ago

@danepowell Thanks for interlinking the issues, I was not aware that this was also reported here.

For people landing here, there are instructions on both of the upstream tickets explaining how to patch your installation.

A fix for this has been posted around the time this issue was created but unfortunately it is still not committed upstream. Feel free to vote for the upstream issue to help get maintainer attention, or even better to review + approve the PR.