Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable timeouts when running under the debug #865

Closed
kevindente opened this issue May 23, 2013 · 10 comments
Closed

Disable timeouts when running under the debug #865

kevindente opened this issue May 23, 2013 · 10 comments

Comments

@kevindente
Copy link

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.

@fakewaffle
Copy link

+1

@tj
Copy link
Contributor

tj commented Aug 9, 2013

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

@markstos
Copy link

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

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

@jsdevel
Copy link
Contributor

jsdevel commented Jul 8, 2014

this just bit me as well

jbnicolai pushed a commit that referenced this issue Jul 13, 2014
…tion-is-set

closes #865: Disable timeouts when running under the debug
@netpoetica
Copy link

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

--no-timeouts

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

@ORESoftware
Copy link

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

@ORESoftware
Copy link

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?

@zanemcca
Copy link

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

    "debug_mocha": "node-debug  _mocha --no-timeouts"

@rulatir
Copy link

rulatir commented Jan 29, 2021

These solutions are unsatisfactory. We absolutely positively do need an option to automatically disable timeouts if mocha is being run under a debugger.

@netpoetica
Copy link

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

This is cute if you're thinking about run time and optimization - of course your functions should run quickly. However, if you are debugging, and for example, you are traversing some giant JSON and running find/filter functions on the data sets to poke around in things, then you may timeout. Now, of course, if it is like a response JSON, you can just copy paste into a JSON editor. But, if you are doing something where you are looking at 1 object, deeply, and based on that information, moving into another object somewhere else, deeply again, and following a complicated process like this, then even if your function runs in well under 2s, your debugging process can be quite long. AKA point is moot but nice humblebrag :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants