Add support for writing the coverage.json file for phantomjs runs in test/test.js. [ci skip]

This commit is contained in:
John-David Dalton
2013-12-07 23:46:22 -08:00
parent 32f760a461
commit 8ebe99d4f5

View File

@@ -106,6 +106,14 @@
});
page.onCallback = function(details) {
var coverage = details.coverage;
if (coverage) {
var fs = require('fs'),
cwd = fs.workingDirectory,
sep = fs.separator;
fs.write([cwd, 'coverage', 'coverage.json'].join(sep), JSON.stringify(coverage));
}
phantom.exit(details.failed ? 1 : 0);
};
@@ -116,7 +124,10 @@
page.onInitialized = function() {
page.evaluate(function() {
document.addEventListener('DOMContentLoaded', function() {
QUnit.done(callPhantom);
QUnit.done(function(details) {
details.coverage = window.__coverage__;
callPhantom(details);
});
});
});
};