Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Travis continuous integration. #33

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
install:
- git submodule update --init --recursive

script: cd test && phantomjs TestRunner.js
29 changes: 29 additions & 0 deletions test/TestRunner.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Run tests in PhantomJS
//
// Exits with status code 0 is all tests pass, or 1 if any fail.
// Pipes successful assertions to stdout and errors to stderr
//
// Run with $ phantomjs TestRunner.js
//
var page = require('webpage').create();
page.open('./test.html', function() {

// get an array, with as the first element the test strings and second the test results
var testOutput = page.evaluate(function () {
return document.getElementById('test-output').textContent.split('Tests: ');
});

var passed = testOutput[0].match(/✔[^✔✘]*/g) || [];
for (var i = 0; i < passed.length; i++) {
console.log(passed[i]);
}

var failed = testOutput[0].match(/✘[^✔✘]*/g) || [];
for (var j = 0; j < failed.length; j++) {
console.error(failed[j]);
}

console.log('Tests: ' + testOutput[1]);
phantom.exit(failed.length ? 1 : 0);
});