The birth of Node coincided with, and even inspired, a host of new tools and techniques for code development, management, and maintenance. Debugging, testing, task management, production rollout, and support are key elements of any Node project, and it’s a good thing that most are automated.
This chapter introduces some of the tools and the concepts. It is not an exhaustive list, but should provide a good start in your explorations.
I confess to using console logging more than I should for debugging. It is an easy approach to checking variable values and results. However, the issue with using the console is that we’re impacting on the dynamics and behavior of the application, and could actually be masking—or creating—a problem just by its use. It really is better to use debugging tools, especially when the application grows beyond simple blocks of code.
Node provides a built-in debugger we can use to set breakpoints in the code and add watchers in order to view intermediate code results. It’s not the most sophisticated tool in the world, but it is sufficient for discovering bugs and potential gotchas. In the next section, we’ll look at a more sophisticated tool, the Node Inspector.
Given the choice, I’ll always prefer native implementations rather than using third-party functionality. Luckily for our debugging needs, Node does provide built-in debugger support. It’s not sophisticated ...