How to use the hookRequire function from istanbul

Find comprehensive JavaScript istanbul.hookRequire code examples handpicked from public code repositorys.

100
101
102
103
104
105
106
107
108

var coverageVar = "$$cov_" + Date.now() + "$$";
var instrumenter = new Instrumenter({ coverageVariable: coverageVar });
var transformer = instrumenter.instrumentSync.bind(instrumenter);

hook.hookRequire(matchFn, transformer, { verbose: opts.verbose });

//initialize the global variable to stop mocha from complaining about leaks
global[coverageVar] = {};
fork icon47
star icon0
watch icon2