mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-09 18:37:50 +00:00
Add support for writing the coverage.json file for phantomjs runs in test/test.js. [ci skip]
This commit is contained in:
13
test/test.js
13
test/test.js
@@ -106,6 +106,14 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
page.onCallback = function(details) {
|
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);
|
phantom.exit(details.failed ? 1 : 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -116,7 +124,10 @@
|
|||||||
page.onInitialized = function() {
|
page.onInitialized = function() {
|
||||||
page.evaluate(function() {
|
page.evaluate(function() {
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
QUnit.done(callPhantom);
|
QUnit.done(function(details) {
|
||||||
|
details.coverage = window.__coverage__;
|
||||||
|
callPhantom(details);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user