"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "test/saucelabs.js" between
lodash-4.0.0.tar.gz and lodash-4.17.21.tar.gz

About: lodash is a modern JavaScript utility library delivering modularity, performance, & extras. Tagged version.

saucelabs.js  (lodash-4.0.0):saucelabs.js  (lodash-4.17.21)
#!/usr/bin/env node #!/usr/bin/env node
'use strict'; 'use strict';
/** Environment shortcut. */ /** Environment shortcut. */
var env = process.env; var env = process.env;
if (env.TRAVIS_SECURE_ENV_VARS == 'false') {
console.log('Skipping Sauce Labs jobs; secure environment variables are unavai
lable');
process.exit(0);
}
/** Load Node.js modules. */ /** Load Node.js modules. */
var EventEmitter = require('events').EventEmitter, var EventEmitter = require('events').EventEmitter,
http = require('http'), http = require('http'),
path = require('path'), path = require('path'),
url = require('url'), url = require('url'),
util = require('util'); util = require('util');
/** Load other modules. */ /** Load other modules. */
var _ = require('../lodash.js'), var _ = require('../lodash.js'),
chalk = require('chalk'), chalk = require('chalk'),
skipping to change at line 100 skipping to change at line 95
tunneled = getOption('tunneled', true), tunneled = getOption('tunneled', true),
tunnelId = getOption('tunnelId', 'tunnel_' + (env.TRAVIS_JOB_ID || 0)), tunnelId = getOption('tunnelId', 'tunnel_' + (env.TRAVIS_JOB_ID || 0)),
tunnelTimeout = getOption('tunnelTimeout', 120), tunnelTimeout = getOption('tunnelTimeout', 120),
videoUploadOnPass = getOption('videoUploadOnPass', false); videoUploadOnPass = getOption('videoUploadOnPass', false);
/** Used to convert Sauce Labs browser identifiers to their formal names. */ /** Used to convert Sauce Labs browser identifiers to their formal names. */
var browserNameMap = { var browserNameMap = {
'googlechrome': 'Chrome', 'googlechrome': 'Chrome',
'iehta': 'Internet Explorer', 'iehta': 'Internet Explorer',
'ipad': 'iPad', 'ipad': 'iPad',
'iphone': 'iPhone' 'iphone': 'iPhone',
'microsoftedge': 'Edge'
}; };
/** List of platforms to load the runner on. */ /** List of platforms to load the runner on. */
var platforms = [ var platforms = [
['Linux', 'android', '5.1'], ['Linux', 'android', '5.1'],
['Windows 10', 'chrome', '47'], ['Windows 10', 'chrome', '54'],
['Windows 10', 'chrome', '46'], ['Windows 10', 'chrome', '53'],
['Windows 10', 'firefox', '43'], ['Windows 10', 'firefox', '50'],
['Windows 10', 'firefox', '42'], ['Windows 10', 'firefox', '49'],
['Windows 10', 'microsoftedge', '20.10240'], ['Windows 10', 'microsoftedge', '14'],
['Windows 10', 'internet explorer', '11'], ['Windows 10', 'internet explorer', '11'],
['Windows 8', 'internet explorer', '10'], ['Windows 8', 'internet explorer', '10'],
['Windows 7', 'internet explorer', '9'], ['Windows 7', 'internet explorer', '9'],
// ['OS X 10.10', 'ipad', '9.1'], ['macOS 10.12', 'safari', '10'],
['OS X 10.11', 'safari', '9'], ['OS X 10.11', 'safari', '9']
['OS X 10.10', 'safari', '8']
]; ];
/** Used to tailor the `platforms` array. */ /** Used to tailor the `platforms` array. */
var isAMD = _.includes(tags, 'amd'), var isAMD = _.includes(tags, 'amd'),
isBackbone = _.includes(tags, 'backbone'), isBackbone = _.includes(tags, 'backbone'),
isModern = _.includes(tags, 'modern'); isModern = _.includes(tags, 'modern');
// The platforms to test IE compatibility modes. // The platforms to test IE compatibility modes.
if (compatMode) { if (compatMode) {
platforms = [ platforms = [
skipping to change at line 216 skipping to change at line 211
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/** /**
* Resolves the formal browser name for a given Sauce Labs browser identifier. * Resolves the formal browser name for a given Sauce Labs browser identifier.
* *
* @private * @private
* @param {string} identifier The browser identifier. * @param {string} identifier The browser identifier.
* @returns {string} Returns the formal browser name. * @returns {string} Returns the formal browser name.
*/ */
function browserName(identifier) { function browserName(identifier) {
return browserNameMap[identifier] || capitalizeWords(identifier); return browserNameMap[identifier] || _.startCase(identifier);
}
/**
* Capitalizes the first character of each word in `string`.
*
* @private
* @param {string} string The string to augment.
* @returns {string} Returns the augmented string.
*/
function capitalizeWords(string) {
return _.map(string.split(' '), _.capitalize).join(' ');
} }
/** /**
* Gets the value for the given option name. If no value is available the * Gets the value for the given option name. If no value is available the
* `defaultValue` is returned. * `defaultValue` is returned.
* *
* @private * @private
* @param {string} name The name of the option. * @param {string} name The name of the option.
* @param {*} defaultValue The default option value. * @param {*} defaultValue The default option value.
* @returns {*} Returns the option value. * @returns {*} Returns the option value.
skipping to change at line 307 skipping to change at line 291
* Extracts the option value from an option string. * Extracts the option value from an option string.
* *
* @private * @private
* @param {string} name The name of the option to inspect. * @param {string} name The name of the option to inspect.
* @param {string} string The options string. * @param {string} string The options string.
* @returns {string|undefined} Returns the option value, else `undefined`. * @returns {string|undefined} Returns the option value, else `undefined`.
*/ */
function optionToValue(name, string) { function optionToValue(name, string) {
var result = string.match(RegExp('^' + name + '(?:=([\\s\\S]+))?$')); var result = string.match(RegExp('^' + name + '(?:=([\\s\\S]+))?$'));
if (result) { if (result) {
result = _.result(result, 1); result = _.get(result, 1);
result = result ? _.trim(result) : true; result = result ? _.trim(result) : true;
} }
if (result === 'false') { if (result === 'false') {
return false; return false;
} }
return result || undefined; return result || undefined;
} }
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
skipping to change at line 379 skipping to change at line 363
* @param {Object} [error] The error object. * @param {Object} [error] The error object.
* @param {Object} res The response data object. * @param {Object} res The response data object.
* @param {Object} body The response body JSON object. * @param {Object} body The response body JSON object.
*/ */
function onJobStart(error, res, body) { function onJobStart(error, res, body) {
this.starting = false; this.starting = false;
if (this.stopping) { if (this.stopping) {
return; return;
} }
var statusCode = _.result(res, 'statusCode'), var statusCode = _.get(res, 'statusCode'),
taskId = _.first(_.result(body, 'js tests')); taskId = _.first(_.get(body, 'js tests'));
if (error || !taskId || statusCode != 200) { if (error || !taskId || statusCode != 200) {
if (this.attempts < this.retries) { if (this.attempts < this.retries) {
this.restart(); this.restart();
return; return;
} }
var na = 'unavailable', var na = 'unavailable',
bodyStr = _.isObject(body) ? '\n' + JSON.stringify(body) : na, bodyStr = _.isObject(body) ? '\n' + JSON.stringify(body) : na,
statusStr = _.isFinite(statusCode) ? statusCode : na; statusStr = _.isFinite(statusCode) ? statusCode : na;
skipping to change at line 421 skipping to change at line 405
* @param {Object} [error] The error object. * @param {Object} [error] The error object.
* @param {Object} res The response data object. * @param {Object} res The response data object.
* @param {Object} body The response body JSON object. * @param {Object} body The response body JSON object.
*/ */
function onJobStatus(error, res, body) { function onJobStatus(error, res, body) {
this.checking = false; this.checking = false;
if (!this.running || this.stopping) { if (!this.running || this.stopping) {
return; return;
} }
var completed = _.result(body, 'completed', false), var completed = _.get(body, 'completed', false),
data = _.first(_.result(body, 'js tests')), data = _.first(_.get(body, 'js tests')),
elapsed = (_.now() - this.timestamp) / 1000, elapsed = (_.now() - this.timestamp) / 1000,
jobId = _.result(data, 'job_id', null), jobId = _.get(data, 'job_id', null),
jobResult = _.result(data, 'result', null), jobResult = _.get(data, 'result', null),
jobStatus = _.result(data, 'status', ''), jobStatus = _.get(data, 'status', ''),
jobUrl = _.result(data, 'url', null), jobUrl = _.get(data, 'url', null),
expired = (elapsed >= queueTimeout && !_.includes(jobStatus, 'in progress' )), expired = (elapsed >= queueTimeout && !_.includes(jobStatus, 'in progress' )),
options = this.options, options = this.options,
platform = options.platforms[0]; platform = options.platforms[0];
if (_.isObject(jobResult)) { if (_.isObject(jobResult)) {
var message = _.result(jobResult, 'message'); var message = _.get(jobResult, 'message');
} else { } else {
if (typeof jobResult == 'string') { if (typeof jobResult == 'string') {
message = jobResult; message = jobResult;
} }
jobResult = null; jobResult = null;
} }
if (isJobId(jobId)) { if (isJobId(jobId)) {
this.id = jobId; this.id = jobId;
this.result = jobResult; this.result = jobResult;
this.url = jobUrl; this.url = jobUrl;
} else { } else {
completed = false; completed = false;
} }
this.emit('status', jobStatus); this.emit('status', jobStatus);
if (!completed && !expired) { if (!completed && !expired) {
this._pollerId = _.delay(_.bind(this.status, this), this.statusInterval * 10 00); this._pollerId = _.delay(_.bind(this.status, this), this.statusInterval * 10 00);
return; return;
} }
var description = browserName(platform[1]) + ' ' + platform[2] + ' on ' + capi talizeWords(platform[0]), var description = browserName(platform[1]) + ' ' + platform[2] + ' on ' + _.st artCase(platform[0]),
errored = !jobResult || !jobResult.passed || reError.test(message) || reEr ror.test(jobStatus), errored = !jobResult || !jobResult.passed || reError.test(message) || reEr ror.test(jobStatus),
failures = _.result(jobResult, 'failed'), failures = _.get(jobResult, 'failed'),
label = options.name + ':', label = options.name + ':',
tunnel = this.tunnel; tunnel = this.tunnel;
if (errored || failures) { if (errored || failures) {
if (errored && this.attempts < this.retries) { if (errored && this.attempts < this.retries) {
this.restart(); this.restart();
return; return;
} }
var details = 'See ' + jobUrl + ' for details.'; var details = 'See ' + jobUrl + ' for details.';
this.failed = true; this.failed = true;
logInline(); logInline();
if (failures) { if (failures) {
console.error(label + ' %s ' + chalk.red('failed') + ' %d test' + (failure s > 1 ? 's' : '') + '. %s', description, failures, details); console.error(label + ' %s ' + chalk.red('failed') + ' %d test' + (failure s > 1 ? 's' : '') + '. %s', description, failures, details);
} }
else if (tunnel.attempts < tunnel.retries) { else if (tunnel.attempts < tunnel.retries) {
tunnel.restart(); tunnel.restart();
return; return;
} }
else { else {
if (typeof message == 'undefined') { if (message === undefined) {
message = 'Results are unavailable. ' + details; message = 'Results are unavailable. ' + details;
} }
console.error(label, description, chalk.red('failed') + ';', message); console.error(label, description, chalk.red('failed') + ';', message);
} }
} }
else { else {
logInline(); logInline();
console.log(label, description, chalk.green('passed')); console.log(label, description, chalk.green('passed'));
} }
this.running = false; this.running = false;
skipping to change at line 604 skipping to change at line 588
*/ */
Job.prototype.restart = function(callback) { Job.prototype.restart = function(callback) {
this.once('restart', _.iteratee(callback)); this.once('restart', _.iteratee(callback));
if (this.restarting) { if (this.restarting) {
return this; return this;
} }
this.restarting = true; this.restarting = true;
var options = this.options, var options = this.options,
platform = options.platforms[0], platform = options.platforms[0],
description = browserName(platform[1]) + ' ' + platform[2] + ' on ' + capi talizeWords(platform[0]), description = browserName(platform[1]) + ' ' + platform[2] + ' on ' + _.st artCase(platform[0]),
label = options.name + ':'; label = options.name + ':';
logInline(); logInline();
console.log('%s %s restart %d of %d', label, description, ++this.attempts, thi s.retries); console.log('%s %s restart %d of %d', label, description, ++this.attempts, thi s.retries);
return this.remove(onGenericRestart); return this.remove(onGenericRestart);
}; };
/** /**
* Starts the job. * Starts the job.
skipping to change at line 829 skipping to change at line 813
return this; return this;
}; };
/** /**
* Removes jobs from the queue and starts them. * Removes jobs from the queue and starts them.
* *
* @memberOf Tunnel * @memberOf Tunnel
* @param {Object} Returns the tunnel instance. * @param {Object} Returns the tunnel instance.
*/ */
Tunnel.prototype.dequeue = function() { Tunnel.prototype.dequeue = function() {
var jobs = this.jobs, var count = 0,
jobs = this.jobs,
active = jobs.active, active = jobs.active,
queue = jobs.queue, queue = jobs.queue,
throttled = this.throttled; throttled = this.throttled;
while (queue.length && (active.length < throttled)) { while (queue.length && (active.length < throttled)) {
active.push(queue.shift().start()); var job = queue.shift();
active.push(job);
_.delay(_.bind(job.start, job), ++count * 1000);
} }
return this; return this;
}; };
/** /**
* Stops the tunnel. * Stops the tunnel.
* *
* @memberOf Tunnel * @memberOf Tunnel
* @param {Function} callback The function called once the tunnel is stopped. * @param {Function} callback The function called once the tunnel is stopped.
* @param {Object} Returns the tunnel instance. * @param {Object} Returns the tunnel instance.
 End of changes. 16 change blocks. 
43 lines changed or deleted 29 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)