mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-08 18:17:48 +00:00
Make saucelabs.js skip running for pull requests, avoid errors when no result object is returned, and add IE 11 to the list of tested browsers.
This commit is contained in:
@@ -4,9 +4,9 @@
|
|||||||
var ecstatic = require('ecstatic'),
|
var ecstatic = require('ecstatic'),
|
||||||
http = require('http'),
|
http = require('http'),
|
||||||
path = require('path'),
|
path = require('path'),
|
||||||
url = require('url'),
|
|
||||||
request = require('request'),
|
request = require('request'),
|
||||||
SauceTunnel = require('sauce-tunnel');
|
SauceTunnel = require('sauce-tunnel'),
|
||||||
|
url = require('url');
|
||||||
|
|
||||||
var port = 8081,
|
var port = 8081,
|
||||||
username = process.env.SAUCE_USERNAME,
|
username = process.env.SAUCE_USERNAME,
|
||||||
@@ -20,6 +20,7 @@
|
|||||||
['Windows 7', 'firefox', '6'],
|
['Windows 7', 'firefox', '6'],
|
||||||
['Windows 7', 'firefox', '4'],
|
['Windows 7', 'firefox', '4'],
|
||||||
['Windows 7', 'firefox', '3'],
|
['Windows 7', 'firefox', '3'],
|
||||||
|
['WIN8.1', 'internet explorer', '11']
|
||||||
['Windows 7', 'internet explorer', '10'],
|
['Windows 7', 'internet explorer', '10'],
|
||||||
['Windows 7', 'internet explorer', '9'],
|
['Windows 7', 'internet explorer', '9'],
|
||||||
['Windows 7', 'internet explorer', '8'],
|
['Windows 7', 'internet explorer', '8'],
|
||||||
@@ -34,10 +35,12 @@
|
|||||||
root: path.resolve(__dirname, '..'),
|
root: path.resolve(__dirname, '..'),
|
||||||
cache: false
|
cache: false
|
||||||
});
|
});
|
||||||
|
|
||||||
http.createServer(function(req, res) {
|
http.createServer(function(req, res) {
|
||||||
var parsedUrl = url.parse(req.url, true);
|
var parsedUrl = url.parse(req.url, true);
|
||||||
var compat = parsedUrl.query.compat;
|
var compat = parsedUrl.query.compat;
|
||||||
if (compat) {
|
if (compat) {
|
||||||
|
// see http://msdn.microsoft.com/en-us/library/ff955275(v=vs.85).aspx
|
||||||
res.setHeader('X-UA-Compatible', 'IE=' + compat);
|
res.setHeader('X-UA-Compatible', 'IE=' + compat);
|
||||||
}
|
}
|
||||||
mount(req, res);
|
mount(req, res);
|
||||||
@@ -54,8 +57,9 @@
|
|||||||
console.log('Sauce connect tunnel opened');
|
console.log('Sauce connect tunnel opened');
|
||||||
runTests();
|
runTests();
|
||||||
} else {
|
} else {
|
||||||
|
// fail without an exit code for pull requests
|
||||||
console.error('Failed to open sauce connect tunnel');
|
console.error('Failed to open sauce connect tunnel');
|
||||||
process.exit(2);
|
process.exit(0);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -73,10 +77,9 @@
|
|||||||
'json': testDefinition
|
'json': testDefinition
|
||||||
}, function(error, response, body) {
|
}, function(error, response, body) {
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
var testIdentifier = body;
|
waitForTestCompletion(body);
|
||||||
waitForTestCompletion(testIdentifier);
|
|
||||||
} else {
|
} else {
|
||||||
console.error('Failed to submit test to SauceLabs, status ' + response.statusCode + ', body:\n' + JSON.stringify(body));
|
console.error('Failed to submit test to Sauce Labs, status ' + response.statusCode + ', body:\n' + JSON.stringify(body));
|
||||||
process.exit(3);
|
process.exit(3);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -94,37 +97,36 @@
|
|||||||
waitForTestCompletion(testIdentifier);
|
waitForTestCompletion(testIdentifier);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
console.error('Failed to check test status on SauceLabs, status ' + response.statusCode + ', body:\n' + JSON.stringify(body));
|
console.error('Failed to check test status on Sauce Labs, status ' + response.statusCode + ', body:\n' + JSON.stringify(body));
|
||||||
process.exit(4);
|
process.exit(4);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleTestResults(results) {
|
function handleTestResults(results) {
|
||||||
var allTestsSuccessful = results.every(function(test) {
|
var failingTests = results.filter(function(test) {
|
||||||
return !test.result.failed;
|
return !test.result || test.result.failed;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (allTestsSuccessful) {
|
var failingPlatforms = failingTests.map(function(test) {
|
||||||
|
return test.platform;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!failingTests.length) {
|
||||||
console.log('Tests passed');
|
console.log('Tests passed');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
var failingTests = results.filter(function(test) {
|
|
||||||
return test.result.failed;
|
|
||||||
});
|
|
||||||
|
|
||||||
var failingPlatforms = failingTests.map(function(test) {
|
|
||||||
return test.platform;
|
|
||||||
});
|
|
||||||
|
|
||||||
console.error('Tests failed on platforms: ' + JSON.stringify(failingPlatforms));
|
console.error('Tests failed on platforms: ' + JSON.stringify(failingPlatforms));
|
||||||
|
|
||||||
failingTests.forEach(function(test) {
|
failingTests.forEach(function(test) {
|
||||||
var platform = JSON.stringify(test.platform);
|
var details = 'See ' + test.url + ' for details.',
|
||||||
if (test.result.failed) {
|
platform = JSON.stringify(test.platform),
|
||||||
console.error(test.result.failed + ' failures on ' + platform + '. See ' + test.url + ' for details.');
|
result = test.result;
|
||||||
|
|
||||||
|
if (result && result.failed) {
|
||||||
|
console.error(result.failed + ' failures on ' + platform + '. ' + details);
|
||||||
} else {
|
} else {
|
||||||
console.error('Testing on ' + platform + ' failed; no results available. See ' + test.url + ' for details.');
|
console.error('Testing on ' + platform + ' failed; no results available. ' + details);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user