2018-03-25 05:52:30 +00:00
|
|
|
const { createCoverageMap } = require('istanbul-lib-coverage');
|
|
|
|
|
|
|
|
const rootMap = createCoverageMap({});
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
collect() {
|
|
|
|
if (bridge.context && bridge.context.__coverage__) {
|
2018-03-25 20:17:26 +00:00
|
|
|
try {
|
|
|
|
rootMap.merge(Object.assign({}, bridge.context.__coverage__));
|
|
|
|
global.__coverage__ = rootMap.toJSON();
|
|
|
|
} catch (e) {
|
|
|
|
// ignore
|
|
|
|
}
|
2018-03-25 05:52:30 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
summary() {
|
|
|
|
return rootMap.getCoverageSummary();
|
|
|
|
},
|
|
|
|
|
|
|
|
json() {
|
|
|
|
return rootMap.toJSON();
|
|
|
|
},
|
|
|
|
};
|