cucumber-js executes all scenarios but it gets stuck in the command propmt

Viewed 987

When I start the command to run cucumber, it executes all of the scenarios and all of them pass. However, when it finishes it doesn't exit the process, but remains stuck until I press Ctrl + C. This is important as I want to use it as a command in Jenkins, and it happens that in Jenkins it wouldn't finish ever given what I have just mentioned.

enter image description here

As you can see, the expected behaviour is the one from my unit test. Just exit the process, without me having to Ctrl + C.

2 Answers

According to the (CLI reference), you should be able to add "--exit" to the end of your command. So for me, it like this:

npx cucumber-js features/ -r steps/ {other cli things} --exit

There's some helpful hints there on finding out why the issue is occurring and fixing it, as well.

This worked for me:

I was using the AfterAll GlobalHook to tear down my in memory database. After changing it to After (after each scenario), my cucumber-js task exit normally

Related