Sylvain UTARD

#geek #passionate #entrepreneur #french #epita #c++ #java #ruby #rails #js #textmining #searchengine #lucene #bigdata #nosql

I'm currently VP of engineering at Algolia.

Testing your pure-JS project with Travis CI and its encrypted keys

I recently spend a few hours trying to test my JavaScript library with Travis CI and thought it was useful to share my experience with you. Travis CI is a hosted continuous platform, it’s free for open-source projects and integrates well with GitHub.

Since Travis CI supports JavaScript with Node.JS, I first thought it will be easy. The problem was that I needed Travis CI’s secure environment variables to be configured in order to setup the credentials used by the API client I was using.

Jasmine doesn’t provide any way to access environment variables. To setup them, I used the templating feature of grunt-contrib-jasmine, that allows you to build the SpecRunner.html used by Jasmine. By default, the template is parsed as underscore templates. You can pass options to your template using the templateOptions option of your Gruntfile.js jasmine tasks: they will be available via the option object.

I created a GIST summing it all up.