Using the latest version of Firefox in Travis CI

A quick tip. If you're running karma tests via Firefox on Travis CI 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: latest This will keep your…

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 strings, especially when you…

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', 'recurrence': None, 'user_identification': True, }]) def test_…

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're using babel via…

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. About Sauce Labs In case you've never heard of Sauce Labs (unlikely!) they provide access to a multitude of browser/platform combinations via vms so you can run your automated test…

SVG credit-card provider icons

Recently I've been working on a UI for credit-card payments. 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't find exactly what I was looking for,…

Tips for building a dev-env with docker

Using docker and docker-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 works if not there's a good overview of what docker is here. We're…

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 used. Which is a…