-
Notifications
You must be signed in to change notification settings - Fork 14
/
sauce-connect.js
44 lines (36 loc) · 1.21 KB
/
sauce-connect.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/* jshint node: true */
'use strict';
var path = require('path');
var saucie = require('saucie');
var RSVP = require('rsvp');
module.exports = {
name: 'sauce:connect',
aliases: ['start-sauce-connect'],
works: 'insideProject',
description: 'Connect to sauce using sauce-connect https://docs.saucelabs.com/reference/sauce-connect/.',
availableOptions: [],
run: function() {
if (!process.env.SAUCE_USERNAME || !process.env.SAUCE_ACCESS_KEY) {
var msg = "Can't find the username or access key for SauceLabs. Please set the 'SAUCE_USERNAME' and 'SAUCE_ACCESS_KEY' environment variable.";
return RSVP.reject(new Error(msg));
}
var self = this;
var opts = {
username: process.env.SAUCE_USERNAME,
accessKey: process.env.SAUCE_ACCESS_KEY,
verbose: true,
logger: function(message) {
self.ui.writeLine(message, 'INFO');
},
pidfile: path.join(this.project.root, 'sc_client.pid'),
connectRetries: 2
};
if (process.env.SAUCE_VERSION) {
opts.connectVersion = process.env.SAUCE_VERSION;
}
if (process.env.TRAVIS_JOB_NUMBER) {
opts.tunnelIdentifier = process.env.TRAVIS_JOB_NUMBER;
}
return saucie.connect(opts);
}
};