mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-09 10:27:49 +00:00
Merge branch 'master' of github.com:lodash/lodash
This commit is contained in:
11
.travis.yml
11
.travis.yml
@@ -5,7 +5,12 @@ node_js:
|
|||||||
- "0.10"
|
- "0.10"
|
||||||
env:
|
env:
|
||||||
global:
|
global:
|
||||||
- BIN="node" BUILD=false MAKE=false OPTION=""
|
- BIN="node" BUILD=false MAKE=false OPTION="" SAUCELABS=false
|
||||||
|
|
||||||
|
# SauceLabs credentials:
|
||||||
|
- SAUCE_USERNAME="pimterry"
|
||||||
|
- secure: "KBETrs7sRrU3V8itVgLzBUVkzP9XXpAEZVjbd8icoNL9eVW3h4Kk5g/bOa06IAml0ThnMZztIwMKkplCIam6W/Cv+eIOiQT2kkG32lHFwbVXEkbq+rKj8XmpRmXBf/Th63V+u5GMVmQlYrIfdXju6cFfSEZ2uG8SHVg9hFyyf8c="
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
- BUILD="compat"
|
- BUILD="compat"
|
||||||
- BUILD="modern"
|
- BUILD="modern"
|
||||||
@@ -34,6 +39,8 @@ matrix:
|
|||||||
env: BIN="ringo" BUILD="compat"
|
env: BIN="ringo" BUILD="compat"
|
||||||
- node_js: "0.10"
|
- node_js: "0.10"
|
||||||
env: BIN="ringo" BUILD="legacy"
|
env: BIN="ringo" BUILD="legacy"
|
||||||
|
- node_js: "0.10"
|
||||||
|
env: SAUCELABS=true
|
||||||
git:
|
git:
|
||||||
depth: 1
|
depth: 1
|
||||||
branches:
|
branches:
|
||||||
@@ -47,6 +54,7 @@ before_install:
|
|||||||
- "[ $BIN == 'rhino' ] && echo -e '#!/bin/sh\\njava -jar /opt/rhino-1.7R5/js.jar $@' | sudo tee /usr/local/bin/rhino && sudo chmod +x /usr/local/bin/rhino || true"
|
- "[ $BIN == 'rhino' ] && echo -e '#!/bin/sh\\njava -jar /opt/rhino-1.7R5/js.jar $@' | sudo tee /usr/local/bin/rhino && sudo chmod +x /usr/local/bin/rhino || true"
|
||||||
- "[ $BIN == 'ringo' ] && wget http://ringojs.org/downloads/ringojs-0.9.zip && sudo unzip ringojs-0.9 -d /opt && rm ringojs-0.9.zip || true"
|
- "[ $BIN == 'ringo' ] && wget http://ringojs.org/downloads/ringojs-0.9.zip && sudo unzip ringojs-0.9 -d /opt && rm ringojs-0.9.zip || true"
|
||||||
- "[ $BIN == 'ringo' ] && sudo ln -s /opt/ringojs-0.9/bin/ringo /usr/local/bin/ringo && sudo chmod +x /usr/local/bin/ringo || true"
|
- "[ $BIN == 'ringo' ] && sudo ln -s /opt/ringojs-0.9/bin/ringo /usr/local/bin/ringo && sudo chmod +x /usr/local/bin/ringo || true"
|
||||||
|
- "[ $SAUCELABS != false ] && npm install connect request sauce-tunnel || true"
|
||||||
script:
|
script:
|
||||||
- "[ $BIN == 'istanbul' ] && $BIN cover ./test/test.js || true"
|
- "[ $BIN == 'istanbul' ] && $BIN cover ./test/test.js || true"
|
||||||
- "[ $BUILD != false ] && [ $BUILD != 'compat' ] && MAKE=true || true"
|
- "[ $BUILD != false ] && [ $BUILD != 'compat' ] && MAKE=true || true"
|
||||||
@@ -56,3 +64,4 @@ script:
|
|||||||
- "[ $BUILD != false ] && cd ./test || true"
|
- "[ $BUILD != false ] && cd ./test || true"
|
||||||
- "[ $BUILD == false ] && true || $BIN $OPTION ./test.js ../dist/lodash.$BUILD.js"
|
- "[ $BUILD == false ] && true || $BIN $OPTION ./test.js ../dist/lodash.$BUILD.js"
|
||||||
- "[ $BUILD == false ] && true || $BIN $OPTION ./test.js ../dist/lodash.$BUILD.min.js"
|
- "[ $BUILD == false ] && true || $BIN $OPTION ./test.js ../dist/lodash.$BUILD.min.js"
|
||||||
|
- "[ $SAUCELABS == false ] && true || node ./test/saucelabs.js"
|
||||||
|
|||||||
@@ -16,6 +16,13 @@
|
|||||||
<script src="./asset/test-ui.js"></script>
|
<script src="./asset/test-ui.js"></script>
|
||||||
<div id="qunit"></div>
|
<div id="qunit"></div>
|
||||||
<div id="exports"></div>
|
<div id="exports"></div>
|
||||||
|
<script>
|
||||||
|
// Report test results in a global, for saucelabs
|
||||||
|
window.global_test_results = null;
|
||||||
|
QUnit.done(function (results) {
|
||||||
|
window.global_test_results = results;
|
||||||
|
});
|
||||||
|
</script>
|
||||||
<script>
|
<script>
|
||||||
// set bad shims
|
// set bad shims
|
||||||
Array._isArray = Array.isArray;
|
Array._isArray = Array.isArray;
|
||||||
|
|||||||
108
test/saucelabs.js
Normal file
108
test/saucelabs.js
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
var connect = require('connect');
|
||||||
|
var path = require('path');
|
||||||
|
var SauceTunnel = require('sauce-tunnel');
|
||||||
|
var request = require('request');
|
||||||
|
|
||||||
|
var port = 8081;
|
||||||
|
var username = process.env['SAUCE_USERNAME'];
|
||||||
|
var accessKey = process.env['SAUCE_ACCESS_KEY'];
|
||||||
|
var platforms = [
|
||||||
|
["Windows 7", "chrome", ""],
|
||||||
|
["Windows 7", "firefox", "24"],
|
||||||
|
["Windows 7", "internet explorer", "9"]
|
||||||
|
];
|
||||||
|
|
||||||
|
// Create a web server for the local dir
|
||||||
|
var server = connect.createServer(
|
||||||
|
connect.static(path.resolve(__dirname, '..'))
|
||||||
|
).listen(port);
|
||||||
|
|
||||||
|
// Set up sauce connect so we can use this server from saucelabs
|
||||||
|
var tunnelTimeout = 10000;
|
||||||
|
var tunnel = new SauceTunnel(username, accessKey, null, true, tunnelTimeout);
|
||||||
|
|
||||||
|
console.log("Opening sauce connect tunnel...");
|
||||||
|
tunnel.start(function (success) {
|
||||||
|
if (success) {
|
||||||
|
console.log("Sauce connect tunnel opened");
|
||||||
|
runTests();
|
||||||
|
} else {
|
||||||
|
console.error("Failed to open sauce connect tunnel")
|
||||||
|
process.exit(2);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
function runTests() {
|
||||||
|
var testDefinition = {
|
||||||
|
platforms: platforms,
|
||||||
|
url: "http://localhost:" + port + "/test/index.html",
|
||||||
|
framework: "qunit"
|
||||||
|
};
|
||||||
|
|
||||||
|
console.log("Starting saucelabs tests: " + JSON.stringify(testDefinition));
|
||||||
|
|
||||||
|
request.post('https://saucelabs.com/rest/v1/' + username + '/js-tests', {
|
||||||
|
auth: { user: username, pass: accessKey },
|
||||||
|
json: testDefinition
|
||||||
|
}, function (error, response, body) {
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
var testIdentifier = body;
|
||||||
|
waitForTestCompletion(testIdentifier);
|
||||||
|
} else {
|
||||||
|
console.error("Failed to submit test to SauceLabs, status " + response.statusCode + ", body:\n" + JSON.stringify(body));
|
||||||
|
process.exit(3);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function waitForTestCompletion(testIdentifier) {
|
||||||
|
request.post('https://saucelabs.com/rest/v1/' + username + '/js-tests/status', {
|
||||||
|
auth: { user: username, pass: accessKey },
|
||||||
|
json: testIdentifier
|
||||||
|
}, function (error, response, body) {
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
if (body["completed"] == true) {
|
||||||
|
handleTestResults(body["js tests"]);
|
||||||
|
} else {
|
||||||
|
waitForTestCompletion(testIdentifier);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.error("Failed to check test status on SauceLabs, status " + response.statusCode + ", body:\n" + JSON.stringify(body));
|
||||||
|
process.exit(4);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleTestResults(results) {
|
||||||
|
var allTestsSuccessful = results.reduce(function (passedSoFar, test) {
|
||||||
|
return passedSoFar && test.result.failed === 0;
|
||||||
|
}, true);
|
||||||
|
|
||||||
|
if (allTestsSuccessful) {
|
||||||
|
console.log("Tests passed");
|
||||||
|
} else {
|
||||||
|
var failingTests = results.filter(function (test) {
|
||||||
|
return test.result.failed !== 0;
|
||||||
|
});
|
||||||
|
var failingPlatforms = failingTests.map(function (test) {
|
||||||
|
return test.platform;
|
||||||
|
});
|
||||||
|
|
||||||
|
console.error("Tests failed on platforms: " + JSON.stringify(failingPlatforms));
|
||||||
|
|
||||||
|
failingTests.forEach(function (test) {
|
||||||
|
var platform = JSON.stringify(test.platform);
|
||||||
|
|
||||||
|
if (test.result.failed) {
|
||||||
|
console.error(test.result.failed + " failures on " + platform + ". See " + test.url + " for details.");
|
||||||
|
} else {
|
||||||
|
console.error("Testing on " + platform + " failed; no results available. See " + test.url + " for details.");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log("Shutting down sauce connect tunnel...");
|
||||||
|
tunnel.stop(function () {
|
||||||
|
process.exit(allTestsSuccessful ? 0 : 1);
|
||||||
|
})
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user