Behat with PhpStorm does not show stack trace for exceptions
Asked Answered
C

2

8

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.

Cubitiere answered 29/9, 2014 at 17:3 Comment(2)
What does it do if you run the behat on the feature file from the command line? Check also for a php.error file in the run directory. PHP silent fails are difficult to track down. I've sometimes had to use something like strace to figure it out (often, a bad nested include).Falls
It shows the exception when run in command line, and when run with --verbose it shows the full stack trace. Thats why I think its something to do with the PhpStormFormatterCubitiere
B
11

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.

Belletrist answered 20/4, 2020 at 16:26 Comment(0)
L
4

Yup, been there, done that… Guys at JetBrains know about this, but no fix version has been set yet. Vote on the issue, this will speed things up.

Landau answered 30/9, 2014 at 23:41 Comment(1)
Ah perfect! I didn't realise that there was a dedicated issue log page like that. Very handy. I have up voted and commented.Cubitiere

© 2022 - 2024 — McMap. All rights reserved.