Skip to content

Commit

Permalink
Add travis and saucelabs (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
robdodson authored and Alice committed Jul 14, 2016
1 parent b2a4843 commit bb35524
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 2 deletions.
9 changes: 9 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
language: node_js
node_js:
- "6"

env:
global:
- SAUCE_USERNAME=robdodson_inert
- SAUCE_ACCESS_KEY=a844aee9-d3ec-4566-94e3-dba3d0c30248
16 changes: 15 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "A polyfill for the proposed inert API",
"main": "inert.js",
"scripts": {
"test": "mocha"
"test": "easy-sauce"
},
"repository": {
"type": "git",
Expand All @@ -28,6 +28,20 @@
"homepage": "https://github.com/WICG/inert#readme",
"devDependencies": {
"chai": "^3.5.0",
"easy-sauce": "^0.3.4",
"mocha": "^2.5.3"
},
"easySauce": {
"username": "robdodson_inert",
"key": "a844aee9-d3ec-4566-94e3-dba3d0c30248",
"tests": "/test/",
"port": "8080",
"platforms": [
[
"Windows 10",
"chrome",
"latest"
]
]
}
}
29 changes: 28 additions & 1 deletion test/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,34 @@
<script>
mocha.setup('bdd');
window.onload = function() {
mocha.run();
var runner = mocha.run();
var failedTests = [];

runner.on('end', function() {
window.mochaResults = runner.stats;
window.mochaResults.reports = failedTests;
});

runner.on('fail', logFailure);

function logFailure(test, err){
var flattenTitles = function(test){
var titles = [];
while (test.parent.title){
titles.push(test.parent.title);
test = test.parent;
}
return titles.reverse();
};

failedTests.push({
name: test.title,
result: false,
message: err.message,
stack: err.stack,
titles: flattenTitles(test)
});
};
};
mocha.checkLeaks(); // Check for global variable leaks
</script>
Expand Down

0 comments on commit bb35524

Please sign in to comment.