background preloader

TDD

Facebook Twitter

How do I Jasmine: a tutorial | Evan Hahn dot com. This guide expects you to have used Node and npm before, but you don't have to be an expert! You should also know how to publish an open source repository on GitHub and a bit about testing. It's time. You've been mooching off of npm for awhile now, and you want to make an open source package. Let me be your spirit guide. Go check out the finished source on GitHub if you'd like to see all of this together. JavaScript has had setInterval for a long time. SetInterval(myFunction, 1000); myFunction(); I'd like to build a nearly-identical function that does the same thing as setInterval but also runs the function immediately. StartInterval(myFunction, 1000); This is a pretty simple package, so it'll be helpful when we learn all of the complexities of a sexy npm module.

There's a lot of stuff you can do for an npm package. Package dot json Every npm module has a file called package.json inside. (Oh hey: make sure you've made a new directory when you're doing this stuff.) So there are four keys: Testacular - Spectacular Test Runner for JavaScript. Testing Your JavaScript with Jasmine. We all know we should be testing our code, but we don’t actually do it. I guess it’s fair to say that most of us put it off because, nine times out of ten, it means learning yet another concept.

In this tutorial, I’ll introduce you to a great little framework for testing your JavaScript code with ease. By the way, did you know that you can have your JavaScript errors fixed quickly and easily by an expert on Envato Studio? ThemeManiac, for example, will fix JavaScript errors or browser compatibility issues on your website or web application. The fixes can be completed very fast, based on the complexity and available information. He can also reorganize your scripts and make a completely new user experience. He has completed more than 1,000 jobs on Envato Studio, with 99% of customers recommending him. Today, we’re going to be learning about the Jasmine BDD testing framework. BDD and TDD … stand for Behaviour-Driven Development and Test-Driven Development. But I’m getting ahead of ourselves.