Giter Site home page Giter Site logo

pc-rgundlapalli / karma-sauce-example Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mgenereu/karma-sauce-example

0.0 0.0 0.0 92 KB

An example of using the Karma test runner with Sauce Labs' browser cloud to run JavaScript unit tests

License: Apache License 2.0

JavaScript 100.00%

karma-sauce-example's Introduction

karma-sauce-example

An example of using the Karma test runner with Sauce Labs' browser cloud to run JavaScript unit tests.

sauce-labs-loves-karma

david-dm-status-badge

Getting Started

To get started, clone the repo:

git clone https://github.com/saucelabs/karma-sauce-example.git && cd karma-sauce-example

Then run the following command to install the Karma command line interface globally and this repo's local node dependencies:

npm install -g karma-cli && npm install 

Note: make sure you have node.js installed before running the above command.

Running Karma locally

You then can run Karma locally to see how it works with the karma start command. Try saving a source file in the src folder or a test file in the test folder to see Karma automatically re-run the tests on the latest source code.

By default, this example runs jasmine tests in Chrome and Firefox on your local machine, and you can add more browsers that you have installed in the karma.conf.js's browsers array.

Running Karma with the karma-sauce-launcher plugin

To use Karma with Sauce, add your Sauce Labs username and access key to the sauce.json file (if you don't have an account, you can sign up here).

You can now run the unit tests on Sauce with the karma start karma.conf-ci.js command. Note that this will by default start Sauce Connect to establish a secure tunnel between your local machine and Sauce's cloud. To speed up the time it takes to connect to Sauce's cloud, you can start Sauce Connect in the background by using one of the binaries or the Mac app and then setting the startConnect option to false in the karma.conf-ci.js file (make sure to change it back to true before running on CI).

Using the karma-sauce-launcher in CI

It is cool to run your unit tests on Sauce locally while you develop, but even cooler to run them on a continuous integration system with every commit to your codebase. To integrate your CI with Sauce check out the instructions for Travis, Jenkins, or Bamboo.

The provided karma.conf-ci.js file already is set up to read environment variables on CI so you shouldn't need to modify it as long as the process.env.SAUCE_USERNAME and process.env.SAUCE_ACCESS_KEY are set properly during the build.

Example CI integration

This repo demonstrates using Sauce with Travis CI. Here is a status badge which shows the build status of this repo's master branch and links to the latest build: Build Status

Note: the build is failing on purpose as a demo of Sauce catching bugs in different browsers.

karma-sauce-example's People

Contributors

chriswren avatar mgenereu avatar colinsauce avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.