Mocha: Disable timeouts when running under the debug

Created on 23 May 2013  路  8Comments  路  Source: mochajs/mocha

Sometime's I'll be stepping through Node code in the debugger, which obviously draws out test execution time considerably, but Mocha still times out the test after 2 seconds. I've been getting around the problem by using .timeout(0), but it would be sweet if Mocha could detect that the code was running under the debugger (by checking the global.v8debug flag, at least in node) and disable timeouts in that case.

Most helpful comment

don't know about you guys, but I can debug all my code in less than 2 seconds :)

All 8 comments

+1

hmm yeah I'm down, bit of an edge-case thing but hey

This person also cites timeout-in-debug as an issue:

http://ronderksen.nl/2012/05/03/debugging-mocha-tests-in-webstorm/

this just bit me as well

Worth noting, for anyone digging into this - the final decision was made to use


as the option name vs. --disable-timeouts in the linked commits

don't know about you guys, but I can debug all my code in less than 2 seconds :)

can someone explain here what --no-timeouts does and what it doesn't do? I have:

//package.json

  "scripts": {
    "start": "node ./bin/start.js",
    "test": "mocha test",
    "debug_mocha": "node-debug --no-timeouts _mocha"
  },

it still seems to show errors/warnings with the no-timeouts flag on, but perhaps it doesn't fail the tests before they all are attempted?

@ORESoftware I think you need to put the argument on the other side of the _mocha call

    "debug_mocha": "node-debug  _mocha --no-timeouts"
Was this page helpful?
0 / 5 - 0 ratings