Wednesday, 12 April 2017

debug v8 c++ addon using mocha as the javascript client, prevent fork

I am developing a c++ addon for node. My javascript-side test-suite is mocha.

In order to debug the c++ addon I run:

node <test_script>.js

direct from the IDE (Clion on a mac).

This works perfectly and allows me to set breakpoints in the c++ code.

However I want to debug using my mocha tests. Running

node /usr/local/lib/node_modules/npm/bin/npm-cli.js run mocha <test_dir>/ 

seems to cause node to fork at some point (I presume in mocha itself?)

LLDB cannot follow forks so I lose my debugging context. GDB is not incompatible with OSX (sigh...)

What I want to do is something like this:

var mocha = require('mocha');
mocha.run_tests_or_something('my test.js file');

in order to run the tests in that file, in a mocha environment, without forking.

Is this possible? I don't see anything in the mocha documentation about it.



via Richard Hodges

No comments:

Post a Comment