I’ve recently moved back from a Macbook to a Windows 8 laptop (yay!) and so I’ve decided to check out visual studio again after a relatively long period of using IDEA IntelliJ. IntelliJ is an awesome environment and I’ve really enjoyed using it (after getting used to it) for client side and Node JS development.
IntelliJ’s integration with node JS is a pleasure to work with and VS has a lot to catch up to. A definite move in the right direction is the recently published (open source) Node.js Tools for Visual Studio package. While its not release ready for VS 2015 (which is also just RC still) it seems to work fine already.
So after installing the package I had a very good experience opening an existing project of mine (mocha-stirrer) and code away. However, while running my test suite (using grunt) I came across an issue that warranted a step through debug session. This was trivial to do in IntelliJ and I’d hoped it would be the same for VS.
So, I opened my project’s properties page and it seemed to be correctly configured or so I thought:
I’ve added my “test” task name to the script arguments and happily clicked F5 and things started to happen, however all I got was a sad command prompt window saying “Debugger listening on port ….” and nothing happened after that…
Disappointed but still optimistic I turned to Google and tried several terms in the hope of finding the step-through that will show me how to configure everything so debugging my grunt tasks would work. Unfortunately, no luck there.
I almost gave up when I thought to myself, wait. If the grunt CLI can run grunt in node, why wouldn’t I be able to?
So in the end the solution is quite simple, basically copying over some of the contents of the grunt.cmd and you’re golden:
In the “script arguments” field, simply put it in the task name (alias) you want to run or leave empty for the default task.
Now clicking F5 breaks at my breakpoint(s) and much merriment ensues!
Although I haven’t tried yet, I’m quite sure that this should work just as well for Visual Studio 2013 together with the NTVS package.