tasks/grunt-mocha-wd.js
function initBrowser(browserOpts, opts, mode, fileGroup, cb) {
    var funcName = opts.usePromises ? 'promiseChainRemote': 'remote';
    var browser = wd[funcName](extractConnectionInfo(opts));
    browser.browserTitle = browserOpts.browserTitle;
    browser.mode = mode;

    browser.mode = mode;
    if (opts.testName) {
      browserOpts.name = opts.testName;
    }
    if (opts.testTags) {
      browserOpts.tags = opts.testTags;
    }
    if (opts.build) {
      browserOpts.build = opts.build;
    }
    if (opts.identifier && opts.tunneled) {
      browserOpts['tunnel-identifier'] = opts.identifier;
    }

    browser.init(browserOpts, function (err) {
      if (err) {
        grunt.log.error(err);
        grunt.log.error('Could not initialize browser - ' + mode);
        grunt.log.error('Make sure Sauce Labs supports the following browser/platform combo' +
                        ' on ' + color('bright yellow', 'saucelabs.com/platforms') + ': ' + browserOpts.browserTitle);
        return cb(false);
      }
      runTestsForBrowser(opts, fileGroup, browser, cb);
    });
  }
function initBrowser(browserOpts, opts, mode, fileGroup, cb) {
    var funcName = opts.usePromises ? 'promiseChainRemote': 'remote';
    var browser = wd[funcName](extractConnectionInfo(opts));
    browser.browserTitle = browserOpts.browserTitle;
    browser.mode = mode;

    browser.mode = mode;
    if (opts.testName) {
      browserOpts.name = opts.testName;
    }
    if (opts.testTags) {
      browserOpts.tags = opts.testTags;
    }
    if (opts.build) {
      browserOpts.build = opts.build;
    }
    if (opts.identifier && opts.tunneled) {
      browserOpts['tunnel-identifier'] = opts.identifier;
    }

    browser.init(browserOpts, function (err) {
      if (err) {
        grunt.log.error(err);
        grunt.log.error('Could not initialize browser - ' + mode);
        grunt.log.error('Make sure Sauce Labs supports the following browser/platform combo' +
                        ' on ' + color('bright yellow', 'saucelabs.com/platforms') + ': ' + browserOpts.browserTitle);
        return cb(false);
      }
      runTestsForBrowser(opts, fileGroup, browser, cb);
    });
  }
function initBrowser ( browserOpts , opts , mode , fileGroup , cb ) { var funcName = opts . usePromises ? 'promiseChainRemote' : 'remote' ; var browser = wd [ funcName ] ( extractConnectionInfo ( opts ) ) ; browser . browserTitle = browserOpts . browserTitle ; browser . mode = mode ; browser . mode = mode ; if ( opts . testName ) { browserOpts . name = opts . testName ; } if ( opts . testTags ) { browserOpts . tags = opts . testTags ; } if ( opts . build ) { browserOpts . build = opts . build ; } if ( opts . identifier && opts . tunneled ) { browserOpts [ 'tunnel-identifier' ] = opts . identifier ; } browser . init ( browserOpts , function ( err ) { if ( err ) { grunt . log . error ( err ) ; grunt . log . error ( 'Could not initialize browser - ' + mode ) ; grunt . log . error ( 'Make sure Sauce Labs supports the following browser/platform combo' + ' on ' + color ( 'bright yellow' , 'saucelabs.com/platforms' ) + ': ' + browserOpts . browserTitle ) ; return cb ( false ) ; } runTestsForBrowser ( opts , fileGroup , browser , cb ) ; } ) ; }
Init a browser
Init a browser