Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

grunt-saucelabs

Package Overview
Dependencies
Maintainers
4
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grunt-saucelabs - npm Package Compare versions

Comparing version 5.1.2 to 5.1.3

4

package.json
{
"name": "grunt-saucelabs",
"description": "Grunt task running tests using Sauce Labs. Supports QUnit, Jasmine, Mocha and YUI tests",
"version": "5.1.2",
"version": "5.1.3",
"homepage": "https://github.com/axemclion/grunt-saucelabs",

@@ -35,3 +35,3 @@ "author": {

"saucelabs": "~0.1.1",
"sauce-tunnel-sc3-1": "~1.0.0",
"sauce-tunnel": "~2.0.6",
"colors": "~0.6.2",

@@ -38,0 +38,0 @@ "lodash": "~2.4.1"

@@ -51,2 +51,3 @@ grunt-saucelabs

testInterval: 'Milliseconds between retries to check if the tests are completed',
throttled: 'A numeric value indicating the maximum number of unit test pages to run concurrently',
testname: 'Name of the test',

@@ -94,2 +95,3 @@ tags: ['Array of tags'],

* __testInterval__ : Number of milliseconds between each retry to see if a test is completed or not (default: 5000). _Optional_
* __thottled__: Maximum number of unit test pages which will be sent to Sauce Labs concurrently. The maximum number of jobs you may have outstanding is this times the number of browsers, can be used to mitigate concurrency failures if you have a lot of unit test pages. _Optional_
* __onTestComplete__ : A callback that is called every time a unit test for a page is complete. Runs per page, per browser configuration. Receives a 'result' argument which is the javascript object exposed to sauce labs. A true or false return value passes or fails the test, undefined return value does not alter the result of the test. For async results, call `this.async()` in the function. The return of `this.async()` is a function that should be called once the async action is completed. _Optional_

@@ -215,2 +217,8 @@

---------
####5.1.3####
* update to sauce-tunnel 2.0.6, which uses Sauce Connect 4.2
####5.1.2####
* use sauce-tunnel-sc3-1 to protect against heartbleed bug
####5.1.1####

@@ -217,0 +225,0 @@ * Qunit reporting code made ecma3 compatible

module.exports = function(grunt) {
var _ = require('lodash'),
request = require('request'),
SauceTunnel = require('sauce-tunnel-sc3-1'),
SauceTunnel = require('sauce-tunnel'),
Q = require('q'),

@@ -99,7 +99,6 @@ rqst = request.defaults({

TestRunner.prototype.runTests = function(browsers, urls, framework, tunnelIdentifier, testname, tags, build, onTestComplete, callback){
TestRunner.prototype.runTests = function(browsers, urls, framework, tunnelIdentifier, testname, tags, build, onTestComplete, throttled, callback){
var me = this;
var numberOfJobs = browsers.length * urls.length;
var addResultPromise = function(promise){

@@ -120,35 +119,60 @@ me.results.push(promise);

urls.forEach(function(url){
me.runTest(browsers, url, framework, tunnelIdentifier, testname, tags, build, function(taskIds){
var outstandingTests = 0;
taskIds.forEach(function(taskId){
var resultPromise = new TestResult(taskId, me.user, me.key, framework, me.testInterval);
addResultPromise(resultPromise);
resultPromise.then(function(result){
function take() {
var url = urls.shift();
if (url) {
outstandingTests++;
me.runTest(browsers, url, framework, tunnelIdentifier, testname, tags, build, function (taskIds) {
var alteredResult = onTestComplete(result);
if (alteredResult !== undefined){
result.passed = alteredResult;
}
var outstandingTasks = taskIds.length;
function taskComplete() {
outstandingTasks--;
if (outstandingTasks === 0) {
outstandingTests--;
takeMany();
}
}
grunt.log.subhead("\nTested %s", url);
grunt.log.writeln("Platform: %s", result.platform);
taskIds.forEach(function (taskId) {
var resultPromise = new TestResult(taskId, me.user, me.key, framework, me.testInterval);
addResultPromise(resultPromise);
resultPromise.then(function (result) {
var alteredResult = onTestComplete(result);
if (alteredResult !== undefined) {
result.passed = alteredResult;
}
if (tunnelIdentifier && unsupportedPort(url)) {
grunt.log.writeln("Warning: This url might use a port that is not proxied by Sauce Connect.".yellow);
}
grunt.log.subhead("\nTested %s", url);
grunt.log.writeln("Platform: %s", result.platform);
if (result.passed === undefined){
grunt.log.error(result.result.message);
} else {
grunt.log.writeln("Passed: %s", result.passed);
}
grunt.log.writeln("Url %s", result.url);
if (tunnelIdentifier && unsupportedPort(url)) {
grunt.log.writeln("Warning: This url might use a port that is not proxied by Sauce Connect.".yellow);
}
}, function(e){
grunt.log.error('some error? %s', e);
});
});
});
});
if (result.passed === undefined) {
grunt.log.error(result.result.message);
} else {
grunt.log.writeln("Passed: %s", result.passed);
}
grunt.log.writeln("Url %s", result.url);
taskComplete();
}, function (e) {
grunt.log.error('some error? %s', e);
taskComplete();
});
});
});
}
}
throttled = throttled || Number.MAX_VALUE;
function takeMany() {
while (urls.length && outstandingTests < throttled) {
take();
}
}
takeMany();
};

@@ -183,3 +207,3 @@

if (tunnelIdentifier){
requestParams.body.tunnel = "tunnel-identifier:" + tunnelIdentifier;
requestParams.body['tunnel-identifier'] = tunnelIdentifier;
}

@@ -247,3 +271,3 @@

if (arg.tunneled){
var tunnel = new SauceTunnel(arg.username, arg.key, arg.identifier, arg.tunneled, arg.tunnelTimeout);
var tunnel = new SauceTunnel(arg.username, arg.key, arg.identifier, arg.tunneled, ['-P', '0']);
grunt.log.writeln("=> Starting Tunnel to Sauce Labs".inverse.bold);

@@ -260,3 +284,3 @@ configureLogEvents(tunnel);

test.runTests(arg.browsers, arg.pages, framework, arg.identifier, arg.testname, arg.tags, arg.build, arg.onTestComplete, function(status){
test.runTests(arg.browsers, arg.pages, framework, arg.identifier, arg.testname, arg.tags, arg.build, arg.onTestComplete, arg.throttled, function (status){
status = status.every(function(passed){ return passed; });

@@ -272,3 +296,3 @@ grunt.log[status ? 'ok' : 'error']("All tests completed with status %s", status);

} else {
test.runTests(arg.browsers, arg.pages, framework, null, arg.testname, arg.tags, arg.build, arg.onTestComplete, function(status){
test.runTests(arg.browsers, arg.pages, framework, null, arg.testname, arg.tags, arg.build, arg.onTestComplete, arg.throttled, function(status){
status = status.every(function(passed){ return passed; });

@@ -275,0 +299,0 @@ grunt.log[status ? 'ok' : 'error']("All tests completed with status %s", status);

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc