Ava: Debugging with the Node.js debugger

Created on 14 Nov 2016  ·  13Comments  ·  Source: avajs/ava

Is it possible to use debugger without purchasing Webstom?

Could you please add a receipt for iron-node or for node --inspect?

enhancement help wanted

Most helpful comment

Great. I'll keep this open for discovery until I have time to add something more visible.

All 13 comments

We have a short guide, but it's not currently working → https://github.com/avajs/ava/issues/988. We plan on supporting the built-in Node.js devtools inspector at some point → https://github.com/avajs/ava/pull/929.

Wow cool that works perfectly - just tested it with node 4 and iron-node.

I only had to reload (CMD+R) after iron-node started up

developer_tools_-_file____users_jnicklas__nodenv_versions_4_4_4_lib_node_modules_iron-node_app_index_html

Great. I'll keep this open for discovery until I have time to add something more visible.

@sindresorhus I'd love the ability to use the node debugger. Mocha has this feature if you run mocha debug. I rely heavily on setting debugger statements in my code and test suite to, well, debug.

I'd love to contribute to AVA and add this feature in. Is anyone currently working on this? Please let me know if the AVA crew is open to someone adding the ability to use the native node debugger.

Thanks.

@jsatk No one is currently working on this. We would welcome a pull request :)

See https://github.com/avajs/ava/pull/929 for the previous attempt. Especially https://github.com/avajs/ava/pull/929#issuecomment-248280229.

@sindresorhus Thank you. Will take a peek and do it if I can. :)

@jantimon can you help me out with the specific command-line/npm-script that you used to invoke iron-node against an ava test? i'm trying the following with ava 0.17.0, node 7.4.0 and iron-node 3.0.17:

iron-node node_modules/ava/profile.js test/ava

but getting:

screen shot 2017-01-29 at 10 18 30 am

iron-node node_modules/ava/profile.js test.js 

you might need to press cmd+r or ctrl+r

or just switch to https://facebook.github.io/jest/

@tony-kerz That command only works on one file, not a directory.

thanks @jantimon and @sindresorhus, got iron-node working calling out a specific file 👍

also, plain-old babel-node kind of works with this:

babel-node --inspect --debug-brk node_modules/ava/profile.js test/ava/my-test.js

but dev-tools couldn't resolve the source-map for some reason.

it showed transpiled code, with this comment included:

//# sourceMappingURL=../../node_modules/.cache/ava/8777fd944b4d081b32c7a8708f7547a4.js.map

a project for another day, but any insight welcome...

thanks again!

Preferably AVA could have a command such as ava --inspect that would simply run node --inspect and then issue debugger; right before it runs the tests.

@Qix- Yup, that's the plan. https://github.com/avajs/ava/pull/929 started work on it, but was never finished.

Since this started out as a documentation request, I'm closing in favor of #1505.

Was this page helpful?
0 / 5 - 0 ratings