Test-Driven Development With The oclif Testing Library: Part Two

In Part One of this series on the oclif testing library, we used a test-driven development approach to building our time-tracker CLI. We talked about the oclif framework, which helps developers dispense with the setup and boilerplate so that they can get to writing the meat of their CLI applications. We also talked about @oclif/test and @oclif/fancy-test, which take care of the repetitive setup and teardown so that developers can focus on writing their Mocha tests.

Our time-tracker application is a multi-command CLI. We’ve already written tests and implemented our first command for adding a new project to our tracker. Next, we’re going to write tests and implement our “start timer” command.

Crafting a Command Line Experience that Developers Love

If you're setting out to build a highly-usable developer tool, it goes without saying that a proper CLI to interface with your API is paramount. As Zeit and Heroku have been setting the tone for these types of developer tools by doing extensive research into best practices when it comes to a command line "experience," we started our quest by digging into their findings.

Since the Stream CLI is currently in public beta, the methods and philosophies we found from our research, as well as those we unearthed ourselves, are fresh in our minds and we wanted to take a few minutes to outline what we found to be best practices among other CLI tools and developers' needs when it comes to building a proper CLI.