forked from nhunzaker/phantomjs_ga
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-runner.js
More file actions
33 lines (23 loc) · 752 Bytes
/
test-runner.js
File metadata and controls
33 lines (23 loc) · 752 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
var page = require("webpage").create();
page.open("http://www.viget.com", function(status) {
if (status !== 'success') {
console.error("Failed to open", page.frameUrl);
phantom.exit();
}
page.injectJs("lib/mocha.js");
page.injectJs("lib/sinon.js");
page.injectJs("src/reporter.js");
page.injectJs("src/rules.js");
page.injectJs("tests/home-test.js");
page.evaluate(function() {
// Undefine GA
window._gat = undefined;
window._gaq = [['_setAccount', 'UA-00000000-1']];
// Run tests
window.mocha.run();
});
});
page.onCallback = function(data) {
data.message && console.log(data.message);
data.exit && phantom.exit();
};