Skip to content

Commit

Permalink
Add Auto running of javascript unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
plessbd committed Apr 27, 2017
1 parent 9a0e0b8 commit bf6a5bb
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .travis.build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ elif [ "$TEST_SUITE" = "style" ]; then
fi
done
elif [ "$TEST_SUITE" = "unit" ]; then
open_xdmod/modules/xdmod/tests/runtests.sh
open_xdmod/modules/xdmod/tests/runtests.sh && phantomjs html/unit_tests/phantom.js
if [ $? != 0 ]; then
build_exit_value=2
fi
Expand Down
8 changes: 8 additions & 0 deletions html/unit_tests/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"env": {
"browser": true,
"node": true,
"phantomjs": true,
"mocha": true
}
}
11 changes: 11 additions & 0 deletions html/unit_tests/phantom.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
var page = require('webpage').create();
page.open('file://' + phantom.libraryPath + '/index.html', function (status) {
var failures = -1;
if (status === 'success') {
failures = page.evaluate(function () {
return mocha.run().failures;
});
}
console.log('Javascript Unit Test Failures: ' + failures);
phantom.exit(failures);
});

0 comments on commit bf6a5bb

Please sign in to comment.