Debugging

You can debug your Cucumber tests or Chimp with the node debugger.

Debug Chimp

1. Add breakpoints

Use the debugger; statement in your code to create a breakpoint. You can place additional breakpoints later in the debugging session with the node-inspector user interface.

2. Start chimp in debug mode

Start chimp with node in debug mode.

node --debug --debug-brk `which chimp`
# or for node 8.0
node --inspect --inspect-brk `which chimp`

Wait until you see debugger listening on port 5858 in the console.

3. Start node-inspector

Install node-inspector.

npm install node-inspector -g

Start node-inspector.

node-inspector

There will be two different debug sessions available.

Chimp: http://127.0.0.1:8080/?ws=127.0.0.1:8080&port=5858
Cucumber (and your tests): http://127.0.0.1:8080/?ws=127.0.0.1:8080&port=5859

First you need to open the Chimp debug session. If you don't want to debug Chimp itself, just press the resume button in the node-inspector user interface.

Wait until you see debugger listening on port 5859 in the console. Now you can open the Cucumber debug session. After you have set your breakpoints, press the resume button and wait until a breakpoint hits.

Happy debugging!

Debug Cucumber (Your Steps)

1. Add breakpoints

Use the debugger; statement in your code to create a breakpoints. You can place additional breakpoints later in the debugging session with the node-inspector user interface.

2. Tell Chimp to start Cucumber in debug mode

You can use these command line switched to do that:

chimp --debugCucumber
# or
chimp --debugCucumber=<port>

To debug mode and break on start:

chimp --debugBrkCucumber
# or
chimp --debugBrkCucumber=<port>

You can then connect your favorite debugger and enjoy!

Debug Mocha (Your Specs)

1. Add breakpoints

Use the debugger; statement in your code to create a breakpoints. You can place additional breakpoints later in the debugging session with the node-inspector user interface.

2. Tell Chimp to start Mocha in debug mode

You can use these command line switched to do that:

chimp --debugMocha
# or
chimp --debugMocha=<port>

To use debug mode and break on start use:

chimp --debugBrkMocha
# or
chimp --debugBrkMocha=<port>