What Bitbucket Learned From Migrating Its Unit Testing Tool

What Bitbucket learned from migrating its unit testing tool

More than four years ago, Stash Bitbucket transitioned from running Javascript unit tests by Java to Karma. Today, I can announce that we switched our test runner to a modern tool called Jest! How did we end up here?

Before Jest, our testing framework was a combination of different tools and helpers wired up together: Each of them serves a different purpose and is mandatory to write unit tests. The problem with that setup is that you need to maintain the custom integrations and this can cost you time and a lot of headaches. As you can guess, the complexity of this solution was evolving over time.

There is no one to blame for that. A few years ago there was no other way to even think about running unit tests inside NodeJS only. Karma and PhantomJS were the only solutions if you wanted to think about unit tests for your Javascript code.

Those days are gone. We have more mature tools and, most importantly, more flexibility in how we want to provide and to run our unit tests. Thanks to the jsdom project we can run the code that works in the browser without a browser.

Why did we have to migrate again? It wasn’t just hype over a new shiny Javascript tooling. We had requirements that our old setup was not meeting: As a developer, I want to test code that depends on the NPM module so that I can ensure my code works.

Source: atlassian.com