Search code examples
phpphpstormbehat

Behat with PhpStorm does not show stack trace for exceptions


I've just started using Behat 3.0 with PhpStorm 8.0.

Everything is working fine, except that for exceptions, there is no stack trace shown in PhpStorm. The test just fails with no feedback on where the failure occurred.

If I use Behat in terminal, the stack trace can be seen with the file and line number of the exception.

I have tried running Behat in PhpStorm with --strict and --verbose but still no joy.

It looks like PhpStorm uses its own Behat formatter (PhpStormBehatFormatter) to display the results, so I'm 99% sure the solution will be to modify that (something I think only PhpStorm can do).

Just wanted to check if anyone else had the same issue and if there was a temporary work around?

Note: This is very specific Behat / PhpStorm issue. Unless you know both tools, it's probably best not to answer. Answers such as 'create a custom exception handler' are not going to help.


Solution

  • So in the 5+ years since this question was asked, PHPStorm has implemented what it has needed, but you still need to know the totally cryptic Behat command-line option, and where to put it. Anyway, this is where desperate Google-searching got me, so let me put the answer here.

    Under Run menu, Edit configurations..., select the Behat template, and in the Test Runner options field, put -vv.

    Then your Behat fails will the full error message and a stack trace.