Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including travis-multirunner with all npm packages installed. Try it out:

travis-multirunner lists no main file and has no index.js, so it can't be directly required. If this is a mistake, please let us know. It may however contain internal files that you can require manually:

// require("travis-multirunner/[??]")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

travis-multirunner v2.0.2

Travis Multirunner

This is a set of scripts designed to help you get up and running multibrowser tests on travis. The scripts themselves are designed to be fetched during a travis before_install process and used to prepare your environment.

NPM

Build Status

Usage

First, create a .travis.yml folder in your project that looks similar to the followng:

sudo: false
language: node_js
node_js:
- 0.10

env:
  matrix:
    - BROWSER=chrome  BVER=stable
    - BROWSER=chrome  BVER=beta
    - BROWSER=chrome  BVER=unstable
    - BROWSER=firefox BVER=stable
    - BROWSER=firefox BVER=beta
    - BROWSER=firefox BVER=unstable

matrix:
  fast_finish: true

  allow_failures:
    - env: BROWSER=chrome  BVER=unstable
    - env: BROWSER=firefox BVER=nightly

before_script:
  - ./node_modules/travis-multirunner/setup.sh
  - export DISPLAY=:99.0
  - sh -e /etc/init.d/xvfb start

after_failure:
  - for file in *.log; do echo $file; echo "======================"; cat $file; done || true

notifications:
  email:
  - {{ package.author.email }}

The most interesting part of the configuration file above is definitely the before_install section which defines a number of commands that will be executed in the TRAVIS environment prior to running the language appropriate install command.

The commands above are used to pull down the contents of this repository into a .trunner within the travis build environment. Once this is completed, the ./travis/setup.sh command is run which will knows how to provision a browser based on a BROWSER (specifying the browser name) and BVER which defines the version to test. This script is an only very slightly modified version of the .travis-setup.sh script written by @mithro.

This is where the matrix section comes into play. In the .travis.yml file above, I've used the matrix to tell travis that I want to a few variants of both chrome and firefox. It should be noted that the original script does this is a slightly different way, but I wanted to use the BROWSER environment variable later when running my npm test command.

Prior Art

None of this would have been possible without the docs and code listed below:

Metadata

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free