Test runners and node-inspector

289 views
Skip to first unread message

Rubikzube

unread,
Apr 22, 2011, 5:51:45 PM4/22/11
to nodejs
Is it possible to use nodeunit in conjunection with node-inspector?
Currently I am calling nodeunit with the following syntax:

> nodeunit test/run.js

I'm thinking about switching over to vows just so I can do this, which
I've read that vows has the capacity to do.

Laurie Harper

unread,
Apr 22, 2011, 6:31:14 PM4/22/11
to nod...@googlegroups.com
node --debug `which nodeunit` test/run.js

> --
> You received this message because you are subscribed to the Google Groups "nodejs" group.
> To post to this group, send email to nod...@googlegroups.com.
> To unsubscribe from this group, send email to nodejs+un...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/nodejs?hl=en.
>

--
Laurie Harper
http://laurie.holoweb.net/

Luke Arduini

unread,
May 21, 2013, 5:23:14 AM5/21/13
to nod...@googlegroups.com
Feel free to use $() as well. 

On Tuesday, May 21, 2013, Miroslav Bajtoš wrote:
On Monday, May 20, 2013 5:35:11 PM UTC+2, Maxim Yefremov wrote:
Tried this on mac:
node --debug 'which nodeunit' myNodeUnitTest.js

You should use back-tick characters `` instead of regular apostrophes ''. Enclosing a command in back-ticks means "call this command and return it's result as string". See also http://unix.stackexchange.com/questions/27428/what-does-backquote-backtick-mean-in-bash.

Miroslav

But got error: 
debugger listening on port 5858

module.js:340
    throw err;
          ^
Error: Cannot find module '/pathToProject/which nodeunit'

--
--
Job Board: http://jobs.nodejs.org/
Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines

You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nod...@googlegroups.com
To unsubscribe from this group, send email to
nodejs+un...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en
 
---
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Maxim Yefremov

unread,
May 21, 2013, 11:00:28 AM5/21/13
to nod...@googlegroups.com
Ok. I fix it with backquotes. 
node `which nodeunit` ./path/To/My/NodeUnitTests/nodeunit_test.coffee

I see output:
debugger listening on port 5858
Then usual output for my nodeunit test. But no debugging. Allthough unit test has string debugger;

In another console:
node-inspector &
[2] 17020
macName:folderName user$    info  - socket.io started
   warn  - error raised: Error: listen EADDRINUSE
connect ECONNREFUSED
 node-inspector &

Just initial nodeinspector state here. No files to choose. No breakpoints to stop.


You received this message because you are subscribed to a topic in the Google Groups "nodejs" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/nodejs/by_WQ5G3Ycc/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to nodejs+un...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
С уважением,
Максим Ефремов

Miroslav Bajtoš

unread,
May 22, 2013, 1:41:40 AM5/22/13
to nod...@googlegroups.com

On Tuesday, May 21, 2013 5:00:28 PM UTC+2, Maxim Yefremov wrote:
Ok. I fix it with backquotes. 
node `which nodeunit` ./path/To/My/NodeUnitTests/nodeunit_test.coffee

I see output:
debugger listening on port 5858
Then usual output for my nodeunit test. But no debugging. Allthough unit test has string debugger;

In another console:
node-inspector &
[2] 17020
macName:folderName user$    info  - socket.io started
   warn  - error raised: Error: listen EADDRINUSE
connect ECONNREFUSED
 node-inspector &

Just initial nodeinspector state here. No files to choose. No breakpoints to stop.

I suspect your unit-test finishes before you manage to attach node-inspector to the debugger. Try using --debug-brk instead of --debug for your node command-line.

   node --debug-brk `which nodeunit`

This will start the debugger and stop (break) at the first line. After your node-inspector is attached to your unit-test, press continue/resume and your `debugger;` statement should break the process shortly afterwards.

Maxim Yefremov

unread,
May 22, 2013, 7:59:52 AM5/22/13
to nod...@googlegroups.com
Thanx a lot to Miroslav. It's working now:
node --debug-brk `which nodeunit` ./path/To/My/NodeUnitTests/nodeunit_test.coffee
on another console: 
node-inspector &

And on google chrome open: http://0.0.0.0:8080/debug?port=5858
Here I see nodeunit debuging from the start. Click continue execution several times in browser until I jump to my test, where I have debugger; string


--
--
Job Board: http://jobs.nodejs.org/
Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nod...@googlegroups.com
To unsubscribe from this group, send email to
nodejs+un...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en
 
---
You received this message because you are subscribed to a topic in the Google Groups "nodejs" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/nodejs/by_WQ5G3Ycc/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to nodejs+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply all
Reply to author
Forward
0 new messages