/ Node.js/io.js

From tests to debugging: node workflow

I've written recently about my test strategy, fixtures and how I'm using tap. In this post, I wanted to show how I go further with the tests and get right into the code to debug in real-time.

Specifically I've been trying to get my workflow into the state where I will first write a failing test, then code against that test until the bug or feature is implemented.

I've got this working to a tee with bugs, but features I still tend to write first, and then debug with tests. This post specifically highlights how I'll move from a failing test to understanding exactly why it's failing and how I'll quickly move to step debugging to solve the problem.

The workflow

I recorded a screencast of my workflow below, but will also detail some of the tools I'm using as they're all useful in isolation.

The tools

There's a number of different tools I use in the workflow video, some of which I've written about before, and others have been included as titbits.


I'm using tap for my test and runner, using the default runner. I always include basic coverage report during my tests using npm scripts.

"scripts": {
  "test": "tap test/**/*.test.js --cov"

In this particular project, I have sub-directories in my test directory, so the file match uses test/**/..., and I always name my test scripts as <name>.test.js.

Read more @ Remy Sharp