Adding auto testing

master
Dmitry Baranovskiy 2017-02-03 11:41:35 +11:00
parent e02f17aebe
commit 9880c1f749
3 changed files with 29 additions and 0 deletions

13
.travis.yml Normal file
View File

@ -0,0 +1,13 @@
language: node_js
node_js:
- "4.4.x"
sudo: true
before_script:
- npm install -g grunt-cli
- npm install
- grunt
- cd test
script: phantomjs test.js

View File

@ -57,6 +57,9 @@ module.exports = function(grunt) {
dr: { dr: {
command: "node node_modules/dr.js/dr dr.json" command: "node node_modules/dr.js/dr dr.json"
}, },
test: {
command: "cd test; phantomjs test.js"
},
eslint: { eslint: {
command: "./node_modules/eslint/bin/eslint.js " + core.join(" ") command: "./node_modules/eslint/bin/eslint.js " + core.join(" ")
}, },
@ -69,4 +72,5 @@ module.exports = function(grunt) {
grunt.registerTask("default", ["exec:eslint", "concat", "uglify", "exec:dr"]); grunt.registerTask("default", ["exec:eslint", "concat", "uglify", "exec:dr"]);
grunt.registerTask("lint", ["exec:eslint"]); grunt.registerTask("lint", ["exec:eslint"]);
grunt.registerTask("test", ["exec:test"]);
}; };

12
test/test.js Normal file
View File

@ -0,0 +1,12 @@
var page = require("webpage").create();
page.open("test.html", function (status) {
var errors = 0;
if (status === "success") {
errors = page.evaluate(function () {
return +document.querySelector("li.failures em").innerText;
});
console.log(errors);
}
phantom.exit(errors);
});