advanced configuration

This document is a comprehensive list of all the parameters you can put into the "testling" field of package.json.

browsers

testling uses the normalize-browser-names module to parse and expand the browser version ranges listed in the "browsers" field.

The browser list is routinely updated as we add more browsers. Here is a list but check the json data for the most up to date version.

When listing browser support, you can use "ie" as shorthand for "iexplore" and "ff" for "firefox".

Here's an example of normalize-browser-names-compliant "browsers" data:

"browsers": [
    "ie/8..10"
    "firefox/3.5", "firefox/latest",
    "chrome/latest",
    "safari/5..latest",
    "opera/11", "opera/next"
]

files

"files" is a single glob string or an array of glob strings that will be run to collect test output written with console.log().

Each file is run through browserify so you can require() other files using node-style module loading.

Usually a single string glob is sufficient:

"files": "test/*.js"

but sometimes extra globs or direct filenames are useful:

"files": [ "test/*.js", "test/browser/*.js" ]

scripts

"scripts" is a single glob string or an array of glob strings that will be run to collect test output written with console.log().

Unlike "files" which are run through browserify to make require() work, each file from "scripts" is inserted directly into the page with a <script> tag.

html

Instead of using "files" and "scripts" to populate an html file with <script> tags, you can give an html file directly.

The "html" entry is just a relative path string from the project root:

"html": "test.html"

preprocess

Instead of using browserify to turn "files" into a bundle, you can use a custom command.

Specify a string and it will be run:

"preprocess": "./build.sh"
quick start guide
Create a github hook to run your tests on every push. Get a browser badge.
writing tests with tape
Write tests with a minimal test api that works in both node and browsers.
testing locally
Run your tests in node and your local browsers.
writing tests with mocha
Run tests in mocha for qunit, tdd, bdd, and exports-style tests.
module-driven development
Write code that is easier to maintain and easier to test with browserify.
dependency management
Use npm to manage your front-end dependencies.
advanced configuration
Read in-depth about the package.json "testling" field.
custom test libraries
Use your own test library by outputting TAP with `console.log()`.