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

Add test debugging support #109

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

micellius
Copy link

When cli.js executed by Node.js running in debug mode, child processes are also running in debug mode with different port.
It is possible to run cli.js in normal mode and debug only child processes using --debug option.
It is possible to specify debug port after --debug option.

Close #108.

When cli.js executed by Node.js running in debug mode, child processes are also running in debug mode with different port.
It is possible to run cli.js in normal mode and debug only child processes using --debug option.
It is possible to specify debug port after --debug option.

Close qunitjs#108.
@kof
Copy link
Contributor

kof commented Nov 8, 2014

I should rewrite the cli with commander ...

@kof
Copy link
Contributor

kof commented Nov 8, 2014

Hmm ... if we need to debug just one child why do we need all this. Arguments are passed to the child in any case.

@kof
Copy link
Contributor

kof commented Nov 8, 2014

The only thing we need is to avoid that runner process gets this flag.

@micellius
Copy link
Author

Hmm ... if we need to debug just one child why do we need all this. Arguments are passed to the child in any case.

The problem is not in passing debug argument to child process, but deeper - in fixing node way of spawning new processes when parent process is running in debug mode; also in ability to run child process in debug mode when parent process is running in normal mode.

There are two parts that should be handled:

  • testrunner.js should change execution arguments passed to node (execArgv not argv) in order to start child process on different debugging port. Therefore passing arguments to child process is not enough, parent process should be reconfigured each time before spawning new child process.
  • child.js should be notified that it is running in debug mode in order to stop sending ping messages, otherwise process will be killed after maxBlockDuration with message "Error: Process blocked for too long". debug option is passed to it in order to avoid duplication of logic that recognises that process is running in debug mode. It may be handy, since there are at least 3 scenarios that cause child process to run in debug mode.

It is possible to simplify logic, avoid --debug flag at all (on cost of flexibility), move logic to recognise debug mode from cli.js to testrunner.js only, not pass debug option to child.js and simply not run block that setups pingCheckTimeoutId in debug mode (which will cause child process to continue polluting event queue with irrelevant ping messages form time to time). In this case everything relevant to debug mode will be handled in testrunner.js. If you think it's the better way, I can make another PR, just let me know. And thanks again for your time :)

@SPopenko
Copy link

SPopenko commented Aug 6, 2018

Guys, what is required to merge this PR? Or do you have any other suggestions on how to debug qunit tests?

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

Successfully merging this pull request may close these issues.

Add support for using 'node --inspect' to debug tests
3 participants