Permalink
Browse files

support getting coverage object from page running mocha tests

  • Loading branch information...
jonbretman committed Feb 11, 2014
1 parent 8e72249 commit 5d0f4f4e52ccec4664fb253bcf288c1f914a14e7
Showing with 10 additions and 0 deletions.
  1. +5 −0 phantomjs/bridge.js
  2. +5 −0 tasks/mocha.js
View
@@ -31,6 +31,11 @@
data.slow = test.slow;
}
// when tests have finished send coverage object if it exists
if (ev === 'end' && window.__coverage__) {
sendMessage('coverage', window.__coverage__);
}
sendMessage('mocha.' + ev, data);
});
}
View
@@ -46,6 +46,11 @@ module.exports = function(grunt) {
var listeners = {};
var suites = [];
// listen for coverage event and propagate through Grunt
phantomjs.on('coverage', function (cov) {
grunt.event.emit('coverage', cov);
});
// Hook on Phantomjs Mocha reporter events.
phantomjs.on('mocha.*', function(test) {
var name, fullTitle, slow, err;

0 comments on commit 5d0f4f4

Please sign in to comment.