function (options) {
    var self = this;

    if (options == null) {
      options = {};
    }

    this.options = extend({
      requestedPorts  : 0,
      type            : this.TYPE_MOCHA,
      compilerModules : []
    }, options);

    this.eventMediator = new EventEmitter();

    this.eventMediator.on('bail', this._bail.bind(this));

    switch (this.options.type) {
      case this.TYPE_CUCUMBER:
        this.reporter = new CucumberReporter(this.eventMediator);
        break;
      case this.TYPE_MOCHA:
      default:
        this.reporter = new MochaReporter(this.eventMediator);
    }

    this._setColors();

    this._handleSignals();

    cluster.setupMaster({
      exec   : path.join(__dirname, 'fork_worker.js'),
      silent : false
    });

    this._loadTestSuites()
      .then(function (tests) {
        return self._processTests(self._batchTests(tests));
      })
      .then(function(){
        self.eventMediator.emit('start');
        return self._getOpenPorts(self.options.requestedPorts);
      })
      .then(function (ports) {
        for (var i=0; i<self._getMaxServers(); i++) {
          var portBlockSize  = self.options.requestedPorts + 1,
              portBlockStart = i * portBlockSize,
              port           = ports[portBlockStart],
              requestedPorts = ports.slice(portBlockStart+1, portBlockStart+portBlockSize);

          self._createServerWorker(port, requestedPorts);
        }
      })
      .done();
  }
function (options) {
    var self = this;

    if (options == null) {
      options = {};
    }

    this.options = extend({
      requestedPorts  : 0,
      type            : this.TYPE_MOCHA,
      compilerModules : []
    }, options);

    this.eventMediator = new EventEmitter();

    this.eventMediator.on('bail', this._bail.bind(this));

    switch (this.options.type) {
      case this.TYPE_CUCUMBER:
        this.reporter = new CucumberReporter(this.eventMediator);
        break;
      case this.TYPE_MOCHA:
      default:
        this.reporter = new MochaReporter(this.eventMediator);
    }

    this._setColors();

    this._handleSignals();

    cluster.setupMaster({
      exec   : path.join(__dirname, 'fork_worker.js'),
      silent : false
    });

    this._loadTestSuites()
      .then(function (tests) {
        return self._processTests(self._batchTests(tests));
      })
      .then(function(){
        self.eventMediator.emit('start');
        return self._getOpenPorts(self.options.requestedPorts);
      })
      .then(function (ports) {
        for (var i=0; i<self._getMaxServers(); i++) {
          var portBlockSize  = self.options.requestedPorts + 1,
              portBlockStart = i * portBlockSize,
              port           = ports[portBlockStart],
              requestedPorts = ports.slice(portBlockStart+1, portBlockStart+portBlockSize);

          self._createServerWorker(port, requestedPorts);
        }
      })
      .done();
  }
function ( options ) { var self = this ; if ( options == null ) { options = { } ; } this . options = extend ( { requestedPorts : 0 , type : this . TYPE_MOCHA , compilerModules : [ ] } , options ) ; this . eventMediator = new EventEmitter ( ) ; this . eventMediator . on ( 'bail' , this . _bail . bind ( this ) ) ; switch ( this . options . type ) { case this . TYPE_CUCUMBER : this . reporter = new CucumberReporter ( this . eventMediator ) ; break ; case this . TYPE_MOCHA : default : this . reporter = new MochaReporter ( this . eventMediator ) ; } this . _setColors ( ) ; this . _handleSignals ( ) ; cluster . setupMaster ( { exec : path . join ( __dirname , 'fork_worker.js' ) , silent : false } ) ; this . _loadTestSuites ( ) . then ( function ( tests ) { return self . _processTests ( self . _batchTests ( tests ) ) ; } ) . then ( function ( ) { self . eventMediator . emit ( 'start' ) ; return self . _getOpenPorts ( self . options . requestedPorts ) ; } ) . then ( function ( ports ) { for ( var i = 0 ; i < self . _getMaxServers ( ) ; i ++ ) { var portBlockSize = self . options . requestedPorts + 1 , portBlockStart = i * portBlockSize , port = ports [ portBlockStart ] , requestedPorts = ports . slice ( portBlockStart + 1 , portBlockStart + portBlockSize ) ; self . _createServerWorker ( port , requestedPorts ) ; } } ) . done ( ) ; }
////////////////////////////////////////////////////////////////////////// Public methods ///////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// 
Functional.start(options) -> Promise
- options (Object)
////////////////////////////////////////////////////////////////////////// Public methods ///////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// Functional . start ( options ) - > Promise - options ( Object )