How many tests is too many?

Tags:

Some time ago I stumbled upon some crazy stuff… Specifically, I found out that SQLite has 787 times more tests than they have actual code! It’s no joke, it’s documented right on their website. While they have about 116 300 lines of source code, they have 91 577 300 lines of test code. That sounds completely insane. I bet you’ve …

How to unit test ES6 code?

Tags:

ES6 is here today. Several browsers have almost all ES6 features available, and even Microsoft Edge is getting there. Tools like Babel help cover the parts which browsers don’t have yet. If you want to start using ES6 for development, that’s easy: there’s a lot of detailed information available. But what about testing? How do you write unit tests for …

Learn to unit test your javaScript code with Mocha and Chai

Tags:

Have you ever made some changes to your code, and later found it caused something else to break? I’m sure most of us have. This is almost inevitable, especially when you have a larger amount of code. One thing depends on another, and then changing it breaks something else as a result. But what if that didn’t happen? What if …

Why is fixing bugs so slow? (and how to make it faster)

Tags:

Have you ever wondered why sometimes fixing bugs seems to take much longer than it should? When you finally find the problem, it turns out all you need is one small change. Yet, it took a lot of time to find what’s going on. This happens to me more often than I’d like. On the other hand, when you’re writing …

Sinon.js best practices for spies, stubs and mocks

Tags:

Sinon is one of the most important tools for testing, as without it writing tests for more complex pieces of code such as Ajax, networking, databases, etc. would become difficult. In this article, I’ll show you the best practices for using Sinon, so you’ll be able to apply it to your own projects more easily. What are the differences between …