Socket
Socket
Sign inDemoInstall

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 8.1.0 to 8.1.1

test/qunit/error.html

3

grunt/aliases.js

@@ -21,3 +21,4 @@ 'use strict';

'saucelabs-mocha:fails',
'saucelabs-custom:fails'
'saucelabs-custom:fails',
'saucelabs-qunit:error'
];

@@ -24,0 +25,0 @@

@@ -19,4 +19,14 @@ 'use strict';

})
},
error: {
// Tests whether Sauce Labs 'errors' are handled. Sauce Labs errors are those where
// the tests status is displayed as 'Finished' on the Sauce Labs dashboard, and the
// result property (when the job is queried via the REST API) is null.
options: merge(true, {}, options.baseSaucelabsTaskOptions, {
urls: ['http://127.0.0.1:9999/qunit/error.html'],
testname: 'saucelabs-qunit:error',
onTestComplete: options.negateResult
})
}
};
};
{
"name": "grunt-saucelabs",
"description": "Grunt task running tests using Sauce Labs. Supports QUnit, Jasmine, Mocha and YUI tests",
"version": "8.1.0",
"version": "8.1.1",
"homepage": "https://github.com/axemclion/grunt-saucelabs",

@@ -6,0 +6,0 @@ "author": {

@@ -42,2 +42,4 @@ grunt-saucelabs

```javascript
var request = require('request');
...
'saucelabs-qunit': {

@@ -56,15 +58,31 @@ all: {

}],
onTestComplete: function(result){
onTestComplete: function(result, callback) {
// Called after a unit test is done, per page, per browser
// 'result' param is the object returned by the test framework's reporter
// 'callback' is a Node.js style callback function. You must invoke it after you
// finish your work.
// Pass a non-null value as the callback's first parameter if you want to throw an
// exception. If your function is synchronous you can also throw exceptions
// directly.
// Passing true or false as the callback's second parameter passes or fails the
// test. Passing undefined does not alter the test result. Please note that this
// only affects the grunt task's result. You have to explicitly update the Sauce
// Labs job's status via its REST API, if you want so.
// Returning true or false, passes or fails the test
// Returning undefined does not alter the test result
// For async return, call
var done = this.async();
setTimeout(function(){
// Return to this test after 1000 milliseconds
done(/*true or false changes the test result, undefined does not alter the result*/);
}, 1000);
// The example below negates the result, and also updates the Sauce Labs job's status
var user = process.env.SAUCE_USERNAME;
var pass = process.env.SAUCE_ACCESS_KEY;
request.put({
url: ['https://saucelabs.com/rest/v1', user, 'jobs', result.job_id].join('/'),
auth: { user: user, pass: pass },
json: { passed: !result.passed }
}, function (error, response, body) {
if (error) {
callback(error);
} else if (response.statusCode !== 200) {
callback(new Error('Unexpected response status'));
} else {
callback(null, !result.passed);
}
});
}

@@ -217,2 +235,5 @@ }

---------
####8.1.1####
* better detection and handling or errors which happen on Sauce Labs
####8.1.0####

@@ -219,0 +240,0 @@ * added retry logic, thanks again to @gvas, now you can use `maxRetries` parameter to automatically retry tests which fail

@@ -121,3 +121,9 @@ 'use strict';

.then(function (result) {
result.passed = resultParsers[me.framework](result.result);
// Sauce Labs sets the result property to null when it encounters an error.
// (One way to trigger this is to set a big (~100KB) test result.)
if (result.result === null) {
result.passed = false;
} else {
result.passed = resultParsers[me.framework](result.result);
}
return result;

@@ -124,0 +130,0 @@ });

@@ -158,3 +158,4 @@ 'use strict';

type: 'jobCompleted',
url: result.url,
url: url,
jobUrl: result.url,
platform: result.platform,

@@ -161,0 +162,0 @@ passed: result.passed,

@@ -38,3 +38,3 @@ 'use strict';

grunt.log.writeln('Passed: %s', notification.passed);
grunt.log.writeln('Url %s', notification.url);
grunt.log.writeln('Url %s', notification.jobUrl);
break;

@@ -41,0 +41,0 @@ case 'testCompleted':

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