moment/moment — pull request #1301 by alexstrat (2013-11-24 17:48:21+00:00)
Title: Add cross browser testing with Karma and SauceLabs

*This pull request adds cross-browser testing facilities thanks to [Karma](http://karma-runner.github.io/0.10/index.html) with access to various virtualized platforms and browsers thanks to [Open Sauce](https://saucelabs.com/opensource) plugged to current Travis CI configuration.*

- make nodeunit test suite browser compatible with bc1ff64, 26ae977 and the file `test/browser.js`
- adds karma and karma-nodeunit adapter in dfaae74: make test run on (local-)chrome
- adds saucelabs support in c43e0d6 and add a task to make tests run on various browsers
- adds necessary configuration to make karma+sauce run on Travis – but needs that *you* finish the integration.

Test suite can be run on a local Chrome with `grunt test:browser`.

To run test suite on saucelabs you need to create an open-source account on https://saucelabs.com/opensource and export your username/accesskey in env variables:

```bash
export SAUCE_USERNAME='your-username'
export SAUCE_ACCESS_KEY='your-accesskey'
```
then, run `grunt test:sauce-browser` that will run tests on various browsers: firefox on linux, ie8, ie9, safari on OSX and chrome on winxp.

To finish the integration for Travis, you need to follow this guide: https://saucelabs.com/opensource/travis and add encrypted username/accesskey to `.travis.yml`.

**Caveats:**
- all tests currently fail on ie8 with `TypeError: 'moment' is null or not an object`. Need to investigate why.
- maintaining this `test/browser.js` file might be cumbersome but it looked like to be the simplest way to make the nodeunit test suite compatible with browser.
- karma@>0.11 is required to make 3+ concurrent browsers work on saucelabs. However there is currently a version issue on grunt-karma (https://github.com/karma-runner/grunt-karma/issues/75) that prevents to install karma@>0.11. So I had to temporarily get grunt-karma from its github repo.
- it will be possible to get the [saucelabs badges](https://saucelabs.com/docs/status-images) once https://github.com/karma-runner/karma-sauce-launcher/pull/11 gets merged