Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
75 lines (58 sloc) 4.744 kb

Testem Configuration File

This document will go into more detail about the Testem configuration file and list in glorious detail all of its available options. The config file is in either JSON format or YAML format and can be called any of the following

  • testem.json
  • .testem.json
  • testem.yml
  • .testem.yml

The file is looked for in the user's current directory.

An Example

Here's an example testem.json file

    "framework": "mocha",
    "src_files": [

Common Configuration Options

  • framework - the test frawework that you are using, in the browser, in the case that you are not also using the test_page option. The possible values at the moment are jasmine, qunit, mocha, and buster.
  • src_files - the location of your source files. This should be the code that you author directly, and not generated source files. So, if you are writing in CoffeeScript or TypeScript, this should be your .coffee or .ts files. If you are writing in Javascript, this would just be your .js files, but if you have a compile step for your JS, this would be the .js file pre-compilation. The files matched here are what Testem watches for modification (the watch list) so that it promptly re-runs the tests when any of them are saved.
  • serve_files - the location of the source files to be served to the browser. If don't have a compilation step, don't set this option, and it will default to src_files. If you have a compilation step, you should set this to the *.js file(s) that result from the compilation.
  • test_page - if you want to use a custom test page to run your tests, put its path here. In most cases, when you use this option, the src_files option becomes unnecessary because Testem simply adds all requested files into the watch list. You will also make sure that you include the /testem.js script in your test page if you use this option - simply include it with a script tag just below the include for your test framework, i.e. jasmine.js.
  • launchers - this option allows you to set up custom process launchers which can be used to run Node programs and indeed any kind of process within Testem.

Option Reference

CLI-level options:

file:                    [String]  configuration file (testem.json, .testem.json, testem.yml, .testem.ym   l)
host:                    [String]  server host to use (localhost)
port:                    [Number]  server port to use (7357)
launch:                  [Array]   list of launchers to use for current runs (defaults to current mo   de)
skip:                    [Array]   list of launchers to skip
debug:                   [Boolean] debug mode (false)
test_page:               [String]  path to the page to use to run tests
growl:                   [Boolean] enables growl (false)
bail_on_uncaught_error:  [Boolean] whether process should exit with error status when there are top level uncaught errors (via `window.onerror`) - in CI mode only

Config-level options:

launchers:              [Object]  a specification for all custom launchers
launch_in_dev:          [Array]   list of launchers to use for dev runs
launch_in_ci:           [Array]   list of launchers to use for CI runs
timeout:                [Number]  timeout for a browser
framework:              [String]  test framework to use
url:                    [String]  url server runs at (http://{host}:{port}/)
src_files:              [Array]   list of files or file patterns to use
serve_files:            [Array]   list of files or file patterns to inject into test playground (defaults t  o src_files)
watch_files:            [Array]   list of files or file patterns to watch changes of (defaults to src_files  )
css_files:              [Array]   additionals stylesheets to include
cwd:                    [Path]    directory to use as root
parallel:               [Number]  max number of parallel runners (1)
routes:                 [Hash]    overrides for assets paths
fail_on_zero_tests:     [Boolean] whether process should exit with error status when no tests found  
unsafe_file_serving:    [Boolean] allow serving directories that are not in your CWD (false)
reporter:               [String]  name of the reporter to be used in ci mode (tap, xunit, dot)

Available hooks:

on_start:             Runs on suite startup
before_tests:         Runs before every run of tests
after_tests:          Runs after every run of tests
on_exit:              Runs before suite exits
Jump to Line
Something went wrong with that request. Please try again.