Using the latest version of Firefox in Travis CI

A quick tip. If you're running karma tests via Firefox on Travis CI [https://travis-ci.org/] by default the Firefox version used is quite old (31 at time of writing). To always use the latest (current) version you can add this snippet to your .travis.yml. addons: firefox:…

Removing leading whitespace in ES6 template strings

Note: this post remains for posterity but rather than using the template tags described here I'd suggest taking a look at common-tags. In some recent code at work we're using fairly large strings for error descriptions. JavaScript has always made it hard to deal with long…

Python: testing beyond exceptions

Recently working on some code I was doing some basic tests that checked for an exception being raised. The tests looked like this: def test_user_identification_is_valid_option(self): with self.assertRaises(ValueError): example_seller(products=[ 'id': 'hai', 'description': 'a description&…

Back to the future: ES6 + React

I've just recently finished shaving about a billion yaks * to convert a React app over to use ES6 modules and classes so we can start living in the future that is ES6 with a sprinkling of ES7. * Might not be true Transpiling back to the present We'…

Running tests on Sauce Labs via Travis

For the Payments Team's front-end projects we've just landed support for running the front-end unit tests using Sauce Labs [https://saucelabs.com/]. About Sauce Labs In case you've never heard of Sauce Labs (unlikely!) they provide access to a multitude of browser/platform combinations…

SVG credit-card provider icons

Recently I've been working on a UI for credit-card payments [https://github.com/mozilla/payments-ui]. As part of this we needed some credit-card icons to show the card type as the user types in the number to the input field. In looking for existing iconography I either couldn&…

Tips for building a dev-env with docker

Using docker [https://www.docker.com/] and docker-compose [https://docs.docker.com/compose/] to run a development environment can be a good way to have all your services connected and running together. I'm going to assume you've got a basic understanding of docker and how it…

JS: Creating instances without new

During a code review recently I was looking at some code that was using the new keyword to create an instance e.g: var inst = new MyConstructor(); The context object when new isn't used The code contained a safeguard to bail if the new keyword wasn't…