react-native-firebase/tests-new/bridge/env/node/coverage.js

24 lines
492 B
JavaScript

const { createCoverageMap } = require('istanbul-lib-coverage');
const rootMap = createCoverageMap({});
module.exports = {
collect() {
if (bridge.context && bridge.context.__coverage__) {
try {
rootMap.merge(Object.assign({}, bridge.context.__coverage__));
global.__coverage__ = rootMap.toJSON();
} catch (e) {
// ignore
}
}
},
summary() {
return rootMap.getCoverageSummary();
},
json() {
return rootMap.toJSON();
},
};