Re-Blog: Testing JavaScript on Various Platforms with Karma and Sauce Labs

Posted Nov 6th, 2014

Thanks to Ben Ripkins for this great blog post on codecentric! See an excerpt below.

The web can be a brutal environment with various combinations of browsers and operating systems (platforms). It is quite likely that your continuous integration setup only covers a small portion of your users’ platforms. The unfortunate truth is that testing on these platforms is necessary to accommodate for compliance differences and partial support of standards and technologies like HTML, JavaScript, CSS and network protocols. Sauce Labs is a service that can be used to test web applications by simulating user behaviour or executing JavaScript unit tests. Sauce Labs eases testing by supporting 442 different platform combinations and additionally recording the test execution. This means that you can actually see what a user might have seen and therefore trace errors easily. For the purpose of this blog post we will cover the following setup:
  • Sources and tests written using CommonJS modules. Modules are transpiled for the web using Browserify.
  • Mocha as our test framework.
  • Local test execution in the headless PhantomJS browser.
  • Testing against the following platforms in our CI environment:
    • Chrome 35 on Windows 7,
    • Firefox 30 on an arbitrary operating system,
    • iPhone 7.1 on OS X 10.9 and
    • Internet Explorer on Windows 8.1.

Written by

Bill McGee


Programming languagesCross-browser testing