The Nock roadmap: Where we are, and where we are going

Gregor
nock
Published in
3 min readDec 11, 2018

--

Nock is a project that many great contributors have been working on for the past couple of years; it is the premier http mocking library for Node.js. However, recently development has stagnated, and I wanted to give a high level overview of where it is now and where we, the maintainers, want it to go in the future. Here’s that vision!

Why a Roadmap?

Nock was published by Pedro Teixeira in 2011 and maintained very actively until early 2016. It became the defacto mocking library for http requests in Node.js. Since Pedro moved on to other projects, nock lost its velocity, and the current code base does not reflect the huge development in the Node community in the past years.

In the past year or so, I took over as the main maintainer; there have been some great contributors over time, but right now nock is lacking in permanent, high-context maintainers. This is hard, as a big effort is necessary to to revitalize the project! So, we’re looking to highlight what is needed, here, to help others in the community step up and help out.

We have set 3 milestones for our project:

  1. Maintainability
  2. Ease of contribution
  3. Outreach & retention

Maintainability

Automation is key for making a widely used project such as nock maintainable. Once a pull request is submitted, automated tests should set a status to see if any existing behaviour was broken by the changes. Once merged, a release should be created immediately and include release notes listing all relevant changes. Dependencies should be updated automatically.

nock already had an extensive test suite when I took on the project. I’ve setup semantic-release and Greenkeeper to automate the release process and dependency updates.

All this automation depends on a reliable continuous integration setup. Unfortunately nock’s test rely on external websites which results in random, unrelated build errors, such as expired certificates. We identified all tests that have to be adopted in #1077 and are looking for help to make them all run offline.

Another important factor is code coverage. I believe in 100% code coverage, it becomes a test by itself. This goal is hard to achieve, but, minimally, we can enforce an increase with each new pull request. Unfortunately, right now the coverage reporting is broken.

In order to finish the maintainability milestone we are organizing a Open Source Friday hackathon from noon to 5pm your local time this Friday, Dec 14— come join us!

Ease of contribution

The easier it is for users to understand how nock works internally, the more likely it is for them to create pull requests when they run into bugs or are looking for a new feature. The nock code base grew a lot over the years and different styles of coding are visible.

Once we have a reliable test suite and decent code coverage, we will split up nock into smaller modules, make sure they all have clear APIs, great tests and documentation for both users and contributors.

We will also look into tooling to help us enforce the same code style and limit code complexity.

We will take the opportunity and rewrite the code base using es6 features such as async/await. Node 6 will be no longer maintained after April 2019, so the timing is perfect, as we can set Node 8 as a minimum requirement for future versions.

Outreach & retention

Once we consider the project easy to maintain and easy to contribute to, we will actively reach out to more contributors in an effort to revitalise the project. There are many directions that the nock project could evolve into while taking advantage of its battle-tested legacy. Our goal is a vital, inclusive Open Source community — and a great, usable tool for modern node developers.

What’s next?

So, in another blogpost in this series, Richard (another maintainer on the project) is laying out the groundwork for a new idea we want to try out: a generally synchronous, live hackathon over multiple timezones by maintainers who want to help bring an up-to-date test suite to Nock. We’re going to be hacking together, and seeing if we can lay the groundwork to build towards some of the goals we listed above. Go read Richard’s post about our Maintain-athon and subscribe to our updates issues.

Thanks for your time. Happy mocking, y’all.

--

--