/**
 * @license
 * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
 * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
 * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
 * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
 * Code distributed by Google as part of the polymer project is also
 * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
 */
var _      = require('lodash');
var events = require('events');

var CleanKill   = require('./cleankill');
var CliReporter = require('./clireporter');
var config      = require('./config');
var steps       = require('./steps');

module.exports = function test(options, done) {
  options = _.merge(config.defaults(), options);
  var emitter = new events.EventEmitter();

  new CliReporter(emitter, options.output, options);

  // Add plugin event listeners
  _.values(options.plugins).forEach(function(plugin) {
    if (plugin.listener) {
        new plugin.listener(emitter, options.output, plugin);
    }
  });

  var cleanOptions = _.omit(options, 'output');
  emitter.emit('log:debug', 'Configuration:', cleanOptions);

  steps.runTests(options, emitter, function(error) {
    CleanKill.close(done.bind(null, error));
  });
  return emitter;
};

@@ -759,55 +759,1479 @@
 );%0A%0A
-module.exports = function test(options, done) %7B
+/**%0A * Runs a suite of web component tests.%0A *%0A * The returned EventEmitter fires various events to allow you to track the%0A * progress of the tests:%0A *%0A * Lifecycle Events:%0A *%0A * %60run-start%60%0A *   WCT is ready to begin spinning up browsers.%0A *%0A * %60browser-init%60 %7Bbrowser%7D %7Bstats%7D%0A *   WCT is ready to begin spinning up browsers.%0A *%0A * %60browser-start%60 %7Bbrowser%7D %7Bmetadata%7D %7Bstats%7D%0A *   The browser has begun running tests. May fire multiple times (i.e. when%0A *   manually refreshing the tests).%0A *%0A * %60sub-suite-start%60 %7Bbrowser%7D %7BsharedState%7D %7Bstats%7D%0A *   A suite file has begun running.%0A *%0A * %60test-start%60 %7Bbrowser%7D %7Btest%7D %7Bstats%7D%0A *   A test has begun.%0A *%0A * %60test-end%60 %7Bbrowser%7D %7Btest%7D %7Bstats%7D%0A *  A test has ended.%0A *%0A * %60sub-suite-end%60 %7Bbrowser%7D %7BsharedState%7D %7Bstats%7D%0A *   A suite file has finished running all of its tests.%0A *%0A * %60browser-end%60 %7Bbrowser%7D %7Berror%7D %7Bstats%7D%0A *   The browser has completed, and it shutting down.%0A *%0A * %60run-end%60 %7Berror%7D%0A *   WCT has run all browsers, and is shutting down.%0A *%0A * Generic Events:%0A *%0A *  * log:debug%0A *  * log:info%0A *  * log:warn%0A *  * log:error%0A *%0A * @param %7B!Object%7D options The configuration, as specified in ./config.js.%0A * @param %7Bfunction(*)%7D done callback indicating error or success.%0A * @return %7B!events.EventEmitter%7D%0A */%0Amodule.exports = function test(options, done) %7B%0A  // All of our internal entry points already have defaults merged, but we also%0A  // want to expose this as the public API to web-component-tester.
 %0A  o
@@ -2276,16 +2276,17 @@
 tions);%0A
+%0A
   var em
@@ -2320,17 +2320,16 @@
 tter();%0A
-%0A
   new Cl
@@ -2488,18 +2488,16 @@
 ener) %7B%0A
-  
       ne

Document test events